Skip to content

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

Fix missing withMobileDialog in MUI5 (#1734)

Stanimire7b7f1723433
diff --git a/app/components/dialogs/AboutDialog.tsx b/app/components/dialogs/AboutDialog.tsx
index 76e52a017..da9fa00fa 100644
--- a/app/components/dialogs/AboutDialog.tsx
+++ b/app/components/dialogs/AboutDialog.tsx
@@ -32,15 +32,11 @@ import { Pro } from '-/pro';
import { getLastVersionPromise } from '-/reducers/settings';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import Links from '-/links';
-
-// FIXME checkout https://mui.com/components/use-media-query/#using-material-uis-breakpoint-helpers
-const withMobileDialog = () => WrappedComponent => props => (
- <WrappedComponent {...props} width="lg" fullScreen={false} />
-);
+import useMediaQuery from '@mui/material/useMediaQuery';
+import useTheme from '@mui/styles/useTheme';
interface Props {
open: boolean;
- fullScreen: boolean;
openURLExternally: (url: string, skipConfirmation?: boolean) => void;
toggleLicenseDialog: () => void;
toggleThirdPartyLibsDialog: () => void;
@@ -58,7 +54,7 @@ document.title = productName + ' ' + versionMeta.version;
function AboutDialog(props: Props) {
const [updateAvailable, setUpdateAvailable] = useState(false);
const [newVersion, setNewVersion] = useState('');
- const { open, onClose, fullScreen } = props;
+ const { open, onClose } = props;
function checkForUpdates() {
if (updateAvailable) {
@@ -96,6 +92,8 @@ function AboutDialog(props: Props) {
}
}
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
@@ -241,4 +239,4 @@ function AboutDialog(props: Props) {
);
}
-export default withMobileDialog()(AboutDialog);
+export default AboutDialog;
diff --git a/app/components/dialogs/AddRemoveTagsDialog.tsx b/app/components/dialogs/AddRemoveTagsDialog.tsx
index d4b18ad17..3bd61aeba 100644
--- a/app/components/dialogs/AddRemoveTagsDialog.tsx
+++ b/app/components/dialogs/AddRemoveTagsDialog.tsx
@@ -41,15 +41,11 @@ import {
import PlatformIO from '-/services/platform-facade';
import { TS } from '-/tagspaces.namespace';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-
-// FIXME checkout https://mui.com/components/use-media-query/#using-material-uis-breakpoint-helpers
-const withMobileDialog = () => WrappedComponent => props => (
- <WrappedComponent {...props} width="lg" fullScreen={false} />
-);
+import useTheme from '@mui/styles/useTheme';
+import useMediaQuery from '@mui/material/useMediaQuery';
interface Props {
open: boolean;
- fullScreen: boolean;
selectedEntries: Array<any>;
onClose: (clearSelection?: boolean) => void;
addTags: (paths: Array<string>, tags: Array<TS.Tag>) => void;
@@ -120,10 +116,12 @@ function AddRemoveTagsDialog(props: Props) {
onCloseDialog(true);
};
- const { open, selectedEntries = [], fullScreen } = props;
+ const { open, selectedEntries = [] } = props;
const disabledButtons =
!newlyAddedTags || newlyAddedTags.length < 1 || selectedEntries.length < 1;
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
@@ -222,4 +220,4 @@ function AddRemoveTagsDialog(props: Props) {
);
}
-export default withMobileDialog()(AddRemoveTagsDialog);
+export default AddRemoveTagsDialog;
diff --git a/app/components/dialogs/AddTagToTagGroupDialog.tsx b/app/components/dialogs/AddTagToTagGroupDialog.tsx
index 3b3431967..b59d14084 100644
--- a/app/components/dialogs/AddTagToTagGroupDialog.tsx
+++ b/app/components/dialogs/AddTagToTagGroupDialog.tsx
@@ -34,12 +34,13 @@ import { getTagGroups } from '-/reducers/taglibrary';
import i18n from '-/services/i18n';
import { getTagColor, getTagTextColor } from '-/reducers/settings';
import { TS } from '-/tagspaces.namespace';
+import useTheme from "@mui/styles/useTheme";
+import useMediaQuery from "@mui/material/useMediaQuery";
interface Props {
open: boolean;
onClose: () => void;
addTag: (tag: TS.Tag, uuid: string) => void;
- fullScreen?: boolean;
selectedTag: TS.Tag;
defaultBackgroundColor?: string;
defaultTextColor?: string;
@@ -65,8 +66,10 @@ function AddTagToTagGroupDialog(props: Props) {
props.onClose();
};
- const { fullScreen, open, onClose } = props;
+ const { open, onClose } = props;
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
diff --git a/app/components/dialogs/CreateDialog.tsx b/app/components/dialogs/CreateDialog.tsx
index 261802511..3485b6c93 100644
--- a/app/components/dialogs/CreateDialog.tsx
+++ b/app/components/dialogs/CreateDialog.tsx
@@ -42,11 +42,8 @@ import IOActions from '-/reducers/io-actions';
import { TS } from '-/tagspaces.namespace';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import Spacer from '-/components/Spacer';
-
-// FIXME checkout https://mui.com/components/use-media-query/#using-material-uis-breakpoint-helpers
-const withMobileDialog = () => WrappedComponent => props => (
- <WrappedComponent {...props} width="lg" fullScreen={false} />
-);
+import useTheme from "@mui/styles/useTheme";
+import useMediaQuery from "@mui/material/useMediaQuery";
const styles: any = () => ({
root: {
@@ -73,7 +70,6 @@ interface Props {
open: boolean;
classes: any;
selectedDirectoryPath: string;
- // fullScreen: boolean;
chooseDirectoryPath: (path: string) => void;
showNotification: (message: string, type: string, autohide: boolean) => void;
reflectCreateEntries: (fsEntries: Array<TS.FileSystemEntry>) => void;
@@ -256,11 +252,13 @@ function CreateDialog(props: Props) {
} */
}
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
onClose={onClose}
- // fullScreen={fullScreen}
+ fullScreen={fullScreen}
keepMounted
scroll="paper"
onKeyDown={event => {
@@ -415,4 +413,4 @@ function mapActionCreatorsToProps(dispatch) {
export default connect(
mapStateToProps,
mapActionCreatorsToProps
-)(withMobileDialog()(withStyles(styles)(CreateDialog)));
+)(withStyles(styles)(CreateDialog));
diff --git a/app/components/dialogs/CreateDirectoryDialog.tsx b/app/components/dialogs/CreateDirectoryDialog.tsx
index 83182aa02..fdae67db8 100644
--- a/app/components/dialogs/CreateDirectoryDialog.tsx
+++ b/app/components/dialogs/CreateDirectoryDialog.tsx
@@ -32,11 +32,12 @@ import { actions as AppActions } from '-/reducers/app';
import { joinPaths } from '@tagspaces/tagspaces-platforms/paths';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import PlatformIO from '-/services/platform-facade';
+import useTheme from "@mui/styles/useTheme";
+import useMediaQuery from "@mui/material/useMediaQuery";
interface Props {
open: boolean;
onClose: () => void;
- fullScreen?: boolean;
selectedDirectoryPath: string;
createDirectory: (directoryPath: string) => void;
}
@@ -46,7 +47,7 @@ function CreateDirectoryDialog(props: Props) {
const isFirstRun = useRef(true);
const [disableConfirmButton, setDisableConfirmButton] = useState(true);
const [name, setName] = useState('');
- const { open, onClose, fullScreen } = props;
+ const { open, onClose } = props;
useEffect(() => {
if (isFirstRun.current) {
@@ -92,6 +93,8 @@ function CreateDirectoryDialog(props: Props) {
setDisableConfirmButton(true);
}
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
diff --git a/app/components/dialogs/CreateEditLocationDialog.tsx b/app/components/dialogs/CreateEditLocationDialog.tsx
index 9393c2a0c..ce3e89bce 100644
--- a/app/components/dialogs/CreateEditLocationDialog.tsx
+++ b/app/components/dialogs/CreateEditLocationDialog.tsx
@@ -68,11 +68,8 @@ 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';
-
-// FIXME checkout https://mui.com/components/use-media-query/#using-material-uis-breakpoint-helpers
-const withMobileDialog = () => WrappedComponent => props => (
- <WrappedComponent {...props} width="lg" fullScreen={false} />
-);
+import useTheme from "@mui/styles/useTheme";
+import useMediaQuery from "@mui/material/useMediaQuery";
const styles: any = theme => ({
formControl: {
@@ -86,7 +83,6 @@ interface Props {
open: boolean;
onClose: () => void;
classes: any;
- fullScreen: boolean;
addLocation: (location: TS.Location, openAfterCreate?: boolean) => void;
editLocation?: (location: TS.Location) => void;
isPersistTagsInSidecar: boolean;
@@ -304,7 +300,7 @@ function CreateEditLocationDialog(props: Props) {
);
};
- const { fullScreen, open, onClose, classes } = props;
+ const { open, onClose, classes } = props;
const onConfirm = () => {
if (!disableConfirmButton()) {
@@ -453,6 +449,8 @@ function CreateEditLocationDialog(props: Props) {
const disableLocationTypeSwitch: boolean = props.location !== undefined;
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
@@ -908,4 +906,4 @@ function mapDispatchToProps(dispatch) {
export default connect(
mapStateToProps,
mapDispatchToProps
-)(withMobileDialog()(withStyles(styles)(CreateEditLocationDialog)));
+)(withStyles(styles)(CreateEditLocationDialog));
diff --git a/app/components/dialogs/CreateFileDialog.tsx b/app/components/dialogs/CreateFileDialog.tsx
index 60452c800..d55c5517b 100644
--- a/app/components/dialogs/CreateFileDialog.tsx
+++ b/app/components/dialogs/CreateFileDialog.tsx
@@ -41,11 +41,8 @@ import i18n from '-/services/i18n';
import TaggingActions from '-/reducers/tagging-actions';
import { actions as AppActions } from '-/reducers/app';
import PlatformIO from '-/services/platform-facade';
-
-// FIXME checkout https://mui.com/components/use-media-query/#using-material-uis-breakpoint-helpers
-const withMobileDialog = () => WrappedComponent => props => (
- <WrappedComponent {...props} width="lg" fullScreen={false} />
-);
+import useTheme from "@mui/styles/useTheme";
+import useMediaQuery from "@mui/material/useMediaQuery";
const styles = theme => ({
root: {
@@ -68,7 +65,6 @@ const styles = theme => ({
interface Props {
open: boolean;
- fullScreen: boolean;
onClose: () => void;
selectedDirectoryPath: string | null;
createFileAdvanced: (
@@ -199,11 +195,13 @@ function CreateFileDialog(props: Props) {
}
};
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={props.open}
onClose={props.onClose}
- fullScreen={props.fullScreen}
+ fullScreen={fullScreen}
keepMounted
scroll="paper"
// onKeyDown={confirmFunction}
@@ -325,4 +323,4 @@ function mapActionCreatorsToProps(dispatch) {
export default connect(
undefined,
mapActionCreatorsToProps
-)(withMobileDialog()(withStyles(styles)(CreateFileDialog)));
+)(withStyles(styles)(CreateFileDialog));
diff --git a/app/components/dialogs/CreateTagGroupDialog.tsx b/app/components/dialogs/CreateTagGroupDialog.tsx
index 8dd7b868d..82696a6c9 100644
--- a/app/components/dialogs/CreateTagGroupDialog.tsx
+++ b/app/components/dialogs/CreateTagGroupDialog.tsx
@@ -36,17 +36,13 @@ import { TS } from '-/tagspaces.namespace';
import { getLocations } from '-/reducers/locations';
import { getCurrentLocationId } from '-/reducers/app';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-
-// FIXME checkout https://mui.com/components/use-media-query/#using-material-uis-breakpoint-helpers
-const withMobileDialog = () => WrappedComponent => props => (
- <WrappedComponent {...props} width="lg" fullScreen={false} />
-);
+import useTheme from "@mui/styles/useTheme";
+import useMediaQuery from "@mui/material/useMediaQuery";
interface Props {
open: boolean;
onClose: () => void;
createTagGroup: (tagGroup: TS.TagGroup) => void;
- fullScreen?: boolean;
color: string;
textcolor: string;
currentLocationId: string | null;
@@ -72,7 +68,6 @@ function CreateTagGroupDialog(props: Props) {
const [ignored, forceUpdate] = useReducer(x => x + 1, 0);
const {
- fullScreen,
open,
saveTagsInLocation,
onClose,
@@ -179,6 +174,8 @@ function CreateTagGroupDialog(props: Props) {
}
};
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
@@ -317,6 +314,4 @@ function mapStateToProps(state) {
};
}
-export default connect(mapStateToProps)(
- withMobileDialog()(CreateTagGroupDialog)
-);
+export default connect(mapStateToProps)(CreateTagGroupDialog);
diff --git a/app/components/dialogs/CreateTagsDialog.tsx b/app/components/dialogs/CreateTagsDialog.tsx
index be97bbf76..82cd332ba 100644
--- a/app/components/dialogs/CreateTagsDialog.tsx
+++ b/app/components/dialogs/CreateTagsDialog.tsx
@@ -29,12 +29,13 @@ 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 useMediaQuery from "@mui/material/useMediaQuery";
interface Props {
open: boolean;
onClose: () => void;
addTag: (tags: string, uuid: string) => void;
- fullScreen?: boolean;
selectedTagGroupEntry: TS.TagGroup;
}
@@ -78,8 +79,10 @@ function CreateTagsDialog(props: Props) {
}
};
- const { fullScreen, open, onClose } = props;
+ const { open, onClose } = props;
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
diff --git a/app/components/dialogs/EditEntryTagDialog.tsx b/app/components/dialogs/EditEntryTagDialog.tsx
index 724fc1f29..7fcafd490 100644
--- a/app/components/dialogs/EditEntryTagDialog.tsx
+++ b/app/components/dialogs/EditEntryTagDialog.tsx
@@ -46,11 +46,8 @@ import { TS } from '-/tagspaces.namespace';
import useValidation from '-/utils/useValidation';
import { getMapTileServer } from '-/reducers/settings';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-
-// FIXME checkout https://mui.com/components/use-media-query/#using-material-uis-breakpoint-helpers
-const withMobileDialog = () => WrappedComponent => props => (
- <WrappedComponent {...props} width="lg" fullScreen={false} />
-);
+import useTheme from "@mui/styles/useTheme";
+import useMediaQuery from "@mui/material/useMediaQuery";
const styles = () => ({
root: {
@@ -63,7 +60,6 @@ const styles = () => ({
interface Props {
classes: any;
open: boolean;
- fullScreen: boolean;
onClose: () => void;
editTagForEntry: (path: string, tag: TS.Tag, title: string) => void;
selectedEntries: Array<TS.FileSystemEntry>;
@@ -102,7 +98,7 @@ function EditEntryTagDialog(props: Props) {
isShowDatePeriodEditor
);
const { setError, haveError } = useValidation();
- const { onClose, open, fullScreen } = props;
+ const { onClose, open } = props;
useEffect(() => {
if (titleRef && titleRef.current) {
@@ -237,6 +233,8 @@ function EditEntryTagDialog(props: Props) {
);
}
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
@@ -286,9 +284,4 @@ const areEqual = (prevProp, nextProp) =>
export default connect(
mapStateToProps,
mapDispatchToProps
-)(
- React.memo(
- withMobileDialog()(withStyles(styles)(EditEntryTagDialog)),
- areEqual
- )
-);
+)(React.memo(withStyles(styles)(EditEntryTagDialog), areEqual));
diff --git a/app/components/dialogs/EditTagDialog.tsx b/app/components/dialogs/EditTagDialog.tsx
index e2b8a896f..6de9b2c90 100644
--- a/app/components/dialogs/EditTagDialog.tsx
+++ b/app/components/dialogs/EditTagDialog.tsx
@@ -31,10 +31,11 @@ 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 useMediaQuery from "@mui/material/useMediaQuery";
interface Props {
open: boolean;
- fullScreen?: boolean;
onClose: () => void;
editTag: (tag: TS.Tag, tagGroupId: string, origTitle: string) => void;
selectedTag: TS.Tag;
@@ -96,7 +97,7 @@ function EditTagDialog(props: Props) {
}
};
- const { fullScreen, open, onClose } = props;
+ const { open, onClose } = props;
const styles = {
color: {
width: '100%',
@@ -124,6 +125,8 @@ function EditTagDialog(props: Props) {
}
};
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
diff --git a/app/components/dialogs/EditTagGroupDialog.tsx b/app/components/dialogs/EditTagGroupDialog.tsx
index e00a23a5e..67cc6c14d 100644
--- a/app/components/dialogs/EditTagGroupDialog.tsx
+++ b/app/components/dialogs/EditTagGroupDialog.tsx
@@ -36,17 +36,13 @@ import { TS } from '-/tagspaces.namespace';
import { getLocations } from '-/reducers/locations';
import { Pro } from '-/pro';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-
-// FIXME checkout https://mui.com/components/use-media-query/#using-material-uis-breakpoint-helpers
-const withMobileDialog = () => WrappedComponent => props => (
- <WrappedComponent {...props} width="lg" fullScreen={false} />
-);
+import useTheme from "@mui/styles/useTheme";
+import useMediaQuery from "@mui/material/useMediaQuery";
const defaultTagGroupLocation = 'TAG_LIBRARY';
interface Props {
open: boolean;
- fullScreen?: boolean;
editTagGroup: (tagGroup: TS.TagGroup) => void;
selectedTagGroupEntry: TS.TagGroup;
onClose: () => void;
@@ -289,10 +285,11 @@ function EditTagGroupDialog(props: Props) {
</DialogActions>
);
- const { open, fullScreen } = props;
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
- open={open}
+ open={props.open}
fullScreen={fullScreen}
onClose={props.onClose}
onKeyDown={event => {
@@ -319,4 +316,4 @@ function mapStateToProps(state) {
};
}
-export default connect(mapStateToProps)(withMobileDialog()(EditTagGroupDialog));
+export default connect(mapStateToProps)(EditTagGroupDialog);
diff --git a/app/components/dialogs/ImportExportTagGroupsDialog.tsx b/app/components/dialogs/ImportExportTagGroupsDialog.tsx
index 55145f390..3c48b6ba2 100644
--- a/app/components/dialogs/ImportExportTagGroupsDialog.tsx
+++ b/app/components/dialogs/ImportExportTagGroupsDialog.tsx
@@ -34,11 +34,8 @@ import TagContainer from '../TagContainer';
import i18n from '-/services/i18n';
import { TS } from '-/tagspaces.namespace';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-
-// FIXME checkout https://mui.com/components/use-media-query/#using-material-uis-breakpoint-helpers
-const withMobileDialog = () => WrappedComponent => props => (
- <WrappedComponent {...props} width="lg" fullScreen={false} />
-);
+import useTheme from "@mui/styles/useTheme";
+import useMediaQuery from "@mui/material/useMediaQuery";
const styles: any = {
root: {
@@ -53,7 +50,6 @@ interface Props {
classes: any;
open: boolean;
tagGroups: Array<any>;
- fullScreen: boolean;
onClose: () => void;
dialogModeImport: boolean;
showNotification?: (text: string) => void;
@@ -167,7 +163,9 @@ function ImportExportTagGroupsDialog(props: Props) {
</DialogActions>
);
- const { onClose, open, fullScreen } = props;
+ const { onClose, open } = props;
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
@@ -182,6 +180,4 @@ function ImportExportTagGroupsDialog(props: Props) {
);
}
-export default withMobileDialog()(
- withStyles(styles)(ImportExportTagGroupsDialog)
-);
+export default withStyles(styles)(ImportExportTagGroupsDialog);
diff --git a/app/components/dialogs/KeyboardDialog.tsx b/app/components/dialogs/KeyboardDialog.tsx
index a520de0b2..f4b0960df 100644
--- a/app/components/dialogs/KeyboardDialog.tsx
+++ b/app/components/dialogs/KeyboardDialog.tsx
@@ -32,11 +32,8 @@ import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import i18n from '-/services/i18n';
import { getKeyBindingObject } from '-/reducers/settings';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-
-// FIXME checkout https://mui.com/components/use-media-query/#using-material-uis-breakpoint-helpers
-const withMobileDialog = () => WrappedComponent => props => (
- <WrappedComponent {...props} width="lg" fullScreen={false} />
-);
+import useTheme from "@mui/styles/useTheme";
+import useMediaQuery from "@mui/material/useMediaQuery";
const styles = theme => ({
root: {
@@ -54,13 +51,14 @@ const styles = theme => ({
interface Props {
open: boolean;
classes: any;
- fullScreen: boolean;
keyBindings: Array<any>;
onClose: () => void;
}
function KeyboardDialog(props: Props) {
- const { open, onClose, fullScreen } = props;
+ const { open, onClose } = props;
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
@@ -109,6 +107,4 @@ function mapStateToProps(state) {
};
}
-export default connect(mapStateToProps)(
- withMobileDialog()(withStyles(styles)(KeyboardDialog))
-);
+export default connect(mapStateToProps)(withStyles(styles)(KeyboardDialog));
diff --git a/app/components/dialogs/LicenseDialog.tsx b/app/components/dialogs/LicenseDialog.tsx
index 2d73efd7d..d0b62922c 100644
--- a/app/components/dialogs/LicenseDialog.tsx
+++ b/app/components/dialogs/LicenseDialog.tsx
@@ -27,17 +27,13 @@ import i18n from '-/services/i18n';
import { Pro } from '-/pro';
import LicenseContent from '-/LICENSE.txt';
import PlatformIO from '-/services/platform-facade';
-
-// FIXME checkout https://mui.com/components/use-media-query/#using-material-uis-breakpoint-helpers
-const withMobileDialog = () => WrappedComponent => props => (
- <WrappedComponent {...props} width="lg" fullScreen={false} />
-);
+import useTheme from "@mui/styles/useTheme";
+import useMediaQuery from "@mui/material/useMediaQuery";
// import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
- fullScreen: boolean;
onClose: () => void;
}
@@ -55,13 +51,15 @@ interface Props {
// }
function LicenseDialog(props: Props) {
- const { fullScreen, open, onClose } = props;
+ const { open, onClose } = props;
// let licenseElement;
// function printLicense() {
// // printElem(licenseElement);
// window.print();
// }
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
@@ -108,4 +106,4 @@ function LicenseDialog(props: Props) {
);
}
-export default withMobileDialog()(LicenseDialog);
+export default LicenseDialog;
diff --git a/app/components/dialogs/MoveCopyFilesDialog.tsx b/app/components/dialogs/MoveCopyFilesDialog.tsx
index 07b5fcb17..f1df227d9 100644
--- a/app/components/dialogs/MoveCopyFilesDialog.tsx
+++ b/app/components/dialogs/MoveCopyFilesDialog.tsx
@@ -42,15 +42,11 @@ import i18n from '-/services/i18n';
import PlatformIO from '-/services/platform-facade';
import IOActions from '-/reducers/io-actions';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-
-// FIXME checkout https://mui.com/components/use-media-query/#using-material-uis-breakpoint-helpers
-const withMobileDialog = () => WrappedComponent => props => (
- <WrappedComponent {...props} width="lg" fullScreen={false} />
-);
+import useTheme from "@mui/styles/useTheme";
+import useMediaQuery from "@mui/material/useMediaQuery";
interface Props {
open: boolean;
- fullScreen: boolean;
onClose: (clearSelection?: boolean) => void;
copyFiles: (files: Array<string>, destination: string) => void;
moveFiles: (files: Array<string>, destination: string) => void;
@@ -61,7 +57,7 @@ function MoveCopyFilesDialog(props: Props) {
const [inputError, setInputError] = useState(false);
const [disableConfirmButton, setDisableConfirmButton] = useState(true);
const [targetPath, setTargetPath] = useState('');
- const { open, onClose, fullScreen } = props;
+ const { open, onClose } = props;
useEffect(() => {
handleValidation();
@@ -112,6 +108,8 @@ function MoveCopyFilesDialog(props: Props) {
onClose();
}
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
@@ -218,7 +216,4 @@ function mapActionCreatorsToProps(dispatch) {
);
}
-export default connect(
- null,
- mapActionCreatorsToProps
-)(withMobileDialog()(MoveCopyFilesDialog));
+export default connect(null, mapActionCreatorsToProps)(MoveCopyFilesDialog);
diff --git a/app/components/dialogs/MoveOrCopyFilesDialog.tsx b/app/components/dialogs/MoveOrCopyFilesDialog.tsx
index c6e428ea9..59052b9a1 100644
--- a/app/components/dialogs/MoveOrCopyFilesDialog.tsx
+++ b/app/components/dialogs/MoveOrCopyFilesDialog.tsx
@@ -35,10 +35,11 @@ import Typography from '@mui/material/Typography';
import Dialog from '@mui/material/Dialog';
import i18n from '-/services/i18n';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
+import useTheme from "@mui/styles/useTheme";
+import useMediaQuery from "@mui/material/useMediaQuery";
interface Props {
open: boolean;
- fullScreen: boolean;
onClose: (clearSelection?: boolean) => void;
selectedFiles: Array<File>;
handleMoveFiles: (files: Array<File>) => void;
@@ -46,8 +47,10 @@ interface Props {
}
function MoveOrCopyFilesDialog(props: Props) {
- const { open, onClose, fullScreen } = props;
+ const { open, onClose } = props;
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
diff --git a/app/components/dialogs/OnboardingDialog.tsx b/app/components/dialogs/OnboardingDialog.tsx
index ebd642c6c..9ae9c3a1b 100644
--- a/app/components/dialogs/OnboardingDialog.tsx
+++ b/app/components/dialogs/OnboardingDialog.tsx
@@ -49,17 +49,13 @@ import {
import { actions as AppActions } from '-/reducers/app';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import Links from '-/links';
-
-// FIXME checkout https://mui.com/components/use-media-query/#using-material-uis-breakpoint-helpers
-const withMobileDialog = () => WrappedComponent => props => (
- <WrappedComponent {...props} width="lg" fullScreen={false} />
-);
+import useTheme from '@mui/styles/useTheme';
+import useMediaQuery from '@mui/material/useMediaQuery';
interface Props {
classes: any;
open: boolean;
isPersistTagsInSidecar: boolean;
- fullScreen: boolean;
currentTheme: string;
// setFirstRun: (isFirstRun: boolean) => void,
setPersistTagsInSidecarFile: (isPersistTagsInSidecar: boolean) => void;
@@ -70,7 +66,7 @@ interface Props {
function OnboardingDialog(props: Props) {
const [activeStep, setActiveStep] = useState(0);
- const { fullScreen, open, onClose } = props;
+ const { open, onClose } = props;
const maxSteps = 4;
@@ -90,6 +86,8 @@ function OnboardingDialog(props: Props) {
props.setPersistTagsInSidecarFile(!props.isPersistTagsInSidecar);
}
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
@@ -338,4 +336,4 @@ function mapActionCreatorsToProps(dispatch) {
export default connect(
mapStateToProps,
mapActionCreatorsToProps
-)(withMobileDialog()(OnboardingDialog));
+)(OnboardingDialog);
diff --git a/app/components/dialogs/OpenLinkDialog.tsx b/app/components/dialogs/OpenLinkDialog.tsx
index e5e63b0bc..5d43dd43d 100644
--- a/app/components/dialogs/OpenLinkDialog.tsx
+++ b/app/components/dialogs/OpenLinkDialog.tsx
@@ -29,11 +29,12 @@ import Dialog from '@mui/material/Dialog';
import i18n from '-/services/i18n';
import { actions as AppActions } from '-/reducers/app';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
+import useTheme from "@mui/styles/useTheme";
+import useMediaQuery from "@mui/material/useMediaQuery";
interface Props {
open: boolean;
onClose: () => void;
- fullScreen?: boolean;
openLink: (linkURL: string) => void;
}
@@ -41,7 +42,7 @@ function OpenLinkDialog(props: Props) {
const [inputError, setInputError] = useState(false);
const [disableConfirmButton, setDisableConfirmButton] = useState(true);
const [linkURL, setLinkURL] = useState('');
- const { open, onClose, fullScreen } = props;
+ const { open, onClose } = props;
useEffect(() => {
handleValidation();
@@ -83,6 +84,8 @@ function OpenLinkDialog(props: Props) {
setDisableConfirmButton(true);
}
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
diff --git a/app/components/dialogs/ProTeaserDialog.tsx b/app/components/dialogs/ProTeaserDialog.tsx
index 4a61cc500..c3aaa0cb8 100644
--- a/app/components/dialogs/ProTeaserDialog.tsx
+++ b/app/components/dialogs/ProTeaserDialog.tsx
@@ -40,15 +40,11 @@ import EnterpriseImage from '-/assets/images/world-undraw.svg';
import i18n from '-/services/i18n';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import Links from '-/links';
-
-// FIXME checkout https://mui.com/components/use-media-query/#using-material-uis-breakpoint-helpers
-const withMobileDialog = () => WrappedComponent => props => (
- <WrappedComponent {...props} width="lg" fullScreen={false} />
-);
+import useTheme from "@mui/styles/useTheme";
+import useMediaQuery from "@mui/material/useMediaQuery";
interface Props {
open: boolean;
- fullScreen: boolean;
openURLExternally: (url: string, skipConfirmation: boolean) => void;
onClose: () => void;
}
@@ -405,8 +401,10 @@ function ProTeaserDialog(props: Props) {
setActiveStep(step);
};
- const { fullScreen, open, onClose, openURLExternally } = props;
+ const { open, onClose, openURLExternally } = props;
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
@@ -472,4 +470,4 @@ function ProTeaserDialog(props: Props) {
);
}
-export default withMobileDialog()(ProTeaserDialog);
+export default ProTeaserDialog;
diff --git a/app/components/dialogs/ThirdPartyLibsDialog.tsx b/app/components/dialogs/ThirdPartyLibsDialog.tsx
index acd97d23f..119814e8f 100644
--- a/app/components/dialogs/ThirdPartyLibsDialog.tsx
+++ b/app/components/dialogs/ThirdPartyLibsDialog.tsx
@@ -25,20 +25,18 @@ import Dialog from '@mui/material/Dialog';
import i18n from '-/services/i18n';
import ThirdPartyLibs from '-/third-party.txt';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-
-// FIXME checkout https://mui.com/components/use-media-query/#using-material-uis-breakpoint-helpers
-const withMobileDialog = () => WrappedComponent => props => (
- <WrappedComponent {...props} width="lg" fullScreen={false} />
-);
+import useTheme from '@mui/styles/useTheme';
+import useMediaQuery from '@mui/material/useMediaQuery';
interface Props {
open: boolean;
onClose: () => void;
- fullScreen: boolean;
}
function ThirdPartyLibsDialog(props: Props) {
- const { open, onClose, fullScreen } = props;
+ const { open, onClose } = props;
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
@@ -68,4 +66,4 @@ function ThirdPartyLibsDialog(props: Props) {
);
}
-export default withMobileDialog()(ThirdPartyLibsDialog);
+export default ThirdPartyLibsDialog;
diff --git a/app/components/dialogs/settings/SettingsDialog.tsx b/app/components/dialogs/settings/SettingsDialog.tsx
index 9fed88362..65e371206 100644
--- a/app/components/dialogs/settings/SettingsDialog.tsx
+++ b/app/components/dialogs/settings/SettingsDialog.tsx
@@ -55,7 +55,6 @@ const styles: any = () => ({
interface Props {
open: boolean;
- fullScreen?: boolean;
classes?: any;
onClose: () => void;
setSupportedFileTypes?: (fileTypes: Array<any>) => void;
diff --git a/app/containers/MainPage.tsx b/app/containers/MainPage.tsx
index c328f58be..469315cd6 100644
--- a/app/containers/MainPage.tsx
+++ b/app/containers/MainPage.tsx
@@ -611,7 +611,6 @@ function MainPage(props: Props) {
onClose={() => {
setMoveCopyDialogOpened(undefined);
}}
- fullScreen={false}
selectedFiles={moveCopyDialogOpened}
handleMoveFiles={files => {
handleMoveCopyFiles(files, true);