TagSpaces is an offline, open source, document manager with tagging support
feat: added search for email, added new file type icons
Ilian Sapundshiev35d38d02a6b1
diff --git a/app/components/CommonIcons.tsx b/app/components/CommonIcons.tsxindex d5eac435c..4078ec699 100644--- a/app/components/CommonIcons.tsx+++ b/app/components/CommonIcons.tsx@@ -78,7 +78,9 @@ export { default as UntaggedIcon } from '@mui/icons-material/LabelOffOutlined';export { default as BookmarkIcon } from '@mui/icons-material/BookmarkBorder';-export { default as BookIcon } from '@mui/icons-material/LocalLibraryOutlined';+export { default as BookIcon } from '@mui/icons-material/MenuBook';++export { default as EmailIcon } from '@mui/icons-material/MailOutline';export { default as DateIcon } from '@mui/icons-material/DateRange';diff --git a/app/components/EntryIcon.tsx b/app/components/EntryIcon.tsxindex 3b7fd7057..e76d87c64 100644--- a/app/components/EntryIcon.tsx+++ b/app/components/EntryIcon.tsx@@ -45,24 +45,38 @@ const noteFileIcon = (<path d="M14 17H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"></path></>);+const bookmarkIcon = (+ <path d="M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2zm0 15-5-2.18L7 18V5h10v13z"></path>+);+const emailIcon = (+ <path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V8l8 5 8-5v10zm-8-7L4 6h16l-8 5z"></path>+);+const ebookIcon = (+ <>+ <path d="M21 5c-1.11-.35-2.33-.5-3.5-.5-1.95 0-4.05.4-5.5 1.5-1.45-1.1-3.55-1.5-5.5-1.5S2.45 4.9 1 6v14.65c0 .25.25.5.5.5.1 0 .15-.05.25-.05C3.1 20.45 5.05 20 6.5 20c1.95 0 4.05.4 5.5 1.5 1.35-.85 3.8-1.5 5.5-1.5 1.65 0 3.35.3 4.75 1.05.1.05.15.05.25.05.25 0 .5-.25.5-.5V6c-.6-.45-1.25-.75-2-1zm0 13.5c-1.1-.35-2.3-.5-3.5-.5-1.7 0-4.15.65-5.5 1.5V8c1.35-.85 3.8-1.5 5.5-1.5 1.2 0 2.4.15 3.5.5v11.5z"></path>+ <path d="M17.5 10.5c.88 0 1.73.09 2.5.26V9.24c-.79-.15-1.64-.24-2.5-.24-1.7 0-3.24.29-4.5.83v1.66c1.13-.64 2.7-.99 4.5-.99zM13 12.49v1.66c1.13-.64 2.7-.99 4.5-.99.88 0 1.73.09 2.5.26V11.9c-.79-.15-1.64-.24-2.5-.24-1.7 0-3.24.3-4.5.83zm4.5 1.84c-1.7 0-3.24.29-4.5.83v1.66c1.13-.64 2.7-.99 4.5-.99.88 0 1.73.09 2.5.26v-1.52c-.79-.16-1.64-.24-2.5-.24z"></path>+ </>+);function EntryIcon(props: Props) {const { isFile, fileExtension = '' } = props;let iconSVGPath = genericFileIcon;if (!isFile) {iconSVGPath = folderIcon;- }- if (FileTypeGroups.audio.includes(fileExtension)) {+ } else if (FileTypeGroups.audio.includes(fileExtension)) {iconSVGPath = audioFileIcon;- }- if (FileTypeGroups.video.includes(fileExtension)) {+ } else if (FileTypeGroups.video.includes(fileExtension)) {iconSVGPath = videoFileIcon;- }- if (FileTypeGroups.images.includes(fileExtension)) {+ } else if (FileTypeGroups.images.includes(fileExtension)) {iconSVGPath = imageFileIcon;- }- if (FileTypeGroups.notes.includes(fileExtension)) {+ } else if (FileTypeGroups.notes.includes(fileExtension)) {iconSVGPath = noteFileIcon;+ } else if (FileTypeGroups.bookmarks.includes(fileExtension)) {+ iconSVGPath = bookmarkIcon;+ } else if (FileTypeGroups.emails.includes(fileExtension)) {+ iconSVGPath = emailIcon;+ } else if (FileTypeGroups.ebooks.includes(fileExtension)) {+ iconSVGPath = ebookIcon;}return (diff --git a/app/components/SearchPopover.tsx b/app/components/SearchPopover.tsxindex 05dd8856a..a1cbec254 100644--- a/app/components/SearchPopover.tsx+++ b/app/components/SearchPopover.tsx@@ -76,6 +76,7 @@ import {BookmarkIcon,BookIcon,DateIcon,+ EmailIcon,EditIcon,PictureIcon,DocumentIcon,@@ -872,8 +873,16 @@ function SearchPopover(props: Props) {</IconButton>{i18n.t('core:searchEbooks')}</MenuItem>+ <MenuItem+ value={JSON.stringify(FileTypeGroups.emails)}+ title={FileTypeGroups.emails.toString()}+ >+ <IconButton size="large">+ <EmailIcon />+ </IconButton>+ {i18n.t('core:searchEmails')}+ </MenuItem></Select>- {/* <FormHelperText>{i18n.t('core:searchFileTypes')}</FormHelperText> */}</ProTooltip></FormControl><FormControldiff --git a/app/locales/en/core.json b/app/locales/en/core.jsonindex 3c8c383ef..0483dc00f 100644--- a/app/locales/en/core.json+++ b/app/locales/en/core.json@@ -248,6 +248,7 @@"searchArchives": "Archives","searchBookmarks": "Bookmarks","searchEbooks": "eBooks",+ "searchEmails": "Emails","searchFolders": "Folders","searchFiles": "Files","searchUntaggedEntries": "Untagged files or folders",diff --git a/app/services/search.ts b/app/services/search.tsindex baeb7b00e..e6c8ea355 100644--- a/app/services/search.ts+++ b/app/services/search.ts@@ -71,6 +71,7 @@ export const FileTypeGroups = {archives: ['zip', 'rar', 'gz', 'tgz', 'arc', '7z'],bookmarks: ['url', 'lnk', 'sym', 'desktop', 'website'],ebooks: ['epub', 'mobi', 'azw', 'prc', 'azw1', 'azw3', 'azw4', 'azw8', 'azk'],+ emails: ['eml', 'msg'],folders: ['folders'],files: ['files'],untagged: ['untagged']