1 import type { FC } from 'react';
3 import { c } from 'ttag';
5 import { PrimaryButton } from '@proton/components';
6 import { DRIVE_APP_NAME } from '@proton/shared/lib/constants';
7 import noResultSearchSvg from '@proton/styles/assets/img/illustrations/empty-search.svg';
9 import { useSearchControl } from '../../../store';
10 import { DriveEmptyView } from '../../layout/DriveEmptyView';
12 const getTitle = (isReady: boolean) => {
14 // translator: Shown when searching and no results are found
15 return c('Title').t`No results found`;
18 // translator: Shown when searching and search is not enabled yet
19 return c('Title').t`Enable drive search`;
22 const getSubtitles = (isReady: boolean) => {
25 // translator: Shown when searching and no results are found
26 c('Info').t`Try searching by file name, date, or type.`,
27 // translator: Shown when searching and no results are found
28 c('Info').t`Also try looking in Trash.`,
32 // translator: Shown when searching and search is not enabled yet
33 return c('Info').t`To enable truly private search ${DRIVE_APP_NAME} needs to index your files locally.`;
38 export const NoSearchResultsView: FC<Props> = () => {
39 const { prepareSearchData, hasData, isEnablingEncryptedSearch } = useSearchControl();
41 const isReady = hasData && !isEnablingEncryptedSearch;
44 <DriveEmptyView image={noResultSearchSvg} title={getTitle(isReady)} subtitle={getSubtitles(isReady)}>
46 <div className="flex justify-center">
50 onClick={() => prepareSearchData()}
51 loading={isEnablingEncryptedSearch}
52 disabled={isEnablingEncryptedSearch || hasData}
54 {c('Action').t`Enable drive search`}