import * as Text from '@atoms/text'; import FileUploadAPIClient from '@features/files/api/file-upload-api-client'; import { Button } from 'app/atoms/button/button'; import { DownloadIcon } from 'app/atoms/icons-agnostic'; import { ArrowRight } from 'react-feather'; import { FileTypeArchiveIcon, FileTypeDocumentIcon, FileTypePdfIcon, FileTypeSlidesIcon, FileTypeSpreadsheetIcon, FileTypeUnknownIcon, } from 'app/atoms/icons-colored'; import { formatDate } from 'app/features/global/utils/format-date'; import { formatSize } from 'app/features/global/utils/format-file-size'; import { DriveItem } from 'app/features/drive/types'; import useRouterWorkspace from 'app/features/router/hooks/use-router-workspace'; import { useSearchModal } from 'app/features/search/hooks/use-search'; import { SearchInputState } from 'app/features/search/state/search-input'; import { UserType } from 'app/features/users/types/user'; import { useFileViewerModal } from 'app/features/viewer/hooks/use-viewer'; import Media from 'app/molecules/media'; import Highlighter from 'react-highlight-words'; import { useRecoilValue, useRecoilState } from 'recoil'; import { openDriveItem, onDriveItemDownloadClick } from '../common'; import ResultContext from './result-context'; import { useCompanyApplications } from 'app/features/applications/hooks/use-company-applications'; import { DriveCurrentFolderAtom } from 'app/views/client/body/drive/browser'; import { FolderIcon } from '@heroicons/react/solid'; export default (props: { driveItem: DriveItem & { user?: UserType } }) => { const input = useRecoilValue(SearchInputState); const currentWorkspaceId = useRouterWorkspace(); const companyApplications = useCompanyApplications(); const [_, setParentId] = useRecoilState(DriveCurrentFolderAtom('root')); const twakeDriveApplicationId = companyApplications.applications.find(application => { return application.identity.code === 'twake_drive'; })?.id || ''; const file = props.driveItem; const name = file?.name; const extension = name?.split('.').pop(); const { setOpen } = useSearchModal(); const { open: openViewer } = useFileViewerModal(); return (