TagSpaces is an offline, open source, document manager with tagging support
chore: migration to tsmenulist
Ilian Sapundshievbdf43ac3782b
diff --git a/src/renderer/components/LocationView.tsx b/src/renderer/components/LocationView.tsxindex 7f2ac1bd6..fedf2d671 100644--- a/src/renderer/components/LocationView.tsx+++ b/src/renderer/components/LocationView.tsx@@ -21,7 +21,6 @@ import { useDispatch } from 'react-redux';import Tooltip from '-/components/Tooltip';import ListItem from '@mui/material/ListItem';import ListItemIcon from '@mui/material/ListItemIcon';-import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction';import MoreVertIcon from '@mui/icons-material/MoreVert';import Typography from '@mui/material/Typography';import IconButton from '@mui/material/IconButton';@@ -50,6 +49,7 @@ import TargetFileBox from '-/components/TargetFileBox';import { NativeTypes } from 'react-dnd-html5-backend';import { TS } from '-/tagspaces.namespace';import { usePerspectiveActionsContext } from '-/hooks/usePerspectiveActionsContext';+import { ListItemText } from '@mui/material';interface Props {location: CommonLocation;@@ -100,8 +100,6 @@ function LocationView(props: Props) {setActions(action);});} else {- // this.directoryTreeRef[location.uuid].loadSubDir(location, 1);- // setSelectedEntries([]);openLocation(location);if (hideDrawer) {hideDrawer();@@ -109,10 +107,6 @@ function LocationView(props: Props) {}};- /*const closeLocationTree = () => {- directoryTreeRef.current.closeLocation();- };*/-const handleLocationContextMenuClick = (event: any, chosenLocation) => {event.preventDefault();event.stopPropagation();@@ -145,14 +139,6 @@ function LocationView(props: Props) {showNotification(t('core:dndDisabledReadOnlyMode'), 'error', true);return;}- /*if (!AppConfig.isWin && !path.startsWith('/')) {- showNotification(t('Moving file not possible'), 'error', true);- return;- }- if (AppConfig.isWin && !path.substr(1).startsWith(':')) {- showNotification(t('Moving file not possible'), 'error', true);- return;- }*/const targetLocation = item.targetLocation;let targetPath = targetLocation ? targetLocation.path : undefined;if (targetPath === undefined) {@@ -235,15 +221,7 @@ function LocationView(props: Props) {);const { FILE } = NativeTypes;return (- /* <div key={location.uuid}> */<SidePanel>- {/*{locationDirectoryContextMenuAnchorEl && (- <LocationContextMenu- setEditLocationDialogOpened={setEditLocationDialogOpened}- setDeleteLocationDialogOpened={setDeleteLocationDialogOpened}- closeLocationTree={closeLocationTree}- />- )}*/}<TargetFileBoxaccepts={[FILE]}directoryPath={location.path}@@ -263,10 +241,6 @@ function LocationView(props: Props) {}><ListItemIcon- // onClick={(e) => {- // e.preventDefault();- // this.loadSubDirectories(location, 1);- // }}style={{minWidth: 'auto',cursor: 'pointer',@@ -291,40 +265,41 @@ function LocationView(props: Props) {)}</Tooltip></ListItemIcon>- {isCloudLocation && !AppConfig.isElectron ? (- <>{LocationTitle}</>- ) : (- <TargetMoveFileBox- accepts={[DragItemTypes.FILE]}- onDrop={handleFileMoveDrop}- targetPath={currentLocationPath}- targetLocation={location}- >- {LocationTitle}- </TargetMoveFileBox>+ <ListItemText>+ {isCloudLocation && !AppConfig.isElectron ? (+ <>{LocationTitle}</>+ ) : (+ <TargetMoveFileBox+ accepts={[DragItemTypes.FILE]}+ onDrop={handleFileMoveDrop}+ targetPath={currentLocationPath}+ targetLocation={location}+ >+ {LocationTitle}+ </TargetMoveFileBox>+ )}+ </ListItemText>+ {location.isDefault && (+ <Tooltip title={t('core:thisIsStartupLocation')}>+ <DefaultLocationIcon+ color="primary"+ data-tid="startupIndication"+ />+ </Tooltip>)}- <ListItemSecondaryAction>- <IconButton- aria-label={t('core:options')}- aria-haspopup="true"- edge="end"- data-tid={'locationMoreButton_' + location.name}- onClick={(event) =>- handleLocationContextMenuClick(event, location)- }- onContextMenu={(event) =>- handleLocationContextMenuClick(event, location)- }- size="large"- >- {location.isDefault && (- <Tooltip title={t('core:thisIsStartupLocation')}>- <DefaultLocationIcon data-tid="startupIndication" />- </Tooltip>- )}- <MoreVertIcon />- </IconButton>- </ListItemSecondaryAction>+ <IconButton+ aria-label={t('core:options')}+ aria-haspopup="true"+ edge="end"+ data-tid={'locationMoreButton_' + location.name}+ onClick={(event) => handleLocationContextMenuClick(event, location)}+ onContextMenu={(event) =>+ handleLocationContextMenuClick(event, location)+ }+ size="large"+ >+ <MoreVertIcon />+ </IconButton></ListItem></TargetFileBox><DirectoryTreeViewdiff --git a/src/renderer/components/SidePanels.css.tsx b/src/renderer/components/SidePanels.css.tsxindex fc19d387f..3acb69342 100644--- a/src/renderer/components/SidePanels.css.tsx+++ b/src/renderer/components/SidePanels.css.tsx@@ -15,6 +15,7 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.**/+import AppConfig from '-/AppConfig';import { styled } from '@mui/material/styles';const PREFIX = 'SidePanel';@@ -53,11 +54,13 @@ export const SidePanel = styled('div')(({ theme }) => ({},[`& .${classes.listItem}`]: {padding: 0,- borderRadius: 5,+ paddingRight: 15,+ borderRadius: AppConfig.defaultCSSRadius,},[`& .${classes.listItemSelected}`]: {padding: 0,- borderRadius: 5,+ paddingRight: 15,+ borderRadius: AppConfig.defaultCSSRadius,backgroundColor: theme.palette.primary.light,},[`& .${classes.panelTitle}`]: {diff --git a/src/renderer/components/dialogs/KeyboardDialog.tsx b/src/renderer/components/dialogs/KeyboardDialog.tsxindex 649337d82..0bc9fa08f 100644--- a/src/renderer/components/dialogs/KeyboardDialog.tsx+++ b/src/renderer/components/dialogs/KeyboardDialog.tsx@@ -24,7 +24,7 @@ import DialogContent from '@mui/material/DialogContent';import DialogTitle from '@mui/material/DialogTitle';import List from '@mui/material/List';import ListItem from '@mui/material/ListItem';-import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction';+import Box from '@mui/material/Box';import ListItemText from '@mui/material/ListItemText';import Dialog from '@mui/material/Dialog';import { getKeyBindingObject } from '-/reducers/settings';@@ -95,7 +95,7 @@ function KeyboardDialog(props: Props) {Object.keys(keyBindings).map((shortcutKey) => (<ListItem key={shortcutKey}><ListItemText primary={t('core:' + shortcutKey)} />- <ListItemSecondaryAction+ <Boxstyle={{backgroundColor: 'gray',color: 'white',@@ -106,7 +106,7 @@ function KeyboardDialog(props: Props) {}}>{adjustKeyBinding(keyBindings[shortcutKey])}- </ListItemSecondaryAction>+ </Box></ListItem>))}</List>diff --git a/src/renderer/components/dialogs/settings/MapTileServerDialog.tsx b/src/renderer/components/dialogs/settings/MapTileServerDialog.tsxindex 888bde373..738d73344 100644--- a/src/renderer/components/dialogs/settings/MapTileServerDialog.tsx+++ b/src/renderer/components/dialogs/settings/MapTileServerDialog.tsx@@ -35,6 +35,7 @@ import { AppDispatch } from '-/reducers/app';import { useTranslation } from 'react-i18next';import ListItemText from '@mui/material/ListItemText';import ListItem from '@mui/material/ListItem/ListItem';+import AppConfig from '-/AppConfig';interface Props {open: boolean;@@ -198,6 +199,7 @@ function MapTileServerDialog(props: Props) {<TsButtondata-tid="saveTileServerDialogTID"onClick={saveTileServer}+ style={{ marginLeft: AppConfig.defaultSpaceBetweenButtons }}variant="contained">{t('core:confirmSaveButton')}diff --git a/src/renderer/components/dialogs/settings/SettingsAdvanced.tsx b/src/renderer/components/dialogs/settings/SettingsAdvanced.tsxindex 86bc9e21f..d35b4f75c 100644--- a/src/renderer/components/dialogs/settings/SettingsAdvanced.tsx+++ b/src/renderer/components/dialogs/settings/SettingsAdvanced.tsx@@ -26,7 +26,6 @@ import TsButton from '-/components/TsButton';import CheckIcon from '@mui/icons-material/Check';import EditIcon from '@mui/icons-material/Edit';import IconButton from '@mui/material/IconButton';-import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction';import Switch from '@mui/material/Switch';import MenuItem from '@mui/material/MenuItem';import AppConfig from '-/AppConfig';@@ -381,13 +380,11 @@ function SettingsAdvanced(props: Props) {</ListItem><ListItem><ListItemText primary={t('core:tileServerTitle')} />- <ListItemSecondaryAction style={{ right: 0 }}>- <TsButton- onClick={(event) => handleEditTileServerClick(event, {}, true)}- >- {t('tileServerDialogAdd')}- </TsButton>- </ListItemSecondaryAction>+ <TsButton+ onClick={(event) => handleEditTileServerClick(event, {}, true)}+ >+ {t('tileServerDialogAdd')}+ </TsButton></ListItem><Liststyle={{@@ -406,28 +403,26 @@ function SettingsAdvanced(props: Props) {secondary={tileServer.serverURL}style={{ maxWidth: 470 }}/>- <ListItemSecondaryAction>- {index === 0 && (- <Tooltip title={t('core:serverIsDefaultHelp')}>- <CheckIcon- data-tid="tileServerDefaultIndication"- style={{ marginLeft: 10 }}- />- </Tooltip>- )}- <IconButton- aria-label={t('core:options')}- aria-haspopup="true"- edge="end"- data-tid={'tileServerEdit_' + tileServer.name}- onClick={(event) =>- handleEditTileServerClick(event, tileServer, index === 0)- }- size="large"- >- <EditIcon />- </IconButton>- </ListItemSecondaryAction>+ <IconButton+ aria-label={t('core:options')}+ aria-haspopup="true"+ edge="end"+ data-tid={'tileServerEdit_' + tileServer.name}+ onClick={(event) =>+ handleEditTileServerClick(event, tileServer, index === 0)+ }+ size="large"+ >+ <EditIcon />+ </IconButton>+ {index === 0 && (+ <Tooltip title={t('core:serverIsDefaultHelp')}>+ <CheckIcon+ data-tid="tileServerDefaultIndication"+ style={{ marginLeft: 10 }}+ />+ </Tooltip>+ )}</ListItem>))) : (diff --git a/src/renderer/components/menus/EntryTagMenu.tsx b/src/renderer/components/menus/EntryTagMenu.tsxindex 371b39cc8..2e614cdda 100644--- a/src/renderer/components/menus/EntryTagMenu.tsx+++ b/src/renderer/components/menus/EntryTagMenu.tsx@@ -26,7 +26,8 @@ import ListItemIcon from '@mui/material/ListItemIcon';import ListItemText from '@mui/material/ListItemText';import Menu from '@mui/material/Menu';import MenuItem from '@mui/material/MenuItem';-import ConfirmDialog from '../dialogs/ConfirmDialog';+import ConfirmDialog from '-/components/dialogs/ConfirmDialog';+import TsMenuList from '-/components/TsMenuList';import { getMaxSearchResults } from '-/reducers/settings';import { TS } from '-/tagspaces.namespace';import { useTranslation } from 'react-i18next';@@ -160,7 +161,7 @@ function EntryTagMenu(props: Props) {return (<div style={{ overflowY: 'hidden' }}><Menu anchorEl={anchorEl} open={open} onClose={onClose}>- {menuItems}+ <TsMenuList>{menuItems}</TsMenuList></Menu><ConfirmDialogopen={isDeleteTagDialogOpened}diff --git a/src/renderer/components/menus/HistoryMenu.tsx b/src/renderer/components/menus/HistoryMenu.tsxindex 34f5a9c63..61ce1af89 100644--- a/src/renderer/components/menus/HistoryMenu.tsx+++ b/src/renderer/components/menus/HistoryMenu.tsx@@ -23,7 +23,8 @@ import Menu from '@mui/material/Menu';import MenuItem from '@mui/material/MenuItem';import RefreshIcon from '@mui/icons-material/Refresh';import DeleteIcon from '@mui/icons-material/Delete';-import { Pro } from '../../pro';+import TsMenuList from '-/components/TsMenuList';+import { Pro } from '-/pro';import { useTranslation } from 'react-i18next';interface Props {@@ -74,7 +75,7 @@ function HistoryMenu(props: Props) {return (<div style={{ overflowY: 'hidden' }}><Menu anchorEl={props.anchorEl} open={props.open} onClose={props.onClose}>- {menuItems}+ <TsMenuList>{menuItems}</TsMenuList></Menu></div>);diff --git a/src/renderer/components/menus/SearchMenu.tsx b/src/renderer/components/menus/SearchMenu.tsxindex a5f3016ff..1d8d1041d 100644--- a/src/renderer/components/menus/SearchMenu.tsx+++ b/src/renderer/components/menus/SearchMenu.tsx@@ -23,7 +23,8 @@ import Menu from '@mui/material/Menu';import MenuItem from '@mui/material/MenuItem';import HelpIcon from '@mui/icons-material/Help';import ExportImportIcon from '@mui/icons-material/SwapHoriz';-import { Pro } from '../../pro';+import TsMenuList from '-/components/TsMenuList';+import { Pro } from '-/pro';import Links from 'assets/links';import { ProLabel } from '-/components/HelperComponents';import { openURLExternally } from '-/services/utils-io';@@ -106,7 +107,7 @@ function SearchMenu(props: Props) {return (<div style={{ overflowY: 'hidden' }}><Menu anchorEl={props.anchorEl} open={props.open} onClose={props.onClose}>- {menuItems}+ <TsMenuList>{menuItems}</TsMenuList></Menu></div>);diff --git a/src/renderer/components/menus/TagGroupMenu.tsx b/src/renderer/components/menus/TagGroupMenu.tsxindex 29c5b6462..a31a929c3 100644--- a/src/renderer/components/menus/TagGroupMenu.tsx+++ b/src/renderer/components/menus/TagGroupMenu.tsx@@ -27,12 +27,11 @@ import DeleteTagGroupIcon from '@mui/icons-material/DeleteForever';import SortTagGroupIcon from '@mui/icons-material/SortByAlpha';import ShowEntriesWithTagIcon from '@mui/icons-material/SearchOutlined';import TagIcon from '@mui/icons-material/LocalOffer';-import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction';import CollectTagsIcon from '@mui/icons-material/Voicemail';import Menu from '@mui/material/Menu';import MenuItem from '@mui/material/MenuItem';import { getMaxSearchResults } from '-/reducers/settings';-import { actions as AppActions, AppDispatch } from '-/reducers/app';+import TsMenuList from '-/components/TsMenuList';import { TS } from '-/tagspaces.namespace';import InfoIcon from '-/components/InfoIcon';import { useTranslation } from 'react-i18next';@@ -119,61 +118,64 @@ function TagGroupMenu(props: Props) {return (<div style={{ overflowY: 'hidden' }}><Menu anchorEl={anchorEl} open={open} onClose={handleCloseTagGroupMenu}>- <MenuItem data-tid="createTags" onClick={showCreateTagsDialog}>- <ListItemIcon>- <TagIcon />- </ListItemIcon>- <ListItemText primary={t('core:addTags')} />- </MenuItem>- <MenuItem data-tid="editTagGroup" onClick={showEditTagGroupDialog}>- <ListItemIcon>- <Edit />- </ListItemIcon>- <ListItemText primary={t('core:editTagGroup')} />- </MenuItem>- <MenuItem data-tid="moveTagGroupUp" onClick={moveTagGroupUpInt}>- <ListItemIcon>- <ArrowUpward />- </ListItemIcon>- <ListItemText primary={t('core:moveTagGroupUp')} />- </MenuItem>- <MenuItem data-tid="moveTagGroupDown" onClick={moveTagGroupDownInt}>- <ListItemIcon>- <ArrowDownward />- </ListItemIcon>- <ListItemText primary={t('core:moveTagGroupDown')} />- </MenuItem>- <MenuItem data-tid="sortTagGroup" onClick={sortTagGroupInt}>- <ListItemIcon>- <SortTagGroupIcon />- </ListItemIcon>- <ListItemText primary={t('core:sortTagGroup')} />- </MenuItem>- <MenuItem data-tid="showFilesWithTagsTID" onClick={showFilesWithTags}>- <ListItemIcon>- <ShowEntriesWithTagIcon />- </ListItemIcon>- <ListItemText primary={t('core:showFilesWithTags')} />- <ListItemSecondaryAction>+ <TsMenuList>+ <MenuItem data-tid="createTags" onClick={showCreateTagsDialog}>+ <ListItemIcon>+ <TagIcon />+ </ListItemIcon>+ <ListItemText primary={t('core:addTags')} />+ </MenuItem>+ <MenuItem data-tid="editTagGroup" onClick={showEditTagGroupDialog}>+ <ListItemIcon>+ <Edit />+ </ListItemIcon>+ <ListItemText primary={t('core:editTagGroup')} />+ </MenuItem>+ <MenuItem data-tid="moveTagGroupUp" onClick={moveTagGroupUpInt}>+ <ListItemIcon>+ <ArrowUpward />+ </ListItemIcon>+ <ListItemText primary={t('core:moveTagGroupUp')} />+ </MenuItem>+ <MenuItem data-tid="moveTagGroupDown" onClick={moveTagGroupDownInt}>+ <ListItemIcon>+ <ArrowDownward />+ </ListItemIcon>+ <ListItemText primary={t('core:moveTagGroupDown')} />+ </MenuItem>+ <MenuItem data-tid="sortTagGroup" onClick={sortTagGroupInt}>+ <ListItemIcon>+ <SortTagGroupIcon />+ </ListItemIcon>+ <ListItemText primary={t('core:sortTagGroup')} />+ </MenuItem>+ <MenuItem data-tid="showFilesWithTagsTID" onClick={showFilesWithTags}>+ <ListItemIcon>+ <ShowEntriesWithTagIcon />+ </ListItemIcon>+ <ListItemText primary={t('core:showFilesWithTags')} /><InfoIcon tooltip={t('core:showFilesWithTagsTooltip')} />- </ListItemSecondaryAction>- </MenuItem>- <MenuItem data-tid="deleteTagGroup" onClick={showDeleteTagGroupDialog}>- <ListItemIcon>- <DeleteTagGroupIcon />- </ListItemIcon>- <ListItemText primary={t('core:deleteTagGroup')} />- </MenuItem>- <MenuItem- data-tid="collectTags"- onClick={handleCollectTags}- title={t('collectTagsFromLocationTitle')}- >- <ListItemIcon>- <CollectTagsIcon />- </ListItemIcon>- <ListItemText primary={<>{t('core:collectTagsFromLocation')}</>} />- </MenuItem>+ </MenuItem>+ <MenuItem+ data-tid="deleteTagGroup"+ onClick={showDeleteTagGroupDialog}+ >+ <ListItemIcon>+ <DeleteTagGroupIcon />+ </ListItemIcon>+ <ListItemText primary={t('core:deleteTagGroup')} />+ </MenuItem>+ <MenuItem+ data-tid="collectTags"+ onClick={handleCollectTags}+ title={t('collectTagsFromLocationTitle')}+ >+ <ListItemIcon>+ <CollectTagsIcon />+ </ListItemIcon>+ <ListItemText primary={<>{t('core:collectTagsFromLocation')}</>} />+ </MenuItem>+ </TsMenuList></Menu></div>);diff --git a/src/renderer/components/menus/TagLibraryMenu.tsx b/src/renderer/components/menus/TagLibraryMenu.tsxindex edc000f64..23a1a4774 100644--- a/src/renderer/components/menus/TagLibraryMenu.tsx+++ b/src/renderer/components/menus/TagLibraryMenu.tsx@@ -28,6 +28,7 @@ import ReloadIcon from '@mui/icons-material/Sync';import AppConfig from '-/AppConfig';import ImportExportTagGroupsDialog from '../dialogs/ImportExportTagGroupsDialog';import Links from 'assets/links';+import TsMenuList from '-/components/TsMenuList';import { ProLabel, ProTooltip } from '-/components/HelperComponents';import { Pro } from '-/pro';import { openURLExternally } from '-/services/utils-io';@@ -112,69 +113,71 @@ function TagLibraryMenu(props: Props) {/>)}<Menu anchorEl={props.anchorEl} open={props.open} onClose={props.onClose}>- <MenuItem- data-tid="createNewTagGroup"- onClick={() => {- props.onClose();- props.showCreateTagGroupDialog();- }}- >- <ListItemIcon>- <AddIcon />- </ListItemIcon>- <ListItemText primary={t('core:createTagGroupTitle')} />- </MenuItem>- <ProTooltip- placement="right"- tooltip={t('core:enableTagsFromLocationHelp')}- >+ <TsMenuList><MenuItem- disabled={!Pro || !saveTagInLocation}- data-tid="refreshTagGroups"+ data-tid="createNewTagGroup"onClick={() => {- props.refreshTagsFromLocation();props.onClose();+ props.showCreateTagGroupDialog();}}><ListItemIcon>- <ReloadIcon />+ <AddIcon /></ListItemIcon>- <ListItemText- primary={- <>- {t('core:refreshTagGroups')}- <ProLabel />- </>- }- />+ <ListItemText primary={t('core:createTagGroupTitle')} /></MenuItem>- </ProTooltip>- <MenuItem data-tid="importTagGroup" onClick={handleImportTagGroup}>- <ListItemIcon>- <ImportExportIcon />- </ListItemIcon>- <ListItemText primary={t('core:importTags')} />- </MenuItem>- {!AppConfig.isCordovaAndroid && (- <MenuItem data-tid="exportTagGroup" onClick={handleExportTagGroup}>+ <ProTooltip+ placement="right"+ tooltip={t('core:enableTagsFromLocationHelp')}+ >+ <MenuItem+ disabled={!Pro || !saveTagInLocation}+ data-tid="refreshTagGroups"+ onClick={() => {+ props.refreshTagsFromLocation();+ props.onClose();+ }}+ >+ <ListItemIcon>+ <ReloadIcon />+ </ListItemIcon>+ <ListItemText+ primary={+ <>+ {t('core:refreshTagGroups')}+ <ProLabel />+ </>+ }+ />+ </MenuItem>+ </ProTooltip>+ <MenuItem data-tid="importTagGroup" onClick={handleImportTagGroup}><ListItemIcon><ImportExportIcon /></ListItemIcon>- <ListItemText primary={t('core:exportTagGroupsButton')} />+ <ListItemText primary={t('core:importTags')} />+ </MenuItem>+ {!AppConfig.isCordovaAndroid && (+ <MenuItem data-tid="exportTagGroup" onClick={handleExportTagGroup}>+ <ListItemIcon>+ <ImportExportIcon />+ </ListItemIcon>+ <ListItemText primary={t('core:exportTagGroupsButton')} />+ </MenuItem>+ )}+ <MenuItem+ data-tid="taglibraryHelp"+ onClick={() => {+ props.onClose();+ openURLExternally(Links.documentationLinks.taglibrary, true);+ }}+ >+ <ListItemIcon>+ <HelpIcon />+ </ListItemIcon>+ <ListItemText primary={t('core:help')} /></MenuItem>- )}- <MenuItem- data-tid="taglibraryHelp"- onClick={() => {- props.onClose();- openURLExternally(Links.documentationLinks.taglibrary, true);- }}- >- <ListItemIcon>- <HelpIcon />- </ListItemIcon>- <ListItemText primary={t('core:help')} />- </MenuItem>+ </TsMenuList></Menu><inputstyle={{ display: 'none' }}diff --git a/src/renderer/components/menus/TagMenu.tsx b/src/renderer/components/menus/TagMenu.tsxindex 5ab518433..c3cbe459d 100644--- a/src/renderer/components/menus/TagMenu.tsx+++ b/src/renderer/components/menus/TagMenu.tsx@@ -28,6 +28,7 @@ import Menu from '@mui/material/Menu';import MenuItem from '@mui/material/MenuItem';import { getMaxSearchResults } from '-/reducers/settings';import { TS } from '-/tagspaces.namespace';+import TsMenuList from '-/components/TsMenuList';import { useTranslation } from 'react-i18next';import { useTaggingActionsContext } from '-/hooks/useTaggingActionsContext';import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';@@ -96,42 +97,44 @@ function TagMenu(props: Props) {return (<div style={{ overflowY: 'hidden' }}><Menu anchorEl={anchorEl} open={open} onClose={onClose}>- {!isSmartTag && (- <MenuItem- data-tid="showFilesWithThisTag"- onClick={showFilesWithThisTag}- >- <ListItemIcon>- <ShowEntriesWithTagIcon />- </ListItemIcon>- <ListItemText primary={t('core:showFilesWithThisTag')} />- </MenuItem>- )}+ <TsMenuList>+ {!isSmartTag && (+ <MenuItem+ data-tid="showFilesWithThisTag"+ onClick={showFilesWithThisTag}+ >+ <ListItemIcon>+ <ShowEntriesWithTagIcon />+ </ListItemIcon>+ <ListItemText primary={t('core:showFilesWithThisTag')} />+ </MenuItem>+ )}- {selectedEntries && selectedEntries.length > 0 && !readOnlyMode && (- <MenuItem data-tid="applyTagTID" onClick={applyTag}>- <ListItemIcon>- <ApplyTagIcon />- </ListItemIcon>- <ListItemText primary={t('core:applyTag')} />- </MenuItem>- )}- {!isSmartTag && !isTagLibraryReadOnly && (- <MenuItem data-tid="editTagDialog" onClick={showEditTagMenuDialog}>- <ListItemIcon>- <Edit />- </ListItemIcon>- <ListItemText primary={t('core:editTag')} />- </MenuItem>- )}- {!isSmartTag && !isTagLibraryReadOnly && (- <MenuItem data-tid="deleteTagDialog" onClick={openDeleteTagDialog}>- <ListItemIcon>- <DeleteIcon />- </ListItemIcon>- <ListItemText primary={t('core:deleteTagFromTagGroup')} />- </MenuItem>- )}+ {selectedEntries && selectedEntries.length > 0 && !readOnlyMode && (+ <MenuItem data-tid="applyTagTID" onClick={applyTag}>+ <ListItemIcon>+ <ApplyTagIcon />+ </ListItemIcon>+ <ListItemText primary={t('core:applyTag')} />+ </MenuItem>+ )}+ {!isSmartTag && !isTagLibraryReadOnly && (+ <MenuItem data-tid="editTagDialog" onClick={showEditTagMenuDialog}>+ <ListItemIcon>+ <Edit />+ </ListItemIcon>+ <ListItemText primary={t('core:editTag')} />+ </MenuItem>+ )}+ {!isSmartTag && !isTagLibraryReadOnly && (+ <MenuItem data-tid="deleteTagDialog" onClick={openDeleteTagDialog}>+ <ListItemIcon>+ <DeleteIcon />+ </ListItemIcon>+ <ListItemText primary={t('core:deleteTagFromTagGroup')} />+ </MenuItem>+ )}+ </TsMenuList></Menu></div>);diff --git a/src/renderer/perspectives/grid/components/GridOptionsMenu.tsx b/src/renderer/perspectives/grid/components/GridOptionsMenu.tsxindex 3ca7af4a4..2f6345cb3 100644--- a/src/renderer/perspectives/grid/components/GridOptionsMenu.tsx+++ b/src/renderer/perspectives/grid/components/GridOptionsMenu.tsx@@ -30,6 +30,7 @@ import RadioCheckedIcon from '@mui/icons-material/RadioButtonChecked';import RadioUncheckedIcon from '@mui/icons-material/RadioButtonUnchecked';import SettingsIcon from '@mui/icons-material/Settings';import HelpIcon from '@mui/icons-material/Help';+import TsMenuList from '-/components/TsMenuList';import { useTranslation } from 'react-i18next';import { usePerspectiveSettingsContext } from '-/hooks/usePerspectiveSettingsContext';@@ -57,185 +58,191 @@ function GridOptionsMenu(props: Props) {return (<Menu anchorEl={anchorEl} open={open} onClose={onClose}>- <MenuItem- data-tid="gridPerspectiveToggleShowDirectories"- title={t('core:showHideDirectories')}- aria-label={t('core:showHideDirectories')}- onClick={() => {- setSettings({ showDirectories: !showDirectories });- saveSettings(false);- }}- >- <ListItemIcon>- {showDirectories ? <CheckBoxIcon /> : <CheckBoxEmptyIcon />}- </ListItemIcon>- <ListItemText primary={t('core:showHideDirectories')} />- </MenuItem>- <MenuItem- data-tid="gridPerspectiveToggleShowTags"- title={t('core:showTags')}- aria-label={t('core:showTags')}- onClick={() => {- setSettings({ showTags: !showTags });- saveSettings(false);- }}- >- <ListItemIcon>- {showTags ? <CheckBoxIcon /> : <CheckBoxEmptyIcon />}- </ListItemIcon>- <ListItemText primary={t('core:showTags')} />- </MenuItem>- <Divider />- <MenuItem- data-tid="gridPerspectiveToggleThumbnailsMode"- title={t('core:toggleThumbnailModeTitle')}- aria-label={t('core:toggleThumbnailMode')}- onClick={() => {- setSettings({- thumbnailMode: thumbnailMode === 'cover' ? 'contain' : 'cover',- });- saveSettings(false);- }}- >- <ListItemIcon>- {thumbnailMode === 'cover' ? (- <ThumbnailCoverIcon />- ) : (- <ThumbnailContainIcon />- )}- </ListItemIcon>- <ListItemText primary={t('core:toggleThumbnailMode')} />- </MenuItem>- <Divider />- <MenuItem- data-tid="gridPerspectiveEntrySizeSmall"- title={t('core:entrySizeSmall')}- aria-label={t('core:entrySizeSmall')}- onClick={() => {- setSettings({ entrySize: 'small' });- saveSettings(false);- }}- >- <ListItemIcon>- {entrySize === 'small' ? (- <RadioCheckedIcon />- ) : (- <RadioUncheckedIcon />- )}- </ListItemIcon>- <ListItemText primary={t('core:entrySizeSmall')} />- </MenuItem>- <MenuItem- data-tid="gridPerspectiveEntrySizeNormal"- title={t('core:entrySizeNormal')}- aria-label={t('core:entrySizeNormal')}- onClick={() => {- setSettings({ entrySize: 'normal' });- saveSettings(false);- }}- >- <ListItemIcon>- {entrySize === 'normal' ? (- <RadioCheckedIcon />- ) : (- <RadioUncheckedIcon />- )}- </ListItemIcon>- <ListItemText primary={t('core:entrySizeNormal')} />- </MenuItem>- <MenuItem- data-tid="gridPerspectiveEntrySizeBig"- title={t('core:entrySizeBig')}- aria-label={t('core:entrySizeBig')}- onClick={() => {- setSettings({ entrySize: 'big' });- saveSettings(false);- }}- >- <ListItemIcon>- {entrySize === 'big' ? <RadioCheckedIcon /> : <RadioUncheckedIcon />}- </ListItemIcon>- <ListItemText primary={t('core:entrySizeBig')} />- </MenuItem>- <Divider />- <MenuItem- data-tid="gridPerspectiveSingleClickOpenInternally"- title={t('core:singleClickOpenInternally')}- aria-label={t('core:singleClickOpenInternally')}- onClick={() => {- setSettings({ singleClickAction: 'openInternal' });- saveSettings(false);- }}- >- <ListItemIcon>- {singleClickAction === 'openInternal' ? (- <RadioCheckedIcon />- ) : (- <RadioUncheckedIcon />- )}- </ListItemIcon>- <ListItemText primary={t('core:singleClickOpenInternally')} />- </MenuItem>- <MenuItem- data-tid="gridPerspectiveSingleClickOpenExternally"- title={t('core:singleClickOpenExternally')}- aria-label={t('core:singleClickOpenExternally')}- onClick={() => {- setSettings({ singleClickAction: 'openExternal' });- saveSettings(false);- }}- >- <ListItemIcon>- {singleClickAction === 'openExternal' ? (- <RadioCheckedIcon />- ) : (- <RadioUncheckedIcon />- )}- </ListItemIcon>- <ListItemText primary={t('core:singleClickOpenExternally')} />- </MenuItem>- <MenuItem- data-tid="gridPerspectiveSingleClickSelects"- title={t('core:singleClickSelects')}- aria-label={t('core:singleClickSelects')}- onClick={() => {- setSettings({ singleClickAction: 'selects' });- saveSettings(false);- }}- >- <ListItemIcon>- {singleClickAction === 'selects' ? (- <RadioCheckedIcon />- ) : (- <RadioUncheckedIcon />- )}- </ListItemIcon>- <ListItemText primary={t('core:singleClickSelects')} />- </MenuItem>- <Divider />- <MenuItem- data-tid="gridPerspectiveSettings"- title={t('core:settings')}- aria-label={t('core:settings')}- onClick={openSettings}- >- <ListItemIcon>- <SettingsIcon />- </ListItemIcon>- <ListItemText primary={t('core:settings')} />- </MenuItem>- <Divider />- <MenuItem- data-tid="gridPerspectiveHelp"- title={t('core:help')}- aria-label={t('core:perspectiveHelp')}- onClick={openHelpWebPage}- >- <ListItemIcon>- <HelpIcon />- </ListItemIcon>- <ListItemText primary={t('core:help')} />- </MenuItem>+ <TsMenuList>+ <MenuItem+ data-tid="gridPerspectiveToggleShowDirectories"+ title={t('core:showHideDirectories')}+ aria-label={t('core:showHideDirectories')}+ onClick={() => {+ setSettings({ showDirectories: !showDirectories });+ saveSettings(false);+ }}+ >+ <ListItemIcon>+ {showDirectories ? <CheckBoxIcon /> : <CheckBoxEmptyIcon />}+ </ListItemIcon>+ <ListItemText primary={t('core:showHideDirectories')} />+ </MenuItem>+ <MenuItem+ data-tid="gridPerspectiveToggleShowTags"+ title={t('core:showTags')}+ aria-label={t('core:showTags')}+ onClick={() => {+ setSettings({ showTags: !showTags });+ saveSettings(false);+ }}+ >+ <ListItemIcon>+ {showTags ? <CheckBoxIcon /> : <CheckBoxEmptyIcon />}+ </ListItemIcon>+ <ListItemText primary={t('core:showTags')} />+ </MenuItem>+ <Divider />+ <MenuItem+ data-tid="gridPerspectiveToggleThumbnailsMode"+ title={t('core:toggleThumbnailModeTitle')}+ aria-label={t('core:toggleThumbnailMode')}+ onClick={() => {+ setSettings({+ thumbnailMode: thumbnailMode === 'cover' ? 'contain' : 'cover',+ });+ saveSettings(false);+ }}+ >+ <ListItemIcon>+ {thumbnailMode === 'cover' ? (+ <ThumbnailCoverIcon />+ ) : (+ <ThumbnailContainIcon />+ )}+ </ListItemIcon>+ <ListItemText primary={t('core:toggleThumbnailMode')} />+ </MenuItem>+ <Divider />+ <MenuItem+ data-tid="gridPerspectiveEntrySizeSmall"+ title={t('core:entrySizeSmall')}+ aria-label={t('core:entrySizeSmall')}+ onClick={() => {+ setSettings({ entrySize: 'small' });+ saveSettings(false);+ }}+ >+ <ListItemIcon>+ {entrySize === 'small' ? (+ <RadioCheckedIcon />+ ) : (+ <RadioUncheckedIcon />+ )}+ </ListItemIcon>+ <ListItemText primary={t('core:entrySizeSmall')} />+ </MenuItem>+ <MenuItem+ data-tid="gridPerspectiveEntrySizeNormal"+ title={t('core:entrySizeNormal')}+ aria-label={t('core:entrySizeNormal')}+ onClick={() => {+ setSettings({ entrySize: 'normal' });+ saveSettings(false);+ }}+ >+ <ListItemIcon>+ {entrySize === 'normal' ? (+ <RadioCheckedIcon />+ ) : (+ <RadioUncheckedIcon />+ )}+ </ListItemIcon>+ <ListItemText primary={t('core:entrySizeNormal')} />+ </MenuItem>+ <MenuItem+ data-tid="gridPerspectiveEntrySizeBig"+ title={t('core:entrySizeBig')}+ aria-label={t('core:entrySizeBig')}+ onClick={() => {+ setSettings({ entrySize: 'big' });+ saveSettings(false);+ }}+ >+ <ListItemIcon>+ {entrySize === 'big' ? (+ <RadioCheckedIcon />+ ) : (+ <RadioUncheckedIcon />+ )}+ </ListItemIcon>+ <ListItemText primary={t('core:entrySizeBig')} />+ </MenuItem>+ <Divider />+ <MenuItem+ data-tid="gridPerspectiveSingleClickOpenInternally"+ title={t('core:singleClickOpenInternally')}+ aria-label={t('core:singleClickOpenInternally')}+ onClick={() => {+ setSettings({ singleClickAction: 'openInternal' });+ saveSettings(false);+ }}+ >+ <ListItemIcon>+ {singleClickAction === 'openInternal' ? (+ <RadioCheckedIcon />+ ) : (+ <RadioUncheckedIcon />+ )}+ </ListItemIcon>+ <ListItemText primary={t('core:singleClickOpenInternally')} />+ </MenuItem>+ <MenuItem+ data-tid="gridPerspectiveSingleClickOpenExternally"+ title={t('core:singleClickOpenExternally')}+ aria-label={t('core:singleClickOpenExternally')}+ onClick={() => {+ setSettings({ singleClickAction: 'openExternal' });+ saveSettings(false);+ }}+ >+ <ListItemIcon>+ {singleClickAction === 'openExternal' ? (+ <RadioCheckedIcon />+ ) : (+ <RadioUncheckedIcon />+ )}+ </ListItemIcon>+ <ListItemText primary={t('core:singleClickOpenExternally')} />+ </MenuItem>+ <MenuItem+ data-tid="gridPerspectiveSingleClickSelects"+ title={t('core:singleClickSelects')}+ aria-label={t('core:singleClickSelects')}+ onClick={() => {+ setSettings({ singleClickAction: 'selects' });+ saveSettings(false);+ }}+ >+ <ListItemIcon>+ {singleClickAction === 'selects' ? (+ <RadioCheckedIcon />+ ) : (+ <RadioUncheckedIcon />+ )}+ </ListItemIcon>+ <ListItemText primary={t('core:singleClickSelects')} />+ </MenuItem>+ <Divider />+ <MenuItem+ data-tid="gridPerspectiveSettings"+ title={t('core:settings')}+ aria-label={t('core:settings')}+ onClick={openSettings}+ >+ <ListItemIcon>+ <SettingsIcon />+ </ListItemIcon>+ <ListItemText primary={t('core:settings')} />+ </MenuItem>+ <Divider />+ <MenuItem+ data-tid="gridPerspectiveHelp"+ title={t('core:help')}+ aria-label={t('core:perspectiveHelp')}+ onClick={openHelpWebPage}+ >+ <ListItemIcon>+ <HelpIcon />+ </ListItemIcon>+ <ListItemText primary={t('core:help')} />+ </MenuItem>+ </TsMenuList></Menu>);}diff --git a/src/renderer/perspectives/grid/components/SortingMenu.tsx b/src/renderer/perspectives/grid/components/SortingMenu.tsxindex 52b36774f..49473c029 100644--- a/src/renderer/perspectives/grid/components/SortingMenu.tsx+++ b/src/renderer/perspectives/grid/components/SortingMenu.tsx@@ -24,6 +24,7 @@ import MenuItem from '@mui/material/MenuItem';import ArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';import ArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';import { useTranslation } from 'react-i18next';+import TsMenuList from '-/components/TsMenuList';import { useSortedDirContext } from '-/perspectives/grid/hooks/useSortedDirContext';import { useLocationIndexContext } from '-/hooks/useLocationIndexContext';import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';@@ -43,92 +44,94 @@ function SortingMenu(props: Props) {const { isSearchMode } = useDirectoryContentContext();return (<Menu anchorEl={anchorEl} open={open} onClose={onClose}>- {/* <ListSubHeader>Sort by</ListSubHeader> */}- {isSearchMode && (+ <TsMenuList>+ {/* <ListSubHeader>Sort by</ListSubHeader> */}+ {isSearchMode && (+ <MenuItem+ data-tid="gridPerspectiveSortByRelevance"+ onClick={() => {+ handleSortBy('byRelevance');+ }}+ >+ <ListItemIcon style={{ minWidth: 25 }}>+ {sortBy === 'byRelevance' &&+ (orderBy ? <ArrowDownIcon /> : <ArrowUpIcon />)}+ </ListItemIcon>+ <ListItemText primary={t('core:relevance')} />+ </MenuItem>+ )}<MenuItem- data-tid="gridPerspectiveSortByRelevance"+ data-tid="gridPerspectiveSortByName"onClick={() => {- handleSortBy('byRelevance');+ handleSortBy('byName');}}><ListItemIcon style={{ minWidth: 25 }}>- {sortBy === 'byRelevance' &&+ {sortBy === 'byName' &&(orderBy ? <ArrowDownIcon /> : <ArrowUpIcon />)}</ListItemIcon>- <ListItemText primary={t('core:relevance')} />+ <ListItemText primary={t('core:sortByName')} /></MenuItem>- )}- <MenuItem- data-tid="gridPerspectiveSortByName"- onClick={() => {- handleSortBy('byName');- }}- >- <ListItemIcon style={{ minWidth: 25 }}>- {sortBy === 'byName' &&- (orderBy ? <ArrowDownIcon /> : <ArrowUpIcon />)}- </ListItemIcon>- <ListItemText primary={t('core:sortByName')} />- </MenuItem>- <MenuItem- data-tid="gridPerspectiveSortBySize"- onClick={() => {- handleSortBy('byFileSize');- }}- >- <ListItemIcon style={{ minWidth: 25 }}>- {sortBy === 'byFileSize' &&- (orderBy ? <ArrowDownIcon /> : <ArrowUpIcon />)}- </ListItemIcon>- <ListItemText primary={t('core:fileSize')} />- </MenuItem>- <MenuItem- data-tid="gridPerspectiveSortByDate"- onClick={() => {- handleSortBy('byDateModified');- }}- >- <ListItemIcon style={{ minWidth: 25 }}>- {sortBy === 'byDateModified' &&- (orderBy ? <ArrowDownIcon /> : <ArrowUpIcon />)}- </ListItemIcon>- <ListItemText primary={t('core:fileLDTM')} />- </MenuItem>- <MenuItem- data-tid="gridPerspectiveSortByFirstTag"- onClick={() => {- handleSortBy('byFirstTag');- }}- >- <ListItemIcon style={{ minWidth: 25 }}>- {sortBy === 'byFirstTag' &&- (orderBy ? <ArrowDownIcon /> : <ArrowUpIcon />)}- </ListItemIcon>- <ListItemText primary={t('core:fileFirstTag')} />- </MenuItem>- <MenuItem- data-tid="gridPerspectiveSortByExt"- onClick={() => {- handleSortBy('byExtension');- }}- >- <ListItemIcon style={{ minWidth: 25 }}>- {sortBy === 'byExtension' &&- (orderBy ? <ArrowDownIcon /> : <ArrowUpIcon />)}- </ListItemIcon>- <ListItemText primary={t('core:fileExtension')} />- </MenuItem>- <MenuItem- data-tid="gridPerspectiveSortRandom"- onClick={() => {- handleSortBy('random');- }}- >- <ListItemIcon style={{ minWidth: 25 }}>- {sortBy === 'random' && <ArrowDownIcon />}- </ListItemIcon>- <ListItemText primary={t('core:random')} />- </MenuItem>+ <MenuItem+ data-tid="gridPerspectiveSortBySize"+ onClick={() => {+ handleSortBy('byFileSize');+ }}+ >+ <ListItemIcon style={{ minWidth: 25 }}>+ {sortBy === 'byFileSize' &&+ (orderBy ? <ArrowDownIcon /> : <ArrowUpIcon />)}+ </ListItemIcon>+ <ListItemText primary={t('core:fileSize')} />+ </MenuItem>+ <MenuItem+ data-tid="gridPerspectiveSortByDate"+ onClick={() => {+ handleSortBy('byDateModified');+ }}+ >+ <ListItemIcon style={{ minWidth: 25 }}>+ {sortBy === 'byDateModified' &&+ (orderBy ? <ArrowDownIcon /> : <ArrowUpIcon />)}+ </ListItemIcon>+ <ListItemText primary={t('core:fileLDTM')} />+ </MenuItem>+ <MenuItem+ data-tid="gridPerspectiveSortByFirstTag"+ onClick={() => {+ handleSortBy('byFirstTag');+ }}+ >+ <ListItemIcon style={{ minWidth: 25 }}>+ {sortBy === 'byFirstTag' &&+ (orderBy ? <ArrowDownIcon /> : <ArrowUpIcon />)}+ </ListItemIcon>+ <ListItemText primary={t('core:fileFirstTag')} />+ </MenuItem>+ <MenuItem+ data-tid="gridPerspectiveSortByExt"+ onClick={() => {+ handleSortBy('byExtension');+ }}+ >+ <ListItemIcon style={{ minWidth: 25 }}>+ {sortBy === 'byExtension' &&+ (orderBy ? <ArrowDownIcon /> : <ArrowUpIcon />)}+ </ListItemIcon>+ <ListItemText primary={t('core:fileExtension')} />+ </MenuItem>+ <MenuItem+ data-tid="gridPerspectiveSortRandom"+ onClick={() => {+ handleSortBy('random');+ }}+ >+ <ListItemIcon style={{ minWidth: 25 }}>+ {sortBy === 'random' && <ArrowDownIcon />}+ </ListItemIcon>+ <ListItemText primary={t('core:random')} />+ </MenuItem>+ </TsMenuList></Menu>);}