diff --git a/src/@types/fdp-storage.d.ts b/src/@types/fdp-storage.d.ts new file mode 100644 index 00000000..98964aac --- /dev/null +++ b/src/@types/fdp-storage.d.ts @@ -0,0 +1,13 @@ +import type { + DirectoryItem as FdpDirectoryItem, + FileItem as FdpFileItem, +} from '@fairdatasociety/fdp-storage'; + +declare module '@fairdatasociety/fdp-storage' { + interface DirectoryItem extends FdpDirectoryItem { + path?: string; + } + interface FileItem extends FdpFileItem { + path?: string; + } +} diff --git a/src/components/Dropdowns/DriveItemDropdown/DriveItemDropdown.tsx b/src/components/Dropdowns/DriveItemDropdown/DriveItemDropdown.tsx index 358e8e7b..267d0f19 100644 --- a/src/components/Dropdowns/DriveItemDropdown/DriveItemDropdown.tsx +++ b/src/components/Dropdowns/DriveItemDropdown/DriveItemDropdown.tsx @@ -10,12 +10,14 @@ interface DriveItemDropdownProps extends UpdateDriveProps { data: { name: string; }; + mobileAlign?: 'left' | 'right'; handlePreviewClick?: () => void; } const DriveDropdown: FC = ({ type, data, + mobileAlign, updateDrive, handlePreviewClick, }) => { @@ -29,6 +31,7 @@ const DriveDropdown: FC = ({ diff --git a/src/components/Dropdowns/DriveItemDropdown/DriveItemMenu.tsx b/src/components/Dropdowns/DriveItemDropdown/DriveItemMenu.tsx index 649e9df6..f039a7a9 100644 --- a/src/components/Dropdowns/DriveItemDropdown/DriveItemMenu.tsx +++ b/src/components/Dropdowns/DriveItemDropdown/DriveItemMenu.tsx @@ -23,12 +23,14 @@ interface DriveItemMenuProps extends UpdateDriveProps { data: { name: string; }; + mobileAlign?: 'left' | 'right'; handlePreviewClick?: () => void; } const DriveItemMenu: FC = ({ type, data, + mobileAlign, updateDrive, handlePreviewClick, }) => { @@ -147,7 +149,11 @@ const DriveItemMenu: FC = ({ return ( <> - + = () => { const { theme } = useContext(ThemeContext); - const { search, updateSearch } = useContext(SearchContext); + const { updateSearch, searchDisabled } = useContext(SearchContext); + const { activePod, loading } = useContext(PodContext); const { intl } = useLocales(); + const { register, handleSubmit, reset } = useForm<{ search: '' }>(); + + const onSubmitInternal = ({ search }) => updateSearch(search); return ( -
- {theme === 'light' ? ( - - ) : ( - - )} +
+ + {theme === 'light' ? ( + + ) : ( + + )} + updateSearch(e.target.value)} + {...register('search', { required: true })} /> -
updateSearch('')}> +
{ + reset(); + updateSearch(''); + }} + > {theme === 'light' ? ( ) : ( )}
-
+
); }; diff --git a/src/components/Modals/PreviewFileModal/PreviewFileModal.tsx b/src/components/Modals/PreviewFileModal/PreviewFileModal.tsx index 2d6b64f3..490749c0 100644 --- a/src/components/Modals/PreviewFileModal/PreviewFileModal.tsx +++ b/src/components/Modals/PreviewFileModal/PreviewFileModal.tsx @@ -70,7 +70,7 @@ const PreviewFileModal: FC = ({ setLoading(true); downloadFile(fdpClientRef.current, { filename: previewFile?.name, - directory: directoryName, + directory: previewFile.path || directoryName, podName: activePod, }) .then(async (response) => { diff --git a/src/components/NavigationBars/DriveActionBar/DriveActionHeaderMobile.tsx b/src/components/NavigationBars/DriveActionBar/DriveActionHeaderMobile.tsx index 633ae1d9..1159a290 100644 --- a/src/components/NavigationBars/DriveActionBar/DriveActionHeaderMobile.tsx +++ b/src/components/NavigationBars/DriveActionBar/DriveActionHeaderMobile.tsx @@ -1,21 +1,40 @@ +import { Button } from '@components/Buttons'; import DirectoryPath from '@components/DirectoryPath/DirectoryPath'; import PodDropdown from '@components/Dropdowns/PodDropdown/PodDropdown'; +import ThemeContext from '@context/ThemeContext'; +import { useContext } from 'react'; + +import DriveViewListLight from '@media/UI/drive-view-list-light.svg'; +import DriveViewListDark from '@media/UI/drive-view-list-dark.svg'; +import DriveViewGridLight from '@media/UI/drive-view-grid-light.svg'; +import DriveViewGridDark from '@media/UI/drive-view-grid-dark.svg'; + +import SortLight from '@media/UI/sort-light.svg'; +import SortDark from '@media/UI/sort-dark.svg'; interface DriveActionHeaderMobileProps { podName: string; + driveView: 'grid' | 'list'; directory: string; onDirectorySelect: (newDirectory: string) => void; onBackToDrive: () => void; + toggleView: () => void; + toggleSort: () => void; } const DriveActionHeaderMobile = ({ podName, + driveView, directory, onDirectorySelect, onBackToDrive, + toggleView, + toggleSort, }: DriveActionHeaderMobileProps) => { + const { theme } = useContext(ThemeContext); + return ( - <> +
- +
+
+
); }; diff --git a/src/components/NavigationBars/MainNavigationBar/MainNavigationBar.tsx b/src/components/NavigationBars/MainNavigationBar/MainNavigationBar.tsx index 27bf6296..6242c184 100644 --- a/src/components/NavigationBars/MainNavigationBar/MainNavigationBar.tsx +++ b/src/components/NavigationBars/MainNavigationBar/MainNavigationBar.tsx @@ -44,10 +44,9 @@ const MainNavigationBar: FC> = () => {
- {/* TODO: Search functionality should be implemented */} - {/*
+
-
*/} +
= ({ return (
- {intl.get('ROWS_PER_PAGE')} + + {intl.get('ROWS_PER_PAGE')} +