diff --git a/tdrive/frontend/src/app/components/search-popup/parts/drive-item-result.tsx b/tdrive/frontend/src/app/components/search-popup/parts/drive-item-result.tsx
index 5c477444..7de76217 100644
--- a/tdrive/frontend/src/app/components/search-popup/parts/drive-item-result.tsx
+++ b/tdrive/frontend/src/app/components/search-popup/parts/drive-item-result.tsx
@@ -1,7 +1,7 @@
import { FolderIcon } from '@heroicons/react/solid';
import Highlighter from 'react-highlight-words';
import { useRecoilState, useRecoilValue } from 'recoil';
-import { onDriveItemDownloadClick, openDriveItem } from '../common';
+import { onDriveItemDownloadClick } from '../common';
import ResultContext from './result-context';
import { Button } from '@atoms/button/button';
import { DownloadIcon } from '@atoms/icons-agnostic';
@@ -15,7 +15,6 @@ import {
} from '@atoms/icons-colored';
import * as Text from '@atoms/text';
import { useCompanyApplications } from '@features/applications/hooks/use-company-applications';
-import useRouterCompany from '@features/router/hooks/use-router-company';
import { DriveItem } from '@features/drive/types';
import FileUploadAPIClient from '@features/files/api/file-upload-api-client';
import { formatDate } from '@features/global/utils/format-date';
@@ -24,16 +23,15 @@ import useRouterWorkspace from '@features/router/hooks/use-router-workspace';
import { useSearchModal } from '@features/search/hooks/use-search';
import { SearchInputState } from '@features/search/state/search-input';
import { UserType } from '@features/users/types/user';
-import { useFileViewerModal } from '@features/viewer/hooks/use-viewer';
import { useDrivePreview } from '@features/drive/hooks/use-drive-preview';
import Media from '@molecules/media';
import { DriveCurrentFolderAtom } from '@views/client/body/drive/browser';
import { useHistory } from 'react-router-dom';
import RouterServices from '@features/router/services/router-service';
import { useCurrentUser } from 'app/features/users/hooks/use-current-user';
+import useRouterCompany from 'app/features/router/hooks/use-router-company';
-
-export default (props: { driveItem: DriveItem & { user?: UserType } }) => {
+export default (props: { driveItem: DriveItem & { user?: UserType }}) => {
const history = useHistory();
const input = useRecoilValue(SearchInputState);
const currentWorkspaceId = useRouterWorkspace();
@@ -49,10 +47,14 @@ export default (props: { driveItem: DriveItem & { user?: UserType } }) => {
const extension = name?.split('.').pop();
const { setOpen } = useSearchModal();
- const { open: openViewer } = useFileViewerModal();
const { open } = useDrivePreview();
const company = useRouterCompany();
+ function openDoc(file: DriveItem){
+ open(file);
+ if (file.is_directory) setOpen(false);
+ }
+
return (
{
- {
- e.preventDefault();
- e.stopPropagation();
- }}
- >
-
+ )}
);
};
diff --git a/tdrive/frontend/src/app/components/search-popup/search-popup.tsx b/tdrive/frontend/src/app/components/search-popup/search-popup.tsx
index 291190b6..0c28421a 100755
--- a/tdrive/frontend/src/app/components/search-popup/search-popup.tsx
+++ b/tdrive/frontend/src/app/components/search-popup/search-popup.tsx
@@ -9,7 +9,7 @@ export default () => {
return (
setOpen(false)} className="sm:w-[80vw] sm:max-w-4xl">
-
+
);
};
@@ -18,7 +18,7 @@ const SearchBox = () => {
return (
-
+
);
};
diff --git a/tdrive/frontend/src/app/components/search-popup/search-tabs.tsx b/tdrive/frontend/src/app/components/search-popup/search-tabs.tsx
index e113a262..343467de 100755
--- a/tdrive/frontend/src/app/components/search-popup/search-tabs.tsx
+++ b/tdrive/frontend/src/app/components/search-popup/search-tabs.tsx
@@ -11,7 +11,7 @@ export const SearchResultsIndex = () => {
options={{ suppressScrollX: true, suppressScrollY: false }}
component="div"
>
-
+
>
);
diff --git a/tdrive/frontend/src/app/components/search-popup/tabs/drive.tsx b/tdrive/frontend/src/app/components/search-popup/tabs/drive.tsx
index 7551fd76..9301e939 100644
--- a/tdrive/frontend/src/app/components/search-popup/tabs/drive.tsx
+++ b/tdrive/frontend/src/app/components/search-popup/tabs/drive.tsx
@@ -22,13 +22,13 @@ export default () => {
)}
-
+
);
};
-export const DriveItemsResults = (props: { max?: number }) => {
+export const DriveItemsResults = (props: { max?: number}) => {
const { driveItems, loading } = useSearchDriveItems();
if (driveItems.length === 0 && !loading) return ;
@@ -36,7 +36,7 @@ export const DriveItemsResults = (props: { max?: number }) => {
return (
<>
{driveItems.slice(0, props?.max || driveItems.length).map(item => (
-
+
))}
>
);
diff --git a/tdrive/frontend/src/app/features/drive/hooks/use-drive-preview.ts b/tdrive/frontend/src/app/features/drive/hooks/use-drive-preview.ts
index dd4d751d..91d57a78 100644
--- a/tdrive/frontend/src/app/features/drive/hooks/use-drive-preview.ts
+++ b/tdrive/frontend/src/app/features/drive/hooks/use-drive-preview.ts
@@ -9,15 +9,21 @@ import { DriveItem } from '../types';
import { useHistory } from 'react-router-dom';
import RouterServices from '@features/router/services/router-service';
import useRouterCompany from '@features/router/hooks/use-router-company';
+import { DriveCurrentFolderAtom } from 'app/views/client/body/drive/browser';
export const useDrivePreviewModal = () => {
const history = useHistory();
const company = useRouterCompany();
const [status, setStatus] = useRecoilState(DriveViewerState);
+ const [ parentId, setParentId ] = useRecoilState(
+ DriveCurrentFolderAtom({ initialFolderId: 'root' }),
+ );
const open: (item: DriveItem) => void = (item: DriveItem) => {
if (item.last_version_cache?.file_metadata?.source === 'internal') {
setStatus({ item, loading: true });
+ } else if (item.is_directory){
+ setParentId(item.id);
}
};
@@ -89,3 +95,4 @@ export const useDrivePreviewDisplayData = () => {
return { download, id, name, type, extension, size: status.details?.item.size };
};
+