TagSpaces is an offline, open source, document manager with tagging support
chore: introducing tsdialogactions component
Ilian Sapundshievaf8436fa0d48
diff --git a/src/renderer/components/EntryContainer.tsx b/src/renderer/components/EntryContainer.tsxindex d520d66b6..287104975 100644--- a/src/renderer/components/EntryContainer.tsx+++ b/src/renderer/components/EntryContainer.tsx@@ -31,7 +31,6 @@ import TsButton from '-/components/TsButton';import LoadingButton from '@mui/lab/LoadingButton';import Tooltip from '-/components/Tooltip';import Box from '@mui/material/Box';-import Button from '@mui/material/Button';import ButtonGroup from '@mui/material/ButtonGroup';import { CancelIcon, CloseEditIcon } from '-/components/CommonIcons';import { getUuid } from '@tagspaces/tagspaces-common/utils-io';diff --git a/src/renderer/components/MobileNavigation.tsx b/src/renderer/components/MobileNavigation.tsxindex 97c849fd8..1c162c769 100644--- a/src/renderer/components/MobileNavigation.tsx+++ b/src/renderer/components/MobileNavigation.tsx@@ -479,11 +479,11 @@ function MobileNavigation(props: Props) {<ToggleButtonGroup exclusive><ToggleButtononClick={() => showPanel('locationManagerPanel')}- // className={- // currentOpenedPanel === 'locationManagerPanel'- // ? classNames(classes.button, classes.selectedButton)- // : classes.button- // }+ className={+ currentOpenedPanel === 'locationManagerPanel'+ ? classNames(classes.button, classes.selectedButton)+ : classes.button+ }data-tid="locationManager"value="check">diff --git a/src/renderer/components/SplitButton.tsx b/src/renderer/components/SplitButton.tsxindex 4e4faf652..0fe49f112 100644--- a/src/renderer/components/SplitButton.tsx+++ b/src/renderer/components/SplitButton.tsx@@ -1,3 +1,4 @@+/**import React from 'react';import Grid from '@mui/material/Grid';import Button from '@mui/material/Button';@@ -16,11 +17,6 @@ interface Props {onChange: (selected: string) => void;}-/**- * https://material-ui.com/components/button-group/#split-button- * @param props- * @constructor- */export default function SplitButton(props: Props) {const { options, selected, onChange } = props;const [open, setOpen] = React.useState(false);@@ -113,3 +109,5 @@ export default function SplitButton(props: Props) {</Grid>);}++*/\ No newline at end of filediff --git a/src/renderer/components/dialogs/AboutDialog.tsx b/src/renderer/components/dialogs/AboutDialog.tsxindex 2b9fb37be..d8b48647c 100644--- a/src/renderer/components/dialogs/AboutDialog.tsx+++ b/src/renderer/components/dialogs/AboutDialog.tsx@@ -20,7 +20,7 @@ import React, { useState } from 'react';import TsButton from '-/components/TsButton';import Paper from '@mui/material/Paper';import Typography from '@mui/material/Typography';-import DialogActions from '@mui/material/DialogActions';+import TsDialogActions from '-/components/dialogs/components/TsDialogActions';import DialogContent from '@mui/material/DialogContent';import DialogTitle from '@mui/material/DialogTitle';import Tooltip from '-/components/Tooltip';@@ -222,9 +222,7 @@ function AboutDialog(props: Props) {</div></Typography></DialogContent>- <DialogActions- style={fullScreen ? { padding: '10px 30px 30px 30px' } : {}}- >+ <TsDialogActions>{!Pro && (<TsButtondata-tid="checkForUpdates"@@ -262,7 +260,7 @@ function AboutDialog(props: Props) {>{t('core:ok')}</TsButton>- </DialogActions>+ </TsDialogActions></TranslucentDialog>);}diff --git a/src/renderer/components/dialogs/ConfirmDialog.tsx b/src/renderer/components/dialogs/ConfirmDialog.tsxindex 4e9f0844e..fc36614a2 100644--- a/src/renderer/components/dialogs/ConfirmDialog.tsx+++ b/src/renderer/components/dialogs/ConfirmDialog.tsx@@ -18,7 +18,7 @@import React from 'react';import TsButton from '-/components/TsButton';-import DialogActions from '@mui/material/DialogActions';+import TsDialogActions from '-/components/dialogs/components/TsDialogActions';import DialogContent from '@mui/material/DialogContent';import DialogTitle from '@mui/material/DialogTitle';import DialogContentText from '@mui/material/DialogContentText';@@ -87,7 +87,7 @@ function ConfirmDialog(props: Props) {)}</DialogContentText></DialogContent>- <DialogActions>+ <TsDialogActions><TsButtononClick={() => onConfirm(false)}data-tid={props.cancelDialogTID}@@ -100,7 +100,7 @@ function ConfirmDialog(props: Props) {>{t('core:yes')}</TsButton>- </DialogActions>+ </TsDialogActions></Dialog>);}diff --git a/src/renderer/components/dialogs/LicenseDialog.tsx b/src/renderer/components/dialogs/LicenseDialog.tsxindex a74b369e6..13c3baed9 100644--- a/src/renderer/components/dialogs/LicenseDialog.tsx+++ b/src/renderer/components/dialogs/LicenseDialog.tsx@@ -18,7 +18,7 @@import React from 'react';import TsButton from '-/components/TsButton';-import DialogActions from '@mui/material/DialogActions';+import TsDialogActions from '-/components/dialogs/components/TsDialogActions';import DialogContent from '@mui/material/DialogContent';import DialogTitle from '@mui/material/DialogTitle';import Dialog from '@mui/material/Dialog';@@ -80,9 +80,7 @@ function LicenseDialog(props: Props) {{Pro ? Pro.EULAContent : LicenseContent}</pre></DialogContent>- <DialogActions- style={fullScreen ? { padding: '10px 30px 30px 30px' } : {}}- >+ <TsDialogActions>{/* <TsButtononClick={printLicense}>@@ -98,7 +96,7 @@ function LicenseDialog(props: Props) {>{t('core:agreeLicense')}</TsButton>- </DialogActions>+ </TsDialogActions></Dialog>);}diff --git a/src/renderer/components/dialogs/ThirdPartyLibsDialog.tsx b/src/renderer/components/dialogs/ThirdPartyLibsDialog.tsxindex ef454d093..e29ade3e5 100644--- a/src/renderer/components/dialogs/ThirdPartyLibsDialog.tsx+++ b/src/renderer/components/dialogs/ThirdPartyLibsDialog.tsx@@ -18,7 +18,7 @@import React from 'react';import TsButton from '-/components/TsButton';-import DialogActions from '@mui/material/DialogActions';+import TsDialogActions from '-/components/dialogs/components/TsDialogActions';import DialogContent from '@mui/material/DialogContent';import DialogTitle from '@mui/material/DialogTitle';import Dialog from '@mui/material/Dialog';@@ -55,9 +55,7 @@ function ThirdPartyLibsDialog(props: Props) {{ThirdPartyLibs}</pre></DialogContent>- <DialogActions- style={fullScreen ? { padding: '10px 30px 30px 30px' } : {}}- >+ <TsDialogActions><TsButtondata-tid="confirmThirdPartyLibsDialog"onClick={onClose}@@ -65,7 +63,7 @@ function ThirdPartyLibsDialog(props: Props) {>{t('core:ok')}</TsButton>- </DialogActions>+ </TsDialogActions></Dialog>);}diff --git a/src/renderer/components/dialogs/components/TsDialogActions.tsx b/src/renderer/components/dialogs/components/TsDialogActions.tsxnew file mode 100644index 000000000..1a7c74707--- /dev/null+++ b/src/renderer/components/dialogs/components/TsDialogActions.tsx@@ -0,0 +1,48 @@+/**+ * TagSpaces - universal file and folder organizer+ * Copyright (C) 2024-present TagSpaces GmbH+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License (version 3) as+ * published by the Free Software Foundation.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ */++import React from 'react';+import { useSelector } from 'react-redux';+import useMediaQuery from '@mui/material/useMediaQuery';+import { useTheme } from '@mui/material/styles';+import DialogActions, { DialogActionsProps } from '@mui/material/DialogActions';+import { isDesktopMode } from '-/reducers/settings';+import AppConfig from '-/AppConfig';++export type TSDialogActions = DialogActionsProps & {};++function TSDialogActions(props: TSDialogActions) {+ const { children, style } = props;+ const desktopMode = useSelector(isDesktopMode);+ const theme = useTheme();+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));++ return (+ <DialogActions+ {...props}+ style={{+ padding: fullScreen ? '10px 30px 30px 30px' : 'inherited',+ ...style,+ }}+ >+ {children}+ </DialogActions>+ );+}++export default TSDialogActions;diff --git a/src/renderer/components/dialogs/settings/SettingsDialog.tsx b/src/renderer/components/dialogs/settings/SettingsDialog.tsxindex a6439840a..965170450 100644--- a/src/renderer/components/dialogs/settings/SettingsDialog.tsx+++ b/src/renderer/components/dialogs/settings/SettingsDialog.tsx@@ -25,7 +25,7 @@ import { useTheme } from '@mui/material/styles';import Tabs from '@mui/material/Tabs';import Tab from '@mui/material/Tab';import Dialog from '@mui/material/Dialog';-import DialogActions from '@mui/material/DialogActions';+import TsDialogActions from '-/components/dialogs/components/TsDialogActions';import DialogContent from '@mui/material/DialogContent';import DialogTitle from '@mui/material/DialogTitle';import { isDesktopMode } from '-/reducers/settings';@@ -191,10 +191,9 @@ function SettingsDialog(props: Props) {);const renderActions = () => (- <DialogActions+ <TsDialogActionsstyle={{justifyContent: 'space-between',- padding: fullScreen ? '10px 30px 30px 30px' : undefined,}}><TsButton@@ -209,7 +208,7 @@ function SettingsDialog(props: Props) {<TsButton data-tid="closeSettingsDialog" onClick={props.onClose}>{t('core:closeButton')}</TsButton>- </DialogActions>+ </TsDialogActions>);return (