TagSpaces is an offline, open source, document manager with tagging support
chore: mobile optimizations
Ilian Sapundshieva5f34d186720
diff --git a/src/renderer/components/dialogs/EditEntryTagDialog.tsx b/src/renderer/components/dialogs/EditEntryTagDialog.tsxindex b4a27bfa7..fdb77c6b3 100644--- a/src/renderer/components/dialogs/EditEntryTagDialog.tsx+++ b/src/renderer/components/dialogs/EditEntryTagDialog.tsx@@ -27,8 +27,8 @@ import { useTheme } from '@mui/material/styles';import useMediaQuery from '@mui/material/useMediaQuery';import TsButton from '-/components/TsButton';import TsDialogActions from '-/components/dialogs/components/TsDialogActions';+import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';import DialogContent from '@mui/material/DialogContent';-import DialogTitle from '@mui/material/DialogTitle';import FormControl from '@mui/material/FormControl';import FormHelperText from '@mui/material/FormHelperText';import Dialog from '@mui/material/Dialog';@@ -39,7 +39,6 @@ import { Pro } from '-/pro';import { isDateTimeTag } from '-/utils/dates';import { TS } from '-/tagspaces.namespace';import useValidation from '-/utils/useValidation';-import DialogCloseButton from '-/components/dialogs/DialogCloseButton';import { useTranslation } from 'react-i18next';import { useTaggingActionsContext } from '-/hooks/useTaggingActionsContext';import { tagsValidation } from '-/services/utils-io';@@ -192,10 +191,11 @@ function EditEntryTagDialog(props: Props) {}*/}}>- <DialogTitle>- {t('core:tagProperties')}{' '}- <DialogCloseButton testId="closeEditEntryTagTID" onClose={onClose} />- </DialogTitle>+ <TsDialogTitle+ dialogTitle={t('core:tagProperties')}+ closeButtonTestId="closeEditEntryTagTID"+ onClose={onClose}+ />{renderContent()}<TsDialogActionsstyle={{diff --git a/src/renderer/components/dialogs/FilePreviewDialog.tsx b/src/renderer/components/dialogs/FilePreviewDialog.tsxindex ee32eaeea..8f178e22d 100644--- a/src/renderer/components/dialogs/FilePreviewDialog.tsx+++ b/src/renderer/components/dialogs/FilePreviewDialog.tsx@@ -47,7 +47,7 @@ function FilePreviewDialog(props: Props) {const { openedEntry } = useOpenedEntryContext();const { isEditMode } = useFilePropertiesContext();const theme = useTheme();- const fullScreen = useMediaQuery(theme.breakpoints.down('md'));+ const smallScreen = useMediaQuery(theme.breakpoints.down('md'));// const supportedFileTypes = useSelector(getSupportedFileTypes);const currentTheme = useSelector(getCurrentTheme);const fileViewer: MutableRefObject<HTMLIFrameElement> =@@ -165,14 +165,13 @@ function FilePreviewDialog(props: Props) {scroll="paper"fullWidthmaxWidth="md"- fullScreen={fullScreen}+ fullScreen={smallScreen}aria-labelledby="draggable-dialog-title"PaperComponent={DraggablePaper}PaperProps={{ sx: { width: '100%', height: '100%' } }}slotProps={{ backdrop: { style: { backgroundColor: 'transparent' } } }}><TsDialogTitle- //data-tid="importDialogTitle"dialogTitle=""closeButtonTestId="closeFilePreviewTID"onClose={onClose}diff --git a/src/renderer/components/dialogs/FileUploadDialog.tsx b/src/renderer/components/dialogs/FileUploadDialog.tsxindex efde0576b..d3d1eb853 100644--- a/src/renderer/components/dialogs/FileUploadDialog.tsx+++ b/src/renderer/components/dialogs/FileUploadDialog.tsx@@ -21,8 +21,8 @@ import { useTheme } from '@mui/material/styles';import useMediaQuery from '@mui/material/useMediaQuery';import TsButton from '-/components/TsButton';import TsDialogActions from '-/components/dialogs/components/TsDialogActions';+import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';import DialogContent from '@mui/material/DialogContent';-import DialogTitle from '@mui/material/DialogTitle';import Dialog from '@mui/material/Dialog';import CloseIcon from '@mui/icons-material/Close';import { useSelector, useDispatch } from 'react-redux';@@ -38,7 +38,6 @@ import {getProgress,} from '-/reducers/app';import { extractFileName } from '@tagspaces/tagspaces-common/paths';-import DialogCloseButton from '-/components/dialogs/DialogCloseButton';import { useTranslation } from 'react-i18next';import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';@@ -57,7 +56,7 @@ function FileUploadDialog(props: Props) {const { t } = useTranslation();const dispatch: AppDispatch = useDispatch();const theme = useTheme();- const fullScreen = useMediaQuery(theme.breakpoints.down('md'));+ const smallScreen = useMediaQuery(theme.breakpoints.down('md'));const { currentDirectoryPath } = useDirectoryContentContext();const { currentLocation } = useCurrentLocationContext();const progress = useSelector(getProgress);@@ -67,10 +66,6 @@ function FileUploadDialog(props: Props) {useEffect(() => {if (AppConfig.isElectron) {window.electronIO.ipcRenderer.on('progress', (fileName, newProgress) => {- /*const { path, filePath, loaded, total, key } = newProgress;- const progressPercentage = Math.round(- (loaded / total) * 100,- );*/dispatch(AppActions.onUploadProgress(newProgress, undefined));});@@ -169,20 +164,19 @@ function FileUploadDialog(props: Props) {keepMountedscroll="paper"fullWidth={true}- fullScreen={fullScreen}+ fullScreen={smallScreen}maxWidth="sm"aria-labelledby="draggable-dialog-title"PaperComponent={DraggablePaper}- BackdropProps={{ style: { backgroundColor: 'transparent' } }}+ slotProps={{ backdrop: { style: { backgroundColor: 'transparent' } } }}>- <DialogTitle- data-tid="importDialogTitle"- style={{ cursor: 'move' }}- id="draggable-dialog-title"- >- {t('core:' + (title && title.length > 0 ? title : 'importDialogTitle'))}- <DialogCloseButton testId="closeFileUploadTID" onClose={onClose} />- </DialogTitle>+ <TsDialogTitle+ dialogTitle={t(+ 'core:' + (title && title.length > 0 ? title : 'importDialogTitle'),+ )}+ closeButtonTestId="closeFileUploadTID"+ onClose={onClose}+ /><DialogContentstyle={{marginLeft: 'auto',@@ -246,7 +240,10 @@ function FileUploadDialog(props: Props) {</Grid><Grid item xs={2}>{abort && typeof abort === 'function' && (- <TsButton onClick={() => abort()}>+ <TsButton+ tooltip={t('core:abort')}+ onClick={() => abort()}+ ><CloseIcon /></TsButton>)}diff --git a/src/renderer/components/dialogs/ImportExportTagGroupsDialog.tsx b/src/renderer/components/dialogs/ImportExportTagGroupsDialog.tsxindex 42bcecff3..aec747cf5 100644--- a/src/renderer/components/dialogs/ImportExportTagGroupsDialog.tsx+++ b/src/renderer/components/dialogs/ImportExportTagGroupsDialog.tsx@@ -19,8 +19,8 @@import React, { useRef, useState } from 'react';import TsButton from '-/components/TsButton';import TsDialogActions from '-/components/dialogs/components/TsDialogActions';+import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';import DialogContent from '@mui/material/DialogContent';-import DialogTitle from '@mui/material/DialogTitle';import FormControl from '@mui/material/FormControl';import FormGroup from '@mui/material/FormGroup';import FormControlLabel from '@mui/material/FormControlLabel';@@ -30,7 +30,6 @@ import { isFunc } from '@tagspaces/tagspaces-common/misc';import TagGroupContainer from '../TagGroupContainer';import TagContainer from '../TagContainer';import { TS } from '-/tagspaces.namespace';-import DialogCloseButton from '-/components/dialogs/DialogCloseButton';import { useTheme } from '@mui/material/styles';import useMediaQuery from '@mui/material/useMediaQuery';import { exportTagGroups } from '-/services/taglibrary-utils';@@ -106,7 +105,6 @@ function ImportExportTagGroupsDialog(props: Props) {id={tagGroup.uuid || tagGroup.key}checked={tagGroup.selected}onClick={(e) => handleTagGroup(e, tagGroup.selected, index)}- // onChange={e => handleChange(e)}value={tagGroup.title}name={tagGroup.title}/>@@ -126,20 +124,34 @@ function ImportExportTagGroupsDialog(props: Props) {const { onClose, open } = props;const theme = useTheme();- const fullScreen = useMediaQuery(theme.breakpoints.down('md'));+ const smallScreen = useMediaQuery(theme.breakpoints.down('md'));+ const confirmButton = (+ <TsButton+ disabled={!isSelected()}+ onClick={onConfirm}+ data-tid="confirmImportExport"+ variant="contained"+ >+ {props.dialogModeImport ? 'Import' : 'Export'}+ </TsButton>+ );return (<Dialogopen={open}- fullScreen={fullScreen}+ fullScreen={smallScreen}onClose={onClose}// onEnterKey={(event) => onEnterKeyHandler(event, this.onConfirm)}>- <DialogTitle>- {props.dialogModeImport- ? t('core:importGroupTagsTitle')- : t('core:exportGroupTagsTitle')}- <DialogCloseButton testId="closeIETagGroupsTID" onClose={onClose} />- </DialogTitle>+ <TsDialogTitle+ dialogTitle={+ props.dialogModeImport+ ? t('core:importGroupTagsTitle')+ : t('core:exportGroupTagsTitle')+ }+ closeButtonTestId="closeIETagGroupsTID"+ onClose={onClose}+ actionSlot={confirmButton}+ /><DialogContent><TsButton onClick={handleToggleSelectAll}>{t('core:selectAllTagGroups')}@@ -148,17 +160,12 @@ function ImportExportTagGroupsDialog(props: Props) {{tagGroupList.map(renderTagGroups)}</FormControl></DialogContent>- <TsDialogActions>- <TsButton onClick={props.onClose}>{t('core:cancel')}</TsButton>- <TsButton- disabled={!isSelected()}- onClick={onConfirm}- data-tid="confirmImportExport"- variant="contained"- >- {props.dialogModeImport ? 'Import' : 'Export'}- </TsButton>- </TsDialogActions>+ {!smallScreen && (+ <TsDialogActions>+ <TsButton onClick={props.onClose}>{t('core:cancel')}</TsButton>+ {confirmButton}+ </TsDialogActions>+ )}</Dialog>);}diff --git a/src/renderer/components/dialogs/KeyboardDialog.tsx b/src/renderer/components/dialogs/KeyboardDialog.tsxindex 7c32f5c6f..4f739d974 100644--- a/src/renderer/components/dialogs/KeyboardDialog.tsx+++ b/src/renderer/components/dialogs/KeyboardDialog.tsx@@ -20,15 +20,14 @@ import React from 'react';import { useSelector } from 'react-redux';import TsButton from '-/components/TsButton';import TsDialogActions from '-/components/dialogs/components/TsDialogActions';+import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';import DialogContent from '@mui/material/DialogContent';-import DialogTitle from '@mui/material/DialogTitle';import List from '@mui/material/List';import ListItem from '@mui/material/ListItem';import Box from '@mui/material/Box';import ListItemText from '@mui/material/ListItemText';import Dialog from '@mui/material/Dialog';import { getKeyBindingObject } from '-/reducers/settings';-import DialogCloseButton from '-/components/dialogs/DialogCloseButton';import { useTheme } from '@mui/material/styles';import useMediaQuery from '@mui/material/useMediaQuery';import { useTranslation } from 'react-i18next';@@ -70,19 +69,31 @@ function KeyboardDialog(props: Props) {const { t } = useTranslation();const keyBindings = useSelector(getKeyBindingObject);const theme = useTheme();- const fullScreen = useMediaQuery(theme.breakpoints.down('md'));+ const smallScreen = useMediaQuery(theme.breakpoints.down('md'));+ const okButton = (+ <TsButton+ data-tid="closeKeyboardDialog"+ onClick={onClose}+ variant="outlined"+ >+ {t('core:ok')}+ </TsButton>+ );+return (<Dialogopen={open}onClose={onClose}- fullScreen={fullScreen}+ fullScreen={smallScreen}keepMountedscroll="paper">- <DialogTitle>- {t('core:shortcutKeys')}- <DialogCloseButton testId="closeKeyboardTID" onClose={onClose} />- </DialogTitle>+ <TsDialogTitle+ dialogTitle={t('core:shortcutKeys')}+ closeButtonTestId="closeKeyboardTID"+ onClose={onClose}+ actionSlot={okButton}+ /><DialogContentdata-tid="keyboardShortCutsDialog"style={{@@ -111,15 +122,7 @@ function KeyboardDialog(props: Props) {))}</List></DialogContent>- <TsDialogActions>- <TsButton- data-tid="closeKeyboardDialog"- onClick={onClose}- variant="contained"- >- {t('core:ok')}- </TsButton>- </TsDialogActions>+ {!smallScreen && <TsDialogActions>{okButton}</TsDialogActions>}</Dialog>);}diff --git a/src/renderer/components/dialogs/LinkGeneratorDialog.tsx b/src/renderer/components/dialogs/LinkGeneratorDialog.tsxindex 762100efd..9bddeaad7 100644--- a/src/renderer/components/dialogs/LinkGeneratorDialog.tsx+++ b/src/renderer/components/dialogs/LinkGeneratorDialog.tsx@@ -19,10 +19,9 @@import React, { ChangeEvent, useRef, useReducer, useEffect } from 'react';import TsButton from '-/components/TsButton';import TsDialogActions from '-/components/dialogs/components/TsDialogActions';+import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';import DialogContent from '@mui/material/DialogContent';-import DialogTitle from '@mui/material/DialogTitle';import Dialog from '@mui/material/Dialog';-import DialogCloseButton from '-/components/dialogs/DialogCloseButton';import { useTheme } from '@mui/material/styles';import useMediaQuery from '@mui/material/useMediaQuery';import { QRCode } from 'react-qrcode-logo';@@ -56,7 +55,7 @@ function LinkGeneratorDialog(props: Props) {const signedLink = useRef<string>(undefined);const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);const theme = useTheme();- const fullScreen = useMediaQuery(theme.breakpoints.down('md'));+ const smallScreen = useMediaQuery(theme.breakpoints.down('md'));let location = findLocation(openedEntry?.locationID);if (!location) {@@ -81,15 +80,16 @@ function LinkGeneratorDialog(props: Props) {<Dialogopen={open}onClose={onClose}- fullScreen={fullScreen}+ fullScreen={smallScreen}keepMountedscroll="paper"style={{ marginTop: 12 }}>- <DialogTitle>- {t('core:downloadLink')}{' '}- <DialogCloseButton testId="closeLinkGeneratorTID" onClose={onClose} />- </DialogTitle>+ <TsDialogTitle+ dialogTitle={t('core:downloadLink')}+ closeButtonTestId="closeLinkGeneratorTID"+ onClose={onClose}+ /><DialogContent style={{ overflow: 'auto', height: 450 }}><TsSelectlabel={@@ -118,6 +118,7 @@ function LinkGeneratorDialog(props: Props) {<InputAdornment position="start"><TsButtondata-tid="copySharingLinkTID"+ variant="contained"onClick={() => {const entryTitle = extractTitle(gPath,@@ -177,7 +178,7 @@ function LinkGeneratorDialog(props: Props) {>{t('help')}</TsButton>- <TsButton data-tid="closeLinkTID" onClick={onClose} variant="contained">+ <TsButton data-tid="closeLinkTID" onClick={onClose}>{t('core:close')}</TsButton></TsDialogActions>diff --git a/src/renderer/components/dialogs/MoveCopyFilesDialog.tsx b/src/renderer/components/dialogs/MoveCopyFilesDialog.tsxindex f5d0c1f83..cbe0560e4 100644--- a/src/renderer/components/dialogs/MoveCopyFilesDialog.tsx+++ b/src/renderer/components/dialogs/MoveCopyFilesDialog.tsx@@ -9,12 +9,11 @@ import ListItem from '@mui/material/ListItem';import ListItemIcon from '@mui/material/ListItemIcon';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 Typography from '@mui/material/Typography';import Dialog from '@mui/material/Dialog';import { FolderIcon, FileIcon } from '-/components/CommonIcons';import DraggablePaper from '-/components/DraggablePaper';-import DialogCloseButton from '-/components/dialogs/DialogCloseButton';import { useTheme } from '@mui/material/styles';import useMediaQuery from '@mui/material/useMediaQuery';import { actions as AppActions, AppDispatch } from '-/reducers/app';@@ -105,10 +104,6 @@ function MoveCopyFilesDialog(props: Props) {}return { path, count };});- /*let total = 0;- const arr = Object.values(dirProp.current);- arr.forEach((n: TS.DirProp) => (total += n.filesCount + n.dirsCount));- return total;*/}function handleCopy() {@@ -193,10 +188,11 @@ function MoveCopyFilesDialog(props: Props) {PaperComponent={fullScreen ? Paper : DraggablePaper}fullScreen={fullScreen}>- <DialogTitle style={{ cursor: 'move' }} id="draggable-dialog-title">- {t('core:copyMoveEntriesTitle')}- <DialogCloseButton testId="closeMCFilesTID" onClose={() => onClose()} />- </DialogTitle>+ <TsDialogTitle+ dialogTitle={t('core:copyMoveEntriesTitle')}+ closeButtonTestId="closeMCFilesTID"+ onClose={onClose}+ /><DialogContent style={{ overflow: 'hidden' }}><Typography variant="subtitle2">{t('selectedFilesAndFolders')}diff --git a/src/renderer/components/dialogs/MoveOrCopyFilesDialog.tsx b/src/renderer/components/dialogs/MoveOrCopyFilesDialog.tsxindex 7ea69889e..501841d47 100644--- a/src/renderer/components/dialogs/MoveOrCopyFilesDialog.tsx+++ b/src/renderer/components/dialogs/MoveOrCopyFilesDialog.tsx@@ -30,14 +30,13 @@ import ListItem from '@mui/material/ListItem';import ListItemIcon from '@mui/material/ListItemIcon';import FileIcon from '@mui/icons-material/InsertDriveFileOutlined';import TsDialogActions from '-/components/dialogs/components/TsDialogActions';+import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';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/material/styles';import useMediaQuery from '@mui/material/useMediaQuery';import DraggablePaper from '-/components/DraggablePaper';-import DialogCloseButton from '-/components/dialogs/DialogCloseButton';import { useTranslation } from 'react-i18next';import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';import { useIOActionsContext } from '-/hooks/useIOActionsContext';@@ -127,13 +126,11 @@ function MoveOrCopyFilesDialog(props: Props) {PaperComponent={fullScreen ? Paper : DraggablePaper}fullScreen={fullScreen}>- <DialogTitle style={{ cursor: 'move' }} id="draggable-dialog-title">- {t('core:copyMoveEntriesTitle')}- <DialogCloseButton- testId="closeMoveOrCopyTID"- onClose={() => onClose()}- />- </DialogTitle>+ <TsDialogTitle+ dialogTitle={t('core:copyMoveEntriesTitle')}+ closeButtonTestId="closeMoveOrCopyTID"+ onClose={onClose}+ /><DialogContentstyle={{overflowX: 'hidden',diff --git a/src/renderer/components/dialogs/OpenLinkDialog.tsx b/src/renderer/components/dialogs/OpenLinkDialog.tsxindex 936ff8f35..5d7fe2a3b 100644--- a/src/renderer/components/dialogs/OpenLinkDialog.tsx+++ b/src/renderer/components/dialogs/OpenLinkDialog.tsx@@ -21,12 +21,11 @@ import useMediaQuery from '@mui/material/useMediaQuery';import { useTheme } from '@mui/material/styles';import TsButton from '-/components/TsButton';import TsDialogActions from '-/components/dialogs/components/TsDialogActions';+import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';import DialogContent from '@mui/material/DialogContent';-import DialogTitle from '@mui/material/DialogTitle';import FormControl from '@mui/material/FormControl';import InputAdornment from '@mui/material/InputAdornment';import Dialog from '@mui/material/Dialog';-import DialogCloseButton from '-/components/dialogs/DialogCloseButton';import InfoIcon from '-/components/InfoIcon';import TsTextField from '-/components/TsTextField';import { useTranslation } from 'react-i18next';@@ -40,7 +39,7 @@ interface Props {function OpenLinkDialog(props: Props) {const { t } = useTranslation();const theme = useTheme();- const fullScreen = useMediaQuery(theme.breakpoints.down('md'));+ const smallScreen = useMediaQuery(theme.breakpoints.down('md'));const { openLink } = useOpenedEntryContext();const [inputError, setInputError] = useState(false);const [disableConfirmButton, setDisableConfirmButton] = useState(true);@@ -87,11 +86,22 @@ function OpenLinkDialog(props: Props) {setDisableConfirmButton(true);}+ const okButton = (+ <TsButton+ disabled={disableConfirmButton}+ onClick={onConfirm}+ data-tid="confirmOpenLink"+ variant="contained"+ >+ {t('core:open')}+ </TsButton>+ );+return (<Dialogopen={open}onClose={onClose}- //fullScreen={fullScreen}+ fullScreen={smallScreen}onKeyDown={(event) => {if (event.key === 'Enter' || event.keyCode === 13) {event.preventDefault();@@ -100,11 +110,13 @@ function OpenLinkDialog(props: Props) {}}}>- <DialogTitle>- {t('core:openLink')}- <DialogCloseButton testId="closeOpenLinkTID" onClose={onClose} />- </DialogTitle>- <DialogContent style={{ minWidth: fullScreen ? 100 : 400 }}>+ <TsDialogTitle+ dialogTitle={t('core:openLink')}+ closeButtonTestId="closeOpenLinkTID"+ onClose={onClose}+ actionSlot={okButton}+ />+ <DialogContent style={{ minWidth: smallScreen ? 100 : 400 }}><FormControl fullWidth={true}><TsTextFieldautoFocus@@ -132,19 +144,14 @@ function OpenLinkDialog(props: Props) {/></FormControl></DialogContent>- <TsDialogActions>- <TsButton data-tid="closeOpenLinkDialog" onClick={onCancel}>- {t('core:cancel')}- </TsButton>- <TsButton- disabled={disableConfirmButton}- onClick={onConfirm}- data-tid="confirmOpenLink"- variant="contained"- >- {t('core:open')}- </TsButton>- </TsDialogActions>+ {!smallScreen && (+ <TsDialogActions>+ <TsButton data-tid="closeOpenLinkDialog" onClick={onCancel}>+ {t('core:cancel')}+ </TsButton>+ {okButton}+ </TsDialogActions>+ )}</Dialog>);}diff --git a/src/renderer/locales/en/core.json b/src/renderer/locales/en/core.jsonindex f55804341..6f421c126 100644--- a/src/renderer/locales/en/core.json+++ b/src/renderer/locales/en/core.json@@ -874,5 +874,6 @@"exportAsPNG": "Export as PNG","tagPreview": "Tag Preview","generateNewLocationId": "Generates new unique identifier for this location",+ "abort": "Abort","-": "-"}