TagSpaces is an offline, open source, document manager with tagging support
chore: introducing tsdialogtitle component
Ilian Sapundshievdea895c09e86
diff --git a/src/renderer/components/EntryProperties.tsx b/src/renderer/components/EntryProperties.tsxindex 857d5f4c1..2b4587f25 100644--- a/src/renderer/components/EntryProperties.tsx+++ b/src/renderer/components/EntryProperties.tsx@@ -961,6 +961,7 @@ function EntryProperties(props: Props) {width: 160,height: 25,background: openedEntry.meta?.color,+ border: '1px solid lightgray',}}onClick={toggleBackgroundColorPicker}>diff --git a/src/renderer/components/TransparentBackground.tsx b/src/renderer/components/TransparentBackground.tsxindex c8eb56c36..fc1752895 100644--- a/src/renderer/components/TransparentBackground.tsx+++ b/src/renderer/components/TransparentBackground.tsx@@ -15,6 +15,7 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.**/+import AppConfig from '-/AppConfig';import React from 'react';interface Props {@@ -26,7 +27,7 @@ function TransparentBackground(props: Props) {<spanstyle={{minHeight: 25,- borderRadius: 5,+ borderRadius: AppConfig.defaultCSSRadius,background:'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==")',}}diff --git a/src/renderer/components/dialogs/AboutDialog.tsx b/src/renderer/components/dialogs/AboutDialog.tsxindex d8b48647c..26f972631 100644--- a/src/renderer/components/dialogs/AboutDialog.tsx+++ b/src/renderer/components/dialogs/AboutDialog.tsx@@ -22,7 +22,7 @@ import Paper from '@mui/material/Paper';import Typography from '@mui/material/Typography';import TsDialogActions from '-/components/dialogs/components/TsDialogActions';import DialogContent from '@mui/material/DialogContent';-import DialogTitle from '@mui/material/DialogTitle';+import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';import Tooltip from '-/components/Tooltip';import semver from 'semver';import DraggablePaper from '-/components/DraggablePaper';@@ -30,7 +30,6 @@ import LogoIcon from '-/assets/images/icon100x100.svg';import versionMeta from '-/version.json';import { Pro } from '-/pro';import { getLastVersionPromise } from '-/reducers/settings';-import DialogCloseButton from '-/components/dialogs/DialogCloseButton';import Links from 'assets/links';import useMediaQuery from '@mui/material/useMediaQuery';import { useTheme } from '@mui/material/styles';@@ -126,10 +125,11 @@ function AboutDialog(props: Props) {PaperComponent={fullScreen ? Paper : DraggablePaper}aria-labelledby="draggable-dialog-title">- <DialogTitle style={{ cursor: 'move' }} id="draggable-dialog-title">- {productName}- <DialogCloseButton testId="closeAboutDialogTID" onClose={onClose} />- </DialogTitle>+ <TsDialogTitle+ title={productName}+ onClose={onClose}+ closeButtonTestId="closeAboutDialogTID"+ /><DialogContent style={{ overflowY: 'auto' }}><imgalt="TagSpaces logo"diff --git a/src/renderer/components/dialogs/OnboardingDialog.tsx b/src/renderer/components/dialogs/OnboardingDialog.tsxindex 4573f0c53..66f67b36e 100644--- a/src/renderer/components/dialogs/OnboardingDialog.tsx+++ b/src/renderer/components/dialogs/OnboardingDialog.tsx@@ -21,7 +21,6 @@ import { useSelector, useDispatch } from 'react-redux';import Slider from 'react-slick';import TsButton from '-/components/TsButton';import DialogContent from '@mui/material/DialogContent';-import DialogTitle from '@mui/material/DialogTitle';import Typography from '@mui/material/Typography';import Radio from '@mui/material/Radio';import RadioGroup from '@mui/material/RadioGroup';@@ -46,10 +45,10 @@ import { useTheme } from '@mui/material/styles';import useMediaQuery from '@mui/material/useMediaQuery';import { openURLExternally } from '-/services/utils-io';import { AppDispatch } from '-/reducers/app';-import { useTranslation } from 'react-i18next';import NavigateBeforeIcon from '@mui/icons-material/NavigateBefore';import NavigateNextIcon from '@mui/icons-material/NavigateNext';+import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';interface Props {classes: any;@@ -59,33 +58,16 @@ interface Props {function OnboardingDialog(props: Props) {const { t } = useTranslation();- //const [activeStep, setActiveStep] = useState(0);const { open, onClose } = props;const isPersistTagsInSidecar = useSelector(getPersistTagsInSidecarFile);const currentTheme = useSelector(getCurrentTheme);const dispatch: AppDispatch = useDispatch();- //const swiperElRef = useRef(null); //<SwiperRef>-- /*useEffect(() => {- if(swiperElRef.current){- // listen for Swiper events using addEventListener- swiperElRef.current.addEventListener('progress', (e) => {- const [swiper, progress] = e.detail;- console.log(progress);- });-- swiperElRef.current.addEventListener('slidechange', (e) => {- console.log('slide changed');- });- }- }, []);*/const setPersistTagsInSidecarFile = (isPersistTagsInSidecar) => {dispatch(SettingsActions.setPersistTagsInSidecarFile(isPersistTagsInSidecar),);};- //const maxSteps = 4;const setCurrentTheme = (theme) => {dispatch(SettingsActions.setCurrentTheme(theme));@@ -139,9 +121,11 @@ function OnboardingDialog(props: Props) {fullScreen={fullScreen}scroll="paper">- <DialogTitle style={{ justifyContent: 'center', textAlign: 'center' }}>- <DialogCloseButton testId="closeOnboardingDialog" onClose={onClose} />- </DialogTitle>+ <TsDialogTitle+ title={''}+ onClose={onClose}+ closeButtonTestId="closeOnboardingDialog"+ /><DialogContentstyle={{overflowY: 'auto',diff --git a/src/renderer/components/dialogs/components/TsDialogTitle.tsx b/src/renderer/components/dialogs/components/TsDialogTitle.tsxnew file mode 100644index 000000000..b99a527a8--- /dev/null+++ b/src/renderer/components/dialogs/components/TsDialogTitle.tsx@@ -0,0 +1,87 @@+/**+ * 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 { useTranslation } from 'react-i18next';+import { GoBackIcon } from '-/components/CommonIcons';+import TsIconButton from '-/components/TsIconButton';+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';+import DialogTitle, { DialogTitleProps } from '@mui/material/DialogTitle';+import { isDesktopMode } from '-/reducers/settings';+import AppConfig from '-/AppConfig';++export type TSDialogActions = DialogTitleProps & {+ title: string;+ closeButtonTestId: string;+ onClose: () => void;+};++function TsDialogTitle(props: TSDialogActions) {+ const { style, title, onClose, closeButtonTestId } = props;+ const { t } = useTranslation();+ const desktopMode = useSelector(isDesktopMode);+ const theme = useTheme();+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));+ const closeButton = (+ <DialogCloseButton testId={closeButtonTestId} onClose={onClose} />+ );+ const backButton = (+ <TsIconButton+ title={t('closeButtonDialog')}+ aria-label="close"+ tabIndex={-1}+ style={{+ position: 'absolute',+ left: 15,+ top: 15,+ }}+ data-tid={closeButtonTestId && closeButtonTestId}+ onClick={onClose}+ >+ <GoBackIcon />+ </TsIconButton>+ );++ return (+ <DialogTitle+ id="draggable-dialog-title"+ {...props}+ style={{+ cursor: 'move',+ ...style,+ }}+ >+ {fullScreen ? (+ <div style={{ textAlign: 'center' }}>+ {backButton}+ {title}+ </div>+ ) : (+ <>+ {title}+ {closeButton}+ </>+ )}+ </DialogTitle>+ );+}++export default TsDialogTitle;diff --git a/src/renderer/perspectives/grid/components/GridSettingsDialog.tsx b/src/renderer/perspectives/grid/components/GridSettingsDialog.tsxindex dd8a9a1d8..03f49eda7 100644--- a/src/renderer/perspectives/grid/components/GridSettingsDialog.tsx+++ b/src/renderer/perspectives/grid/components/GridSettingsDialog.tsx@@ -20,7 +20,6 @@ import React, { useEffect, useReducer } from 'react';import {Dialog,DialogContent,- DialogTitle,FormControl,FormControlLabel,FormGroup,@@ -40,7 +39,6 @@ import ThumbnailContainIcon from '@mui/icons-material/PhotoSizeSelectLarge';import RadioCheckedIcon from '@mui/icons-material/RadioButtonChecked';import RadioUncheckedIcon from '@mui/icons-material/RadioButtonUnchecked';import DraggablePaper from '-/components/DraggablePaper';-import DialogCloseButton from '-/components/dialogs/DialogCloseButton';import TsSelect from '-/components/TsSelect';import TsButton from '-/components/TsButton';import { Pro } from '-/pro';@@ -50,6 +48,7 @@ import { useSortedDirContext } from '-/perspectives/grid/hooks/useSortedDirConteimport ZoomComponent from '-/components/ZoomComponent';import { usePerspectiveSettingsContext } from '-/hooks/usePerspectiveSettingsContext';import useFirstRender from '-/utils/useFirstRender';+import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';interface Props {open: boolean;@@ -116,16 +115,15 @@ function GridSettingsDialog(props: Props) {open={open}onClose={onClose}PaperComponent={fullScreen ? Paper : DraggablePaper}+ fullScreen={fullScreen}keepMountedscroll="paper">- <DialogTitle style={{ cursor: 'move' }} id="draggable-dialog-title">- {t('core:perspectiveSettingsTitle')}- <DialogCloseButton- testId="closePerspectiveSettingsTID"- onClose={onClose}- />- </DialogTitle>+ <TsDialogTitle+ title={t('core:perspectiveSettingsTitle')}+ onClose={onClose}+ closeButtonTestId="closePerspectiveSettingsTID"+ /><DialogContent>{haveLocalSetting() && (<>@@ -149,17 +147,17 @@ function GridSettingsDialog(props: Props) {</TsButton></>)}- <Divider />+ {/* <Divider /> */}<Box style={{ display: 'flex' }}>- <ZoomComponent preview={true} /><Typographystyle={{ color: theme.palette.text.primary, alignSelf: 'center' }}variant="body1">{t('Size of the entries')}</Typography>+ <ZoomComponent preview={true} /></Box>- <Divider />+ {/* <Divider /> */}<FormGroup><FormControlLabel// labelPlacement="start"