TagSpaces is an offline, open source, document manager with tagging support
chore: introducing tsiconbutton
Ilian Sapundshievcd7e25a75cb2
diff --git a/src/renderer/components/EntryContainerNav.tsx b/src/renderer/components/EntryContainerNav.tsxindex 24375f287..e6695d34c 100644--- a/src/renderer/components/EntryContainerNav.tsx+++ b/src/renderer/components/EntryContainerNav.tsx@@ -51,7 +51,6 @@ function EntryContainerNav(props: Props) {setActions(action);//window.dispatchEvent(new Event('previous-file'));}}- // size="large"><PrevDocumentIcon style={{ transform: 'rotate(180deg)' }} /></IconButton>@@ -68,7 +67,6 @@ function EntryContainerNav(props: Props) {setActions(action);//window.dispatchEvent(new Event('next-file'));}}- // size="large"><NextDocumentIcon /></IconButton>@@ -83,7 +81,6 @@ function EntryContainerNav(props: Props) {onClick={startClosingEntry}aria-label={t('core:closeEntry')}data-tid="fileContainerCloseOpenedFile"- // size="large"><CloseIcon /></IconButton>diff --git a/src/renderer/components/SearchPopover.tsx b/src/renderer/components/SearchPopover.tsxindex da659c5a0..1b6ce5298 100644--- a/src/renderer/components/SearchPopover.tsx+++ b/src/renderer/components/SearchPopover.tsx@@ -28,7 +28,8 @@ import TsButton from '-/components/TsButton';import Grid from '@mui/material/Grid';import OutlinedInput from '@mui/material/OutlinedInput';import TsTextField from '-/components/TsTextField';-import InputLabel from '@mui/material/InputLabel';+import TsSelect from '-/components/TsSelect';+import TsMenuList from '-/components/TsMenuList';import FormHelperText from '@mui/material/FormHelperText';import InputAdornment from '@mui/material/InputAdornment';import { InfoTooltipIcon } from '-/components/CommonIcons';@@ -514,7 +515,6 @@ function SearchPopover(props: Props) {style={{ marginLeft: 'auto' }}data-tid="closeSearchTID"onClick={props.onClose}- size="large"><CloseIcon /></IconButton>@@ -799,31 +799,26 @@ function SearchPopover(props: Props) {value={JSON.stringify(fileTypes.current)}onChange={handleFileTypeChange}size={desktopMode ? 'small' : 'medium'}- input={- <OutlinedInput- name="fileTypes"- id="file-type"- // label={t('core:fileType')}- />- }+ input={<OutlinedInput name="fileTypes" id="file-type" />}>+ {/* <TsMenuList> */}<MenuItem value={JSON.stringify(FileTypeGroups.any)}>{t('core:anyType')}</MenuItem><MenuItem value={JSON.stringify(FileTypeGroups.folders)}>- <IconButton size="large">+ <IconButton><FolderIcon /></IconButton>{t('core:searchFolders')}</MenuItem><MenuItem value={JSON.stringify(FileTypeGroups.files)}>- <IconButton size="large">+ <IconButton><FileIcon /></IconButton>{t('core:searchFiles')}</MenuItem><MenuItem value={JSON.stringify(FileTypeGroups.untagged)}>- <IconButton size="large">+ <IconButton><UntaggedIcon /></IconButton>{t('core:searchUntaggedEntries')}@@ -832,7 +827,7 @@ function SearchPopover(props: Props) {value={JSON.stringify(FileTypeGroups.images)}title={FileTypeGroups.images.toString()}>- <IconButton size="large">+ <IconButton><PictureIcon /></IconButton>{t('core:searchPictures')}@@ -841,7 +836,7 @@ function SearchPopover(props: Props) {value={JSON.stringify(FileTypeGroups.documents)}title={FileTypeGroups.documents.toString()}>- <IconButton size="large">+ <IconButton><DocumentIcon /></IconButton>{t('core:searchDocuments')}@@ -850,7 +845,7 @@ function SearchPopover(props: Props) {value={JSON.stringify(FileTypeGroups.notes)}title={FileTypeGroups.notes.toString()}>- <IconButton size="large">+ <IconButton><NoteIcon /></IconButton>{t('core:searchNotes')}@@ -859,7 +854,7 @@ function SearchPopover(props: Props) {value={JSON.stringify(FileTypeGroups.audio)}title={FileTypeGroups.audio.toString()}>- <IconButton size="large">+ <IconButton><AudioIcon /></IconButton>{t('core:searchAudio')}@@ -868,7 +863,7 @@ function SearchPopover(props: Props) {value={JSON.stringify(FileTypeGroups.video)}title={FileTypeGroups.video.toString()}>- <IconButton size="large">+ <IconButton><VideoIcon /></IconButton>{t('core:searchVideoFiles')}@@ -877,7 +872,7 @@ function SearchPopover(props: Props) {value={JSON.stringify(FileTypeGroups.archives)}title={FileTypeGroups.archives.toString()}>- <IconButton size="large">+ <IconButton><ArchiveIcon /></IconButton>{t('core:searchArchives')}@@ -886,7 +881,7 @@ function SearchPopover(props: Props) {value={JSON.stringify(FileTypeGroups.bookmarks)}title={FileTypeGroups.bookmarks.toString()}>- <IconButton size="large">+ <IconButton><BookmarkIcon /></IconButton>{t('core:searchBookmarks')}@@ -895,7 +890,7 @@ function SearchPopover(props: Props) {value={JSON.stringify(FileTypeGroups.ebooks)}title={FileTypeGroups.ebooks.toString()}>- <IconButton size="large">+ <IconButton><BookIcon /></IconButton>{t('core:searchEbooks')}@@ -904,11 +899,12 @@ function SearchPopover(props: Props) {value={JSON.stringify(FileTypeGroups.emails)}title={FileTypeGroups.emails.toString()}>- <IconButton size="large">+ <IconButton><EmailIcon /></IconButton>{t('core:searchEmails')}</MenuItem>+ {/* </TsMenuList> */}</Select></ProTooltip></FormControl>diff --git a/src/renderer/components/TagLibrary.tsx b/src/renderer/components/TagLibrary.tsxindex 541edb083..6b3a8445c 100644--- a/src/renderer/components/TagLibrary.tsx+++ b/src/renderer/components/TagLibrary.tsx@@ -20,7 +20,7 @@ import React, { useCallback, useEffect, useState } from 'react';import { useSelector, useDispatch } from 'react-redux';import classNames from 'classnames';import Typography from '@mui/material/Typography';-import IconButton from '@mui/material/IconButton';+import TsIconButton from '-/components/TsIconButton';import Collapse from '@mui/material/Collapse';import MoreVertIcon from '@mui/icons-material/MoreVert';import AppConfig from '-/AppConfig';@@ -318,13 +318,12 @@ function TagLibrary(props: Props) {{t('core:tagLibrary')}</Typography>{!isTagLibraryReadOnly && (- <IconButton+ <TsIconButtondata-tid="tagLibraryMenu"onClick={handleTagLibraryMenu}- size="large"><MoreVertIcon />- </IconButton>+ </TsIconButton>)}</div>{isDeleteTagGroupDialogOpened && (diff --git a/src/renderer/components/TsIconButton.tsx b/src/renderer/components/TsIconButton.tsxnew file mode 100644index 000000000..c45d8bc68--- /dev/null+++ b/src/renderer/components/TsIconButton.tsx@@ -0,0 +1,44 @@+/**+ * TagSpaces - universal file and folder organizer+ * Copyright (C) 2024-present TagSpaces GmbH+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License (version 3) as+ * published by the Free Software Foundation.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ */++import React from 'react';+import { useSelector } from 'react-redux';+import IconButton, { IconButtonProps } from '@mui/material/IconButton';+import { isDesktopMode } from '-/reducers/settings';+import AppConfig from '-/AppConfig';++export type TSIconButtonProps = IconButtonProps & {};++function TsIconButton(props: TSIconButtonProps) {+ const { children, style } = props;+ const desktopMode = useSelector(isDesktopMode);++ return (+ <IconButton+ size={desktopMode ? 'medium' : 'large'}+ {...props}+ style={{+ ...style,+ }}+ >+ {children}+ </IconButton>+ );+}++export default TsIconButton;diff --git a/src/renderer/components/menus/LocationContextMenu.tsx b/src/renderer/components/menus/LocationContextMenu.tsxindex 88d888f69..ff4575af4 100644--- a/src/renderer/components/menus/LocationContextMenu.tsx+++ b/src/renderer/components/menus/LocationContextMenu.tsx@@ -32,6 +32,7 @@ import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward';import DeleteIcon from '@mui/icons-material/DeleteForever';import OpenFolderNativelyIcon from '@mui/icons-material/Launch';import { OpenNewWindowIcon, CloseIcon } from '-/components/CommonIcons';+import TsMenuList from '-/components/TsMenuList';import { locationType } from '@tagspaces/tagspaces-common/misc';import AppConfig from '-/AppConfig';import { useTranslation } from 'react-i18next';@@ -268,7 +269,7 @@ function LocationContextMenu(props: Props) {open={Boolean(locationDirectoryContextMenuAnchorEl)}onClose={() => setLocationDirectoryContextMenuAnchorEl(null)}>- {menuItems}+ <TsMenuList>{menuItems}</TsMenuList></Menu>);}diff --git a/src/renderer/components/menus/LocationManagerMenu.tsx b/src/renderer/components/menus/LocationManagerMenu.tsxindex 4cc7af1b6..d72ad3be2 100644--- a/src/renderer/components/menus/LocationManagerMenu.tsx+++ b/src/renderer/components/menus/LocationManagerMenu.tsx@@ -37,6 +37,7 @@ import {HelpIcon,LocalLocationIcon,} from '-/components/CommonIcons';+import TsMenuList from '-/components/TsMenuList';import { openURLExternally } from '-/services/utils-io';import { useTranslation } from 'react-i18next';import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';@@ -223,7 +224,7 @@ function LocationManagerMenu(props: Props) {setLocationManagerMenuAnchorEl(null);}}>- {menuItems}+ <TsMenuList>{menuItems}</TsMenuList></Menu></>);