Skip to content

TagSpaces is an offline, open source, document manager with tagging support

migrate emotion (#1964)

Stanimir208eae7cf7c8
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml
index cee39f59b..6f4e3da7f 100644
--- a/.github/workflows/pull_request.yml
+++ b/.github/workflows/pull_request.yml
@@ -78,7 +78,7 @@ jobs:
- name: Checkout TagspacesPro
uses: actions/checkout@v2
with:
- ref: Refactor-to-use-useDispatch-and-useSelector-v2
+ ref: migrate-from-mui-styles-to-emotion
repository: tagspaces/tagspacespro
token: ${{ secrets.CHECKOUT_TSPRO }}
path: extensions/tagspacespro
diff --git a/app/components/CustomLogo.tsx b/app/components/CustomLogo.tsx
index 469d2686f..25b697a84 100644
--- a/app/components/CustomLogo.tsx
+++ b/app/components/CustomLogo.tsx
@@ -17,10 +17,10 @@
*/
import React, { useMemo } from 'react';
+import { styled } from '@mui/material/styles';
import { useDispatch, useSelector } from 'react-redux';
import IconButton from '@mui/material/IconButton';
-import withStyles from '@mui/styles/withStyles';
-import Badge from '@mui/material/Badge';
+import Badge, { badgeClasses } from '@mui/base/Badge';
import Tooltip from '-/components/Tooltip';
import AppConfig from '-/AppConfig';
import { Pro } from '../pro';
@@ -30,10 +30,10 @@ import LogoIcon from '../assets/images/icon100x100.svg';
import i18n from '../services/i18n';
import versionMeta from '../version.json';
import { getCurrentLanguage } from '-/reducers/settings';
-import { actions } from '../reducers/app';
+import { actions } from '-/reducers/app';
-const AppVersionBadge = withStyles(theme => ({
- badge: {
+const StyledAppVersionBadge = styled(Badge)(({ theme }) => ({
+ [`& .${badgeClasses.badge}`]: {
top: '25%',
right: -25,
color:
@@ -45,9 +45,9 @@ const AppVersionBadge = withStyles(theme => ({
? theme.palette.grey[200]
: theme.palette.grey[900]
}
-}))(Badge);
+}));
-function CustomLogo(props) {
+function CustomLogo() {
const dispatch = useDispatch();
const language = useSelector(getCurrentLanguage);
@@ -63,7 +63,10 @@ function CustomLogo(props) {
}, []);
return (
- <AppVersionBadge badgeContent={'v' + versionMeta.version} color="primary">
+ <StyledAppVersionBadge
+ badgeContent={'v' + versionMeta.version}
+ color="primary"
+ >
<Tooltip title={i18n.t('core:aboutTitle')}>
<IconButton
onClick={() => dispatch(actions.toggleAboutDialog())}
@@ -91,7 +94,7 @@ function CustomLogo(props) {
/>
</IconButton>
</Tooltip>
- </AppVersionBadge>
+ </StyledAppVersionBadge>
);
}
diff --git a/app/components/DnD.css.tsx b/app/components/DnD.css.tsx
new file mode 100644
index 000000000..0044481d7
--- /dev/null
+++ b/app/components/DnD.css.tsx
@@ -0,0 +1,45 @@
+/**
+ * TagSpaces - universal file and folder organizer
+ * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)
+ *
+ * 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 { styled } from '@mui/material/styles';
+
+const PREFIX = 'DnD';
+export const classes = {
+ dropzone: `${PREFIX}-dropzone`
+};
+
+export const DnD = styled('div')(({ theme }) => ({
+ [`& .${classes.dropzone}`]: {
+ margin: 5,
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ right: 0,
+ bottom: 0,
+ backgroundColor: '#1dd19f40',
+ zIndex: 1000,
+ border: '3px dashed white',
+ display: 'flex',
+ justifyContent: 'center',
+ alignItems: 'center',
+ textAlign: 'center',
+ fontSize: '40px',
+ fontWeight: 'bold',
+ color: 'white'
+ }
+}));
diff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsx
index 9b60dd1cc..263d9b89c 100644
--- a/app/components/EntryContainer.tsx
+++ b/app/components/EntryContainer.tsx
@@ -45,7 +45,6 @@ import NextDocumentIcon from '@mui/icons-material/KeyboardArrowDown';
import FileDownloadIcon from '@mui/icons-material/AssignmentReturned';
import DetailsIcon from '@mui/icons-material/Info';
import ExpandIcon from '@mui/icons-material/SettingsEthernet';
-import withStyles from '@mui/styles/withStyles';
import Box from '@mui/material/Box';
import ButtonGroup from '@mui/material/ButtonGroup';
import {
@@ -107,7 +106,8 @@ import { Switch } from '@mui/material';
import useFirstRender from '-/utils/useFirstRender';
import ResolveConflictDialog from '-/components/dialogs/ResolveConflictDialog';
import { dataTidFormat } from '-/services/test';
-import { getMetaForEntry, loadJSONFile } from '-/services/utils-io';
+import { loadJSONFile } from '-/services/utils-io';
+import { styled, useTheme } from '@mui/material/styles';
const defaultSplitSize = '7.86%'; // '7.2%'; // 103;
// const openedSplitSize = AppConfig.isElectron ? 560 : 360;
@@ -119,8 +119,15 @@ const bufferedSplitResize = buffer({
id: 'buffered-split-resize'
});
-const styles: any = (theme: any) => ({
- toolbar2: {
+const PREFIX = 'EntryContainer';
+const classes = {
+ toolbar2: `${PREFIX}-toolbar2`,
+ flexLeft: `${PREFIX}-flexLeft`,
+ fileBadge: `${PREFIX}-fileBadge`
+};
+
+const Root = styled('div')(({ theme }) => ({
+ [`& .${classes.toolbar2}`]: {
width: '100%',
paddingLeft: 0,
paddingRight: 5,
@@ -131,7 +138,7 @@ const styles: any = (theme: any) => ({
zIndex: 2
// borderBottom: '1px solid ' + theme.palette.divider
},
- flexLeft: {
+ [`& .${classes.flexLeft}`]: {
flexDirection: 'row',
flex: '1 1',
display: 'flex',
@@ -140,7 +147,7 @@ const styles: any = (theme: any) => ({
overflowY: 'hidden',
paddingRight: 100
},
- fileBadge: {
+ [`& .${classes.fileBadge}`]: {
color: 'white',
backgroundColor: AppConfig.defaultFileColor,
padding: 3,
@@ -149,11 +156,9 @@ const styles: any = (theme: any) => ({
marginLeft: 3,
borderRadius: 3
}
-});
+}));
interface Props {
- classes: any;
- theme: any;
openedFiles: Array<OpenedEntry>;
settings: any;
keyBindings: any;
@@ -203,9 +208,7 @@ const historyKeys = Pro && Pro.history ? Pro.history.historyKeys : {};
function EntryContainer(props: Props) {
const {
- classes,
keyBindings,
- theme,
settings,
openedFiles,
currentDirectoryPath,
@@ -229,6 +232,7 @@ function EntryContainer(props: Props) {
tileServer
} = props;
+ const theme = useTheme();
// const [percent, setPercent] = React.useState<number | undefined>(undefined);
const percent = useRef<number | undefined>(undefined);
const timer = useRef(null);
@@ -1705,7 +1709,7 @@ function EntryContainer(props: Props) {
/>
{/* eslint-disable-next-line jsx-a11y/anchor-has-content,jsx-a11y/anchor-is-valid */}
<a href="#" id="downloadFile" />
- {renderPanels()}
+ <Root>{renderPanels()}</Root>
</GlobalHotKeys>
);
}
@@ -1766,5 +1770,5 @@ export default connect(
mapActionCreatorsToProps
)(
// @ts-ignore
- React.memo(withStyles(styles, { withTheme: true })(EntryContainer), areEqual)
+ React.memo(EntryContainer, areEqual)
);
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsx
index 13ef70202..f7e730bac 100644
--- a/app/components/EntryProperties.tsx
+++ b/app/components/EntryProperties.tsx
@@ -23,17 +23,18 @@ import React, {
useRef,
useState
} from 'react';
+import { styled, useTheme } from '@mui/material/styles';
import { getBgndFileLocationForDirectory } from '@tagspaces/tagspaces-common/paths';
import L from 'leaflet';
-import { Theme } from '@mui/material/styles';
-import withStyles from '@mui/styles/withStyles';
-import createStyles from '@mui/styles/createStyles';
-import Grid from '@mui/material/Grid';
-import FormControl from '@mui/material/FormControl';
-import Typography from '@mui/material/Typography';
-import TextField from '@mui/material/TextField';
-import Button from '@mui/material/Button';
-import InputAdornment from '@mui/material/InputAdornment';
+import {
+ Grid,
+ FormControl,
+ Typography,
+ TextField,
+ inputBaseClasses,
+ Button,
+ InputAdornment
+} from '@mui/material';
import QRCodeIcon from '@mui/icons-material/QrCode';
import Tooltip from '-/components/Tooltip';
import { LocalLocationIcon, CloudLocationIcon } from '-/components/CommonIcons';
@@ -58,7 +59,6 @@ import {
extractFileName,
extractDirectoryName
} from '@tagspaces/tagspaces-common/paths';
-import AppConfig from '-/AppConfig';
import TagDropContainer from './TagDropContainer';
import MoveCopyFilesDialog from './dialogs/MoveCopyFilesDialog';
import i18n from '../services/i18n';
@@ -103,65 +103,95 @@ import useFirstRender from '-/utils/useFirstRender';
import LinkGeneratorDialog from '-/components/dialogs/LinkGeneratorDialog';
import { LinkIcon } from '-/components/CommonIcons';
-const ThumbnailChooserDialog =
- Pro && Pro.UI ? Pro.UI.ThumbnailChooserDialog : false;
-const CustomBackgroundDialog =
- Pro && Pro.UI ? Pro.UI.CustomBackgroundDialog : false;
-const BgndImgChooserDialog =
- Pro && Pro.UI ? Pro.UI.BgndImgChooserDialog : false;
+const PREFIX = 'EntryProperties';
-const styles: any = (theme: any) => ({
- entryProperties: {
- overflowY: 'auto',
- overflowX: 'hidden',
- flexGrow: 1,
- padding: 7,
- paddingRight: 2,
- height: '100%'
- },
- tags: {
+const classes = {
+ entryProperties: `${PREFIX}-entryProperties`,
+ tags: `${PREFIX}-tags`,
+ editTagsButton: `${PREFIX}-editTagsButton`,
+ textField: `${PREFIX}-textField`,
+ dropText: `${PREFIX}-dropText`,
+ propertyName: `${PREFIX}-propertyName`,
+ actionPlaceholder: `${PREFIX}-actionPlaceholder`,
+ button: `${PREFIX}-button`,
+ mdHelpers: `${PREFIX}-mdHelpers`,
+ formControl: `${PREFIX}-formControl`
+};
+
+const Root = styled('div')(({ theme }) => ({
+ overflowY: 'auto',
+ overflowX: 'hidden',
+ flexGrow: 1,
+ padding: 7,
+ paddingRight: 2,
+ height: '100%',
+
+ [`& .${classes.tags}`]: {
padding: '5px 5px 2px 2px',
margin: 6,
clear: 'both',
boxShadow: '0 1px 1px 0 rgba(0,0,0,0.16),0 1px 1px 0 rgba(239,239,239,0.12)'
},
- editTagsButton: {
+
+ [`& .${classes.editTagsButton}`]: {
float: 'right',
margin: '0 0 10px 0'
},
- textField: {
+
+ [`& .${classes.textField}`]: {
marginLeft: theme.spacing(1),
marginRight: theme.spacing(1),
width: '100vh'
},
- dropText: {
+
+ [`& .${classes.dropText}`]: {
display: 'flex',
width: '100%',
padding: '20px',
color: '#728496'
},
- propertyName: {
+
+ [`& .${classes.propertyName}`]: {
marginTop: 10
},
- actionPlaceholder: {
+
+ [`& .${classes.actionPlaceholder}`]: {
textAlign: 'end'
},
- button: {
+
+ [`& .${classes.button}`]: {
position: 'relative',
padding: '8px 12px 6px 8px',
margin: '0'
},
- mdHelpers: {
+
+ [`& .${classes.mdHelpers}`]: {
borderRadius: '0.25rem',
paddingLeft: '0.25rem',
paddingRight: '0.25rem',
backgroundColor: '#bcc0c561'
+ },
+ [`& .${classes.formControl}`]: {
+ marginLeft: theme.spacing(0),
+ width: '100%'
+ }
+}));
+
+const ThumbnailTextField = styled(TextField)(({ theme }) => ({
+ //[`& .MuiInputBase-root}`]: {
+ [`& .${inputBaseClasses.root}`]: {
+ height: 220
}
-});
+}));
+
+const ThumbnailChooserDialog =
+ Pro && Pro.UI ? Pro.UI.ThumbnailChooserDialog : false;
+const CustomBackgroundDialog =
+ Pro && Pro.UI ? Pro.UI.CustomBackgroundDialog : false;
+const BgndImgChooserDialog =
+ Pro && Pro.UI ? Pro.UI.BgndImgChooserDialog : false;
interface Props {
- classes: any;
- theme: any;
language: string;
openedEntry: OpenedEntry;
renameFile: (path: string, nextPath: string) => Promise<boolean>;
@@ -196,7 +226,7 @@ const defaultBackgrounds = [
];
function EntryProperties(props: Props) {
- // const EntryProperties = React.memo((props: Props) => {
+ const theme = useTheme();
const fileNameRef = useRef<HTMLInputElement>(null);
const sharingLinkRef = useRef<HTMLInputElement>(null);
const fileDescriptionRef = useRef<MilkdownRef>(null);
@@ -607,7 +637,7 @@ function EntryProperties(props: Props) {
});
};
- const { classes, isReadOnlyMode, theme, sharingLink, language } = props;
+ const { isReadOnlyMode, sharingLink, language } = props;
if (
!currentEntry ||
@@ -746,7 +776,7 @@ function EntryProperties(props: Props) {
const showLinkForDownloading = isCloudLocation && currentEntry.current.isFile;
return (
- <div className={classes.entryProperties}>
+ <Root>
<Grid container>
<Grid item xs={12}>
<TextField
@@ -1464,20 +1494,10 @@ function EntryProperties(props: Props) {
]}*/
/>
)}
- </div>
+ </Root>
);
}
-const ThumbnailTextField = withStyles((theme: Theme) =>
- createStyles({
- root: {
- '& .MuiInputBase-root': {
- height: 220
- }
- }
- })
-)(TextField);
-
function mapStateToProps(state) {
return {
lastBackgroundImageChange: getLastBackgroundImageChange(state),
@@ -1512,9 +1532,6 @@ export default withLeaflet(
mapActionCreatorsToProps
)(
// @ts-ignore
- React.memo(
- withStyles(styles, { withTheme: true })(EntryProperties),
- areEqual
- )
+ React.memo(EntryProperties, areEqual)
)
);
diff --git a/app/components/FileView.tsx b/app/components/FileView.tsx
index 6918708ad..cda96a6fd 100644
--- a/app/components/FileView.tsx
+++ b/app/components/FileView.tsx
@@ -17,8 +17,7 @@
*/
import React, { MutableRefObject } from 'react';
-import withStyles from '@mui/styles/withStyles';
-import { rgbToHex } from '@mui/material/styles';
+import { rgbToHex, useTheme } from '@mui/material/styles';
import CloseIcon from '@mui/icons-material/Close';
import i18n from '-/services/i18n';
import { OpenedEntry } from '-/reducers/app';
@@ -36,15 +35,14 @@ interface Props {
searchQuery: TS.SearchQuery;
toggleFullScreen?: () => void;
height?: string;
- theme: any;
currentTheme: string;
eventID: string;
}
function FileView(props: Props) {
+ const theme = useTheme();
const {
openedFile,
- theme,
fileViewer,
isFullscreen,
fileViewerContainer,
@@ -196,6 +194,4 @@ function mapStateToProps(state) {
};
}
-export default connect(mapStateToProps)(
- React.memo(withStyles(undefined, { withTheme: true })(FileView), areEqual)
-);
+export default connect(mapStateToProps)(React.memo(FileView, areEqual));
diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsx
index 6376b7622..1f2bc4133 100644
--- a/app/components/FolderContainer.tsx
+++ b/app/components/FolderContainer.tsx
@@ -17,6 +17,7 @@
*/
import React, { useEffect, useState } from 'react';
+import { styled, useTheme } from '@mui/material/styles';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import IconButton from '@mui/material/IconButton';
@@ -26,7 +27,6 @@ import Tooltip from '-/components/Tooltip';
import Typography from '@mui/material/Typography';
import InputAdornment from '@mui/material/InputAdornment';
import Badge from '@mui/material/Badge';
-import withStyles from '@mui/styles/withStyles';
import ToggleButton from '@mui/material/ToggleButton';
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
import AppConfig from '-/AppConfig';
@@ -74,6 +74,35 @@ import MainSearchField from '-/components/MainSearchField';
import SearchBox from '-/components/SearchBox';
import useFirstRender from '-/utils/useFirstRender';
+const PREFIX = 'FolderContainer';
+
+const classes = {
+ button: `${PREFIX}-button`
+};
+
+const Root = styled('div')(({ theme }) => ({
+ [`& .${classes.button}`]: {
+ position: 'relative',
+ padding: '8px 12px 6px 8px',
+ margin: '0'
+ }
+}));
+
+/*const CounterBadge: any = withStyles(theme => ({
+ badge: {
+ top: '50%',
+ right: -15,
+ color:
+ theme.palette.mode === 'light'
+ ? theme.palette.grey[900]
+ : theme.palette.grey[200],
+ backgroundColor:
+ theme.palette.mode === 'light'
+ ? theme.palette.grey[200]
+ : theme.palette.grey[900]
+ }
+}))(Badge);*/
+
const GridPerspective = React.lazy(() =>
import(
/* webpackChunkName: "GridPerspective" */ '../perspectives/grid-perspective'
@@ -148,24 +177,8 @@ function WelcomePanelAsync(props) {
);
}
-const CounterBadge: any = withStyles(theme => ({
- badge: {
- top: '50%',
- right: -15,
- color:
- theme.palette.mode === 'light'
- ? theme.palette.grey[900]
- : theme.palette.grey[200],
- backgroundColor:
- theme.palette.mode === 'light'
- ? theme.palette.grey[200]
- : theme.palette.grey[900]
- }
-}))(Badge);
interface Props {
- classes: any;
settings: any;
- theme: any;
windowHeight: number;
windowWidth: number;
directoryContent: Array<TS.FileSystemEntry>;
@@ -220,6 +233,7 @@ interface Props {
}
function FolderContainer(props: Props) {
+ const theme = useTheme();
const havePrevOpenedFile = React.useRef<boolean>(false);
const firstRender = useFirstRender();
@@ -282,11 +296,9 @@ function FolderContainer(props: Props) {
language,
loadDirectoryContent,
directoryContent,
- classes,
toggleDrawer,
toggleProTeaser,
isDesktopMode,
- theme,
currentDirectoryPerspective,
currentLocationPath,
currentLocation,
@@ -495,7 +507,7 @@ function FolderContainer(props: Props) {
: '';
// keyBindings['openSearch'].toUpperCase()
return (
- <div data-tid="folderContainerTID" style={{ position: 'relative' }}>
+ <Root data-tid="folderContainerTID" style={{ position: 'relative' }}>
<div
style={{
flex: '1 1 100%',
@@ -599,7 +611,7 @@ function FolderContainer(props: Props) {
title={i18n.t('core:progress')}
data-tid="uploadProgress"
onClick={() => props.toggleUploadDialog()}
- className={[classes.button, classes.upgradeButton].join(' ')}
+ className={classes.button}
>
<CircularProgressWithLabel value={getProgressValue()} />
</IconButton>
@@ -615,7 +627,6 @@ function FolderContainer(props: Props) {
openDirectory={openDirectory}
reflectCreateEntry={reflectCreateEntry}
openFsEntry={openFsEntry}
- isReadOnlyMode={props.isReadOnlyMode}
isDesktopMode={isDesktopMode}
openRenameDirectoryDialog={() =>
setIsRenameEntryDialogOpened(true)
@@ -664,7 +675,7 @@ function FolderContainer(props: Props) {
{perspectiveToggleButtons}
</ToggleButtonGroup>
)}
- </div>
+ </Root>
);
}
@@ -733,7 +744,7 @@ const areEqual = (prevProp: Props, nextProp: Props) =>
JSON.stringify(prevProp.directoryContent) &&
JSON.stringify(nextProp.openedFiles) ===
JSON.stringify(prevProp.openedFiles) &&
- JSON.stringify(nextProp.theme) === JSON.stringify(prevProp.theme) &&
+ //JSON.stringify(nextProp.theme) === JSON.stringify(prevProp.theme) &&
// JSON.stringify(nextProp.editedEntryPaths) === JSON.stringify(prevProp.editedEntryPaths) &&
nextProp.windowWidth === prevProp.windowWidth &&
nextProp.windowHeight === prevProp.windowHeight &&
@@ -748,8 +759,5 @@ export default connect(
mapActionCreatorsToProps
)(
// @ts-ignore
- React.memo(
- withStyles(undefined, { withTheme: true })(FolderContainer),
- areEqual
- )
+ React.memo(FolderContainer, areEqual)
);
diff --git a/app/components/HelpFeedbackPanel.tsx b/app/components/HelpFeedbackPanel.tsx
index 484f8b7e4..1de8a22de 100644
--- a/app/components/HelpFeedbackPanel.tsx
+++ b/app/components/HelpFeedbackPanel.tsx
@@ -18,7 +18,6 @@
import React from 'react';
import { useSelector } from 'react-redux';
-import withStyles from '@mui/styles/withStyles';
import classNames from 'classnames';
import Typography from '@mui/material/Typography';
import List from '@mui/material/List';
@@ -37,18 +36,16 @@ import NewFeatureIcon from '@mui/icons-material/Gesture';
import TwitterIcon from '@mui/icons-material/Twitter';
import ForumIcon from '@mui/icons-material/Forum';
import ProTeaserIcon from '@mui/icons-material/FlightTakeoff';
-import AppConfig from '-/AppConfig';
-import styles from '-/components/SidePanels.css';
import i18n from '-/services/i18n';
import { KeyShortcutsIcon, HelpIcon } from '-/components/CommonIcons';
import Links from '-/content/links';
import { Pro } from '-/pro';
import { openURLExternally } from '-/services/utils-io';
import { getCurrentLanguage } from '-/reducers/settings';
+import { classes, SidePanel } from '-/components/SidePanels.css';
+import { useTheme } from '@mui/material/styles';
interface Props {
- classes?: any;
- theme?: any;
toggleAboutDialog?: () => void;
toggleKeysDialog: () => void;
toggleOnboardingDialog: () => void;
@@ -58,20 +55,18 @@ interface Props {
}
function HelpFeedbackPanel(props: Props) {
+ const theme = useTheme();
const language = useSelector(getCurrentLanguage);
const {
- classes,
toggleAboutDialog,
toggleKeysDialog,
toggleOnboardingDialog,
toggleProTeaser,
- theme,
reduceHeightBy
} = props;
return (
- <div
- className={classes.panel}
+ <SidePanel
style={{
display: 'flex',
flexDirection: 'column'
@@ -240,8 +235,8 @@ function HelpFeedbackPanel(props: Props) {
</Typography>
</ListItem>
</List>
- </div>
+ </SidePanel>
);
}
-export default withStyles(styles, { withTheme: true })(HelpFeedbackPanel);
+export default HelpFeedbackPanel;
diff --git a/app/components/HowToStart.tsx b/app/components/HowToStart.tsx
index 58e79f6b2..4fe1d7150 100644
--- a/app/components/HowToStart.tsx
+++ b/app/components/HowToStart.tsx
@@ -1,5 +1,4 @@
import * as React from 'react';
-import withStyles from '@mui/styles/withStyles';
import Button from '@mui/material/Button';
import Box from '@mui/material/Box';
import Stepper from '@mui/material/Stepper';
@@ -12,14 +11,15 @@ import i18n from '-/services/i18n';
import Links from '-/content/links';
import { ProSign } from '-/components/HelperComponents';
import { openURLExternally } from '-/services/utils-io';
+import { useTheme } from '@mui/material/styles';
-export const styles: any = (theme: any) => ({
+/*export const styles: any = (theme: any) => ({
recentTitle: {
color: theme.palette.text.primary,
textTransform: 'uppercase',
textAlign: 'center'
}
-});
+});*/
const selectByTID: any = tid =>
document.querySelector('[data-tid="' + tid + '"]');
@@ -39,13 +39,8 @@ function clearHighlights() {
selectByTID('floatingPerspectiveSwitcher').classList.remove('highlighterOn');
}
-interface Props {
- theme: any;
- classes: any;
-}
-
-function HowToStart(props: Props) {
- const { classes, theme } = props;
+function HowToStart() {
+ const theme = useTheme();
const steps = [
{
label: 'Introduction',
@@ -322,10 +317,12 @@ function HowToStart(props: Props) {
</style>
<Typography
variant="inherit"
- style={{
+ sx={{
+ color: theme.palette.text.primary,
+ textTransform: 'uppercase',
+ textAlign: 'center',
paddingTop: 20
}}
- className={classes.recentTitle}
noWrap
>
{i18n.t('Get Started with TagSpaces')}
@@ -379,4 +376,4 @@ function HowToStart(props: Props) {
);
}
-export default withStyles(styles, { withTheme: true })(HowToStart);
+export default HowToStart;
diff --git a/app/components/LoadingAnimation.tsx b/app/components/LoadingAnimation.tsx
index 89dd52d33..7a32b3ce3 100644
--- a/app/components/LoadingAnimation.tsx
+++ b/app/components/LoadingAnimation.tsx
@@ -18,16 +18,12 @@
import React from 'react';
import { useSelector } from 'react-redux';
-import withStyles from '@mui/styles/withStyles';
import PlatformIO from '-/services/platform-facade';
import { isLoading } from '-/reducers/app';
+import { useTheme } from '@mui/material/styles';
-interface Props {
- theme: any;
-}
-
-function LoadingAnimation(props: Props) {
- const { theme } = props;
+function LoadingAnimation() {
+ const theme = useTheme();
const loading = useSelector(isLoading);
if (
@@ -61,6 +57,4 @@ function LoadingAnimation(props: Props) {
);
}
-export default withStyles(undefined, { withTheme: true })(
- React.memo(LoadingAnimation)
-);
+export default React.memo(LoadingAnimation);
diff --git a/app/components/LocationManager.tsx b/app/components/LocationManager.tsx
index 57b6cc484..e6a57df4e 100644
--- a/app/components/LocationManager.tsx
+++ b/app/components/LocationManager.tsx
@@ -18,10 +18,8 @@
import React, { useEffect, useRef, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
-import withStyles from '@mui/styles/withStyles';
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
import { List } from '@mui/material';
-import styles from '-/components/SidePanels.css';
import LocationManagerMenu from '-/components/menus/LocationManagerMenu';
import ConfirmDialog from '-/components/dialogs/ConfirmDialog';
import { actions as LocationActions, getLocations } from '-/reducers/locations';
@@ -33,6 +31,7 @@ import LocationView from '-/components/LocationView';
import { Pro } from '-/pro';
import { TS } from '-/tagspaces.namespace';
import PlatformIO from '-/services/platform-facade';
+import { classes, SidePanel } from '-/components/SidePanels.css';
const CreateEditLocationDialog = React.lazy(() =>
import(
@@ -48,7 +47,6 @@ function CreateEditLocationDialogAsync(props) {
}
interface Props {
- classes?: any;
style?: any;
reduceHeightBy: number;
show: boolean;
@@ -112,10 +110,9 @@ function LocationManager(props: Props) {
);
};
- const { classes, reduceHeightBy, show } = props;
+ const { reduceHeightBy, show } = props;
return (
- <div
- className={classes.panel}
+ <SidePanel
style={{
display: show ? 'flex' : 'none',
flexDirection: 'column'
@@ -197,7 +194,6 @@ function LocationManager(props: Props) {
>
<LocationView
key={location.uuid}
- classes={classes}
location={location}
setEditLocationDialogOpened={
setEditLocationDialogOpened
@@ -268,8 +264,8 @@ function LocationManager(props: Props) {
locations={locations}
/>
)}
- </div>
+ </SidePanel>
);
}
-export default withStyles(styles)(LocationManager);
+export default LocationManager;
diff --git a/app/components/LocationView.tsx b/app/components/LocationView.tsx
index ee94d87a6..d9b524ee7 100644
--- a/app/components/LocationView.tsx
+++ b/app/components/LocationView.tsx
@@ -18,7 +18,6 @@
import React, { useRef, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
-import withStyles from '@mui/styles/withStyles';
import Tooltip from '-/components/Tooltip';
import ListItem from '@mui/material/ListItem';
import ListItemIcon from '@mui/material/ListItemIcon';
@@ -30,7 +29,6 @@ import { LocalLocationIcon, CloudLocationIcon } from '-/components/CommonIcons';
import DefaultLocationIcon from '@mui/icons-material/Highlight';
import { locationType } from '@tagspaces/tagspaces-common/misc';
import AppConfig from '-/AppConfig';
-import styles from './SidePanels.css';
import {
actions as AppActions,
AppDispatch,
@@ -51,9 +49,9 @@ import {
} from '-/reducers/settings';
import LocationContextMenu from '-/components/menus/LocationContextMenu';
import { TS } from '-/tagspaces.namespace';
+import { classes, SidePanel } from '-/components/SidePanels.css';
interface Props {
- classes: any;
location: TS.Location;
hideDrawer?: () => void;
setEditLocationDialogOpened: (open: boolean) => void;
@@ -75,7 +73,6 @@ function LocationView(props: Props) {
const readOnlyMode = useSelector(isReadOnlyMode);
const {
- classes,
location,
hideDrawer,
setSelectedLocation,
@@ -255,7 +252,7 @@ function LocationView(props: Props) {
return (
/* <div key={location.uuid}> */
- <>
+ <SidePanel>
{locationDirectoryContextMenuAnchorEl && (
<LocationContextMenu
setEditLocationDialogOpened={setEditLocationDialogOpened}
@@ -348,8 +345,8 @@ function LocationView(props: Props) {
location={location}
handleFileMoveDrop={handleFileMoveDrop}
/>
- </>
+ </SidePanel>
);
}
-export default withStyles(styles)(React.memo(LocationView));
+export default React.memo(LocationView);
diff --git a/app/components/MainSearchField.tsx b/app/components/MainSearchField.tsx
index 4538d7ad1..cb1899358 100644
--- a/app/components/MainSearchField.tsx
+++ b/app/components/MainSearchField.tsx
@@ -17,50 +17,44 @@
*/
import React from 'react';
-import { Theme } from '@mui/material/styles';
-import withStyles from '@mui/styles/withStyles';
-import createStyles from '@mui/styles/createStyles';
+import { styled } from '@mui/material/styles';
import TextField from '@mui/material/TextField';
-const MainSearchField = withStyles((theme: Theme) =>
- createStyles({
- root: {
- overflow: 'hidden',
- '& input': {
- padding: 6
- },
- '& .MuiInputBase-root': {
- borderRadius: 7,
- paddingRight: 5,
- paddingLeft: 5
- },
- '& .Mui-focused': {
- color:
- theme.palette.mode === 'light'
- ? theme.palette.grey[900]
- : theme.palette.grey[200],
- backgroundColor:
- theme.palette.mode === 'light'
- ? theme.palette.grey[200]
- : theme.palette.grey[900]
- // backgroundColor: 'gray',
- // outline: '2px solid red',
- // border: 'none',
- // boxShadow: 'none'
- },
- // '&$focused': {
- // outline: 'none',
- // boxShadow: '0 0 0 4px rgba(21, 156, 228, 0.4)'
- // },
- '&:hover': {
- backgroundColor: theme.palette.background.paper
- // boxShadow: `${alpha(theme.palette.primary.main, 0.25)} 0 0 0 0.2rem`
- }
- // '&:active': {
- // backgroundColor: theme.palette.background.paper
- // }
- }
- })
-)(TextField);
+const MainSearchField = styled(TextField)(({ theme }) => ({
+ overflow: 'hidden',
+ '& input': {
+ padding: 6
+ },
+ '& .MuiInputBase-root': {
+ borderRadius: 7,
+ paddingRight: 5,
+ paddingLeft: 5
+ },
+ '& .Mui-focused': {
+ color:
+ theme.palette.mode === 'light'
+ ? theme.palette.grey[900]
+ : theme.palette.grey[200],
+ backgroundColor:
+ theme.palette.mode === 'light'
+ ? theme.palette.grey[200]
+ : theme.palette.grey[900]
+ // backgroundColor: 'gray',
+ // outline: '2px solid red',
+ // border: 'none',
+ // boxShadow: 'none'
+ },
+ // '&$focused': {
+ // outline: 'none',
+ // boxShadow: '0 0 0 4px rgba(21, 156, 228, 0.4)'
+ // },
+ '&:hover': {
+ backgroundColor: theme.palette.background.paper
+ // boxShadow: `${alpha(theme.palette.primary.main, 0.25)} 0 0 0 0.2rem`
+ }
+ // '&:active': {
+ // backgroundColor: theme.palette.background.paper
+ // }
+}));
export default MainSearchField;
diff --git a/app/components/MobileNavigation.tsx b/app/components/MobileNavigation.tsx
index d0999f755..da4632a67 100644
--- a/app/components/MobileNavigation.tsx
+++ b/app/components/MobileNavigation.tsx
@@ -17,6 +17,7 @@
*/
import React, { useState } from 'react';
+import { styled } from '@mui/material/styles';
import { useDispatch, useSelector } from 'react-redux';
import classNames from 'classnames';
import Box from '@mui/material/Box';
@@ -33,7 +34,6 @@ import HelpIcon from '@mui/icons-material/HelpOutline';
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
import AccountCircleIcon from '@mui/icons-material/AccountCircle';
import SettingsIcon from '@mui/icons-material/Settings';
-import withStyles from '@mui/styles/withStyles';
import { CognitoUserInterface } from '@aws-amplify/ui-components';
import Popover from '@mui/material/Popover';
import { Pro } from '-/pro';
@@ -59,14 +59,25 @@ import { CreateFileIcon, LocalLocationIcon } from '-/components/CommonIcons';
import PlatformIO from '-/services/platform-facade';
import AppConfig from '-/AppConfig';
-const styles: any = (theme: any) => ({
- selectedButton: {
+const PREFIX = 'MobileNavigation';
+
+const classes = {
+ button: `${PREFIX}-button`,
+ selectedButton: `${PREFIX}-selectedButton`
+};
+
+const Root = styled(Box)(({ theme }) => ({
+ [`& .${classes.button}`]: {
+ position: 'relative',
+ padding: '8px 12px 6px 8px',
+ margin: '0'
+ },
+ [`& .${classes.selectedButton}`]: {
backgroundColor: theme.palette.primary.light
}
-});
+}));
interface Props {
- classes: any;
hideDrawer?: () => void;
width?: number;
}
@@ -89,7 +100,7 @@ function MobileNavigation(props: Props) {
const showProTeaser = !Pro && showTeaserBanner;
- const { classes, hideDrawer, width } = props;
+ const { hideDrawer, width } = props;
const toggleNewEntryDialog = () =>
dispatch(AppActions.toggleNewEntryDialog());
@@ -110,7 +121,7 @@ function MobileNavigation(props: Props) {
const switchTheme = () => dispatch(SettingsActions.switchTheme());
return (
- <Box
+ <Root
style={{
// backgroundColor: theme.palette.background.default,
height: '100%',
@@ -292,7 +303,7 @@ function MobileNavigation(props: Props) {
style={{ marginTop: -15, marginRight: 2 }}
size="large"
>
- <AccountCircleIcon className={classes.buttonIcon} />
+ <AccountCircleIcon />
</IconButton>
</Tooltip>
<Popover
@@ -319,12 +330,12 @@ function MobileNavigation(props: Props) {
style={{ marginTop: -15, marginRight: 2 }}
size="large"
>
- <ThemingIcon className={classes.buttonIcon} />
+ <ThemingIcon />
</IconButton>
</Tooltip>
)}
</Box>
- </Box>
+ </Root>
);
}
-export default withStyles(styles)(MobileNavigation);
+export default MobileNavigation;
diff --git a/app/components/PathBreadcrumbs.tsx b/app/components/PathBreadcrumbs.tsx
index ae61fadf5..f432f2c2f 100644
--- a/app/components/PathBreadcrumbs.tsx
+++ b/app/components/PathBreadcrumbs.tsx
@@ -17,8 +17,8 @@
*/
import React, { useState } from 'react';
+import { styled } from '@mui/material/styles';
import { emphasize, Theme } from '@mui/material/styles';
-import withStyles from '@mui/styles/withStyles';
import Breadcrumbs from '@mui/material/Breadcrumbs';
import Tooltip from '-/components/Tooltip';
import Chip from '@mui/material/Chip';
@@ -34,24 +34,29 @@ import { TS } from '-/tagspaces.namespace';
import { LocalLocationIcon, CloudLocationIcon } from '-/components/CommonIcons';
import { locationType } from '@tagspaces/tagspaces-common/misc';
-// @ts-ignore
-const StyledBreadcrumb = withStyles((theme: Theme) => ({
- root: {
- backgroundColor: emphasize(theme.palette.background.default, 0.06),
- // height: theme.spacing(3),
+const StyledBreadcrumb = styled(Chip)(({ theme }) => {
+ const backgroundColor =
+ theme.palette.mode === 'light'
+ ? theme.palette.grey[100]
+ : theme.palette.grey[800];
+ return {
+ backgroundColor,
+ height: theme.spacing(3),
color: theme.palette.text.primary,
fontWeight: theme.typography.fontWeightRegular,
'&:hover, &:focus': {
- backgroundColor: emphasize(theme.palette.background.default, 0.22)
+ backgroundColor: emphasize(backgroundColor, 0.06)
+ },
+ '&:active': {
+ boxShadow: theme.shadows[1],
+ backgroundColor: emphasize(backgroundColor, 0.12)
}
- }
-}))(Chip) as typeof Chip;
+ };
+}) as typeof Chip; // TypeScript only: need a type cast here because https://github.com/Microsoft/TypeScript/issues/26591
-const NoWrapBreadcrumb = withStyles({
- ol: {
- flexWrap: 'nowrap'
- }
-})(Breadcrumbs);
+const NoWrapBreadcrumb = styled(StyledBreadcrumb)(({ theme }) => {
+ return { flexWrap: 'nowrap' };
+});
interface Props {
currentDirectoryPath: string;
@@ -68,7 +73,6 @@ interface Props {
openDirectory: () => void;
reflectCreateEntry: (path: string, isFile: boolean) => void;
openFsEntry: (fsEntry: TS.FileSystemEntry) => void;
- isReadOnlyMode: boolean;
openRenameDirectoryDialog: () => void;
openMoveCopyFilesDialog: () => void;
isDesktopMode: boolean;
@@ -91,7 +95,6 @@ function PathBreadcrumbs(props: Props) {
openDirectory,
reflectCreateEntry,
openFsEntry,
- isReadOnlyMode,
openRenameDirectoryDialog,
openMoveCopyFilesDialog,
isDesktopMode
@@ -165,9 +168,59 @@ function PathBreadcrumbs(props: Props) {
currentFolderName = currentLocation.name;
}
+ function getBreadcrumbs() {
+ let breadcrumbs = [];
+ if (pathParts.length > 0) {
+ breadcrumbs = pathParts.map((pathPart, index) => {
+ const folderName = extractShortDirectoryName(
+ pathPart,
+ PlatformIO.getDirSeparator()
+ );
+ return (
+ <Tooltip
+ key={pathPart}
+ title={i18n.t('core:navigateTo') + ' ' + pathPart}
+ >
+ <StyledBreadcrumb
+ component="a"
+ href="#"
+ label={folderName}
+ icon={index === 0 && locationTypeIcon}
+ onClick={() => loadDirectoryContent(pathPart, false, true)}
+ />
+ </Tooltip>
+ );
+ });
+ }
+ if (currentDirectoryPath) {
+ const curDirBreadcrumb = (
+ <Tooltip
+ title={
+ i18n.t('core:openDirectoryMenu') +
+ ' - ' +
+ (currentDirectoryPath || '')
+ }
+ >
+ <StyledBreadcrumb
+ data-tid="folderContainerOpenDirMenu"
+ label={currentFolderName}
+ icon={currentFolderChipIcon}
+ deleteIcon={<ExpandMoreIcon />}
+ onDelete={openDirectoryMenu}
+ onClick={openDirectoryMenu}
+ onContextMenu={openDirectoryMenu}
+ />
+ </Tooltip>
+ );
+ breadcrumbs = [...breadcrumbs, curDirBreadcrumb];
+ }
+ return breadcrumbs;
+ }
+
return (
<>
- <NoWrapBreadcrumb
+ <Breadcrumbs
+ sx={{ display: 'flex', flexWrap: 'nowrap' }}
maxItems={isDesktopMode ? 3 : 1}
itemsAfterCollapse={isDesktopMode ? 2 : 1}
itemsBeforeCollapse={isDesktopMode ? 1 : 0}
@@ -183,47 +236,8 @@ function PathBreadcrumbs(props: Props) {
</span>
}
>
- {pathParts.length > 0 &&
- pathParts.map((pathPart, index) => {
- const folderName = extractShortDirectoryName(
- pathPart,
- PlatformIO.getDirSeparator()
- );
- return (
- <Tooltip
- key={pathPart}
- title={i18n.t('core:navigateTo') + ' ' + pathPart}
- >
- <StyledBreadcrumb
- component="a"
- href="#"
- label={folderName}
- icon={index === 0 && locationTypeIcon}
- onClick={() => loadDirectoryContent(pathPart, false, true)}
- />
- </Tooltip>
- );
- })}
- {currentDirectoryPath && (
- <Tooltip
- title={
- i18n.t('core:openDirectoryMenu') +
- ' - ' +
- (currentDirectoryPath || '')
- }
- >
- <StyledBreadcrumb
- data-tid="folderContainerOpenDirMenu"
- label={currentFolderName}
- icon={currentFolderChipIcon}
- deleteIcon={<ExpandMoreIcon />}
- onDelete={openDirectoryMenu}
- onClick={openDirectoryMenu}
- onContextMenu={openDirectoryMenu}
- />
- </Tooltip>
- )}
- </NoWrapBreadcrumb>
+ {getBreadcrumbs()}
+ </Breadcrumbs>
<DirectoryMenu
open={Boolean(directoryContextMenuAnchorEl)}
onClose={closeDirectoryMenu}
diff --git a/app/components/PerspectiveManager.tsx b/app/components/PerspectiveManager.tsx
index d65cb7a61..3924252fc 100644
--- a/app/components/PerspectiveManager.tsx
+++ b/app/components/PerspectiveManager.tsx
@@ -17,24 +17,20 @@
*/
import React from 'react';
-import withStyles from '@mui/styles/withStyles';
import Typography from '@mui/material/Typography';
-import styles from './SidePanels.css';
+import { classes, SidePanel } from '-/components/SidePanels.css';
interface Props {
- classes: any;
style: any;
}
function PerspectiveManager(props: Props) {
- const { classes } = props;
-
return (
- <div className={classes.panel} style={props.style}>
+ <SidePanel style={props.style}>
<Typography className={classes.panelTitle}>Perspectives</Typography>
- </div>
+ </SidePanel>
);
// <Button onClick={() => history.push('/login')}>Login</Button>
}
-export default withStyles(styles)(PerspectiveManager);
+export default PerspectiveManager;
diff --git a/app/components/SearchAutocomplete.tsx b/app/components/SearchAutocomplete.tsx
index b2d87544d..fc8f36389 100644
--- a/app/components/SearchAutocomplete.tsx
+++ b/app/components/SearchAutocomplete.tsx
@@ -19,8 +19,6 @@
import React, { useEffect, useReducer, useRef, useState } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { format, formatDistanceToNow } from 'date-fns';
-import withStyles from '@mui/styles/withStyles';
-import makeStyles from '@mui/styles/makeStyles';
import HelpOutlineIcon from '@mui/icons-material/HelpOutline';
import Button from '@mui/material/Button';
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
@@ -73,26 +71,27 @@ import { getTagLibrary } from '-/services/taglibrary-utils';
import { getSearches } from '-/reducers/searches';
import { getSearchOptions } from '-/components/SearchOptionsMenu';
import { dataTidFormat } from '-/services/test';
+import { useTheme } from '@mui/material/styles';
interface Props {
style?: any;
- theme: any;
open: boolean;
textQuery: string;
setTextQuery: (value: string) => void;
setAnchorSearch: (el: HTMLButtonElement) => void;
}
-const useStyles = makeStyles(theme => ({
+/*const useStyles = makeStyles(theme => ({
customWidth: {
maxWidth: 550
},
noMaxWidth: {
maxWidth: 'none'
}
-}));
+}));*/
function SearchAutocomplete(props: Props) {
+ const theme = useTheme();
const dispatch: AppDispatch = useDispatch();
const indexing = useSelector(isIndexing);
const searchQuery: TS.SearchQuery = useSelector(getSearchQuery);
@@ -113,7 +112,7 @@ function SearchAutocomplete(props: Props) {
const openFsEntryDispatch = fsEntry =>
dispatch(AppActions.openFsEntry(fsEntry));
- const { setTextQuery, textQuery, open, theme, setAnchorSearch } = props;
+ const { setTextQuery, textQuery, open, setAnchorSearch } = props;
// const [, forceUpdate] = useReducer(x => x + 1, 0);
const [
openSavedSearches,
@@ -485,12 +484,11 @@ function SearchAutocomplete(props: Props) {
setOpenSavedSearches(event.currentTarget);
};
- const classes = useStyles();
+ // const classes = useStyles();
function HelpTooltip(hClasses) {
return (
<Tooltip
- classes={{ tooltip: hClasses.customWidth }}
title={
<span style={{ fontSize: 14 }}>
The search query consists of a tag part and a search term. This term
@@ -1712,5 +1710,4 @@ function SearchAutocomplete(props: Props) {
);
}
-// @ts-ignore
-export default withStyles(undefined, { withTheme: true })(SearchAutocomplete);
+export default SearchAutocomplete;
diff --git a/app/components/SearchInline.css.tsx b/app/components/SearchInline.css.tsx
deleted file mode 100644
index b619eb57f..000000000
--- a/app/components/SearchInline.css.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-import AppConfig from '-/AppConfig';
-import { BaseCSSProperties } from '@mui/styles';
-
-export interface StyleProps {
- panel: BaseCSSProperties;
- fontIcon: BaseCSSProperties;
- header: BaseCSSProperties;
- icon: BaseCSSProperties;
- locationListArea: BaseCSSProperties;
- listItem: BaseCSSProperties;
- listItemSelected: BaseCSSProperties;
- panelTitle: BaseCSSProperties;
- toolbar: BaseCSSProperties;
- formControl: BaseCSSProperties;
- mainActionButton: BaseCSSProperties;
- leftIcon: BaseCSSProperties;
-}
-
-export const styles = (theme: any) => {
- const baseStyle: StyleProps = {
- panel: {
- height: '100%',
- paddingLeft: 5,
- paddingRight: 5
- },
- fontIcon: {
- color: theme.palette.text.primary
- },
- header: {
- color: theme.palette.text.primary
- },
- icon: {
- margin: theme.spacing(1)
- },
- locationListArea: {
- paddingTop: 0,
- marginTop: 0
- },
- listItem: {
- paddingLeft: 0,
- paddingTop: 2,
- paddingBottom: 2,
- paddingRight: 0,
- borderRadius: 5,
- backgroundColor: 'transparent'
- },
- listItemSelected: {
- paddingLeft: 0,
- paddingRight: 0,
- paddingTop: 2,
- paddingBottom: 2,
- borderRadius: 5,
- backgroundColor: theme.palette.primary.light
- },
- panelTitle: {
- textTransform: 'uppercase',
- flex: 1,
- paddingLeft: 7,
- paddingTop: 12
- },
- toolbar: {
- display: 'flex'
- },
- formControl: {
- width: '100%',
- marginBottom: 10
- },
- mainActionButton: {
- marginTop: 10,
- marginLeft: 0,
- paddingLeft: 8
- },
- leftIcon: {
- marginRight: theme.spacing(1)
- }
- };
- return baseStyle as any;
-};
diff --git a/app/components/SearchPopover.tsx b/app/components/SearchPopover.tsx
index 0d82bf403..77408602d 100644
--- a/app/components/SearchPopover.tsx
+++ b/app/components/SearchPopover.tsx
@@ -23,9 +23,6 @@ import { LocalizationProvider, DatePicker } from '@mui/x-date-pickers';
import DateFnsUtils from '@date-io/date-fns';
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
import Box from '@mui/material/Box';
-import { Theme } from '@mui/material/styles';
-import withStyles from '@mui/styles/withStyles';
-import makeStyles from '@mui/styles/makeStyles';
import format from 'date-fns/format';
import Typography from '@mui/material/Typography';
import MenuItem from '@mui/material/MenuItem';
@@ -36,7 +33,6 @@ import Input from '@mui/material/Input';
import OutlinedInput from '@mui/material/OutlinedInput';
import TextField from '@mui/material/TextField';
import InputLabel from '@mui/material/InputLabel';
-import InputAdornment from '@mui/material/InputAdornment';
import IconButton from '@mui/material/IconButton';
import Select from '@mui/material/Select';
import FormControl from '@mui/material/FormControl';
@@ -44,7 +40,6 @@ import ButtonGroup from '@mui/material/ButtonGroup';
import ToggleButton from '@mui/material/ToggleButton';
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
import { mergeWithExtractedTags } from '@tagspaces/tagspaces-common/misc';
-import AppConfig from '-/AppConfig';
import TagsSelect from './TagsSelect';
import { actions as AppActions, getDirectoryPath } from '../reducers/app';
import {
@@ -57,7 +52,6 @@ import {
getMaxSearchResults,
getShowUnixHiddenEntries
} from '-/reducers/settings';
-import { styles, StyleProps } from './SearchInline.css';
import i18n from '../services/i18n';
import { FileTypeGroups, haveSearchFilters } from '-/services/search';
import { Pro } from '../pro';
@@ -87,14 +81,13 @@ import {
CloseIcon
} from '-/components/CommonIcons';
import { openURLExternally } from '-/services/utils-io';
+import { useTheme } from '@mui/material/styles';
+import { classes, SidePanel } from '-/components/SidePanels.css';
const SaveSearchDialog = Pro && Pro.UI ? Pro.UI.SaveSearchDialog : false;
-type PropsClasses = Record<keyof StyleProps, string>;
-
interface Props {
style?: any;
- theme?: any;
loadDirectoryContent: (
path: string,
generateThumbnails: boolean,
@@ -116,11 +109,8 @@ interface Props {
setTextQuery: (value: string) => void;
}
-const useStyles = makeStyles<Theme, StyleProps>(styles);
-
function SearchPopover(props: Props) {
- // @ts-ignore
- const classes: PropsClasses = useStyles({} as StyleProps);
+ const theme = useTheme();
const [, forceUpdate] = useReducer(x => x + 1, 0);
// const textQuery = useRef<string>(props.searchQuery.textQuery);
// const tagsAND = useRef<Array<TS.Tag>>(props.searchQuery.tagsAND);
@@ -525,12 +515,12 @@ function SearchPopover(props: Props) {
props.onClose();
};
- const { indexing, theme } = props;
+ const { indexing } = props;
const indexStatus = GlobalSearch.getInstance().getIndex()
? GlobalSearch.getInstance().getIndex().length + ' indexed entries'
: '';
return (
- <div
+ <SidePanel
style={{
maxWidth: 400,
height: '100%'
@@ -1129,7 +1119,7 @@ function SearchPopover(props: Props) {
searchQuery={saveSearchDialogOpened}
/>
)}
- </div>
+ </SidePanel>
);
}
@@ -1170,9 +1160,4 @@ const areEqual = (prevProp, nextProp) =>
export default connect(
mapStateToProps,
mapDispatchToProps
-)(
- React.memo(
- withStyles(undefined, { withTheme: true })(SearchPopover),
- areEqual
- )
-);
+)(React.memo(SearchPopover, areEqual));
diff --git a/app/components/SidePanels.css.tsx b/app/components/SidePanels.css.tsx
index 2d99af443..df6530961 100644
--- a/app/components/SidePanels.css.tsx
+++ b/app/components/SidePanels.css.tsx
@@ -1,3 +1,5 @@
+import { styled } from '@mui/material/styles';
+
/**
* TagSpaces - universal file and folder organizer
* Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)
@@ -15,64 +17,75 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
-import AppConfig from '-/AppConfig';
+const PREFIX = 'SidePanel';
+export const classes = {
+ panel: `${PREFIX}-panel`,
+ fontIcon: `${PREFIX}-fontIcon`,
+ header: `${PREFIX}-header`,
+ icon: `${PREFIX}-icon`,
+ locationListArea: `${PREFIX}-locationListArea`,
+ listItem: `${PREFIX}-listItem`,
+ listItemSelected: `${PREFIX}-listItemSelected`,
+ panelTitle: `${PREFIX}-panelTitle`,
+ toolbar: `${PREFIX}-toolbar`,
+ formControl: `${PREFIX}-formControl`,
+ mainActionButton: `${PREFIX}-mainActionButton`,
+ leftIcon: `${PREFIX}-leftIcon`
+};
-export default (theme: any) =>
- ({
- panel: {
- height: '100%',
- paddingLeft: 5,
- paddingRight: 5
- },
- fontIcon: {
- color: theme.palette.text.primary
- },
- header: {
- color: theme.palette.text.primary
- },
- icon: {
- margin: theme.spacing(1)
- },
- locationListArea: {
- paddingTop: 0,
- marginTop: 0,
- overflowY: 'auto'
- },
- listItem: {
- paddingLeft: 0,
- paddingTop: 2,
- paddingBottom: 2,
- paddingRight: 0,
- borderRadius: 5,
- backgroundColor: 'transparent'
- },
- listItemSelected: {
- paddingLeft: 0,
- paddingRight: 0,
- paddingTop: 2,
- paddingBottom: 2,
- borderRadius: 5,
- backgroundColor: theme.palette.primary.light
- },
- panelTitle: {
- textTransform: 'uppercase',
- flex: 1,
- paddingLeft: 7,
- paddingTop: 12
- },
- toolbar: {
- display: 'flex'
- },
- formControl: {
- width: '100%',
- marginBottom: 10
- },
- mainActionButton: {
- marginTop: 10,
- marginLeft: 0,
- paddingLeft: 8
- },
- leftIcon: {
- marginRight: theme.spacing(1)
- }
- } as any);
+export const SidePanel = styled('div')(({ theme }) => ({
+ height: '100%',
+ paddingLeft: 5,
+ paddingRight: 5,
+ [`& .${classes.fontIcon}`]: {
+ color: theme.palette.text.primary
+ },
+ [`& .${classes.header}`]: {
+ color: theme.palette.text.primary
+ },
+ [`& .${classes.icon}`]: {
+ margin: theme.spacing(1)
+ },
+ [`& .${classes.locationListArea}`]: {
+ paddingTop: 0,
+ marginTop: 0,
+ overflowY: 'auto'
+ },
+ [`& .${classes.listItem}`]: {
+ paddingLeft: 0,
+ paddingTop: 2,
+ paddingBottom: 2,
+ paddingRight: 0,
+ borderRadius: 5,
+ backgroundColor: 'transparent'
+ },
+ [`& .${classes.listItemSelected}`]: {
+ paddingLeft: 0,
+ paddingRight: 0,
+ paddingTop: 2,
+ paddingBottom: 2,
+ borderRadius: 5,
+ backgroundColor: theme.palette.primary.light
+ },
+ [`& .${classes.panelTitle}`]: {
+ textTransform: 'uppercase',
+ flex: 1,
+ paddingLeft: 7,
+ paddingTop: 12
+ },
+ [`& .${classes.toolbar}`]: {
+ display: 'flex'
+ },
+ [`& .${classes.formControl}`]: {
+ width: '100%',
+ marginBottom: 10
+ },
+ [`& .${classes.mainActionButton}`]: {
+ marginTop: 10,
+ marginLeft: 0,
+ paddingLeft: 8
+ },
+ [`& .${classes.leftIcon}`]: {
+ marginRight: theme.spacing(1)
+ }
+}));
diff --git a/app/components/StoredSearches.tsx b/app/components/StoredSearches.tsx
index 71704cac0..7be757775 100644
--- a/app/components/StoredSearches.tsx
+++ b/app/components/StoredSearches.tsx
@@ -20,8 +20,6 @@ import React, { useReducer, useRef, useState } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import classNames from 'classnames';
-import withStyles from '@mui/styles/withStyles';
-import styles from './SidePanels.css';
import IconButton from '@mui/material/IconButton';
import Button from '@mui/material/Button';
import Grid from '@mui/material/Grid';
@@ -66,10 +64,10 @@ import PlatformIO from '-/services/platform-facade';
import HistoryMenu from '-/components/menus/HistoryMenu';
import BookmarksMenu from '-/components/menus/BookmarksMenu';
import { renderHistory } from '-/components/RenderHistory';
+import { classes, SidePanel } from '-/components/SidePanels.css';
interface Props {
style?: any;
- classes?: any;
searchQuery: TS.SearchQuery;
setSearchQuery: (searchQuery: TS.SearchQuery) => void;
searches: Array<TS.SearchQuery>;
@@ -170,7 +168,7 @@ function StoredSearches(props: Props) {
const noSearchesFound = props.searches.length < 1;
- const { reduceHeightBy, classes } = props;
+ const { reduceHeightBy } = props;
const bookmarkItems: Array<TS.BookmarkItem> = Pro
? Pro.bookmarks.getBookmarks()
@@ -194,8 +192,7 @@ function StoredSearches(props: Props) {
folderOpenHistoryItems && folderOpenHistoryItems.length > 0;
return (
- <div
- className={classes.panel}
+ <SidePanel
data-tid="quickAccessArea"
style={{
display: 'flex',
@@ -609,7 +606,7 @@ function StoredSearches(props: Props) {
searches={props.searches}
/>
)}
- </div>
+ </SidePanel>
);
}
@@ -659,10 +656,10 @@ const areEqual = (prevProp, nextProp) =>
nextProp.searchQuery === prevProp.searchQuery &&
nextProp.currentDirectory === prevProp.currentDirectory &&
nextProp.indexedEntriesCount === prevProp.indexedEntriesCount &&
- JSON.stringify(nextProp.searches) === JSON.stringify(prevProp.searches) &&
- JSON.stringify(nextProp.classes) === JSON.stringify(prevProp.classes);
+ JSON.stringify(nextProp.searches) === JSON.stringify(prevProp.searches);
+// JSON.stringify(nextProp.classes) === JSON.stringify(prevProp.classes);
export default connect(
mapStateToProps,
mapDispatchToProps
-)(React.memo(withStyles(styles)(StoredSearches), areEqual));
+)(React.memo(StoredSearches, areEqual));
diff --git a/app/components/TagGroupTitleDnD.tsx b/app/components/TagGroupTitleDnD.tsx
index 4515836bd..8e6b9fec3 100644
--- a/app/components/TagGroupTitleDnD.tsx
+++ b/app/components/TagGroupTitleDnD.tsx
@@ -31,9 +31,9 @@ import {
import Grid from '@mui/material/Grid';
import { TS } from '-/tagspaces.namespace';
import DragItemTypes from '-/components/DragItemTypes';
+import { classes, SidePanel } from '-/components/SidePanels.css';
interface Props {
- classes: any;
index: number;
tagGroup: TS.TagGroup;
handleTagGroupMenu: (
@@ -74,75 +74,81 @@ function TagGroupTitleDnD(props: Props) {
} = props;
const tagGroupTitle = (
- <div
- data-tid={'tagLibraryTagGroupTitle_' + tagGroup.title}
- className={props.classes.listItem}
- title={'Number of tags in this tag group: ' + tagGroup.children.length}
- >
- <Grid
- container
- direction="row"
- alignItems="stretch"
- alignContent="center"
- style={{ flexWrap: 'nowrap' }}
+ <div>
+ <SidePanel
+ data-tid={'tagLibraryTagGroupTitle_' + tagGroup.title}
+ className={classes.listItem}
+ title={'Number of tags in this tag group: ' + tagGroup.children.length}
>
- <Grid item xs={2} style={{ maxWidth: 40 }}>
- <IconButton
- style={{ minWidth: 'auto', padding: 7 }}
- onClick={(event: any) => handleTagGroupTitleClick(event, tagGroup)}
- size="large"
- >
- {tagGroup.expanded ? <ArrowDownIcon /> : <ArrowRightIcon />}
- </IconButton>
- </Grid>
- <Grid item xs={8} style={{ alignSelf: 'center' }}>
- <Typography
- variant="inherit"
- className={props.classes.header}
- style={{ paddingLeft: 0 }}
- data-tid="locationTitleElement"
- noWrap
- onClick={(event: any) => handleTagGroupTitleClick(event, tagGroup)}
- >
- {tagGroup.title + getLocationName(tagGroup.locationId)}
- {!tagGroup.expanded && (
- <span
- style={{
- display: 'inline-block',
- minWidth: 10,
- padding: '3px 7px',
- fontSize: 10,
- fontWeight: 'normal',
- marginLeft: 4,
- color: '#ffffff',
- lineHeight: 1,
- verticalAlign: 'middle',
- whiteSpace: 'nowrap',
- textAlign: 'center',
- backgroundColor: '#bbbbbb',
- borderRadius: 10
- }}
- >
- {tagGroup.children.length}
- </span>
- )}
- </Typography>
- </Grid>
- <Grid item xs={2} style={{ textAlign: 'end' }}>
- {!props.isReadOnly && (
+ <Grid
+ container
+ direction="row"
+ alignItems="stretch"
+ alignContent="center"
+ style={{ flexWrap: 'nowrap' }}
+ >
+ <Grid item xs={2} style={{ maxWidth: 40 }}>
<IconButton
style={{ minWidth: 'auto', padding: 7 }}
- data-tid={
- 'tagLibraryMoreButton_' + tagGroup.title.replace(/ /g, '_')
+ onClick={(event: any) =>
+ handleTagGroupTitleClick(event, tagGroup)
}
- onClick={(event: any) => handleTagGroupMenu(event, tagGroup)}
size="large"
>
- <MoreVertIcon />
+ {tagGroup.expanded ? <ArrowDownIcon /> : <ArrowRightIcon />}
</IconButton>
- )}
+ </Grid>
+ <Grid item xs={8} style={{ alignSelf: 'center' }}>
+ <Typography
+ variant="inherit"
+ className={classes.header}
+ style={{ paddingLeft: 0 }}
+ data-tid="locationTitleElement"
+ noWrap
+ onClick={(event: any) =>
+ handleTagGroupTitleClick(event, tagGroup)
+ }
+ >
+ {tagGroup.title + getLocationName(tagGroup.locationId)}
+ {!tagGroup.expanded && (
+ <span
+ style={{
+ display: 'inline-block',
+ minWidth: 10,
+ padding: '3px 7px',
+ fontSize: 10,
+ fontWeight: 'normal',
+ marginLeft: 4,
+ color: '#ffffff',
+ lineHeight: 1,
+ verticalAlign: 'middle',
+ whiteSpace: 'nowrap',
+ textAlign: 'center',
+ backgroundColor: '#bbbbbb',
+ borderRadius: 10
+ }}
+ >
+ {tagGroup.children.length}
+ </span>
+ )}
+ </Typography>
+ </Grid>
+ <Grid item xs={2} style={{ textAlign: 'end' }}>
+ {!props.isReadOnly && (
+ <IconButton
+ style={{ minWidth: 'auto', padding: 7 }}
+ data-tid={
+ 'tagLibraryMoreButton_' + tagGroup.title.replace(/ /g, '_')
+ }
+ onClick={(event: any) => handleTagGroupMenu(event, tagGroup)}
+ size="large"
+ >
+ <MoreVertIcon />
+ </IconButton>
+ )}
+ </Grid>
</Grid>
- </Grid>
+ </SidePanel>
</div>
);
if (tagGroup.readOnly) {
diff --git a/app/components/TagLibrary.tsx b/app/components/TagLibrary.tsx
index cd1e2a8aa..f9b428912 100644
--- a/app/components/TagLibrary.tsx
+++ b/app/components/TagLibrary.tsx
@@ -19,7 +19,6 @@
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import classNames from 'classnames';
-import withStyles from '@mui/styles/withStyles';
import Typography from '@mui/material/Typography';
import IconButton from '@mui/material/IconButton';
import Collapse from '@mui/material/Collapse';
@@ -28,7 +27,6 @@ import AppConfig from '-/AppConfig';
import TagContainerDnd from './TagContainerDnd';
import TagContainer from './TagContainer';
import ConfirmDialog from './dialogs/ConfirmDialog';
-import styles from './SidePanels.css';
import CreateTagGroupDialog from './dialogs/CreateTagGroupDialog';
import CreateTagsDialog from './dialogs/CreateTagsDialog';
import EditTagGroupDialog from './dialogs/EditTagGroupDialog';
@@ -77,9 +75,9 @@ import {
sortTagGroup
} from '-/services/taglibrary-utils';
import useFirstRender from '-/utils/useFirstRender';
+import { classes, SidePanel } from '-/components/SidePanels.css';
interface Props {
- classes?: any;
style?: any;
reduceHeightBy: number;
}
@@ -283,7 +281,6 @@ function TagLibrary(props: Props) {
<div key={tagGroup.uuid}>
<TagGroupTitleDnD
index={index}
- classes={classes}
tagGroup={tagGroup}
moveTagGroup={(tagGroupUuid, position) => {
setTagGroups(moveTagGroup(tagGroupUuid, position, tagGroups));
@@ -382,12 +379,11 @@ function TagLibrary(props: Props) {
}
}
- const { classes, reduceHeightBy } = props;
+ const { reduceHeightBy } = props;
const allTags = getAllTags(tagGroups);
return (
- <div
- className={classes.panel}
+ <SidePanel
style={{
display: 'flex',
flexDirection: 'column'
@@ -576,8 +572,8 @@ function TagLibrary(props: Props) {
)}
<div style={{ paddingTop: 0 }}>{tagGroups.map(renderTagGroup)}</div>
</div>
- </div>
+ </SidePanel>
);
}
-export default withStyles(styles)(TagLibrary);
+export default TagLibrary;
diff --git a/app/components/TagsSelect.tsx b/app/components/TagsSelect.tsx
index 0775680a6..360951b8d 100644
--- a/app/components/TagsSelect.tsx
+++ b/app/components/TagsSelect.tsx
@@ -18,7 +18,6 @@
import React, { useRef, useState } from 'react';
import { useSelector } from 'react-redux';
-import withStyles from '@mui/styles/withStyles';
import TextField from '@mui/material/TextField';
import Autocomplete from '@mui/material/Autocomplete';
import { getTagColor, getTagTextColor } from '-/reducers/settings';
@@ -29,7 +28,7 @@ import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
import { getAllTags } from '-/services/taglibrary-utils';
import { Box } from '@mui/material';
-const styles: any = (theme: any) => ({
+/*const styles: any = (theme: any) => ({
root: {
flexGrow: 1
},
@@ -64,12 +63,10 @@ const styles: any = (theme: any) => ({
left: 0,
right: 0
}
-});
+});*/
interface Props {
dataTid?: string;
- classes?: any;
- theme?: any;
tags: TS.Tag[];
label?: string;
tagSearchType?: string;
@@ -96,7 +93,6 @@ function TagsSelect(props: Props) {
const defaultBackgroundColor = useSelector(getTagColor);
const defaultTextColor = useSelector(getTagTextColor);
const {
- classes,
placeholderText = '',
label,
selectedEntryPath,
@@ -184,7 +180,7 @@ function TagsSelect(props: Props) {
};
return (
- <div className={classes.root}>
+ <Box sx={{ flexGrow: 1 }}>
<Autocomplete
data-tid={props.dataTid}
multiple
@@ -241,8 +237,8 @@ function TagsSelect(props: Props) {
removeTags={handleRemoveTag}
/>
)}
- </div>
+ </Box>
);
}
-export default withStyles(styles, { withTheme: true })(TagsSelect);
+export default TagsSelect;
diff --git a/app/components/TargetFileBox.tsx b/app/components/TargetFileBox.tsx
index 310d56172..ec30933c3 100644
--- a/app/components/TargetFileBox.tsx
+++ b/app/components/TargetFileBox.tsx
@@ -18,32 +18,10 @@
import React, { ReactNode, useRef } from 'react';
import { DropTargetMonitor, useDrop } from 'react-dnd';
-import withStyles from '@mui/styles/withStyles';
import i18n from '../services/i18n';
-
-const styles: any = (theme: any) => ({
- dropzone: {
- margin: 5,
- position: 'absolute',
- top: 0,
- left: 0,
- right: 0,
- bottom: 0,
- backgroundColor: '#1dd19f40',
- zIndex: 1000,
- border: '3px dashed white',
- display: 'flex',
- justifyContent: 'center',
- alignItems: 'center',
- textAlign: 'center',
- fontSize: '40px',
- fontWeight: 'bold',
- color: 'white'
- }
-});
+import { classes, DnD } from '-/components/DnD.css';
interface Props {
- classes?: any;
children: ReactNode;
accepts: Array<string>;
onDrop: (item) => void;
@@ -69,18 +47,18 @@ function TargetFileBox(props: Props) {
drop(ref);
const { isActive } = collectedProps;
- const { classes, children } = props;
+ const { children } = props;
const dragContent = isActive ? (
<div className={classes.dropzone}>{i18n.t('core:releaseToDrop')}</div>
) : (
undefined
);
return (
- <div ref={ref} style={{ height: '100%' }}>
+ <DnD ref={ref} style={{ height: '100%' }}>
{dragContent}
{children}
- </div>
+ </DnD>
);
}
-export default withStyles(styles, { withTheme: true })(TargetFileBox);
+export default TargetFileBox;
diff --git a/app/components/TargetMoveFileBox.tsx b/app/components/TargetMoveFileBox.tsx
index fe9c8e0d0..b88b099a9 100644
--- a/app/components/TargetMoveFileBox.tsx
+++ b/app/components/TargetMoveFileBox.tsx
@@ -18,8 +18,8 @@
import React from 'react';
import { DropTarget } from 'react-dnd';
-import withStyles from '@mui/styles/withStyles';
import { TS } from '-/tagspaces.namespace';
+import { classes, DnD } from '-/components/DnD.css';
const styles: any = () => ({
dropzone: {
@@ -45,7 +45,6 @@ const boxTarget = {
interface Props {
accepts: Array<string>;
onDrop: (item: any, monitor: any) => void;
- classes?: any;
canDrop: boolean;
isOver: boolean;
connectDropTarget: any;
@@ -55,10 +54,10 @@ interface Props {
}
const TargetMoveFileBox = (props: Props) => {
- const { classes, canDrop, isOver, connectDropTarget, children } = props;
+ const { canDrop, isOver, connectDropTarget, children } = props;
const dragContent =
canDrop && isOver ? (
- <div
+ <DnD
className={classes.dropzone}
/> /* {i18n.t('core:releaseToMoveDrop')} */
) : (
@@ -72,14 +71,12 @@ const TargetMoveFileBox = (props: Props) => {
);
};
-export default withStyles(styles, { withTheme: true })(
- DropTarget(
- props => props.accepts,
- boxTarget,
- (connect, monitor) => ({
- connectDropTarget: connect.dropTarget(),
- isOver: monitor.isOver(),
- canDrop: monitor.canDrop()
- })
- )(TargetMoveFileBox)
-);
+export default DropTarget(
+ props => props.accepts,
+ boxTarget,
+ (connect, monitor) => ({
+ connectDropTarget: connect.dropTarget(),
+ isOver: monitor.isOver(),
+ canDrop: monitor.canDrop()
+ })
+)(TargetMoveFileBox);
diff --git a/app/components/UserDetailsPopover.tsx b/app/components/UserDetailsPopover.tsx
index c1e0c9538..278c745c9 100644
--- a/app/components/UserDetailsPopover.tsx
+++ b/app/components/UserDetailsPopover.tsx
@@ -28,22 +28,49 @@ import Tooltip from '-/components/Tooltip';
import Button from '@mui/material/Button';
import Auth from '@aws-amplify/auth';
import ExitToAppIcon from '@mui/icons-material/ExitToApp';
-import withStyles from '@mui/styles/withStyles';
import { useSelector } from 'react-redux';
import { clearAllURLParams } from '-/utils/dom';
import i18n from '-/services/i18n';
-import styles from '-/components/SidePanels.css';
import { Pro } from '-/pro';
import { currentUser } from '-/reducers/app';
+import { styled, useTheme } from '@mui/material/styles';
+
+const PREFIX = 'UserDetailsPopover';
+
+const classes = {
+ panelTitle: `${PREFIX}-panelTitle`,
+ header: `${PREFIX}-header`,
+ mainActionButton: `${PREFIX}-mainActionButton`,
+ leftIcon: `${PREFIX}-leftIcon`
+};
+
+const Root = styled('div')(({ theme }) => ({
+ [`& .${classes.panelTitle}`]: {
+ textTransform: 'uppercase',
+ flex: 1,
+ paddingLeft: 7,
+ paddingTop: 12
+ },
+ [`& .${classes.header}`]: {
+ color: theme.palette.text.primary
+ },
+ [`& .${classes.mainActionButton}`]: {
+ marginTop: 10,
+ marginLeft: 0,
+ paddingLeft: 8
+ },
+ [`& .${classes.leftIcon}`]: {
+ marginRight: theme.spacing(1)
+ }
+}));
interface Props {
- classes?: any;
- theme?: any;
onClose: () => void;
}
function UserDetailsPopover(props: Props) {
- const { classes, theme, onClose } = props;
+ const theme = useTheme();
+ const { onClose } = props;
const cognitoUser: CognitoUserInterface = useSelector(currentUser);
const [isSetupTOTPOpened, setSetupTOTPOpened] = useState<boolean>(false);
const SetupTOTPDialog = Pro && Pro.UI ? Pro.UI.SetupTOTPDialog : false;
@@ -70,7 +97,7 @@ function UserDetailsPopover(props: Props) {
};
return (
- <div
+ <Root
style={{
maxWidth: 400,
height: '100%'
@@ -185,8 +212,8 @@ function UserDetailsPopover(props: Props) {
</Button>
</Box>
</Box>
- </div>
+ </Root>
);
}
-export default withStyles(styles, { withTheme: true })(UserDetailsPopover);
+export default UserDetailsPopover;
diff --git a/app/components/WelcomePanel.tsx b/app/components/WelcomePanel.tsx
index 224fe1eb3..f85e135e2 100644
--- a/app/components/WelcomePanel.tsx
+++ b/app/components/WelcomePanel.tsx
@@ -18,7 +18,6 @@
import React, { useReducer } from 'react';
import { useSelector, useDispatch } from 'react-redux';
-import withStyles from '@mui/styles/withStyles';
import Typography from '@mui/material/Typography';
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
@@ -56,33 +55,36 @@ import { TS } from '-/tagspaces.namespace';
import { renderHistory } from '-/components/RenderHistory';
import HowToStart from '-/components/HowToStart';
import { openURLExternally } from '-/services/utils-io';
+import { styled, useTheme } from '@mui/material/styles';
-interface Props {
- theme: any;
- classes: any;
-}
+const PREFIX = 'WelcomePanel';
+
+const classes = {
+ listItem: `${PREFIX}-listItem`,
+ recentTitle: `${PREFIX}-recentTitle`,
+ noRecentItems: `${PREFIX}-noRecentItems`
+};
-export const styles: any = (theme: any) => ({
- listItem: {
+const Root = styled('div')(({ theme }) => ({
+ [`& .${classes.listItem}`]: {
color: theme.palette.text.primary,
textTransform: 'uppercase',
marginTop: 10
},
- recentTitle: {
+ [`& .${classes.recentTitle}`]: {
color: theme.palette.text.primary,
textTransform: 'uppercase',
textAlign: 'center'
},
- noRecentItems: {
+ [`& .${classes.noRecentItems}`]: {
color: theme.palette.text.primary,
padding: 30,
alignSelf: 'center'
}
-});
-
-function WelcomePanel(props: Props) {
- const { theme, classes } = props;
+}));
+function WelcomePanel() {
+ const theme = useTheme();
const dispatch: AppDispatch = useDispatch();
const desktopMode = useSelector(getDesktopMode);
const currentLocationId = useSelector(getCurrentLocationId);
@@ -367,7 +369,7 @@ function WelcomePanel(props: Props) {
}
return (
- <div
+ <Root
data-tid="WelcomePanelTID"
style={{
overflow: 'hidden',
@@ -439,8 +441,8 @@ function WelcomePanel(props: Props) {
</Grid>
)}
</Grid>
- </div>
+ </Root>
);
}
-export default withStyles(styles, { withTheme: true })(WelcomePanel);
+export default WelcomePanel;
diff --git a/app/components/dialogs/AboutDialog.tsx b/app/components/dialogs/AboutDialog.tsx
index 43bcf6549..46acc30b2 100644
--- a/app/components/dialogs/AboutDialog.tsx
+++ b/app/components/dialogs/AboutDialog.tsx
@@ -35,7 +35,7 @@ import { getLastVersionPromise } from '-/reducers/settings';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import Links from '-/content/links';
import useMediaQuery from '@mui/material/useMediaQuery';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import AppConfig from '-/AppConfig';
import { Fullscreen } from '@mui/icons-material';
import { openURLExternally } from '-/services/utils-io';
diff --git a/app/components/dialogs/AddRemoveTagsDialog.tsx b/app/components/dialogs/AddRemoveTagsDialog.tsx
index 39aaf2ce9..6a6f6598f 100644
--- a/app/components/dialogs/AddRemoveTagsDialog.tsx
+++ b/app/components/dialogs/AddRemoveTagsDialog.tsx
@@ -40,7 +40,7 @@ import {
import PlatformIO from '-/services/platform-facade';
import { TS } from '-/tagspaces.namespace';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import TaggingActions from '-/reducers/tagging-actions';
import { AppDispatch } from '-/reducers/app';
diff --git a/app/components/dialogs/CreateEditLocationDialog.tsx b/app/components/dialogs/CreateEditLocationDialog.tsx
index c9b7b1d2a..e206d4bbc 100644
--- a/app/components/dialogs/CreateEditLocationDialog.tsx
+++ b/app/components/dialogs/CreateEditLocationDialog.tsx
@@ -17,8 +17,8 @@
*/
import React, { ChangeEvent, useEffect, useState } from 'react';
+import { styled } from '@mui/material/styles';
import Button from '@mui/material/Button';
-import withStyles from '@mui/styles/withStyles';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import DialogTitle from '@mui/material/DialogTitle';
@@ -73,18 +73,24 @@ import ConfirmDialog from '-/components/dialogs/ConfirmDialog';
import { actions as LocationIndexActions } from '-/reducers/location-index';
import PlatformIO from '-/services/platform-facade';
import WebdavForm from '-/components/dialogs/WebdavForm';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import { loadLocationDataPromise } from '-/services/utils-io';
import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
import { ExpandIcon } from '-/components/CommonIcons';
-const styles: any = theme => ({
- formControl: {
+const PREFIX = 'CreateEditLocationDialog';
+
+const classes = {
+ formControl: `${PREFIX}-formControl`
+};
+
+const StyledDialog = styled(Dialog)(({ theme }) => ({
+ [`& .${classes.formControl}`]: {
marginLeft: theme.spacing(0),
width: '100%'
}
-});
+}));
interface Props {
location?: TS.Location;
@@ -349,7 +355,7 @@ function CreateEditLocationDialog(props: Props) {
);
};
- const { open, onClose, classes } = props;
+ const { open, onClose } = props;
const onConfirm = () => {
if (!disableConfirmButton()) {
@@ -508,7 +514,7 @@ function CreateEditLocationDialog(props: Props) {
const theme = useTheme();
const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
- <Dialog
+ <StyledDialog
open={open}
onClose={onClose}
fullScreen={fullScreen}
@@ -1016,8 +1022,8 @@ function CreateEditLocationDialog(props: Props) {
{i18n.t('core:ok')}
</Button>
</DialogActions>
- </Dialog>
+ </StyledDialog>
);
}
-export default withStyles(styles)(CreateEditLocationDialog);
+export default CreateEditLocationDialog;
diff --git a/app/components/dialogs/CreateTagGroupDialog.tsx b/app/components/dialogs/CreateTagGroupDialog.tsx
index cb20053a3..5f58dd53f 100644
--- a/app/components/dialogs/CreateTagGroupDialog.tsx
+++ b/app/components/dialogs/CreateTagGroupDialog.tsx
@@ -35,7 +35,7 @@ import { TS } from '-/tagspaces.namespace';
import { getLocations } from '-/reducers/locations';
import { getSaveTagInLocation } from '-/reducers/settings';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-// import useTheme from '@mui/styles/useTheme';
+// import { useTheme } from '@mui/material/styles';
// import useMediaQuery from '@mui/material/useMediaQuery';
import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
diff --git a/app/components/dialogs/CreateTagsDialog.tsx b/app/components/dialogs/CreateTagsDialog.tsx
index c746a59d6..5cb627e84 100644
--- a/app/components/dialogs/CreateTagsDialog.tsx
+++ b/app/components/dialogs/CreateTagsDialog.tsx
@@ -29,7 +29,7 @@ import i18n from '-/services/i18n';
import useFirstRender from '-/utils/useFirstRender';
import { TS } from '-/tagspaces.namespace';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
interface Props {
diff --git a/app/components/dialogs/EditEntryTagDialog.tsx b/app/components/dialogs/EditEntryTagDialog.tsx
index 6ebc7558b..5d9d7acb5 100644
--- a/app/components/dialogs/EditEntryTagDialog.tsx
+++ b/app/components/dialogs/EditEntryTagDialog.tsx
@@ -23,6 +23,7 @@ import React, {
ChangeEvent,
useRef
} from 'react';
+import { styled } from '@mui/material/styles';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import Button from '@mui/material/Button';
@@ -30,7 +31,6 @@ import TextField from '@mui/material/TextField';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import DialogTitle from '@mui/material/DialogTitle';
-import withStyles from '@mui/styles/withStyles';
import FormControl from '@mui/material/FormControl';
import FormHelperText from '@mui/material/FormHelperText';
import Dialog from '@mui/material/Dialog';
@@ -46,16 +46,22 @@ import { TS } from '-/tagspaces.namespace';
import useValidation from '-/utils/useValidation';
import { getMapTileServer, getCurrentLanguage } from '-/reducers/settings';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
-const styles = () => ({
- root: {
+const PREFIX = 'EditEntryTagDialog';
+
+const classes = {
+ root: `${PREFIX}-root`
+};
+
+const StyledDialog = styled(Dialog)(() => ({
+ [`& .${classes.root}`]: {
minWidth: 400,
height: '100%',
marginBottom: 30
}
-});
+}));
interface Props {
classes: any;
@@ -146,7 +152,7 @@ function EditEntryTagDialog(props: Props) {
return (
<DialogContent
data-tid="editEntryTagDialog"
- className={props.classes.root}
+ className={classes.root}
style={{
overflow: 'auto'
}}
@@ -240,7 +246,7 @@ function EditEntryTagDialog(props: Props) {
const theme = useTheme();
const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
- <Dialog
+ <StyledDialog
open={open}
fullScreen={fullScreen}
onClose={onClose}
@@ -257,7 +263,7 @@ function EditEntryTagDialog(props: Props) {
{renderTitle()}
{renderContent()}
{renderActions()}
- </Dialog>
+ </StyledDialog>
);
}
@@ -285,4 +291,4 @@ const areEqual = (prevProp, nextProp) =>
export default connect(
mapStateToProps,
mapDispatchToProps
-)(React.memo(withStyles(styles)(EditEntryTagDialog), areEqual));
+)(React.memo(EditEntryTagDialog, areEqual));
diff --git a/app/components/dialogs/EditTagDialog.tsx b/app/components/dialogs/EditTagDialog.tsx
index fd69d8220..cd34bc41c 100644
--- a/app/components/dialogs/EditTagDialog.tsx
+++ b/app/components/dialogs/EditTagDialog.tsx
@@ -31,7 +31,7 @@ import TransparentBackground from '../TransparentBackground';
import i18n from '-/services/i18n';
import { TS } from '-/tagspaces.namespace';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
interface Props {
diff --git a/app/components/dialogs/ImportExportTagGroupsDialog.tsx b/app/components/dialogs/ImportExportTagGroupsDialog.tsx
index 85d53627d..a15d8a05c 100644
--- a/app/components/dialogs/ImportExportTagGroupsDialog.tsx
+++ b/app/components/dialogs/ImportExportTagGroupsDialog.tsx
@@ -18,7 +18,6 @@
import React, { useRef, useState } from 'react';
import Button from '@mui/material/Button';
-import withStyles from '@mui/styles/withStyles';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import DialogTitle from '@mui/material/DialogTitle';
@@ -34,7 +33,7 @@ import TagContainer from '../TagContainer';
import i18n from '-/services/i18n';
import { TS } from '-/tagspaces.namespace';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import { exportTagGroups } from '-/services/taglibrary-utils';
diff --git a/app/components/dialogs/KeyboardDialog.tsx b/app/components/dialogs/KeyboardDialog.tsx
index 152286222..302eecf0b 100644
--- a/app/components/dialogs/KeyboardDialog.tsx
+++ b/app/components/dialogs/KeyboardDialog.tsx
@@ -17,6 +17,7 @@
*/
import React from 'react';
+import { styled } from '@mui/material/styles';
import { useSelector } from 'react-redux';
import Button from '@mui/material/Button';
import DialogActions from '@mui/material/DialogActions';
@@ -26,23 +27,28 @@ import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction';
import ListItemText from '@mui/material/ListItemText';
-import withStyles from '@mui/styles/withStyles';
import Dialog from '@mui/material/Dialog';
import i18n from '-/services/i18n';
import { getKeyBindingObject } from '-/reducers/settings';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
-const styles = theme => ({
- shortcutKey: {
+const PREFIX = 'KeyboardDialog';
+
+const classes = {
+ shortcutKey: `${PREFIX}-shortcutKey`
+};
+
+const StyledDialog = styled(Dialog)(({ theme }) => ({
+ [`& .${classes.shortcutKey}`]: {
backgroundColor: theme.palette.primary.main,
font: 'Console',
fontFamily: 'monospace',
padding: '5px',
borderRadius: '5px'
}
-});
+}));
interface Props {
open: boolean;
@@ -51,12 +57,12 @@ interface Props {
}
function KeyboardDialog(props: Props) {
- const { open, onClose, classes } = props;
+ const { open, onClose } = props;
const keyBindings = useSelector(getKeyBindingObject);
const theme = useTheme();
const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
- <Dialog
+ <StyledDialog
open={open}
onClose={onClose}
fullScreen={fullScreen}
@@ -98,8 +104,8 @@ function KeyboardDialog(props: Props) {
{i18n.t('core:ok')}
</Button>
</DialogActions>
- </Dialog>
+ </StyledDialog>
);
}
-export default withStyles(styles)(KeyboardDialog);
+export default KeyboardDialog;
diff --git a/app/components/dialogs/LicenseDialog.tsx b/app/components/dialogs/LicenseDialog.tsx
index 7f7649b2e..5bdab47c4 100644
--- a/app/components/dialogs/LicenseDialog.tsx
+++ b/app/components/dialogs/LicenseDialog.tsx
@@ -26,7 +26,7 @@ import i18n from '-/services/i18n';
import { Pro } from '-/pro';
import LicenseContent from '-/LICENSE.txt';
import PlatformIO from '-/services/platform-facade';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
// import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
diff --git a/app/components/dialogs/LinkGeneratorDialog.tsx b/app/components/dialogs/LinkGeneratorDialog.tsx
index 8dc5b43cf..5f34b4826 100644
--- a/app/components/dialogs/LinkGeneratorDialog.tsx
+++ b/app/components/dialogs/LinkGeneratorDialog.tsx
@@ -17,10 +17,9 @@
*/
import React, { ChangeEvent, useRef, useReducer, useEffect } from 'react';
+import { styled } from '@mui/material/styles';
import { Theme } from '@mui/material/styles';
import { useDispatch } from 'react-redux';
-import withStyles from '@mui/styles/withStyles';
-import createStyles from '@mui/styles/createStyles';
import Button from '@mui/material/Button';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
@@ -28,7 +27,7 @@ import DialogTitle from '@mui/material/DialogTitle';
import Dialog from '@mui/material/Dialog';
import i18n from '-/services/i18n';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import { QRCode } from 'react-qrcode-logo';
import InfoIcon from '-/components/InfoIcon';
@@ -39,6 +38,21 @@ import PlatformIO from '-/services/platform-facade';
import { actions } from '-/reducers/app';
import Links from '-/content/links';
+const PREFIX = 'LinkGeneratorDialog';
+
+const classes = {
+ root: `${PREFIX}-root`
+};
+
+const StyledDialog = styled(Dialog)(({ theme: Theme }) => ({
+ [`& .${classes.root}`]: {
+ marginTop: 12,
+ '& .MuiInputBase-root': {
+ height: 450
+ }
+ }
+}));
+
interface Props {
open: boolean;
onClose: () => void;
@@ -49,16 +63,7 @@ interface Props {
switchCurrentLocationType?: (currentLocationId: string) => Promise<boolean>;
}
-const QRTextField = withStyles((theme: Theme) =>
- createStyles({
- root: {
- marginTop: 12,
- '& .MuiInputBase-root': {
- height: 450
- }
- }
- })
-)(TextField);
+const QRTextField = TextField;
function LinkGeneratorDialog(props: Props) {
const { open, onClose, path } = props;
@@ -93,7 +98,7 @@ function LinkGeneratorDialog(props: Props) {
}
return (
- <Dialog
+ <StyledDialog
open={open}
onClose={onClose}
fullScreen={fullScreen}
@@ -187,6 +192,9 @@ function LinkGeneratorDialog(props: Props) {
</InputAdornment>
)
}}
+ classes={{
+ root: classes.root
+ }}
/>
</DialogContent>
<DialogActions
@@ -213,7 +221,7 @@ function LinkGeneratorDialog(props: Props) {
{i18n.t('core:close')}
</Button>
</DialogActions>
- </Dialog>
+ </StyledDialog>
);
}
diff --git a/app/components/dialogs/MoveCopyFilesDialog.tsx b/app/components/dialogs/MoveCopyFilesDialog.tsx
index 9b10201a5..62e003dd6 100644
--- a/app/components/dialogs/MoveCopyFilesDialog.tsx
+++ b/app/components/dialogs/MoveCopyFilesDialog.tsx
@@ -17,7 +17,7 @@ import i18n from '-/services/i18n';
import PlatformIO from '-/services/platform-facade';
import IOActions from '-/reducers/io-actions';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import {
actions as AppActions,
diff --git a/app/components/dialogs/MoveOrCopyFilesDialog.tsx b/app/components/dialogs/MoveOrCopyFilesDialog.tsx
index e9ad032aa..ad0027ea2 100644
--- a/app/components/dialogs/MoveOrCopyFilesDialog.tsx
+++ b/app/components/dialogs/MoveOrCopyFilesDialog.tsx
@@ -34,7 +34,7 @@ import DialogContent from '@mui/material/DialogContent';
import DialogTitle from '@mui/material/DialogTitle';
import Typography from '@mui/material/Typography';
import Dialog from '@mui/material/Dialog';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import DraggablePaper from '-/components/DraggablePaper';
import i18n from '-/services/i18n';
diff --git a/app/components/dialogs/NewEntryDialog.tsx b/app/components/dialogs/NewEntryDialog.tsx
index cddb4c1a7..133f63afa 100644
--- a/app/components/dialogs/NewEntryDialog.tsx
+++ b/app/components/dialogs/NewEntryDialog.tsx
@@ -26,7 +26,7 @@ import { Accordion, AccordionDetails, AccordionSummary } from '@mui/material';
import DraggablePaper from '-/components/DraggablePaper';
import i18n from '-/services/i18n';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import { ExpandIcon } from '-/components/CommonIcons';
import CreateDirectory from '-/components/dialogs/components/CreateDirectory';
diff --git a/app/components/dialogs/NewFileDialog.tsx b/app/components/dialogs/NewFileDialog.tsx
index b57844236..aeaf3e01d 100644
--- a/app/components/dialogs/NewFileDialog.tsx
+++ b/app/components/dialogs/NewFileDialog.tsx
@@ -24,7 +24,7 @@ import Paper from '@mui/material/Paper';
import DraggablePaper from '-/components/DraggablePaper';
import i18n from '-/services/i18n';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import CreateFile from '-/components/dialogs/components/CreateFile';
import TargetPath from '-/components/dialogs/components/TargetPath';
diff --git a/app/components/dialogs/ObjectStoreForm.tsx b/app/components/dialogs/ObjectStoreForm.tsx
index 05c585e8b..6798cf67c 100644
--- a/app/components/dialogs/ObjectStoreForm.tsx
+++ b/app/components/dialogs/ObjectStoreForm.tsx
@@ -17,7 +17,6 @@
*/
import React from 'react';
-import withStyles from '@mui/styles/withStyles';
import Autocomplete from '@mui/material/Autocomplete';
import Grid from '@mui/material/Grid';
import FormControl from '@mui/material/FormControl';
@@ -78,8 +77,6 @@ export const regions = [
];
interface Props {
- classes: any;
- theme: any;
cloudErrorTextName: boolean;
cloudErrorTextPath: boolean;
cloudErrorAccessKey: boolean;
@@ -307,4 +304,4 @@ function ObjectStoreForm(props: Props) {
);
}
-export default withStyles(undefined, { withTheme: true })(ObjectStoreForm);
+export default ObjectStoreForm;
diff --git a/app/components/dialogs/OnboardingDialog.tsx b/app/components/dialogs/OnboardingDialog.tsx
index 7f9828fd5..86cbad76c 100644
--- a/app/components/dialogs/OnboardingDialog.tsx
+++ b/app/components/dialogs/OnboardingDialog.tsx
@@ -44,7 +44,7 @@ import {
} from '-/reducers/settings';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import Links from '-/content/links';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import { openURLExternally } from '-/services/utils-io';
import { AppDispatch } from '-/reducers/app';
diff --git a/app/components/dialogs/OpenLinkDialog.tsx b/app/components/dialogs/OpenLinkDialog.tsx
index 85e3da24a..f05579193 100644
--- a/app/components/dialogs/OpenLinkDialog.tsx
+++ b/app/components/dialogs/OpenLinkDialog.tsx
@@ -27,7 +27,7 @@ import InputAdornment from '@mui/material/InputAdornment';
import Dialog from '@mui/material/Dialog';
import i18n from '-/services/i18n';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
// import useMediaQuery from '@mui/material/useMediaQuery';
import InfoIcon from '-/components/InfoIcon';
diff --git a/app/components/dialogs/ProTeaserDialog.tsx b/app/components/dialogs/ProTeaserDialog.tsx
index d7dd34f3e..76369e3b0 100644
--- a/app/components/dialogs/ProTeaserDialog.tsx
+++ b/app/components/dialogs/ProTeaserDialog.tsx
@@ -27,7 +27,7 @@ import MobileStepper from '@mui/material/MobileStepper';
import Dialog from '@mui/material/Dialog';
import i18n from '-/services/i18n';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import { getProTeaserIndex } from '-/reducers/app';
import { useSelector } from 'react-redux';
diff --git a/app/components/dialogs/ResolveConflictDialog.tsx b/app/components/dialogs/ResolveConflictDialog.tsx
index 3ca7d461f..c79885b74 100644
--- a/app/components/dialogs/ResolveConflictDialog.tsx
+++ b/app/components/dialogs/ResolveConflictDialog.tsx
@@ -26,7 +26,7 @@ import Dialog from '@mui/material/Dialog';
import i18n from '-/services/i18n';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import useMediaQuery from '@mui/material/useMediaQuery';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import { OpenedEntry } from '-/reducers/app';
import {
extractContainingDirectoryPath,
diff --git a/app/components/dialogs/ThirdPartyLibsDialog.tsx b/app/components/dialogs/ThirdPartyLibsDialog.tsx
index ce3b80afb..2723e6d87 100644
--- a/app/components/dialogs/ThirdPartyLibsDialog.tsx
+++ b/app/components/dialogs/ThirdPartyLibsDialog.tsx
@@ -25,7 +25,7 @@ import Dialog from '@mui/material/Dialog';
import i18n from '-/services/i18n';
import ThirdPartyLibs from '-/third-party.txt';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
interface Props {
diff --git a/app/components/dialogs/components/CreateDirectory.tsx b/app/components/dialogs/components/CreateDirectory.tsx
index e53c9adc4..463d616ce 100644
--- a/app/components/dialogs/components/CreateDirectory.tsx
+++ b/app/components/dialogs/components/CreateDirectory.tsx
@@ -17,12 +17,12 @@
*/
import React, { useRef, useState } from 'react';
+import { styled } from '@mui/material/styles';
import { useDispatch } from 'react-redux';
import { saveAs } from 'file-saver';
import Button from '@mui/material/Button';
import ButtonGroup from '@mui/material/ButtonGroup';
import Grid from '@mui/material/Grid';
-import withStyles from '@mui/styles/withStyles';
import AppConfig from '-/AppConfig';
import i18n from '-/services/i18n';
import {
@@ -38,20 +38,25 @@ import TextField from '@mui/material/TextField';
import { useTargetPathContext } from '-/components/dialogs/hooks/useTargetPathContext';
import Typography from '@mui/material/Typography';
-const styles: any = () => ({
- createButton: {
+const PREFIX = 'CreateDirectory';
+
+const classes = {
+ createButton: `${PREFIX}-createButton`
+};
+
+const Root = styled('div')(() => ({
+ [`& .${classes.createButton}`]: {
width: '100%',
textAlign: 'center'
}
-});
+}));
interface Props {
- classes: any;
onClose: () => void;
}
function CreateDirectory(props: Props) {
- const { classes, onClose } = props;
+ const { onClose } = props;
const dispatch: AppDispatch = useDispatch();
const { targetDirectoryPath } = useTargetPathContext();
@@ -176,7 +181,7 @@ function CreateDirectory(props: Props) {
}
return (
- <>
+ <Root>
<Grid item xs={12}>
<Button
variant="outlined"
@@ -263,8 +268,8 @@ function CreateDirectory(props: Props) {
multiple
onChange={handleFileInputChange}
/>
- </>
+ </Root>
);
}
-export default withStyles(styles)(CreateDirectory);
+export default CreateDirectory;
diff --git a/app/components/dialogs/components/CreateFile.tsx b/app/components/dialogs/components/CreateFile.tsx
index 3e7b8796b..5b0a0563d 100644
--- a/app/components/dialogs/components/CreateFile.tsx
+++ b/app/components/dialogs/components/CreateFile.tsx
@@ -17,12 +17,12 @@
*/
import React, { useReducer, useRef, useState } from 'react';
+import { styled } from '@mui/material/styles';
import { useSelector, useDispatch } from 'react-redux';
import Button from '@mui/material/Button';
import ButtonGroup from '@mui/material/ButtonGroup';
import Typography from '@mui/material/Typography';
import Grid from '@mui/material/Grid';
-import withStyles from '@mui/styles/withStyles';
import { formatDateTime4Tag } from '@tagspaces/tagspaces-common/misc';
import AppConfig from '-/AppConfig';
import i18n from '-/services/i18n';
@@ -40,21 +40,26 @@ import { FormControl } from '@mui/material';
import { fileNameValidation } from '-/services/utils-io';
import { useTargetPathContext } from '-/components/dialogs/hooks/useTargetPathContext';
-const styles: any = () => ({
- createButton: {
+const PREFIX = 'CreateFile';
+
+const classes = {
+ createButton: `${PREFIX}-createButton`
+};
+
+const StyledGrid = styled(Grid)(() => ({
+ [`& .${classes.createButton}`]: {
width: '100%',
textAlign: 'center'
}
-});
+}));
interface Props {
//open: boolean;
- classes: any;
onClose: () => void;
}
function CreateFile(props: Props) {
- const { classes, onClose } = props;
+ const { onClose } = props;
const dispatch: AppDispatch = useDispatch();
const firstRWLocation = useSelector(getFirstRWLocation);
@@ -160,7 +165,7 @@ function CreateFile(props: Props) {
};
return (
- <Grid style={{ flexGrow: 1, width: '100%' }} container spacing={1}>
+ <StyledGrid style={{ flexGrow: 1, width: '100%' }} container spacing={1}>
<Grid item xs={12}>
<FormControl fullWidth={true} error={inputError}>
<TextField
@@ -241,8 +246,8 @@ function CreateFile(props: Props) {
</Button>
</ButtonGroup>
</Grid>
- </Grid>
+ </StyledGrid>
);
}
-export default withStyles(styles)(CreateFile);
+export default CreateFile;
diff --git a/app/components/dialogs/settings/SettingsAdvanced.tsx b/app/components/dialogs/settings/SettingsAdvanced.tsx
index 7da36168a..6bfdf3e73 100644
--- a/app/components/dialogs/settings/SettingsAdvanced.tsx
+++ b/app/components/dialogs/settings/SettingsAdvanced.tsx
@@ -18,7 +18,6 @@
import React, { useState } from 'react';
import { useSelector, useDispatch } from 'react-redux';
-import withStyles from '@mui/styles/withStyles';
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import ListItemText from '@mui/material/ListItemText';
@@ -49,33 +48,42 @@ import { DeleteIcon } from '-/components/CommonIcons';
import { ListItemIcon } from '@mui/material';
import ConfirmDialog from '-/components/dialogs/ConfirmDialog';
import { AppDispatch } from '-/reducers/app';
+import { styled } from '@mui/material/styles';
-const styles: any = {
- root: {
+const PREFIX = 'SettingsGeneral';
+
+const classes = {
+ root: `${PREFIX}-root`,
+ listItem: `${PREFIX}-listItem`,
+ pro: `${PREFIX}-pro`,
+ colorChooserButton: `${PREFIX}-colorChooserButton`
+};
+
+const Root = styled('div')(({ theme }) => ({
+ [`& .${classes.root}`]: {
overflowX: 'hidden'
},
- listItem: {
+ [`& .${classes.listItem}`]: {
paddingLeft: 0,
paddingRight: 0
},
- pro: {
+ [`& .${classes.pro}`]: {
backgroundColor: '#1DD19F'
},
- colorChooserButton: {
+ [`& .${classes.colorChooserButton}`]: {
minHeight: 30,
border: '1px solid lightgray'
}
-};
+}));
interface Props {
- classes: any;
showResetSettings: (showDialog: boolean) => void;
}
const historyKeys = Pro && Pro.history ? Pro.history.historyKeys : {};
function SettingsAdvanced(props: Props) {
- const { classes, showResetSettings } = props;
+ const { showResetSettings } = props;
const dispatch: AppDispatch = useDispatch();
const settings = useSelector(getSettings);
const tileServers: Array<TS.MapTileServer> = useSelector(getMapTileServers);
@@ -123,7 +131,7 @@ function SettingsAdvanced(props: Props) {
dispatch(SettingsActions.setPrefixTagContainer(prefix));
return (
- <div style={{ width: '100%' }}>
+ <Root style={{ width: '100%' }}>
<List className={classes.root}>
<ListItem className={classes.listItem}>
<Button
@@ -462,8 +470,8 @@ function SettingsAdvanced(props: Props) {
isDefault={tileServerDialog.isDefault}
/>
)}
- </div>
+ </Root>
);
}
-export default withStyles(styles, { withTheme: true })(SettingsAdvanced);
+export default SettingsAdvanced;
diff --git a/app/components/dialogs/settings/SettingsDialog.tsx b/app/components/dialogs/settings/SettingsDialog.tsx
index 4ea5350ea..7015e38b0 100644
--- a/app/components/dialogs/settings/SettingsDialog.tsx
+++ b/app/components/dialogs/settings/SettingsDialog.tsx
@@ -17,11 +17,11 @@
*/
import React, { useState, useEffect } from 'react';
+import { styled } from '@mui/material/styles';
import { useSelector } from 'react-redux';
import Button from '@mui/material/Button';
-import withStyles from '@mui/styles/withStyles';
import useMediaQuery from '@mui/material/useMediaQuery';
-import useTheme from '@mui/styles/useTheme';
+import { useTheme } from '@mui/material/styles';
import AppBar from '@mui/material/AppBar';
import Tabs from '@mui/material/Tabs';
import Tab from '@mui/material/Tab';
@@ -42,11 +42,17 @@ import Links from '-/content/links';
import SettingsExtensions from '-/components/dialogs/settings/SettingsExtensions';
import { openURLExternally } from '-/services/utils-io';
-const styles: any = () => ({
- mainContent: {
+const PREFIX = 'SettingsDialog';
+
+const classes = {
+ mainContent: `${PREFIX}-mainContent`
+};
+
+const StyledDialog = styled(Dialog)(() => ({
+ [`& .${classes.mainContent}`]: {
overflowY: 'auto'
}
-});
+}));
interface Props {
open: boolean;
@@ -106,7 +112,7 @@ function SettingsDialog(props: Props) {
);
const renderContent = () => (
- <DialogContent className={props.classes.mainContent}>
+ <DialogContent className={classes.mainContent}>
{isResetSettingsDialogOpened && (
<ConfirmDialog
open={isResetSettingsDialogOpened}
@@ -134,7 +140,7 @@ function SettingsDialog(props: Props) {
/>
)}
- <div data-tid="settingsDialog" className={props.classes.mainContent}>
+ <div data-tid="settingsDialog" className={classes.mainContent}>
{currentTab === 0 && <SettingsGeneral />}
{currentTab === 1 && <SettingsFileTypes />}
{currentTab === 2 && <SettingsKeyBindings />}
@@ -180,7 +186,7 @@ function SettingsDialog(props: Props) {
const theme = useTheme();
const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
- <Dialog
+ <StyledDialog
fullScreen={fullScreen}
open={open}
keepMounted
@@ -190,8 +196,8 @@ function SettingsDialog(props: Props) {
{renderTitle()}
{renderContent()}
{renderActions()}
- </Dialog>
+ </StyledDialog>
);
}
-export default withStyles(styles)(SettingsDialog);
+export default SettingsDialog;
diff --git a/app/components/dialogs/settings/SettingsFileTypes.tsx b/app/components/dialogs/settings/SettingsFileTypes.tsx
index d93d64f32..f4e314172 100644
--- a/app/components/dialogs/settings/SettingsFileTypes.tsx
+++ b/app/components/dialogs/settings/SettingsFileTypes.tsx
@@ -17,9 +17,9 @@
*/
import React, { useState, useEffect, useRef, useReducer } from 'react';
+import { styled } from '@mui/material/styles';
import { useSelector, useDispatch } from 'react-redux';
import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
-import withStyles from '@mui/styles/withStyles';
import MenuItem from '@mui/material/MenuItem';
import Input from '@mui/material/Input';
import FormControl from '@mui/material/FormControl';
@@ -55,29 +55,35 @@ import { AppDispatch, getExtensions } from '-/reducers/app';
import { supportedFileTypes as defaultSupportedFileTypes } from '-/extension-config';
import useFirstRender from '-/utils/useFirstRender';
-const styles: any = (theme: any) => ({
- fileTypeColorDialog: {
+const PREFIX = 'SettingsFileTypes';
+
+const classes = {
+ fileTypeColorDialog: `${PREFIX}-fileTypeColorDialog`,
+ colorChooserButton: `${PREFIX}-colorChooserButton`,
+ fileExtRemove: `${PREFIX}-fileExtRemove`
+};
+
+const Root = styled('div')(({ theme: any }) => ({
+ [`& .${classes.fileTypeColorDialog}`]: {
width: 60,
padding: '0 12px 0 0'
},
- colorChooserButton: {
+
+ [`& .${classes.colorChooserButton}`]: {
maxWidth: 30,
width: 30,
border: '1px solid lightgray'
},
- fileExtRemove: {
+
+ [`& .${classes.fileExtRemove}`]: {
height: '38px',
cursor: 'pointer',
marginLeft: 10,
padding: '0'
}
-});
+}));
-interface Props {
- classes: any;
-}
-
-function SettingsFileTypes(props: Props) {
+function SettingsFileTypes() {
const supportedFileTypes = useSelector(getSupportedFileTypes);
const items = useRef<Array<TS.FileTypes>>(supportedFileTypes);
const selectedItem = useRef<TS.FileTypes>(undefined);
@@ -233,8 +239,6 @@ function SettingsFileTypes(props: Props) {
const sanitizeFileTypeInput = fileTypeInput =>
fileTypeInput.replace(/[^a-zA-Z0-9 ]/g, '');
- const { classes } = props;
-
interface ColumnData {
dataKey: keyof TS.FileTypes;
label: string;
@@ -439,7 +443,7 @@ function SettingsFileTypes(props: Props) {
}}
>
&nbsp;
- <div style={styles.color} />
+ <div />
</Button>
</Tooltip>
</TransparentBackground>
@@ -459,7 +463,7 @@ function SettingsFileTypes(props: Props) {
}
return (
- <>
+ <Root>
<Paper
style={{
height: 600,
@@ -523,15 +527,14 @@ function SettingsFileTypes(props: Props) {
ref={settingsFileTypeRef}
/>
</Paper>
-
<ColorPickerDialog
open={isColorPickerVisible}
setColor={handleChangeColor}
onClose={closeColorPicker}
color={selectedItem.current && selectedItem.current.color}
/>
- </>
+ </Root>
);
}
-export default withStyles(styles)(SettingsFileTypes);
+export default SettingsFileTypes;
diff --git a/app/components/dialogs/settings/SettingsGeneral.tsx b/app/components/dialogs/settings/SettingsGeneral.tsx
index 80f4fbba7..badf5dbe5 100644
--- a/app/components/dialogs/settings/SettingsGeneral.tsx
+++ b/app/components/dialogs/settings/SettingsGeneral.tsx
@@ -18,7 +18,6 @@
import React, { useState } from 'react';
import { useSelector, useDispatch } from 'react-redux';
-import withStyles from '@mui/styles/withStyles';
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import ListItemText from '@mui/material/ListItemText';
@@ -49,29 +48,35 @@ import { BetaLabel } from '-/components/HelperComponents';
import PlatformIO from '-/services/platform-facade';
import { PerspectiveIDs } from '-/perspectives';
import { AppDispatch } from '-/reducers/app';
+import { styled } from '@mui/material/styles';
-const styles: any = {
- root: {
+const PREFIX = 'SettingsGeneral';
+
+const classes = {
+ root: `${PREFIX}-root`,
+ listItem: `${PREFIX}-listItem`,
+ pro: `${PREFIX}-pro`,
+ colorChooserButton: `${PREFIX}-colorChooserButton`
+};
+
+const Root = styled('div')(({ theme }) => ({
+ [`& .${classes.root}`]: {
overflowX: 'hidden'
},
- listItem: {
+ [`& .${classes.listItem}`]: {
paddingLeft: 0,
paddingRight: 0
},
- pro: {
+ [`& .${classes.pro}`]: {
backgroundColor: '#1DD19F'
},
- colorChooserButton: {
+ [`& .${classes.colorChooserButton}`]: {
minHeight: 30,
border: '1px solid lightgray'
}
-};
+}));
-interface Props {
- classes: any;
-}
-
-function SettingsGeneral(props: Props) {
+function SettingsGeneral() {
const [displayColorPicker, setDisplayColorPicker] = useState<boolean>(false);
const [displayTextColorPicker, setDisplayTextColorPicker] = useState<boolean>(
false
@@ -111,296 +116,297 @@ function SettingsGeneral(props: Props) {
defaultPerspective = settings.defaultPerspective;
}
- const { classes } = props;
-
return (
- <List className={classes.root}>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:interfaceLanguage')} />
- <Select
- data-tid="settingsSetLanguage"
- value={settings.interfaceLanguage}
- onChange={(event: any) => {
- dispatch(SettingsActions.setLanguage(event.target.value));
- PlatformIO.setLanguage(event.target.value);
- }}
- input={<Input id="languageSelector" />}
- >
- {settings.supportedLanguages.map(language => (
- <MenuItem key={language.iso} value={language.iso}>
- {language.title}
- </MenuItem>
- ))}
- </Select>
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:themeSelector')} />
- <Select
- data-tid="settingsSetCurrentTheme"
- value={settings.currentTheme}
- onChange={(event: any) =>
- dispatch(SettingsActions.setCurrentTheme(event.target.value))
- }
- input={<Input id="themeSelector" />}
- >
- {settings.supportedThemes.map(theme => (
- <MenuItem key={theme} value={theme}>
- {theme === 'light' && i18n.t('core:regularScheme')}
- {theme === 'dark' && i18n.t('core:darkScheme')}
- {theme === 'system' && i18n.t('core:systemScheme')}
- </MenuItem>
- ))}
- </Select>
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:themeRegularSelector')} />
- <Select
- data-tid="settingsCurrentRegularThemeTID"
- value={settings.currentRegularTheme}
- onChange={(event: any) =>
- dispatch(SettingsActions.setCurrentRegularTheme(event.target.value))
- }
- input={<Input id="themeRegularSelector" />}
- >
- {settings.supportedRegularThemes.map(theme => (
- <MenuItem key={theme} value={theme}>
- {theme.charAt(0).toUpperCase() + theme.slice(1)}
- </MenuItem>
- ))}
- </Select>
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:themeDarkSelector')} />
- <Select
- data-tid="settingsCurrentDarkThemeTID"
- value={settings.currentDarkTheme}
- onChange={(event: any) =>
- dispatch(SettingsActions.setCurrentDarkTheme(event.target.value))
+ <Root>
+ <List className={classes.root}>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:interfaceLanguage')} />
+ <Select
+ data-tid="settingsSetLanguage"
+ value={settings.interfaceLanguage}
+ onChange={(event: any) => {
+ dispatch(SettingsActions.setLanguage(event.target.value));
+ PlatformIO.setLanguage(event.target.value);
+ }}
+ input={<Input id="languageSelector" />}
+ >
+ {settings.supportedLanguages.map(language => (
+ <MenuItem key={language.iso} value={language.iso}>
+ {language.title}
+ </MenuItem>
+ ))}
+ </Select>
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:themeSelector')} />
+ <Select
+ data-tid="settingsSetCurrentTheme"
+ value={settings.currentTheme}
+ onChange={(event: any) =>
+ dispatch(SettingsActions.setCurrentTheme(event.target.value))
+ }
+ input={<Input id="themeSelector" />}
+ >
+ {settings.supportedThemes.map(theme => (
+ <MenuItem key={theme} value={theme}>
+ {theme === 'light' && i18n.t('core:regularScheme')}
+ {theme === 'dark' && i18n.t('core:darkScheme')}
+ {theme === 'system' && i18n.t('core:systemScheme')}
+ </MenuItem>
+ ))}
+ </Select>
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:themeRegularSelector')} />
+ <Select
+ data-tid="settingsCurrentRegularThemeTID"
+ value={settings.currentRegularTheme}
+ onChange={(event: any) =>
+ dispatch(
+ SettingsActions.setCurrentRegularTheme(event.target.value)
+ )
+ }
+ input={<Input id="themeRegularSelector" />}
+ >
+ {settings.supportedRegularThemes.map(theme => (
+ <MenuItem key={theme} value={theme}>
+ {theme.charAt(0).toUpperCase() + theme.slice(1)}
+ </MenuItem>
+ ))}
+ </Select>
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:themeDarkSelector')} />
+ <Select
+ data-tid="settingsCurrentDarkThemeTID"
+ value={settings.currentDarkTheme}
+ onChange={(event: any) =>
+ dispatch(SettingsActions.setCurrentDarkTheme(event.target.value))
+ }
+ input={<Input id="themeDarkSelector" />}
+ >
+ {settings.supportedDarkThemes.map(theme => (
+ <MenuItem key={theme} value={theme}>
+ {theme.charAt(0).toUpperCase() + theme.slice(1)}
+ </MenuItem>
+ ))}
+ </Select>
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('Default Perspective')} />
+ <PerspectiveSelector
+ language={language}
+ onChange={changePerspective}
+ defaultValue={defaultPerspective}
+ testId="changePerspectiveInSettingsTID"
+ />
+ </ListItem>
+ <ListItem
+ className={classes.listItem}
+ title={
+ AppConfig.useSidecarsForFileTaggingDisableSetting
+ ? i18n.t('core:settingExternallyConfigured')
+ : ''
}
- input={<Input id="themeDarkSelector" />}
>
- {settings.supportedDarkThemes.map(theme => (
- <MenuItem key={theme} value={theme}>
- {theme.charAt(0).toUpperCase() + theme.slice(1)}
- </MenuItem>
- ))}
- </Select>
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('Default Perspective')} />
- <PerspectiveSelector
- language={language}
- onChange={changePerspective}
- defaultValue={defaultPerspective}
- testId="changePerspectiveInSettingsTID"
- />
- </ListItem>
- <ListItem
- className={classes.listItem}
- title={
- AppConfig.useSidecarsForFileTaggingDisableSetting
- ? i18n.t('core:settingExternallyConfigured')
- : ''
- }
- >
- <ListItemText primary={i18n.t('core:fileTaggingSetting')} />
- {AppConfig.useSidecarsForFileTaggingDisableSetting ? (
- <Button size="small" variant="outlined" disabled>
- {persistTagsInSidecarFile
- ? i18n.t('core:useSidecarFile')
- : i18n.t('core:renameFile')}
- </Button>
- ) : (
- <ToggleButtonGroup
- value={persistTagsInSidecarFile}
- size="small"
- exclusive
- >
- <ToggleButton
- value={false}
- data-tid="settingsSetPersistTagsInFileName"
- onClick={() =>
- dispatch(SettingsActions.setPersistTagsInSidecarFile(false))
- }
+ <ListItemText primary={i18n.t('core:fileTaggingSetting')} />
+ {AppConfig.useSidecarsForFileTaggingDisableSetting ? (
+ <Button size="small" variant="outlined" disabled>
+ {persistTagsInSidecarFile
+ ? i18n.t('core:useSidecarFile')
+ : i18n.t('core:renameFile')}
+ </Button>
+ ) : (
+ <ToggleButtonGroup
+ value={persistTagsInSidecarFile}
+ size="small"
+ exclusive
>
- <Tooltip
- title={
- <Typography color="inherit">
- {i18n.t('core:tagsInFilenameExplanation')}
- </Typography>
+ <ToggleButton
+ value={false}
+ data-tid="settingsSetPersistTagsInFileName"
+ onClick={() =>
+ dispatch(SettingsActions.setPersistTagsInSidecarFile(false))
}
>
- <div style={{ display: 'flex' }}>
- {!persistTagsInSidecarFile && <CheckIcon />}
- &nbsp;{i18n.t('core:renameFile')}&nbsp;&nbsp;
- <InfoMuiIcon />
- </div>
- </Tooltip>
- </ToggleButton>
- <ToggleButton
- value={true}
- data-tid="settingsSetPersistTagsInSidecarFile"
- onClick={() =>
- dispatch(SettingsActions.setPersistTagsInSidecarFile(true))
- }
- >
- <Tooltip
- title={
- <Typography color="inherit">
- {i18n.t('core:tagsInSidecarFileExplanation')}
- </Typography>
+ <Tooltip
+ title={
+ <Typography color="inherit">
+ {i18n.t('core:tagsInFilenameExplanation')}
+ </Typography>
+ }
+ >
+ <div style={{ display: 'flex' }}>
+ {!persistTagsInSidecarFile && <CheckIcon />}
+ &nbsp;{i18n.t('core:renameFile')}&nbsp;&nbsp;
+ <InfoMuiIcon />
+ </div>
+ </Tooltip>
+ </ToggleButton>
+ <ToggleButton
+ value={true}
+ data-tid="settingsSetPersistTagsInSidecarFile"
+ onClick={() =>
+ dispatch(SettingsActions.setPersistTagsInSidecarFile(true))
}
>
- <div style={{ display: 'flex' }}>
- {persistTagsInSidecarFile && <CheckIcon />}
- &nbsp;{i18n.t('core:useSidecarFile')}&nbsp;&nbsp;
- <InfoMuiIcon />
- </div>
- </Tooltip>
- </ToggleButton>
- </ToggleButtonGroup>
- )}
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:checkForNewVersionOnStartup')} />
- <Switch
- data-tid="settingsSetCheckForUpdates"
- onClick={() =>
- dispatch(
- SettingsActions.setCheckForUpdates(!settings.checkForUpdates)
- )
- }
- checked={settings.checkForUpdates}
- />
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText
- primary={
- <>
- {i18n.t('core:reorderTags')}
- <BetaLabel />
- </>
- }
- />
- <Switch
- data-tid="reorderTagsTID"
- onClick={() =>
- dispatch(SettingsActions.reorderTags(!settings.reorderTags))
- }
- checked={settings.reorderTags}
- />
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:addTagsToLibrary')} />
- <Switch
- data-tid="settingsSetAddTagsToLibrary"
- onClick={() =>
- dispatch(
- SettingsActions.setAddTagsToLibrary(!settings.addTagsToLibrary)
- )
- }
- checked={settings.addTagsToLibrary}
- />
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:useGenerateThumbnails')} />
- <Switch
- disabled={AppConfig.useGenerateThumbnails !== undefined}
- data-tid="settingsUseGenerateThumbnails"
- onClick={() =>
- dispatch(
- SettingsActions.setUseGenerateThumbnails(
- !settings.useGenerateThumbnails
+ <Tooltip
+ title={
+ <Typography color="inherit">
+ {i18n.t('core:tagsInSidecarFileExplanation')}
+ </Typography>
+ }
+ >
+ <div style={{ display: 'flex' }}>
+ {persistTagsInSidecarFile && <CheckIcon />}
+ &nbsp;{i18n.t('core:useSidecarFile')}&nbsp;&nbsp;
+ <InfoMuiIcon />
+ </div>
+ </Tooltip>
+ </ToggleButton>
+ </ToggleButtonGroup>
+ )}
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:checkForNewVersionOnStartup')} />
+ <Switch
+ data-tid="settingsSetCheckForUpdates"
+ onClick={() =>
+ dispatch(
+ SettingsActions.setCheckForUpdates(!settings.checkForUpdates)
)
- )
- }
- checked={
- AppConfig.useGenerateThumbnails !== undefined
- ? AppConfig.useGenerateThumbnails
- : settings.useGenerateThumbnails
- }
- />
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:tagBackgroundColor')} />
- <TransparentBackground>
- <Button
- data-tid="settingsToggleDefaultTagBackgroundColor"
- className={classes.colorChooserButton}
- size="small"
- style={{
- backgroundColor: settings.tagBackgroundColor
- }}
- onClick={toggleDefaultTagBackgroundColorPicker}
- >
- &nbsp;
- </Button>
- </TransparentBackground>
- {displayColorPicker && (
- <ColorPickerDialog
- open={displayColorPicker}
- setColor={color => {
- dispatch(SettingsActions.setTagColor(color));
- }}
- onClose={toggleDefaultTagBackgroundColorPicker}
- color={settings.tagBackgroundColor}
- />
- )}
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:tagForegroundColor')} />
- <TransparentBackground>
- <Button
- data-tid="settingsToggleDefaultTagForegroundColor"
- className={classes.colorChooserButton}
- size="small"
- style={{ backgroundColor: settings.tagTextColor }}
- onClick={toggleDefaultTagTextColorPicker}
- >
- &nbsp;
- </Button>
- </TransparentBackground>
- {displayTextColorPicker && (
- <ColorPickerDialog
- open={displayTextColorPicker}
- setColor={color => {
- dispatch(SettingsActions.setTagTextColor(color));
- }}
- onClose={toggleDefaultTagTextColorPicker}
- color={settings.tagTextColor}
+ }
+ checked={settings.checkForUpdates}
/>
- )}
- </ListItem>
- {AppConfig.isElectron && (
+ </ListItem>
<ListItem className={classes.listItem}>
<ListItemText
primary={
- <Typography>
- {i18n.t('core:useTrashCan')}
- <InfoIcon tooltip={i18n.t('core:useTrashCanInfo')} />
- </Typography>
+ <>
+ {i18n.t('core:reorderTags')}
+ <BetaLabel />
+ </>
}
/>
<Switch
- data-tid="settingsSetUseTrashCan"
+ data-tid="reorderTagsTID"
onClick={() =>
- dispatch(SettingsActions.setUseTrashCan(!settings.useTrashCan))
+ dispatch(SettingsActions.reorderTags(!settings.reorderTags))
}
- checked={settings.useTrashCan}
+ checked={settings.reorderTags}
/>
</ListItem>
- )}
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:showUnixHiddenFiles')} />
- <Switch
- data-tid="settingsSetShowUnixHiddenEntries"
- onClick={() =>
- dispatch(SettingsActions.toggleShowUnixHiddenEntries())
- }
- checked={settings.showUnixHiddenEntries}
- />
- </ListItem>
- {/* <ListItem className={classes.listItem}>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:addTagsToLibrary')} />
+ <Switch
+ data-tid="settingsSetAddTagsToLibrary"
+ onClick={() =>
+ dispatch(
+ SettingsActions.setAddTagsToLibrary(!settings.addTagsToLibrary)
+ )
+ }
+ checked={settings.addTagsToLibrary}
+ />
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:useGenerateThumbnails')} />
+ <Switch
+ disabled={AppConfig.useGenerateThumbnails !== undefined}
+ data-tid="settingsUseGenerateThumbnails"
+ onClick={() =>
+ dispatch(
+ SettingsActions.setUseGenerateThumbnails(
+ !settings.useGenerateThumbnails
+ )
+ )
+ }
+ checked={
+ AppConfig.useGenerateThumbnails !== undefined
+ ? AppConfig.useGenerateThumbnails
+ : settings.useGenerateThumbnails
+ }
+ />
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:tagBackgroundColor')} />
+ <TransparentBackground>
+ <Button
+ data-tid="settingsToggleDefaultTagBackgroundColor"
+ className={classes.colorChooserButton}
+ size="small"
+ style={{
+ backgroundColor: settings.tagBackgroundColor
+ }}
+ onClick={toggleDefaultTagBackgroundColorPicker}
+ >
+ &nbsp;
+ </Button>
+ </TransparentBackground>
+ {displayColorPicker && (
+ <ColorPickerDialog
+ open={displayColorPicker}
+ setColor={color => {
+ dispatch(SettingsActions.setTagColor(color));
+ }}
+ onClose={toggleDefaultTagBackgroundColorPicker}
+ color={settings.tagBackgroundColor}
+ />
+ )}
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:tagForegroundColor')} />
+ <TransparentBackground>
+ <Button
+ data-tid="settingsToggleDefaultTagForegroundColor"
+ className={classes.colorChooserButton}
+ size="small"
+ style={{ backgroundColor: settings.tagTextColor }}
+ onClick={toggleDefaultTagTextColorPicker}
+ >
+ &nbsp;
+ </Button>
+ </TransparentBackground>
+ {displayTextColorPicker && (
+ <ColorPickerDialog
+ open={displayTextColorPicker}
+ setColor={color => {
+ dispatch(SettingsActions.setTagTextColor(color));
+ }}
+ onClose={toggleDefaultTagTextColorPicker}
+ color={settings.tagTextColor}
+ />
+ )}
+ </ListItem>
+ {AppConfig.isElectron && (
+ <ListItem className={classes.listItem}>
+ <ListItemText
+ primary={
+ <Typography>
+ {i18n.t('core:useTrashCan')}
+ <InfoIcon tooltip={i18n.t('core:useTrashCanInfo')} />
+ </Typography>
+ }
+ />
+ <Switch
+ data-tid="settingsSetUseTrashCan"
+ onClick={() =>
+ dispatch(SettingsActions.setUseTrashCan(!settings.useTrashCan))
+ }
+ checked={settings.useTrashCan}
+ />
+ </ListItem>
+ )}
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:showUnixHiddenFiles')} />
+ <Switch
+ data-tid="settingsSetShowUnixHiddenEntries"
+ onClick={() =>
+ dispatch(SettingsActions.toggleShowUnixHiddenEntries())
+ }
+ checked={settings.showUnixHiddenEntries}
+ />
+ </ListItem>
+ {/* <ListItem className={classes.listItem}>
<ListItemText style={{ maxWidth: '300px' }} primary={i18n.t('core:tagDelimiterChoose')} />
<Select
style={{ minWidth: '170px' }}
@@ -417,18 +423,19 @@ function SettingsGeneral(props: Props) {
<MenuItem value=",">{i18n.t('core:tagDelimiterComma')}</MenuItem>
</Select>
</ListItem> */}
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:maxSearchResultChoose')} />
- <Input
- style={{ maxWidth: '100px' }}
- type="number"
- data-tid="settingsMaxSearchResult"
- value={settings.maxSearchResult}
- onChange={handleMaxSearchResult}
- />
- </ListItem>
- </List>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:maxSearchResultChoose')} />
+ <Input
+ style={{ maxWidth: '100px' }}
+ type="number"
+ data-tid="settingsMaxSearchResult"
+ value={settings.maxSearchResult}
+ onChange={handleMaxSearchResult}
+ />
+ </ListItem>
+ </List>
+ </Root>
);
}
-export default withStyles(styles, { withTheme: true })(SettingsGeneral);
+export default SettingsGeneral;
diff --git a/app/components/dialogs/settings/SettingsKeyBindings.tsx b/app/components/dialogs/settings/SettingsKeyBindings.tsx
index 9fa49ab9f..c538ae0e4 100644
--- a/app/components/dialogs/settings/SettingsKeyBindings.tsx
+++ b/app/components/dialogs/settings/SettingsKeyBindings.tsx
@@ -17,8 +17,8 @@
*/
import React from 'react';
+import { styled } from '@mui/material/styles';
import { useSelector, useDispatch } from 'react-redux';
-import withStyles from '@mui/styles/withStyles';
import TextField from '@mui/material/TextField';
import Switch from '@mui/material/Switch';
import ListItem from '@mui/material/ListItem';
@@ -34,18 +34,20 @@ import {
import DefaultSettings from '-/reducers/settings-default';
import { AppDispatch } from '-/reducers/app';
-const styles: any = (theme: any) => ({
- keyBinding: {
+const PREFIX = 'SettingsKeyBindings';
+
+const classes = {
+ keyBinding: `${PREFIX}-keyBinding`
+};
+
+const Root = styled('form')(({ theme }) => ({
+ [`& .${classes.keyBinding}`]: {
marginTop: 10,
marginBottom: 10
}
-});
+}));
-interface Props {
- classes: any;
-}
-function SettingsKeyBindings(props: Props) {
- const { classes } = props;
+function SettingsKeyBindings() {
const keyBindings = useSelector(getKeyBindings);
const globalKeyBindingEnabled = useSelector(isGlobalKeyBindingEnabled);
const dispatch: AppDispatch = useDispatch();
@@ -60,7 +62,7 @@ function SettingsKeyBindings(props: Props) {
};
return (
- <form className={classes.root} noValidate autoComplete="off">
+ <Root className={classes.keyBinding} noValidate autoComplete="off">
<ListItem style={{ paddingLeft: 0, paddingRight: 0 }}>
<ListItemText primary={i18n.t('core:enableGlobalKeyboardShortcuts')} />
<Switch
@@ -90,8 +92,8 @@ function SettingsKeyBindings(props: Props) {
/>
);
})}
- </form>
+ </Root>
);
}
-export default withStyles(styles)(SettingsKeyBindings);
+export default SettingsKeyBindings;
diff --git a/app/components/menus/LocationMenu.tsx b/app/components/menus/LocationMenu.tsx
index f55710f30..edaeaa291 100644
--- a/app/components/menus/LocationMenu.tsx
+++ b/app/components/menus/LocationMenu.tsx
@@ -25,7 +25,6 @@ import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
import ListSubHeader from '@mui/material/ListSubheader';
import Tooltip from '-/components/Tooltip';
-import withTheme from '@mui/styles/withTheme';
import IconButton from '@mui/material/IconButton';
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
import { locationType } from '@tagspaces/tagspaces-common/misc';
@@ -37,13 +36,14 @@ import {
getCurrentLocationId
} from '-/reducers/app';
import { TS } from '-/tagspaces.namespace';
+import { useTheme } from '@mui/material/styles';
interface Props {
- theme: any;
menuAnchorEl?: Element;
}
function LocationMenu(props: Props) {
+ const theme = useTheme();
const dispatch: AppDispatch = useDispatch();
const locations: Array<TS.Location> = useSelector(getLocations);
const currentLocationId: string | null = useSelector(getCurrentLocationId);
@@ -59,7 +59,6 @@ function LocationMenu(props: Props) {
);
}
- const { theme } = props;
const locationIcon =
currentLocation && currentLocation.type === locationType.TYPE_CLOUD ? (
<CloudLocationIcon />
@@ -145,4 +144,4 @@ function LocationMenu(props: Props) {
);
}
-export default withTheme(LocationMenu);
+export default LocationMenu;
diff --git a/app/containers/App.tsx b/app/containers/App.tsx
index 35fa6ba06..965ddba8f 100644
--- a/app/containers/App.tsx
+++ b/app/containers/App.tsx
@@ -22,7 +22,6 @@ import { I18nextProvider } from 'react-i18next'; // as we build ourself via webp
import {
createTheme,
ThemeProvider,
- Theme,
StyledEngineProvider
} from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
@@ -34,9 +33,10 @@ import {
getDefaultDarkTheme
} from '-/reducers/settings';
-declare module '@mui/styles/defaultTheme' {
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
- interface DefaultTheme extends Theme {}
+declare module '@mui/material/styles' {
+ interface Theme extends Record<string, any> {
+ // Any additional properties or overrides
+ }
}
const legacyTheme = createTheme({
diff --git a/app/containers/MainPage.tsx b/app/containers/MainPage.tsx
index 306f51ed5..6f576b907 100644
--- a/app/containers/MainPage.tsx
+++ b/app/containers/MainPage.tsx
@@ -20,7 +20,6 @@ import React, { useEffect, useReducer, useRef, useState } from 'react';
import clsx from 'clsx';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
-import withStyles from '@mui/styles/withStyles';
import { translate } from 'react-i18next';
import SwipeableDrawer from '@mui/material/SwipeableDrawer';
import Drawer from '@mui/material/Drawer';
@@ -93,6 +92,7 @@ import MoveOrCopyFilesDialog from '-/components/dialogs/MoveOrCopyFilesDialog';
import PlatformIO from '-/services/platform-facade';
import { Pro } from '-/pro';
import NewFileDialog from '-/components/dialogs/NewFileDialog';
+import { styled, useTheme } from '@mui/material/styles';
const drawerWidth = 320;
const body = document.getElementsByTagName('body')[0];
@@ -103,8 +103,15 @@ const bufferedLeftSplitResize = buffer({
const KanBanImportDialog = Pro && Pro.UI ? Pro.UI.KanBanImportDialog : false;
-const styles: any = (theme: any) => ({
- content: {
+const PREFIX = 'MainPage';
+
+const classes = {
+ content: `${PREFIX}-content`,
+ contentShift: `${PREFIX}-contentShift`
+};
+
+const Root = styled('div')(({ theme }) => ({
+ [`& .${classes.content}`]: {
height: '100%',
flexGrow: 1,
padding: 0,
@@ -114,7 +121,7 @@ const styles: any = (theme: any) => ({
duration: theme.transitions.duration.leavingScreen
})
},
- contentShift: {
+ [`& .${classes.contentShift}`]: {
height: '100%',
padding: 0,
transition: theme.transitions.create('margin', {
@@ -123,7 +130,7 @@ const styles: any = (theme: any) => ({
}),
marginLeft: 0
}
-});
+}));
interface Props {
isFirstRun: boolean;
@@ -133,8 +140,6 @@ interface Props {
isGeneratingThumbs: boolean;
// setGeneratingThumbnails: (isGenerating: boolean) => void;
isEntryInFullWidth: boolean;
- classes: any;
- theme: any;
isReadOnlyMode: boolean;
isSettingsDialogOpened: boolean;
isNewEntryDialogOpened: boolean;
@@ -341,6 +346,7 @@ function ProTeaserDialogAsync(props) {
}
function MainPage(props: Props) {
+ const theme = useTheme();
const percent = useRef<number | undefined>(undefined);
const [ignored, forceUpdate] = useReducer(x => x + 1, 0);
@@ -576,7 +582,6 @@ function MainPage(props: Props) {
};
const {
- theme,
toggleOnboardingDialog,
toggleSettingsDialog,
toggleKeysDialog,
@@ -597,8 +602,7 @@ function MainPage(props: Props) {
directoryPath,
mainSplitSize,
openedFiles,
- openLink,
- classes
+ openLink
} = props;
const { FILE } = NativeTypes;
@@ -674,180 +678,181 @@ function MainPage(props: Props) {
};
return (
- <HotKeys
- handlers={keyBindingHandlers}
- keyMap={keyMap}
- style={{ height: '100%' }}
- >
- <MoveOrCopyFilesDialog
- open={moveCopyDialogOpened !== undefined}
- onClose={() => {
- setMoveCopyDialogOpened(undefined);
- }}
- selectedFiles={moveCopyDialogOpened}
- handleMoveFiles={files => {
- handleMoveCopyFiles(files, true);
- setMoveCopyDialogOpened(undefined);
- }}
- handleCopyFiles={files => {
- handleMoveCopyFiles(files, false);
- setMoveCopyDialogOpened(undefined);
- }}
- />
- {props.isLocationDialogOpened && (
- <CreateEditLocationDialogAsync
- open={props.isLocationDialogOpened}
- onClose={toggleLocationDialog}
- />
- )}
- {props.isAboutDialogOpened && (
- <AboutDialogAsync
- open={props.isAboutDialogOpened}
- toggleLicenseDialog={toggleLicenseDialog}
- toggleThirdPartyLibsDialog={toggleThirdPartyLibsDialog}
- onClose={toggleAboutDialog}
- />
- )}
- {props.isKeysDialogOpened && (
- <KeyboardDialogAsync
- open={props.isKeysDialogOpened}
- onClose={toggleKeysDialog}
- />
- )}
- {props.isLicenseDialogOpened && (
- <LicenseDialogAsync
- open={props.isLicenseDialogOpened}
- onClose={(event, reason) => {
- if (reason === 'backdropClick' || reason === 'escapeKeyDown') {
- return true;
- }
- setFirstRun(false);
- toggleLicenseDialog();
+ <Root>
+ <HotKeys
+ handlers={keyBindingHandlers}
+ keyMap={keyMap}
+ style={{ height: '100%' }}
+ >
+ <MoveOrCopyFilesDialog
+ open={moveCopyDialogOpened !== undefined}
+ onClose={() => {
+ setMoveCopyDialogOpened(undefined);
+ }}
+ selectedFiles={moveCopyDialogOpened}
+ handleMoveFiles={files => {
+ handleMoveCopyFiles(files, true);
+ setMoveCopyDialogOpened(undefined);
+ }}
+ handleCopyFiles={files => {
+ handleMoveCopyFiles(files, false);
+ setMoveCopyDialogOpened(undefined);
}}
/>
- )}
- {props.isOnboardingDialogOpened && (
- <OnboardingDialogAsync
- open={props.isOnboardingDialogOpened}
- onClose={toggleOnboardingDialog}
- />
- )}
- {props.isThirdPartyLibsDialogOpened && (
- <ThirdPartyLibsDialogAsync
- open={props.isThirdPartyLibsDialogOpened}
- onClose={toggleThirdPartyLibsDialog}
- />
- )}
- {props.isEditTagDialogOpened && (
- <EditEntryTagDialogAsync
- open={props.isEditTagDialogOpened}
- onClose={() => toggleEditTagDialog(undefined)}
- />
- )}
- {props.isOpenLinkDialogOpened && (
- <OpenLinkDialogAsync
- open={props.isOpenLinkDialogOpened}
- onClose={toggleOpenLinkDialog}
- openLink={openLink}
- />
- )}
- {props.isProTeaserVisible && (
- <ProTeaserDialogAsync
- open={props.isProTeaserVisible}
- onClose={toggleProTeaser}
- />
- )}
- {props.isUploadProgressDialogOpened !== undefined && (
- <FileUploadDialog
- open={true}
- onClose={toggleUploadDialog}
- title={props.isUploadProgressDialogOpened}
- />
- )}
- {props.isProgressDialogOpened && (
- <ProgressDialog
- open={props.isProgressDialogOpened}
- onClose={toggleProgressDialog}
- />
- )}
- {props.isCreateDirectoryOpened !== null && (
- <CreateDirectoryDialog
- open={true}
- onClose={toggleCreateDirectoryDialog}
- selectedDirectoryPath={
- props.isCreateDirectoryOpened &&
- props.isCreateDirectoryOpened.rootDirPath
- ? props.isCreateDirectoryOpened.rootDirPath
- : directoryPath
- }
- callback={props.isCreateDirectoryOpened?.callback}
- reflect={props.isCreateDirectoryOpened?.reflect}
- />
- )}
- {props.isNewEntryDialogOpened && (
- <NewEntryDialog
- open={props.isNewEntryDialogOpened}
- onClose={toggleNewEntryDialog}
- />
- )}
- {props.isNewFileDialogOpened && (
- <NewFileDialog
- open={props.isNewFileDialogOpened}
- onClose={toggleNewFileDialog}
- />
- )}
- <SettingsDialog
- open={props.isSettingsDialogOpened}
- onClose={toggleSettingsDialog}
- />
- {KanBanImportDialog && props.selectedEntries[0] && (
- <KanBanImportDialog
- open={props.isImportKanBanDialogOpened}
- onClose={props.toggleImportKanBanDialog}
+ {props.isLocationDialogOpened && (
+ <CreateEditLocationDialogAsync
+ open={props.isLocationDialogOpened}
+ onClose={toggleLocationDialog}
+ />
+ )}
+ {props.isAboutDialogOpened && (
+ <AboutDialogAsync
+ open={props.isAboutDialogOpened}
+ toggleLicenseDialog={toggleLicenseDialog}
+ toggleThirdPartyLibsDialog={toggleThirdPartyLibsDialog}
+ onClose={toggleAboutDialog}
+ />
+ )}
+ {props.isKeysDialogOpened && (
+ <KeyboardDialogAsync
+ open={props.isKeysDialogOpened}
+ onClose={toggleKeysDialog}
+ />
+ )}
+ {props.isLicenseDialogOpened && (
+ <LicenseDialogAsync
+ open={props.isLicenseDialogOpened}
+ onClose={(event, reason) => {
+ if (reason === 'backdropClick' || reason === 'escapeKeyDown') {
+ return true;
+ }
+ setFirstRun(false);
+ toggleLicenseDialog();
+ }}
+ />
+ )}
+ {props.isOnboardingDialogOpened && (
+ <OnboardingDialogAsync
+ open={props.isOnboardingDialogOpened}
+ onClose={toggleOnboardingDialog}
+ />
+ )}
+ {props.isThirdPartyLibsDialogOpened && (
+ <ThirdPartyLibsDialogAsync
+ open={props.isThirdPartyLibsDialogOpened}
+ onClose={toggleThirdPartyLibsDialog}
+ />
+ )}
+ {props.isEditTagDialogOpened && (
+ <EditEntryTagDialogAsync
+ open={props.isEditTagDialogOpened}
+ onClose={() => toggleEditTagDialog(undefined)}
+ />
+ )}
+ {props.isOpenLinkDialogOpened && (
+ <OpenLinkDialogAsync
+ open={props.isOpenLinkDialogOpened}
+ onClose={toggleOpenLinkDialog}
+ openLink={openLink}
+ />
+ )}
+ {props.isProTeaserVisible && (
+ <ProTeaserDialogAsync
+ open={props.isProTeaserVisible}
+ onClose={toggleProTeaser}
+ />
+ )}
+ {props.isUploadProgressDialogOpened !== undefined && (
+ <FileUploadDialog
+ open={true}
+ onClose={toggleUploadDialog}
+ title={props.isUploadProgressDialogOpened}
+ />
+ )}
+ {props.isProgressDialogOpened && (
+ <ProgressDialog
+ open={props.isProgressDialogOpened}
+ onClose={toggleProgressDialog}
+ />
+ )}
+ {props.isCreateDirectoryOpened !== null && (
+ <CreateDirectoryDialog
+ open={true}
+ onClose={toggleCreateDirectoryDialog}
+ selectedDirectoryPath={
+ props.isCreateDirectoryOpened &&
+ props.isCreateDirectoryOpened.rootDirPath
+ ? props.isCreateDirectoryOpened.rootDirPath
+ : directoryPath
+ }
+ callback={props.isCreateDirectoryOpened?.callback}
+ reflect={props.isCreateDirectoryOpened?.reflect}
+ />
+ )}
+ {props.isNewEntryDialogOpened && (
+ <NewEntryDialog
+ open={props.isNewEntryDialogOpened}
+ onClose={toggleNewEntryDialog}
+ />
+ )}
+ {props.isNewFileDialogOpened && (
+ <NewFileDialog
+ open={props.isNewFileDialogOpened}
+ onClose={toggleNewFileDialog}
+ />
+ )}
+ <SettingsDialog
+ open={props.isSettingsDialogOpened}
+ onClose={toggleSettingsDialog}
/>
- )}
- {props.isDeleteMultipleEntriesDialogOpened && (
- <ConfirmDialog
- open={props.isDeleteMultipleEntriesDialogOpened}
- onClose={() => props.toggleDeleteMultipleEntriesDialog()}
- title={i18n.t('core:deleteConfirmationTitle')}
- content={i18n.t('core:deleteConfirmationContent')}
- list={props.selectedEntries.map(fsEntry => fsEntry.name)}
- confirmCallback={result => {
- if (result && props.selectedEntries) {
- const deletePromises = props.selectedEntries.map(fsEntry => {
- if (fsEntry.isFile) {
- return props.deleteFile(fsEntry.path, fsEntry.uuid);
- }
- return props.deleteDirectory(fsEntry.path);
- });
- Promise.all(deletePromises)
- .then(delResult => {
- // console.debug(delResult);
- if (delResult.some(del => del)) {
- props.setSelectedEntries([]);
- } // TODO else { remove only deleted from setSelectedEntries}
- return true;
- })
- .catch(err => {
- console.warn('Deleting file failed', err);
+ {KanBanImportDialog && props.selectedEntries[0] && (
+ <KanBanImportDialog
+ open={props.isImportKanBanDialogOpened}
+ onClose={props.toggleImportKanBanDialog}
+ />
+ )}
+ {props.isDeleteMultipleEntriesDialogOpened && (
+ <ConfirmDialog
+ open={props.isDeleteMultipleEntriesDialogOpened}
+ onClose={() => props.toggleDeleteMultipleEntriesDialog()}
+ title={i18n.t('core:deleteConfirmationTitle')}
+ content={i18n.t('core:deleteConfirmationContent')}
+ list={props.selectedEntries.map(fsEntry => fsEntry.name)}
+ confirmCallback={result => {
+ if (result && props.selectedEntries) {
+ const deletePromises = props.selectedEntries.map(fsEntry => {
+ if (fsEntry.isFile) {
+ return props.deleteFile(fsEntry.path, fsEntry.uuid);
+ }
+ return props.deleteDirectory(fsEntry.path);
});
- }
+ Promise.all(deletePromises)
+ .then(delResult => {
+ // console.debug(delResult);
+ if (delResult.some(del => del)) {
+ props.setSelectedEntries([]);
+ } // TODO else { remove only deleted from setSelectedEntries}
+ return true;
+ })
+ .catch(err => {
+ console.warn('Deleting file failed', err);
+ });
+ }
+ }}
+ cancelDialogTID="cancelDeleteFileDialog"
+ confirmDialogTID="confirmDeleteFileDialog"
+ confirmDialogContentTID="confirmDeleteDialogContent"
+ />
+ )}
+ <PageNotification />
+ <div
+ style={{
+ // backgroundColor: theme.palette.background.default,
+ height: '100%'
}}
- cancelDialogTID="cancelDeleteFileDialog"
- confirmDialogTID="confirmDeleteFileDialog"
- confirmDialogContentTID="confirmDeleteDialogContent"
- />
- )}
- <PageNotification />
- <div
- style={{
- // backgroundColor: theme.palette.background.default,
- height: '100%'
- }}
- >
- <style>
- {`
+ >
+ <style>
+ {`
.default-splitter {
--default-splitter-line-margin: 2px !important;
--default-splitter-line-size: 1px !important;
@@ -868,53 +873,54 @@ function MainPage(props: Props) {
} !important;
}
`}
- </style>
- {props.isDesktopMode || (AppConfig.isAmplify && !props.user) ? (
- <TargetFileBox
- accepts={[FILE]}
- onDrop={(item: any) => {
- if (
- AppConfig.isElectron &&
- !PlatformIO.haveObjectStoreSupport() &&
- !PlatformIO.haveWebDavSupport()
- ) {
- setMoveCopyDialogOpened(item.files);
- } else {
- handleCopyFiles(item.files);
- }
- }}
- >
- <CustomDragLayer />
- <Drawer variant="persistent" anchor="left" open={drawerOpened}>
- <MobileNavigation width={drawerWidth} />
- </Drawer>
- <main
- className={clsx(classes.content, {
- [classes.contentShift]: !drawerOpened
- })}
+ </style>
+ {props.isDesktopMode || (AppConfig.isAmplify && !props.user) ? (
+ <TargetFileBox
+ accepts={[FILE]}
+ onDrop={(item: any) => {
+ if (
+ AppConfig.isElectron &&
+ !PlatformIO.haveObjectStoreSupport() &&
+ !PlatformIO.haveWebDavSupport()
+ ) {
+ setMoveCopyDialogOpened(item.files);
+ } else {
+ handleCopyFiles(item.files);
+ }
+ }}
>
+ <CustomDragLayer />
+ <Drawer variant="persistent" anchor="left" open={drawerOpened}>
+ <MobileNavigation width={drawerWidth} />
+ </Drawer>
+ <main
+ className={clsx(classes.content, {
+ [classes.contentShift]: !drawerOpened
+ })}
+ >
+ {renderContainers()}
+ </main>
+ </TargetFileBox>
+ ) : (
+ <>
+ <SwipeableDrawer
+ open={drawerOpened}
+ onClose={() => setDrawerOpened(false)}
+ onOpen={() => setDrawerOpened(true)}
+ hysteresis={0.1}
+ disableBackdropTransition={!AppConfig.isIOS}
+ >
+ <MobileNavigation
+ width={drawerWidth}
+ hideDrawer={() => setDrawerOpened(false)}
+ />
+ </SwipeableDrawer>
{renderContainers()}
- </main>
- </TargetFileBox>
- ) : (
- <>
- <SwipeableDrawer
- open={drawerOpened}
- onClose={() => setDrawerOpened(false)}
- onOpen={() => setDrawerOpened(true)}
- hysteresis={0.1}
- disableBackdropTransition={!AppConfig.isIOS}
- >
- <MobileNavigation
- width={drawerWidth}
- hideDrawer={() => setDrawerOpened(false)}
- />
- </SwipeableDrawer>
- {renderContainers()}
- </>
- )}
- </div>
- </HotKeys>
+ </>
+ )}
+ </div>
+ </HotKeys>
+ </Root>
);
}
@@ -1055,9 +1061,5 @@ export default withDnDContext(
connect(
mapStateToProps,
mapDispatchToProps
- )(
- translate(['core'], { wait: true })(
- React.memo(withStyles(styles, { withTheme: true })(MainPage), areEqual)
- )
- )
+ )(translate(['core'], { wait: true })(React.memo(MainPage, areEqual)))
);
diff --git a/app/containers/PageNotification.tsx b/app/containers/PageNotification.tsx
index e3af527f4..f40d27748 100644
--- a/app/containers/PageNotification.tsx
+++ b/app/containers/PageNotification.tsx
@@ -19,9 +19,7 @@
import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
-import { Theme } from '@mui/material/styles';
-import withStyles from '@mui/styles/withStyles';
-import createStyles from '@mui/styles/createStyles';
+import { emphasize, styled, Theme } from '@mui/material/styles';
import Snackbar from '@mui/material/Snackbar';
import Button from '@mui/material/Button';
import IconButton from '@mui/material/IconButton';
@@ -41,6 +39,7 @@ import i18n from '../services/i18n';
import { Pro } from '../pro';
import Links from '-/content/links';
import { openURLExternally } from '-/services/utils-io';
+import Chip from '@mui/material/Chip';
interface Props {
notificationStatus: any;
@@ -59,15 +58,15 @@ interface Props {
setGeneratingThumbnails: (isGenerating: boolean) => void;
}
-const TSNotification = withStyles((theme: Theme) =>
- createStyles({
+const TSNotification = styled(Snackbar)(({ theme }) => {
+ return {
root: {
'& .MuiSnackbarContent-root': {
borderRadius: 10
}
}
- })
-)(Snackbar);
+ };
+}) as typeof Snackbar;
function PageNotification(props: Props) {
const skipRelease = () => {
diff --git a/app/perspectives/common/main-container.tsx b/app/perspectives/common/main-container.tsx
index b63a04ee8..81416f3fd 100644
--- a/app/perspectives/common/main-container.tsx
+++ b/app/perspectives/common/main-container.tsx
@@ -45,8 +45,6 @@ export const renderCell = (
handleGridCellDblClick,
isLast?: boolean
) => any,
- classes,
- theme,
showDirectories: boolean,
isReadOnlyMode: boolean,
desktopMode: boolean,
diff --git a/app/perspectives/grid-perspective/components/CellContent.tsx b/app/perspectives/grid-perspective/components/CellContent.tsx
index 9b8e6f331..cd167f77f 100644
--- a/app/perspectives/grid-perspective/components/CellContent.tsx
+++ b/app/perspectives/grid-perspective/components/CellContent.tsx
@@ -18,6 +18,7 @@
import React, { useMemo } from 'react';
import { useSelector, useDispatch } from 'react-redux';
+import { useTheme } from '@mui/material/styles';
import classNames from 'classnames';
import Grid from '@mui/material/Grid';
import Typography from '@mui/material/Typography';
@@ -61,6 +62,10 @@ import {
isDesktopMode,
isReorderTags
} from '-/reducers/settings';
+import {
+ classes,
+ GridStyles
+} from '-/perspectives/grid-perspective/components/styles.css';
const maxDescriptionPreviewLength = 100;
@@ -69,9 +74,7 @@ interface Props {
isLast?: boolean;
fsEntry: TS.FileSystemEntry;
entrySize: string;
- classes: any;
style?: any;
- theme: any;
thumbnailMode: any;
openFsEntry: (fsEntry: TS.FileSystemEntry) => void;
selectedEntries: Array<TS.FileSystemEntry>;
@@ -91,8 +94,6 @@ function CellContent(props: Props) {
selected,
fsEntry,
entrySize,
- classes,
- theme,
thumbnailMode,
selectedEntries,
handleTagMenu,
@@ -107,6 +108,8 @@ function CellContent(props: Props) {
deselectEntry,
isLast
} = props;
+
+ const theme = useTheme();
const readOnlyMode = useSelector(isReadOnlyMode);
const supportedFileTypes = useSelector(getSupportedFileTypes);
const reorderTags: boolean = useSelector(isReorderTags);
@@ -368,11 +371,7 @@ function CellContent(props: Props) {
container
wrap="nowrap"
className={classes.rowHover}
- style={{
- // opacity: fileSystemEntry.isIgnored ? 0.3 : 1,
- backgroundColor,
- borderRadius: 5
- }}
+ sx={{ backgroundColor }}
>
<Grid
item
@@ -560,37 +559,39 @@ function CellContent(props: Props) {
}
return (
- <Paper
- elevation={2}
- data-entry-id={fSystemEntry.uuid}
- className={classNames(
- layoutType === 'grid' && classes.gridCell,
- layoutType === 'row' && classes.rowCell,
- selected && layoutType === 'grid' && classes.selectedGridCell,
- selected && layoutType === 'row' && classes.selectedRowCell
- )}
- style={{
- minHeight: layoutType === 'row' ? entryHeight : 'auto',
- marginBottom: isLast ? 40 : 'auto',
- backgroundColor: theme.palette.background.default
- }}
- onContextMenu={event => handleGridContextMenu(event, fSystemEntry)}
- onDoubleClick={event => {
- handleGridCellDblClick(event, fSystemEntry);
- }}
- onClick={event => {
- event.stopPropagation();
- AppConfig.isCordovaiOS // TODO DoubleClick not fired in Cordova IOS
- ? handleGridCellDblClick(event, fSystemEntry)
- : handleGridCellClick(event, fSystemEntry);
- }}
- onDrag={event => {
- handleGridCellClick(event, fSystemEntry);
- }}
- >
- {layoutType === 'grid' && renderGridCell()}
- {layoutType === 'row' && renderRowCell()}
- </Paper>
+ <GridStyles>
+ <Paper
+ elevation={2}
+ data-entry-id={fSystemEntry.uuid}
+ className={classNames(
+ layoutType === 'grid' && classes.gridCell,
+ layoutType === 'row' && classes.rowCell,
+ selected && layoutType === 'grid' && classes.selectedGridCell,
+ selected && layoutType === 'row' && classes.selectedRowCell
+ )}
+ style={{
+ minHeight: layoutType === 'row' ? entryHeight : 'auto',
+ marginBottom: isLast ? 40 : 'auto',
+ backgroundColor: theme.palette.background.default
+ }}
+ onContextMenu={event => handleGridContextMenu(event, fSystemEntry)}
+ onDoubleClick={event => {
+ handleGridCellDblClick(event, fSystemEntry);
+ }}
+ onClick={event => {
+ event.stopPropagation();
+ AppConfig.isCordovaiOS // TODO DoubleClick not fired in Cordova IOS
+ ? handleGridCellDblClick(event, fSystemEntry)
+ : handleGridCellClick(event, fSystemEntry);
+ }}
+ onDrag={event => {
+ handleGridCellClick(event, fSystemEntry);
+ }}
+ >
+ {layoutType === 'grid' && renderGridCell()}
+ {layoutType === 'row' && renderRowCell()}
+ </Paper>
+ </GridStyles>
);
}
diff --git a/app/perspectives/grid-perspective/components/GridPagination.tsx b/app/perspectives/grid-perspective/components/GridPagination.tsx
index 26c68f190..2a77a457f 100644
--- a/app/perspectives/grid-perspective/components/GridPagination.tsx
+++ b/app/perspectives/grid-perspective/components/GridPagination.tsx
@@ -18,6 +18,7 @@
import React, { useEffect, useReducer, useRef } from 'react';
import { connect } from 'react-redux';
+import { useTheme } from '@mui/material/styles';
import Typography from '@mui/material/Typography';
import Tooltip from '-/components/Tooltip';
import Grid from '@mui/material/Grid';
@@ -64,8 +65,6 @@ interface Props {
isMetaLoaded: boolean;
setIsMetaLoaded: (isLoaded: boolean) => void;
style?: any;
- classes: any;
- theme: any;
// gridRef: Object;
directories: Array<TS.FileSystemEntry>;
showDirectories: boolean;
@@ -134,8 +133,6 @@ interface Props {
function GridPagination(props: Props) {
const {
style,
- theme,
- classes,
directories,
showDirectories,
showDetails,
@@ -170,6 +167,7 @@ function GridPagination(props: Props) {
clearSelection,
files
} = props;
+ const theme = useTheme();
const allFilesCount = files.length;
const showPagination = gridPageLimit && files.length > gridPageLimit;
const paginationCount = showPagination
@@ -578,8 +576,6 @@ function GridPagination(props: Props) {
entry,
index,
getCellContent,
- classes,
- theme,
showDirectories,
isReadOnlyMode,
desktopMode,
@@ -604,8 +600,6 @@ function GridPagination(props: Props) {
entry,
index,
getCellContent,
- classes,
- theme,
showDirectories,
isReadOnlyMode,
desktopMode,
@@ -735,7 +729,7 @@ function mapActionCreatorsToProps(dispatch) {
}
const areEqual = (prevProp: Props, nextProp: Props) =>
- nextProp.theme === prevProp.theme &&
+ // nextProp.theme === prevProp.theme &&
JSON.stringify(nextProp.lastBackgroundImageChange) ===
JSON.stringify(prevProp.lastBackgroundImageChange) &&
JSON.stringify(nextProp.lastThumbnailImageChange) ===
diff --git a/app/perspectives/grid-perspective/components/GridSettingsDialog.tsx b/app/perspectives/grid-perspective/components/GridSettingsDialog.tsx
index 5ba3f25fc..47241bffb 100644
--- a/app/perspectives/grid-perspective/components/GridSettingsDialog.tsx
+++ b/app/perspectives/grid-perspective/components/GridSettingsDialog.tsx
@@ -41,10 +41,10 @@ import ThumbnailCoverIcon from '@mui/icons-material/PhotoSizeSelectActual';
import ThumbnailContainIcon from '@mui/icons-material/PhotoSizeSelectLarge';
import RadioCheckedIcon from '@mui/icons-material/RadioButtonChecked';
import RadioUncheckedIcon from '@mui/icons-material/RadioButtonUnchecked';
-import withStyles from '@mui/styles/withStyles';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import i18n from '-/services/i18n';
import { Pro } from '-/pro';
+import { useTheme } from '@mui/material/styles';
const styles: any = {
root: {
@@ -65,7 +65,6 @@ const styles: any = {
interface Props {
open: boolean;
- theme?: any;
gridPageLimit: number;
onClose: (isDefault?: boolean) => void;
setGridPageLimit: (number) => void;
@@ -89,7 +88,6 @@ interface Props {
sortBy: string;
orderBy: boolean;
handleSortingMenu: (event) => void;
- classes: any;
isLocal: boolean;
resetLocalSettings: () => void;
// setShowDirectories: (check: boolean) => void;
@@ -100,6 +98,8 @@ function GridSettingsDialog(props: Props) {
const thumbnailMode = useRef<string>(props.thumbnailMode);
const entrySize = useRef<string>(props.entrySize);
const singleClickAction = useRef<string>(props.singleClickAction);
+
+ const theme = useTheme();
const {
open,
onClose,
@@ -117,8 +117,7 @@ function GridSettingsDialog(props: Props) {
toggleThumbnailsMode,
changeEntrySize,
changeSingleClickAction,
- openHelpWebPage,
- theme
+ openHelpWebPage
} = props;
let newGridPageLimit = gridPageLimit;
@@ -443,4 +442,4 @@ function GridSettingsDialog(props: Props) {
);
}
-export default withStyles(styles, { withTheme: true })(GridSettingsDialog);
+export default GridSettingsDialog;
diff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsx
index b8c167314..a7994b2d4 100644
--- a/app/perspectives/grid-perspective/components/MainContainer.tsx
+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx
@@ -19,11 +19,9 @@
import React, { useEffect, useReducer, useRef, useState } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { GlobalHotKeys } from 'react-hotkeys';
-import withStyles from '@mui/styles/withStyles';
import { isObj, sortByCriteria } from '@tagspaces/tagspaces-common/misc';
import { isVisibleOnScreen } from '-/utils/dom';
import { getDesktopMode, getKeyBindingObject } from '-/reducers/settings';
-import styles from './styles.css';
import FileMenu from '-/components/menus/FileMenu';
import DirectoryMenu from '-/components/menus/DirectoryMenu';
import EntryTagMenu from '-/components/menus/EntryTagMenu';
@@ -62,8 +60,6 @@ import useFirstRender from '-/utils/useFirstRender';
import { openURLExternally } from '-/services/utils-io';
interface Props {
- classes: any;
- theme: any;
currentDirectoryPath: string;
openFsEntry: (fsEntry?: TS.FileSystemEntry) => void;
openRenameEntryDialog: () => void;
@@ -97,9 +93,7 @@ function getSettings(directoryMeta: TS.FileSystemEntryMeta): TS.FolderSettings {
function GridPerspective(props: Props) {
const {
- classes,
loadParentDirectoryContent,
- theme,
currentDirectoryPath,
openRenameEntryDialog,
directoryContent,
@@ -736,9 +730,7 @@ function GridPerspective(props: Props) {
fsEntry={fsEntry}
showEntriesDescription={showEntriesDescription.current}
entrySize={entrySize.current}
- classes={classes}
isLast={isLast}
- theme={theme}
thumbnailMode={thumbnailMode.current}
selectedEntries={selectedEntries}
selectEntry={selectEntry}
@@ -770,7 +762,6 @@ function GridPerspective(props: Props) {
data-tid={defaultSettings.testID}
>
<MainToolbar
- classes={classes}
prefixDataTID={'grid'}
layoutType={layoutType.current}
selectedEntries={selectedEntries}
@@ -807,8 +798,6 @@ function GridPerspective(props: Props) {
gridTemplateColumns:
'repeat(auto-fit,minmax(' + entryWidth + 'px,1fr))'
}}
- classes={classes}
- theme={theme}
directories={sortedDirectories}
showDetails={showDetails.current}
showDescription={showDescription.current}
@@ -1001,4 +990,4 @@ function GridPerspective(props: Props) {
);
}
-export default withStyles(styles, { withTheme: true })(GridPerspective);
+export default GridPerspective;
diff --git a/app/perspectives/grid-perspective/components/MainToolbar.tsx b/app/perspectives/grid-perspective/components/MainToolbar.tsx
index 591e356c3..a76d78507 100644
--- a/app/perspectives/grid-perspective/components/MainToolbar.tsx
+++ b/app/perspectives/grid-perspective/components/MainToolbar.tsx
@@ -47,9 +47,12 @@ import { getKeyBindingObject } from '-/reducers/settings';
import { getAllPropertiesPromise } from '-/services/utils-io';
import { TS } from '-/tagspaces.namespace';
import { actions as AppActions, isReadOnlyMode } from '-/reducers/app';
+import {
+ classes,
+ GridStyles
+} from '-/perspectives/grid-perspective/components/styles.css';
interface Props {
- classes: any;
prefixDataTID?: string;
selectedEntries: Array<TS.FileSystemEntry>;
loadParentDirectoryContent: () => void;
@@ -75,7 +78,6 @@ interface Props {
function MainToolbar(props: Props) {
const {
- classes,
prefixDataTID,
selectedEntries,
toggleSelectAllFiles,
@@ -111,173 +113,175 @@ function MainToolbar(props: Props) {
}
return (
- <Toolbar
- className={classes.topToolbar}
- data-tid={prefixDataTID + 'perspectiveToolbar'}
- >
- <Tooltip
- title={
- i18n.t('core:navigateToParentDirectory') +
- ' (' +
- keyBindings['openParentDirectory'].toUpperCase() +
- ')'
- }
+ <GridStyles>
+ <Toolbar
+ className={classes.topToolbar}
+ data-tid={prefixDataTID + 'perspectiveToolbar'}
>
- <IconButton
- aria-label={i18n.t('core:navigateToParentDirectory')}
- data-tid={prefixDataTID + 'PerspectiveOnBackButton'}
- onClick={() => {
- if (
- props.searchQuery &&
- Object.keys(props.searchQuery).length > 0
- ) {
- props.setSearchQuery({});
- props.openCurrentDirectory();
- } else {
- loadParentDirectoryContent();
- }
- }}
- size="large"
- >
- <ParentFolderIcon />
- </IconButton>
- </Tooltip>
- <Tooltip
- title={
- i18n.t('core:toggleSelectAllFiles') +
- ' (' +
- keyBindings['selectAll'].toUpperCase() +
- ')'
- }
- >
- <IconButton
- data-tid={prefixDataTID + 'PerspectiveSelectAllFiles'}
- onClick={toggleSelectAllFiles}
- size="large"
- >
- {someFileSelected ? <SelectedIcon /> : <UnSelectedIcon />}
- </IconButton>
- </Tooltip>
- <Tooltip title={i18n.t('core:directoryPropertiesTitle')}>
- <IconButton
- aria-label={i18n.t('core:directoryPropertiesTitle')}
- data-tid="openFolderProperties"
- onClick={showProperties}
- size="large"
- >
- <FolderPropertiesIcon />
- </IconButton>
- </Tooltip>
- {!readOnlyMode && (
<Tooltip
title={
- i18n.t('core:tagSelectedEntries') +
+ i18n.t('core:navigateToParentDirectory') +
' (' +
- keyBindings['addRemoveTags'].toUpperCase() +
+ keyBindings['openParentDirectory'].toUpperCase() +
')'
}
>
- <span>
- <IconButton
- aria-label={i18n.t('core:tagSelectedEntries')}
- data-tid={prefixDataTID + 'PerspectiveAddRemoveTags'}
- disabled={selectedEntries.length < 1}
- onClick={openAddRemoveTagsDialog}
- size="large"
- >
- <TagIcon />
- </IconButton>
- </span>
- </Tooltip>
- )}
- {!readOnlyMode && (
- <Tooltip title={i18n.t('core:copyMoveSelectedEntries')}>
- <span>
- <IconButton
- aria-label={i18n.t('core:copyMoveSelectedEntries')}
- data-tid={prefixDataTID + 'PerspectiveCopySelectedFiles'}
- disabled={selectedEntries.length < 1}
- onClick={openMoveCopyFilesDialog}
- size="large"
- >
- <CopyIcon />
- </IconButton>
- </span>
+ <IconButton
+ aria-label={i18n.t('core:navigateToParentDirectory')}
+ data-tid={prefixDataTID + 'PerspectiveOnBackButton'}
+ onClick={() => {
+ if (
+ props.searchQuery &&
+ Object.keys(props.searchQuery).length > 0
+ ) {
+ props.setSearchQuery({});
+ props.openCurrentDirectory();
+ } else {
+ loadParentDirectoryContent();
+ }
+ }}
+ size="large"
+ >
+ <ParentFolderIcon />
+ </IconButton>
</Tooltip>
- )}
- {!readOnlyMode && (
<Tooltip
title={
- i18n.t('core:deleteSelectedEntries') +
+ i18n.t('core:toggleSelectAllFiles') +
' (' +
- keyBindings['deleteDocument'].toUpperCase() +
+ keyBindings['selectAll'].toUpperCase() +
')'
}
>
- <span>
- <IconButton
- aria-label={i18n.t('core:deleteSelectedEntries')}
- data-tid={prefixDataTID + 'PerspectiveDeleteMultipleFiles'}
- onClick={openDeleteFileDialog}
- disabled={selectedEntries.length < 1}
- size="large"
- >
- <DeleteIcon />
- </IconButton>
- </span>
+ <IconButton
+ data-tid={prefixDataTID + 'PerspectiveSelectAllFiles'}
+ onClick={toggleSelectAllFiles}
+ size="large"
+ >
+ {someFileSelected ? <SelectedIcon /> : <UnSelectedIcon />}
+ </IconButton>
</Tooltip>
- )}
- {openShareFilesDialog && (
- <ProTooltip tooltip={i18n.t('core:shareFiles')}>
- <span>
- <IconButton
- aria-label={i18n.t('core:shareFiles')}
- data-tid={prefixDataTID + 'PerspectiveShareFiles'}
- onClick={openShareFilesDialog}
- disabled={selectedEntries.length < 1}
- size="large"
- >
- <ShareIcon />
- </IconButton>
- </span>
- </ProTooltip>
- )}
- <Tooltip title={i18n.t('core:sort')}>
- <IconButton
- // title={i18n.t('core:sort')}
- aria-label={i18n.t('core:sort')}
- data-tid={prefixDataTID + 'PerspectiveSortMenu'}
- onClick={e => {
- handleSortingMenu(e);
- }}
- size="large"
- >
- <SortingIcon />
- </IconButton>
- </Tooltip>
- {Pro &&
- !AppConfig.isCordovaAndroid && ( // https://trello.com/c/z6ESlqxz/697-exports-to-json-or-csv-do-not-work-on-android
- <Tooltip title={i18n.t('core:exportCsv')}>
- <IconButton
- data-tid={prefixDataTID + 'PerspectiveExportCsvMenuTID'}
- onClick={props.handleExportCsvMenu}
- style={{ transform: 'scale(-1, 1)' }}
- size="large"
- >
- <ExportIcon />
- </IconButton>
+ <Tooltip title={i18n.t('core:directoryPropertiesTitle')}>
+ <IconButton
+ aria-label={i18n.t('core:directoryPropertiesTitle')}
+ data-tid="openFolderProperties"
+ onClick={showProperties}
+ size="large"
+ >
+ <FolderPropertiesIcon />
+ </IconButton>
+ </Tooltip>
+ {!readOnlyMode && (
+ <Tooltip
+ title={
+ i18n.t('core:tagSelectedEntries') +
+ ' (' +
+ keyBindings['addRemoveTags'].toUpperCase() +
+ ')'
+ }
+ >
+ <span>
+ <IconButton
+ aria-label={i18n.t('core:tagSelectedEntries')}
+ data-tid={prefixDataTID + 'PerspectiveAddRemoveTags'}
+ disabled={selectedEntries.length < 1}
+ onClick={openAddRemoveTagsDialog}
+ size="large"
+ >
+ <TagIcon />
+ </IconButton>
+ </span>
</Tooltip>
)}
- <Tooltip title={i18n.t('core:perspectiveSettingsTitle')}>
- <IconButton
- data-tid={prefixDataTID + 'PerspectiveOptionsMenu'}
- onClick={openSettings}
- size="large"
- >
- <PerspectiveSettingsIcon />
- </IconButton>
- </Tooltip>
- </Toolbar>
+ {!readOnlyMode && (
+ <Tooltip title={i18n.t('core:copyMoveSelectedEntries')}>
+ <span>
+ <IconButton
+ aria-label={i18n.t('core:copyMoveSelectedEntries')}
+ data-tid={prefixDataTID + 'PerspectiveCopySelectedFiles'}
+ disabled={selectedEntries.length < 1}
+ onClick={openMoveCopyFilesDialog}
+ size="large"
+ >
+ <CopyIcon />
+ </IconButton>
+ </span>
+ </Tooltip>
+ )}
+ {!readOnlyMode && (
+ <Tooltip
+ title={
+ i18n.t('core:deleteSelectedEntries') +
+ ' (' +
+ keyBindings['deleteDocument'].toUpperCase() +
+ ')'
+ }
+ >
+ <span>
+ <IconButton
+ aria-label={i18n.t('core:deleteSelectedEntries')}
+ data-tid={prefixDataTID + 'PerspectiveDeleteMultipleFiles'}
+ onClick={openDeleteFileDialog}
+ disabled={selectedEntries.length < 1}
+ size="large"
+ >
+ <DeleteIcon />
+ </IconButton>
+ </span>
+ </Tooltip>
+ )}
+ {openShareFilesDialog && (
+ <ProTooltip tooltip={i18n.t('core:shareFiles')}>
+ <span>
+ <IconButton
+ aria-label={i18n.t('core:shareFiles')}
+ data-tid={prefixDataTID + 'PerspectiveShareFiles'}
+ onClick={openShareFilesDialog}
+ disabled={selectedEntries.length < 1}
+ size="large"
+ >
+ <ShareIcon />
+ </IconButton>
+ </span>
+ </ProTooltip>
+ )}
+ <Tooltip title={i18n.t('core:sort')}>
+ <IconButton
+ // title={i18n.t('core:sort')}
+ aria-label={i18n.t('core:sort')}
+ data-tid={prefixDataTID + 'PerspectiveSortMenu'}
+ onClick={e => {
+ handleSortingMenu(e);
+ }}
+ size="large"
+ >
+ <SortingIcon />
+ </IconButton>
+ </Tooltip>
+ {Pro &&
+ !AppConfig.isCordovaAndroid && ( // https://trello.com/c/z6ESlqxz/697-exports-to-json-or-csv-do-not-work-on-android
+ <Tooltip title={i18n.t('core:exportCsv')}>
+ <IconButton
+ data-tid={prefixDataTID + 'PerspectiveExportCsvMenuTID'}
+ onClick={props.handleExportCsvMenu}
+ style={{ transform: 'scale(-1, 1)' }}
+ size="large"
+ >
+ <ExportIcon />
+ </IconButton>
+ </Tooltip>
+ )}
+ <Tooltip title={i18n.t('core:perspectiveSettingsTitle')}>
+ <IconButton
+ data-tid={prefixDataTID + 'PerspectiveOptionsMenu'}
+ onClick={openSettings}
+ size="large"
+ >
+ <PerspectiveSettingsIcon />
+ </IconButton>
+ </Tooltip>
+ </Toolbar>
+ </GridStyles>
);
}
diff --git a/app/perspectives/grid-perspective/components/styles.css.tsx b/app/perspectives/grid-perspective/components/styles.css.tsx
index 85df0f077..d0e62aaeb 100644
--- a/app/perspectives/grid-perspective/components/styles.css.tsx
+++ b/app/perspectives/grid-perspective/components/styles.css.tsx
@@ -15,10 +15,27 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
-// import AppConfig from '-/AppConfig';
-import { alpha } from '@mui/material/styles';
+import { alpha, styled } from '@mui/material/styles';
-export default (theme: any): any => ({
+const PREFIX = 'GridStyles';
+export const classes = {
+ gridCell: `${PREFIX}-gridCell`,
+ rowCell: `${PREFIX}-rowCell`,
+ rowHover: `${PREFIX}-rowHover`,
+ selectedGridCell: `${PREFIX}-selectedGridCell`,
+ selectedRowCell: `${PREFIX}-selectedRowCell`,
+ gridCellThumb: `${PREFIX}-gridCellThumb`,
+ gridCellTitle: `${PREFIX}-gridCellTitle`,
+ gridCellTags: `${PREFIX}-gridCellTags`,
+ gridCellDescription: `${PREFIX}-gridCellDescription`,
+ gridFileExtension: `${PREFIX}-gridFileExtension`,
+ gridSizeDate: `${PREFIX}-gridSizeDate`,
+ gridDetails: `${PREFIX}-gridDetails`,
+ gridFolder: `${PREFIX}-gridFolder`,
+ topToolbar: `${PREFIX}-topToolbar`
+};
+
+export const GridStyles = styled('div')(({ theme }) => ({
// rowContainer: {
// display: 'grid',
// gridGap: '0px 0px',
@@ -26,14 +43,14 @@ export default (theme: any): any => ({
// margin: 0,
// paddingBottom: 10
// },
- gridCell: {
+ [`& .${classes.gridCell}`]: {
border: '2px solid transparent',
marginTop: 1,
marginLeft: 2,
marginBottom: 1,
marginRight: 1
},
- rowCell: {
+ [`& .${classes.rowCell}`]: {
boxShadow: 'none',
borderLeft: '1px solid transparent',
borderRight: '1px solid transparent',
@@ -43,25 +60,25 @@ export default (theme: any): any => ({
marginTop: 0,
marginBottom: 0
},
- rowHover: {
+ [`& .${classes.rowHover}`]: {
'&:hover': {
backgroundColor: theme.palette.divider + ' !important'
}
},
- selectedGridCell: {
+ [`& .${classes.selectedGridCell}`]: {
border: '2px solid' + theme.palette.primary.main,
backgroundColor: theme.palette.primary.light + ' !important'
},
- selectedRowCell: {
+ [`& .${classes.selectedRowCell}`]: {
border: '1px solid' + theme.palette.primary.main + ' !important'
},
- gridCellThumb: {
+ [`& .${classes.gridCellThumb}`]: {
backgroundRepeat: 'no-repeat',
backgroundPosition: 'center',
borderRadius: 5,
marginBottom: 5
},
- gridCellTitle: {
+ [`& .${classes.gridCellTitle}`]: {
padding: '0px 5px 0 5px',
minHeight: 45,
display: '-webkit-box',
@@ -70,7 +87,7 @@ export default (theme: any): any => ({
textOverflow: 'ellipsis',
overflow: 'hidden'
},
- gridCellTags: {
+ [`& .${classes.gridCellTags}`]: {
padding: 0,
paddingTop: 2,
height: 100,
@@ -78,7 +95,7 @@ export default (theme: any): any => ({
overflowX: 'hidden',
position: 'relative'
},
- gridCellDescription: {
+ [`& .${classes.gridCellDescription}`]: {
padding: 2,
margin: 2,
backgroundColor: theme.palette.background.paper,
@@ -87,7 +104,7 @@ export default (theme: any): any => ({
wordBreak: 'break-word',
display: 'block'
},
- gridFileExtension: {
+ [`& .${classes.gridFileExtension}`]: {
paddingTop: 1,
paddingBottom: 7,
paddingLeft: 3,
@@ -101,25 +118,25 @@ export default (theme: any): any => ({
borderRadius: 3,
textAlign: 'center'
},
- gridSizeDate: {
+ [`& .${classes.gridSizeDate}`]: {
overflow: 'hidden',
whiteSpace: 'nowrap',
marginRight: 5,
marginLeft: 'auto',
paddingTop: 12
},
- gridDetails: {
+ [`& .${classes.gridDetails}`]: {
display: 'flex',
whiteSpace: 'nowrap'
},
- gridFolder: {
+ [`& .${classes.gridFolder}`]: {
color: 'white',
padding: 5,
minHeight: 15,
height: 20,
borderRadius: 3
},
- topToolbar: {
+ [`& .${classes.topToolbar}`]: {
paddingLeft: 5,
paddingRight: 5,
minHeight: 40,
@@ -137,4 +154,4 @@ export default (theme: any): any => ({
width: 'calc(100% - 10px)',
overflowX: 'auto'
}
-});
+}));
diff --git a/app/perspectives/list/components/MainContainer.tsx b/app/perspectives/list/components/MainContainer.tsx
index 8ecb56754..6d9694ecd 100644
--- a/app/perspectives/list/components/MainContainer.tsx
+++ b/app/perspectives/list/components/MainContainer.tsx
@@ -19,11 +19,9 @@
import React, { useEffect, useReducer, useRef, useState } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { GlobalHotKeys } from 'react-hotkeys';
-import withStyles from '@mui/styles/withStyles';
import { isObj, sortByCriteria } from '@tagspaces/tagspaces-common/misc';
import { isVisibleOnScreen } from '-/utils/dom';
import { getDesktopMode, getKeyBindingObject } from '-/reducers/settings';
-import styles from '-/perspectives/grid-perspective/components/styles.css';
import FileMenu from '-/components/menus/FileMenu';
import DirectoryMenu from '-/components/menus/DirectoryMenu';
import EntryTagMenu from '-/components/menus/EntryTagMenu';
@@ -62,8 +60,6 @@ import useFirstRender from '-/utils/useFirstRender';
import { openURLExternally } from '-/services/utils-io';
interface Props {
- classes: any;
- theme: any;
currentDirectoryPath: string;
openFsEntry: (fsEntry?: TS.FileSystemEntry) => void;
openRenameEntryDialog: () => void;
@@ -95,11 +91,9 @@ function getSettings(directoryMeta: TS.FileSystemEntryMeta): TS.FolderSettings {
}
}
-function GridPerspective(props: Props) {
+function ListPerspective(props: Props) {
const {
- classes,
loadParentDirectoryContent,
- theme,
currentDirectoryPath,
openRenameEntryDialog,
directoryContent,
@@ -736,9 +730,7 @@ function GridPerspective(props: Props) {
fsEntry={fsEntry}
showEntriesDescription={showEntriesDescription.current}
entrySize={entrySize.current}
- classes={classes}
isLast={isLast}
- theme={theme}
thumbnailMode={thumbnailMode.current}
selectedEntries={selectedEntries}
selectEntry={selectEntry}
@@ -770,7 +762,6 @@ function GridPerspective(props: Props) {
data-tid={defaultSettings.testID}
>
<MainToolbar
- classes={classes}
prefixDataTID={'list'}
layoutType={layoutType.current}
selectedEntries={selectedEntries}
@@ -804,8 +795,6 @@ function GridPerspective(props: Props) {
paddingLeft: 4,
gridTemplateColumns: 'none'
}}
- classes={classes}
- theme={theme}
directories={sortedDirectories}
showDetails={showDetails.current}
showDescription={showDescription.current}
@@ -998,4 +987,4 @@ function GridPerspective(props: Props) {
);
}
-export default withStyles(styles, { withTheme: true })(GridPerspective);
+export default ListPerspective;
diff --git a/package-lock.json b/package-lock.json
index 38b975222..23c51a4b8 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -18,7 +18,6 @@
"@mui/icons-material": "^5.13.7",
"@mui/lab": "^5.0.0-alpha.135",
"@mui/material": "^5.13.7",
- "@mui/styles": "^5.13.7",
"@mui/x-date-pickers": "^5.0.20",
"@tagspaces/tagspaces-md": "2.1.6",
"@tagspaces/tagspaces-platforms": "2.1.56",
@@ -10621,46 +10620,6 @@
}
}
},
- "node_modules/@mui/styles": {
- "version": "5.13.7",
- "resolved": "https://registry.npmjs.org/@mui/styles/-/styles-5.13.7.tgz",
- "integrity": "sha512-RWoQwMYzW4gg2ksVGBIGeMjz1bFz6H+FcHOgncYytaZbvXiMXRkChomb+do4cx41BuXpe94YLP63keM7tjNFpg==",
- "dependencies": {
- "@babel/runtime": "^7.22.5",
- "@emotion/hash": "^0.9.1",
- "@mui/private-theming": "^5.13.7",
- "@mui/types": "^7.2.4",
- "@mui/utils": "^5.13.7",
- "clsx": "^1.2.1",
- "csstype": "^3.1.2",
- "hoist-non-react-statics": "^3.3.2",
- "jss": "^10.10.0",
- "jss-plugin-camel-case": "^10.10.0",
- "jss-plugin-default-unit": "^10.10.0",
- "jss-plugin-global": "^10.10.0",
- "jss-plugin-nested": "^10.10.0",
- "jss-plugin-props-sort": "^10.10.0",
- "jss-plugin-rule-value-function": "^10.10.0",
- "jss-plugin-vendor-prefixer": "^10.10.0",
- "prop-types": "^15.8.1"
- },
- "engines": {
- "node": ">=12.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/mui"
- },
- "peerDependencies": {
- "@types/react": "^17.0.0 || ^18.0.0",
- "react": "^17.0.0"
- },
- "peerDependenciesMeta": {
- "@types/react": {
- "optional": true
- }
- }
- },
"node_modules/@mui/system": {
"version": "5.13.7",
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.13.7.tgz",
@@ -17757,15 +17716,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/css-vendor": {
- "version": "2.0.8",
- "resolved": "https://registry.npmjs.org/css-vendor/-/css-vendor-2.0.8.tgz",
- "integrity": "sha512-x9Aq0XTInxrkuFeHKbYC7zWY8ai7qJ04Kxd9MnvbC1uO5DagxoHQjm4JvG+vCdXOoFtCjbL2XSZfxmoYa9uQVQ==",
- "dependencies": {
- "@babel/runtime": "^7.8.3",
- "is-in-browser": "^1.0.2"
- }
- },
"node_modules/css-what": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz",
@@ -23471,11 +23421,6 @@
"url": "https://github.com/sponsors/typicode"
}
},
- "node_modules/hyphenate-style-name": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz",
- "integrity": "sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ=="
- },
"node_modules/i18next": {
"version": "20.6.1",
"resolved": "https://registry.npmjs.org/i18next/-/i18next-20.6.1.tgz",
@@ -24260,11 +24205,6 @@
"url": "https://github.com/sponsors/wooorm"
}
},
- "node_modules/is-in-browser": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/is-in-browser/-/is-in-browser-1.1.3.tgz",
- "integrity": "sha512-FeXIBgG/CPGd/WUxuEyvgGTEfwiG9Z4EKGxjNMRqviiIIfsmgrpnHLffEDdwUHqNva1VEW91o3xBT/m8Elgl9g=="
- },
"node_modules/is-interactive": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz",
@@ -25561,88 +25501,6 @@
"extsprintf": "^1.2.0"
}
},
- "node_modules/jss": {
- "version": "10.10.0",
- "resolved": "https://registry.npmjs.org/jss/-/jss-10.10.0.tgz",
- "integrity": "sha512-cqsOTS7jqPsPMjtKYDUpdFC0AbhYFLTcuGRqymgmdJIeQ8cH7+AgX7YSgQy79wXloZq2VvATYxUOUQEvS1V/Zw==",
- "dependencies": {
- "@babel/runtime": "^7.3.1",
- "csstype": "^3.0.2",
- "is-in-browser": "^1.1.3",
- "tiny-warning": "^1.0.2"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/jss"
- }
- },
- "node_modules/jss-plugin-camel-case": {
- "version": "10.10.0",
- "resolved": "https://registry.npmjs.org/jss-plugin-camel-case/-/jss-plugin-camel-case-10.10.0.tgz",
- "integrity": "sha512-z+HETfj5IYgFxh1wJnUAU8jByI48ED+v0fuTuhKrPR+pRBYS2EDwbusU8aFOpCdYhtRc9zhN+PJ7iNE8pAWyPw==",
- "dependencies": {
- "@babel/runtime": "^7.3.1",
- "hyphenate-style-name": "^1.0.3",
- "jss": "10.10.0"
- }
- },
- "node_modules/jss-plugin-default-unit": {
- "version": "10.10.0",
- "resolved": "https://registry.npmjs.org/jss-plugin-default-unit/-/jss-plugin-default-unit-10.10.0.tgz",
- "integrity": "sha512-SvpajxIECi4JDUbGLefvNckmI+c2VWmP43qnEy/0eiwzRUsafg5DVSIWSzZe4d2vFX1u9nRDP46WCFV/PXVBGQ==",
- "dependencies": {
- "@babel/runtime": "^7.3.1",
- "jss": "10.10.0"
- }
- },
- "node_modules/jss-plugin-global": {
- "version": "10.10.0",
- "resolved": "https://registry.npmjs.org/jss-plugin-global/-/jss-plugin-global-10.10.0.tgz",
- "integrity": "sha512-icXEYbMufiNuWfuazLeN+BNJO16Ge88OcXU5ZDC2vLqElmMybA31Wi7lZ3lf+vgufRocvPj8443irhYRgWxP+A==",
- "dependencies": {
- "@babel/runtime": "^7.3.1",
- "jss": "10.10.0"
- }
- },
- "node_modules/jss-plugin-nested": {
- "version": "10.10.0",
- "resolved": "https://registry.npmjs.org/jss-plugin-nested/-/jss-plugin-nested-10.10.0.tgz",
- "integrity": "sha512-9R4JHxxGgiZhurDo3q7LdIiDEgtA1bTGzAbhSPyIOWb7ZubrjQe8acwhEQ6OEKydzpl8XHMtTnEwHXCARLYqYA==",
- "dependencies": {
- "@babel/runtime": "^7.3.1",
- "jss": "10.10.0",
- "tiny-warning": "^1.0.2"
- }
- },
- "node_modules/jss-plugin-props-sort": {
- "version": "10.10.0",
- "resolved": "https://registry.npmjs.org/jss-plugin-props-sort/-/jss-plugin-props-sort-10.10.0.tgz",
- "integrity": "sha512-5VNJvQJbnq/vRfje6uZLe/FyaOpzP/IH1LP+0fr88QamVrGJa0hpRRyAa0ea4U/3LcorJfBFVyC4yN2QC73lJg==",
- "dependencies": {
- "@babel/runtime": "^7.3.1",
- "jss": "10.10.0"
- }
- },
- "node_modules/jss-plugin-rule-value-function": {
- "version": "10.10.0",
- "resolved": "https://registry.npmjs.org/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.10.0.tgz",
- "integrity": "sha512-uEFJFgaCtkXeIPgki8ICw3Y7VMkL9GEan6SqmT9tqpwM+/t+hxfMUdU4wQ0MtOiMNWhwnckBV0IebrKcZM9C0g==",
- "dependencies": {
- "@babel/runtime": "^7.3.1",
- "jss": "10.10.0",
- "tiny-warning": "^1.0.2"
- }
- },
- "node_modules/jss-plugin-vendor-prefixer": {
- "version": "10.10.0",
- "resolved": "https://registry.npmjs.org/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.10.0.tgz",
- "integrity": "sha512-UY/41WumgjW8r1qMCO8l1ARg7NHnfRVWRhZ2E2m0DMYsr2DD91qIXLyNhiX83hHswR7Wm4D+oDYNC1zWCJWtqg==",
- "dependencies": {
- "@babel/runtime": "^7.3.1",
- "css-vendor": "^2.0.8",
- "jss": "10.10.0"
- }
- },
"node_modules/jsx-ast-utils": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.4.tgz",
@@ -40922,11 +40780,6 @@
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.1.tgz",
"integrity": "sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw=="
},
- "node_modules/tiny-warning": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
- "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="
- },
"node_modules/tinycolor2": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.2.tgz",
@@ -51797,30 +51650,6 @@
"prop-types": "^15.8.1"
}
},
- "@mui/styles": {
- "version": "5.13.7",
- "resolved": "https://registry.npmjs.org/@mui/styles/-/styles-5.13.7.tgz",
- "integrity": "sha512-RWoQwMYzW4gg2ksVGBIGeMjz1bFz6H+FcHOgncYytaZbvXiMXRkChomb+do4cx41BuXpe94YLP63keM7tjNFpg==",
- "requires": {
- "@babel/runtime": "^7.22.5",
- "@emotion/hash": "^0.9.1",
- "@mui/private-theming": "^5.13.7",
- "@mui/types": "^7.2.4",
- "@mui/utils": "^5.13.7",
- "clsx": "^1.2.1",
- "csstype": "^3.1.2",
- "hoist-non-react-statics": "^3.3.2",
- "jss": "^10.10.0",
- "jss-plugin-camel-case": "^10.10.0",
- "jss-plugin-default-unit": "^10.10.0",
- "jss-plugin-global": "^10.10.0",
- "jss-plugin-nested": "^10.10.0",
- "jss-plugin-props-sort": "^10.10.0",
- "jss-plugin-rule-value-function": "^10.10.0",
- "jss-plugin-vendor-prefixer": "^10.10.0",
- "prop-types": "^15.8.1"
- }
- },
"@mui/system": {
"version": "5.13.7",
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.13.7.tgz",
@@ -57350,15 +57179,6 @@
}
}
},
- "css-vendor": {
- "version": "2.0.8",
- "resolved": "https://registry.npmjs.org/css-vendor/-/css-vendor-2.0.8.tgz",
- "integrity": "sha512-x9Aq0XTInxrkuFeHKbYC7zWY8ai7qJ04Kxd9MnvbC1uO5DagxoHQjm4JvG+vCdXOoFtCjbL2XSZfxmoYa9uQVQ==",
- "requires": {
- "@babel/runtime": "^7.8.3",
- "is-in-browser": "^1.0.2"
- }
- },
"css-what": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz",
@@ -61804,11 +61624,6 @@
"integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==",
"dev": true
},
- "hyphenate-style-name": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz",
- "integrity": "sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ=="
- },
"i18next": {
"version": "20.6.1",
"resolved": "https://registry.npmjs.org/i18next/-/i18next-20.6.1.tgz",
@@ -62363,11 +62178,6 @@
"resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz",
"integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg=="
},
- "is-in-browser": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/is-in-browser/-/is-in-browser-1.1.3.tgz",
- "integrity": "sha512-FeXIBgG/CPGd/WUxuEyvgGTEfwiG9Z4EKGxjNMRqviiIIfsmgrpnHLffEDdwUHqNva1VEW91o3xBT/m8Elgl9g=="
- },
"is-interactive": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz",
@@ -63344,84 +63154,6 @@
}
}
},
- "jss": {
- "version": "10.10.0",
- "resolved": "https://registry.npmjs.org/jss/-/jss-10.10.0.tgz",
- "integrity": "sha512-cqsOTS7jqPsPMjtKYDUpdFC0AbhYFLTcuGRqymgmdJIeQ8cH7+AgX7YSgQy79wXloZq2VvATYxUOUQEvS1V/Zw==",
- "requires": {
- "@babel/runtime": "^7.3.1",
- "csstype": "^3.0.2",
- "is-in-browser": "^1.1.3",
- "tiny-warning": "^1.0.2"
- }
- },
- "jss-plugin-camel-case": {
- "version": "10.10.0",
- "resolved": "https://registry.npmjs.org/jss-plugin-camel-case/-/jss-plugin-camel-case-10.10.0.tgz",
- "integrity": "sha512-z+HETfj5IYgFxh1wJnUAU8jByI48ED+v0fuTuhKrPR+pRBYS2EDwbusU8aFOpCdYhtRc9zhN+PJ7iNE8pAWyPw==",
- "requires": {
- "@babel/runtime": "^7.3.1",
- "hyphenate-style-name": "^1.0.3",
- "jss": "10.10.0"
- }
- },
- "jss-plugin-default-unit": {
- "version": "10.10.0",
- "resolved": "https://registry.npmjs.org/jss-plugin-default-unit/-/jss-plugin-default-unit-10.10.0.tgz",
- "integrity": "sha512-SvpajxIECi4JDUbGLefvNckmI+c2VWmP43qnEy/0eiwzRUsafg5DVSIWSzZe4d2vFX1u9nRDP46WCFV/PXVBGQ==",
- "requires": {
- "@babel/runtime": "^7.3.1",
- "jss": "10.10.0"
- }
- },
- "jss-plugin-global": {
- "version": "10.10.0",
- "resolved": "https://registry.npmjs.org/jss-plugin-global/-/jss-plugin-global-10.10.0.tgz",
- "integrity": "sha512-icXEYbMufiNuWfuazLeN+BNJO16Ge88OcXU5ZDC2vLqElmMybA31Wi7lZ3lf+vgufRocvPj8443irhYRgWxP+A==",
- "requires": {
- "@babel/runtime": "^7.3.1",
- "jss": "10.10.0"
- }
- },
- "jss-plugin-nested": {
- "version": "10.10.0",
- "resolved": "https://registry.npmjs.org/jss-plugin-nested/-/jss-plugin-nested-10.10.0.tgz",
- "integrity": "sha512-9R4JHxxGgiZhurDo3q7LdIiDEgtA1bTGzAbhSPyIOWb7ZubrjQe8acwhEQ6OEKydzpl8XHMtTnEwHXCARLYqYA==",
- "requires": {
- "@babel/runtime": "^7.3.1",
- "jss": "10.10.0",
- "tiny-warning": "^1.0.2"
- }
- },
- "jss-plugin-props-sort": {
- "version": "10.10.0",
- "resolved": "https://registry.npmjs.org/jss-plugin-props-sort/-/jss-plugin-props-sort-10.10.0.tgz",
- "integrity": "sha512-5VNJvQJbnq/vRfje6uZLe/FyaOpzP/IH1LP+0fr88QamVrGJa0hpRRyAa0ea4U/3LcorJfBFVyC4yN2QC73lJg==",
- "requires": {
- "@babel/runtime": "^7.3.1",
- "jss": "10.10.0"
- }
- },
- "jss-plugin-rule-value-function": {
- "version": "10.10.0",
- "resolved": "https://registry.npmjs.org/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.10.0.tgz",
- "integrity": "sha512-uEFJFgaCtkXeIPgki8ICw3Y7VMkL9GEan6SqmT9tqpwM+/t+hxfMUdU4wQ0MtOiMNWhwnckBV0IebrKcZM9C0g==",
- "requires": {
- "@babel/runtime": "^7.3.1",
- "jss": "10.10.0",
- "tiny-warning": "^1.0.2"
- }
- },
- "jss-plugin-vendor-prefixer": {
- "version": "10.10.0",
- "resolved": "https://registry.npmjs.org/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.10.0.tgz",
- "integrity": "sha512-UY/41WumgjW8r1qMCO8l1ARg7NHnfRVWRhZ2E2m0DMYsr2DD91qIXLyNhiX83hHswR7Wm4D+oDYNC1zWCJWtqg==",
- "requires": {
- "@babel/runtime": "^7.3.1",
- "css-vendor": "^2.0.8",
- "jss": "10.10.0"
- }
- },
"jsx-ast-utils": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.4.tgz",
@@ -74949,11 +74681,6 @@
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.1.tgz",
"integrity": "sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw=="
},
- "tiny-warning": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
- "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="
- },
"tinycolor2": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.2.tgz",
diff --git a/package.json b/package.json
index 09d2d5d4d..693dd37e8 100644
--- a/package.json
+++ b/package.json
@@ -147,7 +147,6 @@
"@mui/icons-material": "^5.13.7",
"@mui/lab": "^5.0.0-alpha.135",
"@mui/material": "^5.13.7",
- "@mui/styles": "^5.13.7",
"@mui/x-date-pickers": "^5.0.20",
"@tagspaces/tagspaces-md": "2.1.6",
"@tagspaces/tagspaces-platforms": "2.1.56",
diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.js
index 40aa13d7f..537183215 100644
--- a/tests/e2e/general.helpers.js
+++ b/tests/e2e/general.helpers.js
@@ -313,8 +313,9 @@ export async function getGridElement(fileIndex = 0) {
}
export async function getGridCellClass(fileIndex = 0) {
- const file = await getGridElement(fileIndex);
+ let file = await getGridElement(fileIndex);
if (file !== undefined) {
+ file = await file.$('div');
return file.getAttribute('class');
}
return undefined;
diff --git a/tests/e2e/perspective-grid.pw.e2e.js b/tests/e2e/perspective-grid.pw.e2e.js
index 257272971..df09588ed 100644
--- a/tests/e2e/perspective-grid.pw.e2e.js
+++ b/tests/e2e/perspective-grid.pw.e2e.js
@@ -82,13 +82,24 @@ test.describe('TST50 - Perspective Grid', () => {
expect(classNotSelected).not.toBe(classSelected);
- const filesList = await global.client.$$(selectorFile);
+ let filesList = await global.client.$$(selectorFile);
for (let i = 0; i < filesList.length; i++) {
let file = await filesList[i].$('div');
file = await file.$('div');
+ file = await file.$('div');
const style = await file.getAttribute('class');
expect(style).toBe(classSelected);
}
+ //deselect
+ /*await selectAllFiles();
+ filesList = await global.client.$$(selectorFile);
+ for (let i = 0; i < filesList.length; i++) {
+ let file = await filesList[i].$('div');
+ file = await file.$('div');
+ file = await file.$('div');
+ const style = await file.getAttribute('class');
+ expect(style).toBe(classNotSelected);
+ }*/
});
// This scenario includes "Add tags" && "Remove tags" to be fulfilled