Skip to content

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

chore: mobile optimizations

Ilian Sapundshiev7069d3d64b03
diff --git a/src/renderer/components/dialogs/AddRemoveTagsDialog.tsx b/src/renderer/components/dialogs/AddRemoveTagsDialog.tsx
index 3fcaebaed..e81ec4631 100644
--- a/src/renderer/components/dialogs/AddRemoveTagsDialog.tsx
+++ b/src/renderer/components/dialogs/AddRemoveTagsDialog.tsx
@@ -21,7 +21,7 @@ import TsButton from '-/components/TsButton';
import Paper from '@mui/material/Paper';
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 List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import ListItemIcon from '@mui/material/ListItemIcon';
@@ -36,7 +36,7 @@ import {
extractDirectoryName,
} from '@tagspaces/tagspaces-common/paths';
import { TS } from '-/tagspaces.namespace';
-import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
+import TsTextField from '-/components/TsTextField';
import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import { useTranslation } from 'react-i18next';
@@ -148,10 +148,11 @@ function AddRemoveTagsDialog(props: Props) {
PaperComponent={fullScreen ? Paper : DraggablePaper}
aria-labelledby="draggable-dialog-title"
>
- <DialogTitle style={{ cursor: 'move' }} id="draggable-dialog-title">
- {t('core:tagOperationTitle')}
- <DialogCloseButton testId="closeAddRemoveTagsTID" onClose={onClose} />
- </DialogTitle>
+ <TsDialogTitle
+ dialogTitle={t('core:tagOperationTitle')}
+ closeButtonTestId="closeAddRemoveTagsTID"
+ onClose={onClose}
+ />
<DialogContent
style={{
minHeight: 330,
diff --git a/src/renderer/components/dialogs/CreateDirectoryDialog.tsx b/src/renderer/components/dialogs/CreateDirectoryDialog.tsx
index 071f740ec..4720429fb 100644
--- a/src/renderer/components/dialogs/CreateDirectoryDialog.tsx
+++ b/src/renderer/components/dialogs/CreateDirectoryDialog.tsx
@@ -16,21 +16,22 @@
*
*/
-import React, { useState, useEffect, useRef, useReducer } from 'react';
+import React, { useState, useRef, useReducer } from 'react';
import { styled, useTheme } from '@mui/material/styles';
import {
Dialog,
FormControl,
DialogContent,
- DialogTitle,
FormHelperText,
InputAdornment,
inputBaseClasses,
+ useMediaQuery,
+ Box,
} from '@mui/material';
import TsDialogActions from '-/components/dialogs/components/TsDialogActions';
+import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';
import SetBackgroundIcon from '@mui/icons-material/OpacityOutlined';
import { joinPaths } from '@tagspaces/tagspaces-common/paths';
-import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import TsTextField from '-/components/TsTextField';
import TsIconButton from '-/components/TsIconButton';
import TsButton from '-/components/TsButton';
@@ -44,7 +45,7 @@ import { dirNameValidation } from '-/services/utils-io';
const FolderColorTextField = styled(TsTextField)(({ theme }) => ({
[`& .${inputBaseClasses.root}`]: {
- height: 100,
+ height: 200,
},
}));
@@ -72,14 +73,6 @@ function CreateDirectoryDialog(props: Props) {
const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);
const { open, onClose, selectedDirectoryPath } = props;
- /*useEffect(() => {
- if (isFirstRun.current) {
- isFirstRun.current = false;
- return;
- }
- handleValidation();
- });*/
-
const defaultBackgrounds = [
'transparent',
// '#00000044',
@@ -94,11 +87,11 @@ function CreateDirectoryDialog(props: Props) {
'#92e1c044',
'#9fe1e744',
'#9fc6e744',
- // '#4986e744',
- // '#9a9cff44',
- // '#c2c2c244',
- // '#cca6ac44',
- // '#f691b244',
+ '#4986e744',
+ '#9a9cff44',
+ '#c2c2c244',
+ '#cca6ac44',
+ '#f691b244',
// '#cd74e644',
// '#a47ae244',
// '#845EC260',
@@ -165,13 +158,26 @@ function CreateDirectoryDialog(props: Props) {
setDisableConfirmButton(true);
}
- // const theme = useTheme();
- // const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
+ const theme = useTheme();
+ const smallScreen = useMediaQuery(theme.breakpoints.down('md'));
+ const okButton = (
+ <TsButton
+ disabled={disableConfirmButton}
+ onClick={onConfirm}
+ data-tid="confirmCreateNewDirectory"
+ id="confirmCreateNewDirectory"
+ variant="contained"
+ //variant={smallScreen ? 'outlined' : 'contained'}
+ >
+ {t('core:ok')}
+ </TsButton>
+ );
+
return (
<Dialog
open={open}
onClose={onClose}
- // fullScreen={fullScreen}
+ fullScreen={smallScreen}
keepMounted
scroll="paper"
onKeyDown={(event) => {
@@ -184,15 +190,18 @@ function CreateDirectoryDialog(props: Props) {
}
}}
>
- <DialogTitle>
- {t('core:createNewDirectoryTitle')}
- <DialogCloseButton testId="closeCreateDirectoryTID" onClose={onClose} />
- </DialogTitle>
+ <TsDialogTitle
+ dialogTitle={t('core:createNewDirectoryTitle')}
+ closeButtonTestId="closeCreateDirectoryTID"
+ onClose={onClose}
+ actionSlot={okButton}
+ />
<DialogContent>
<FormControl fullWidth={true} error={inputError}>
<TsTextField
error={inputError}
autoFocus
+ fullWidth
name="name"
label={t('core:folderName')}
onChange={(event) => {
@@ -215,58 +224,58 @@ function CreateDirectoryDialog(props: Props) {
<FormControl>
<FolderColorTextField
data-tid="folderColorTID"
- size="medium"
+ fullWidth
label={t('backgroundColor')}
retrieveValue={() => backgroundColor.current}
value={' '}
- style={{ height: 100, marginTop: 0 }}
- InputProps={{
- readOnly: true,
- endAdornment: (
- <InputAdornment position="end">
- {defaultBackgrounds.map((background, cnt) => (
- <>
- <TsIconButton
- key={cnt}
- data-tid={'bgTID' + cnt}
- aria-label="changeFolderBackground"
- onClick={() => {
- backgroundColor.current = background;
- forceUpdate();
- }}
- style={{
- backgroundColor: background,
- backgroundImage: background,
- margin: 5,
- ...(backgroundColor.current === background && {
- border: '0.5rem outset ' + background,
- }),
- }}
- >
- <SetBackgroundIcon />
- </TsIconButton>
- </>
- ))}
- </InputAdornment>
- ),
+ style={{ marginTop: 0 }}
+ slotProps={{
+ input: {
+ readOnly: true,
+ endAdornment: (
+ <InputAdornment position="end" style={{ height: 300 }}>
+ <Box style={{ padding: 10, width: 300 }}>
+ {defaultBackgrounds.map((background, cnt) => (
+ <>
+ <TsIconButton
+ key={cnt}
+ tooltip={background}
+ data-tid={'bgTID' + cnt}
+ aria-label="changeFolderBackground"
+ onClick={() => {
+ backgroundColor.current = background;
+ forceUpdate();
+ }}
+ style={{
+ backgroundColor: background,
+ backgroundImage: background,
+ margin: 5,
+ ...(backgroundColor.current === background && {
+ border: '0.5rem outset ' + background,
+ }),
+ }}
+ >
+ <SetBackgroundIcon />
+ </TsIconButton>
+ {(cnt + 1) % 5 === 0 && <br />}
+ </>
+ ))}
+ </Box>
+ </InputAdornment>
+ ),
+ },
}}
/>
</FormControl>
</DialogContent>
- <TsDialogActions>
- <TsButton data-tid="closeCreateNewDirectory" onClick={onCancel}>
- {t('core:cancel')}
- </TsButton>
- <TsButton
- disabled={disableConfirmButton}
- onClick={onConfirm}
- data-tid="confirmCreateNewDirectory"
- id="confirmCreateNewDirectory"
- variant="contained"
- >
- {t('core:ok')}
- </TsButton>
- </TsDialogActions>
+ {!smallScreen && (
+ <TsDialogActions>
+ <TsButton data-tid="closeCreateNewDirectory" onClick={onCancel}>
+ {t('core:cancel')}
+ </TsButton>
+ {okButton}
+ </TsDialogActions>
+ )}
</Dialog>
);
}
diff --git a/src/renderer/components/dialogs/DownloadUrlDialog.tsx b/src/renderer/components/dialogs/DownloadUrlDialog.tsx
index e1271e345..9514d79fa 100644
--- a/src/renderer/components/dialogs/DownloadUrlDialog.tsx
+++ b/src/renderer/components/dialogs/DownloadUrlDialog.tsx
@@ -19,18 +19,17 @@
import React, { useRef, useState } from 'react';
import { saveAs } from 'file-saver';
import DialogContent from '@mui/material/DialogContent';
-import DialogTitle from '@mui/material/DialogTitle';
import Dialog from '@mui/material/Dialog';
import Paper from '@mui/material/Paper';
import DraggablePaper from '-/components/DraggablePaper';
-import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-import { styled, useTheme } from '@mui/material/styles';
+import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import TargetPath from '-/components/dialogs/components/TargetPath';
import { TargetPathContextProvider } from '-/components/dialogs/hooks/TargetPathContextProvider';
import { useTranslation } from 'react-i18next';
import TsButton from '-/components/TsButton';
import TsDialogActions from '-/components/dialogs/components/TsDialogActions';
+import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';
import AppConfig from '-/AppConfig';
import { actions as AppActions, AppDispatch } from '-/reducers/app';
import TsTextField from '-/components/TsTextField';
@@ -43,19 +42,6 @@ import { useTargetPathContext } from '-/components/dialogs/hooks/useTargetPathCo
import { TS } from '-/tagspaces.namespace';
import { useEditedEntryContext } from '-/hooks/useEditedEntryContext';
-const PREFIX = 'CreateDirectory';
-
-const classes = {
- createButton: `${PREFIX}-createButton`,
-};
-
-const Root = styled('div')(() => ({
- [`& .${classes.createButton}`]: {
- width: '100%',
- textAlign: 'center',
- },
-}));
-
interface Props {
open: boolean;
onClose: (event?: Object, reason?: string) => void;
@@ -65,7 +51,7 @@ function DownloadUrlDialog(props: Props) {
const { open, onClose } = props;
const { t } = useTranslation();
const theme = useTheme();
- const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
+ const smallScreen = useMediaQuery(theme.breakpoints.down('md'));
const { currentLocation, getFirstRWLocation } = useCurrentLocationContext();
const { setReflectActions } = useEditedEntryContext();
const { downloadUrl } = useIOActionsContext();
@@ -157,63 +143,64 @@ function DownloadUrlDialog(props: Props) {
}
}
+ const okButton = (
+ <TsButton
+ variant="contained"
+ data-tid={'downloadFileUrlTID'}
+ onClick={() => downloadURL()}
+ >
+ {t('core:ok')}
+ </TsButton>
+ );
+
return (
- <Root>
- <TargetPathContextProvider>
- <Dialog
- open={open}
+ <TargetPathContextProvider>
+ <Dialog
+ open={open}
+ onClose={onClose}
+ fullScreen={smallScreen}
+ keepMounted
+ aria-labelledby="draggable-dialog-title"
+ PaperComponent={smallScreen ? Paper : DraggablePaper}
+ scroll="paper"
+ >
+ <TsDialogTitle
+ dialogTitle={t('core:downloadLink')}
+ closeButtonTestId="closeCreateDialogTID"
onClose={onClose}
- fullScreen={fullScreen}
- keepMounted
- aria-labelledby="draggable-dialog-title"
- PaperComponent={fullScreen ? Paper : DraggablePaper}
- scroll="paper"
+ actionSlot={okButton}
+ />
+ <DialogContent
+ style={{
+ minWidth: 200,
+ marginBottom: 20,
+ overflow: 'overlay',
+ }}
+ data-tid="downloadUrlDialogTID"
>
- <DialogTitle style={{ cursor: 'move' }} id="draggable-dialog-title">
- {t('core:downloadLink')}
- <DialogCloseButton
- testId="closeCreateDialogTID"
- onClose={() => onClose()}
- />
- </DialogTitle>
- <DialogContent
- style={{
- minWidth: 200,
- //minHeight: 300,
- marginBottom: 20,
- overflow: 'overlay',
+ <TsTextField
+ error={invalidURL}
+ label={t('core:url')}
+ autoFocus
+ name="name"
+ data-tid="newUrlTID"
+ onKeyDown={(event) => {
+ if (event.key === 'Enter') {
+ downloadURL();
+ }
}}
- data-tid="downloadUrlDialogTID"
- >
- <TsTextField
- error={invalidURL}
- label={t('core:url')}
- autoFocus
- name="name"
- data-tid="newUrlTID"
- onKeyDown={(event) => {
- if (event.key === 'Enter') {
- downloadURL();
- }
- }}
- onChange={handleUrlChange}
- />
- <TargetPath />
- </DialogContent>
+ onChange={handleUrlChange}
+ />
+ <TargetPath />
+ </DialogContent>
+ {!smallScreen && (
<TsDialogActions>
<TsButton onClick={onClose}>{t('core:cancel')}</TsButton>
- <TsButton
- variant="contained"
- data-tid={'downloadFileUrlTID'}
- className={classes.createButton}
- onClick={() => downloadURL()}
- >
- {t('core:ok')}
- </TsButton>
+ {okButton}
</TsDialogActions>
- </Dialog>
- </TargetPathContextProvider>
- </Root>
+ )}
+ </Dialog>
+ </TargetPathContextProvider>
);
}
diff --git a/src/renderer/components/dialogs/EditEntryTagDialog.tsx b/src/renderer/components/dialogs/EditEntryTagDialog.tsx
index 21329dc75..b4a27bfa7 100644
--- a/src/renderer/components/dialogs/EditEntryTagDialog.tsx
+++ b/src/renderer/components/dialogs/EditEntryTagDialog.tsx
@@ -56,14 +56,10 @@ const DateTagEditor = Pro && Pro.UI ? Pro.UI.DateTagEditor : React.Fragment;
function EditEntryTagDialog(props: Props) {
const { t } = useTranslation();
-
const { onClose, open, tag } = props;
-
const { addTagsToEntry, editTagForEntry } = useTaggingActionsContext();
- // const selectedTag: TS.Tag = useSelector(getSelectedTag);
const [showAdvancedMode, setShowAdvancedMode] = useState<boolean>(false);
const [title, setTitle] = useState(tag && tag.title);
-
const titleRef = useRef<HTMLInputElement>(null);
const isShowDatePeriodEditor = useMemo(() => {
let showDatePeriodEditor = false;
@@ -91,14 +87,12 @@ function EditEntryTagDialog(props: Props) {
if (titleRef && titleRef.current) {
titleRef.current.value = title;
}
- // handleValidation();
}, [title]);
function handleValidation(tagTitle: string) {
// Tags should be at least 1 character long and should not contain: spaces, \, / #
//const tagCheck = RegExp(/^[^#/\\ [\]]{1,}$/);
if (tagsValidation(tagTitle)) {
- // && tagCheck.test(title)) {
setError('tag', false);
return true;
}
@@ -120,15 +114,6 @@ function EditEntryTagDialog(props: Props) {
}
}
- function renderTitle() {
- return (
- <DialogTitle>
- {t('core:tagProperties')}{' '}
- <DialogCloseButton testId="closeEditEntryTagTID" onClose={onClose} />
- </DialogTitle>
- );
- }
-
function renderContent() {
const showGeoEditor = GeoTagEditor && isGeoTag(title);
@@ -185,8 +170,33 @@ function EditEntryTagDialog(props: Props) {
);
}
- function renderActions() {
- return (
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
+ return (
+ <Dialog
+ open={open}
+ fullScreen={fullScreen}
+ onClose={onClose}
+ style={{
+ minWidth: 400,
+ height: '100%',
+ marginBottom: 30,
+ }}
+ onKeyDown={(event) => {
+ if (event.key === 'Enter' || event.keyCode === 13) {
+ event.preventDefault();
+ event.stopPropagation();
+ onConfirm();
+ } /*else if (event.key === 'Escape') {
+ onClose();
+ }*/
+ }}
+ >
+ <DialogTitle>
+ {t('core:tagProperties')}{' '}
+ <DialogCloseButton testId="closeEditEntryTagTID" onClose={onClose} />
+ </DialogTitle>
+ {renderContent()}
<TsDialogActions
style={{
justifyContent: 'space-between',
@@ -219,34 +229,6 @@ function EditEntryTagDialog(props: Props) {
</TsButton>
</div>
</TsDialogActions>
- );
- }
-
- const theme = useTheme();
- const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
- return (
- <Dialog
- open={open}
- fullScreen={fullScreen}
- onClose={onClose}
- style={{
- minWidth: 400,
- height: '100%',
- marginBottom: 30,
- }}
- onKeyDown={(event) => {
- if (event.key === 'Enter' || event.keyCode === 13) {
- event.preventDefault();
- event.stopPropagation();
- onConfirm();
- } /*else if (event.key === 'Escape') {
- onClose();
- }*/
- }}
- >
- {renderTitle()}
- {renderContent()}
- {renderActions()}
</Dialog>
);
}
diff --git a/src/renderer/components/dialogs/EditTagGroupDialog.tsx b/src/renderer/components/dialogs/EditTagGroupDialog.tsx
index cebd82e43..f41338fc4 100644
--- a/src/renderer/components/dialogs/EditTagGroupDialog.tsx
+++ b/src/renderer/components/dialogs/EditTagGroupDialog.tsx
@@ -19,8 +19,8 @@
import React, { ChangeEvent, useEffect, 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 FormHelperText from '@mui/material/FormHelperText';
import ListItem from '@mui/material/ListItem';
@@ -33,7 +33,6 @@ import ColorPickerDialog from './ColorPickerDialog';
import TransparentBackground from '../TransparentBackground';
import { TS } from '-/tagspaces.namespace';
import { Pro } from '-/pro';
-import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import TsTextField from '-/components/TsTextField';
import TsSelect from '-/components/TsSelect';
import Tag from '-/components/Tag';
@@ -43,6 +42,7 @@ import { useTaggingActionsContext } from '-/hooks/useTaggingActionsContext';
import { CommonLocation } from '-/utils/CommonLocation';
import { useTagGroupsLocationContext } from '-/hooks/useTagGroupsLocationContext';
import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
+import { useMediaQuery, useTheme } from '@mui/material';
const defaultTagGroupLocation = 'TAG_LIBRARY';
@@ -59,7 +59,6 @@ function EditTagGroupDialog(props: Props) {
const { updateTagGroup } = useTaggingActionsContext();
const { removeLocationTagGroup } = useTagGroupsLocationContext();
const { t } = useTranslation();
- //const locations: Array<CommonLocation> = useSelector(getLocations);
const saveTagInLocation: boolean = useSelector(getSaveTagInLocation);
const [displayColorPicker, setDisplayColorPicker] = useState<boolean>(false);
const [displayTextColorPicker, setDisplayTextColorPicker] =
@@ -74,6 +73,8 @@ function EditTagGroupDialog(props: Props) {
const [textcolor, setTextcolor] = useState<string>(
selectedTagGroupEntry.textcolor,
);
+ const theme = useTheme();
+ const smallScreen = useMediaQuery(theme.breakpoints.down('md'));
useEffect(() => {
handleValidation();
@@ -132,153 +133,142 @@ function EditTagGroupDialog(props: Props) {
}
};
- const renderTitle = () => (
- <DialogTitle style={{ overflow: 'visible' }}>
- {t('core:editTagGroupTitle')}{' '}
- <Tag backgroundColor={color} textColor={textcolor} isDragging={false}>
- tag-preview
- <span style={{ margin: 3 }} />
- </Tag>
- <DialogCloseButton testId="closeEditTagGroupTID" onClose={onClose} />
- </DialogTitle>
+ const okButton = (
+ <TsButton
+ disabled={disableConfirmButton()}
+ onClick={onConfirm}
+ data-tid="editTagGroupConfirmButton"
+ variant="contained"
+ >
+ {t('core:ok')}
+ </TsButton>
);
- const renderContent = () => {
- return (
- <DialogContent style={{ overflow: 'visible' }}>
- <FormControl
- fullWidth={true}
+ const renderContent = (
+ <DialogContent style={{ overflow: 'visible' }}>
+ <FormControl
+ fullWidth={true}
+ error={inputError}
+ style={{ overflow: 'visible' }}
+ >
+ <TsTextField
error={inputError}
- style={{ overflow: 'visible' }}
- >
- <TsTextField
- error={inputError}
- name="title"
- autoFocus
- label={t('core:editTagGroupNewName')}
- onChange={handleTagGroupTitleChange}
- value={title}
- data-tid="editTagGroupInput"
- />
- {inputError && (
- <FormHelperText>{t('core:taggroupTitleHelper')}</FormHelperText>
- )}
- </FormControl>
- {saveTagInLocation && (
- <FormControl fullWidth={true} error={inputError}>
- <FormHelperText style={{ marginLeft: 0, marginTop: 0 }}>
- {t('core:tagGroupLocation')}
- </FormHelperText>
- <TsSelect
- fullWidth={false}
- defaultValue={locationId}
- onChange={(event: ChangeEvent<HTMLInputElement>) => {
- setLocationId(event.target.value);
- }}
+ name="title"
+ autoFocus
+ label={t('core:editTagGroupNewName')}
+ onChange={handleTagGroupTitleChange}
+ value={title}
+ data-tid="editTagGroupInput"
+ />
+ {inputError && (
+ <FormHelperText>{t('core:taggroupTitleHelper')}</FormHelperText>
+ )}
+ </FormControl>
+ {saveTagInLocation && (
+ <FormControl fullWidth={true} error={inputError}>
+ <FormHelperText style={{ marginLeft: 0, marginTop: 0 }}>
+ {t('core:tagGroupLocation')}
+ </FormHelperText>
+ <TsSelect
+ fullWidth={false}
+ defaultValue={locationId}
+ onChange={(event: ChangeEvent<HTMLInputElement>) => {
+ setLocationId(event.target.value);
+ }}
+ >
+ <MenuItem
+ key={defaultTagGroupLocation}
+ value={defaultTagGroupLocation}
>
- <MenuItem
- key={defaultTagGroupLocation}
- value={defaultTagGroupLocation}
- >
- {t('core:tagLibrary')}
+ {t('core:tagLibrary')}
+ </MenuItem>
+ {locations.map((location) => (
+ <MenuItem key={location.uuid} value={location.uuid}>
+ {t('core:location') + ': ' + location.name}
</MenuItem>
- {locations.map((location) => (
- <MenuItem key={location.uuid} value={location.uuid}>
- {t('core:location') + ': ' + location.name}
- </MenuItem>
- ))}
- </TsSelect>
- </FormControl>
+ ))}
+ </TsSelect>
+ </FormControl>
+ )}
+ <ListItem style={{ paddingLeft: 0, paddingRight: 0 }}>
+ <ListItemText primary={t('tagBackgroundColor')} />
+ <TransparentBackground>
+ <TsButton
+ onClick={() => setDisplayColorPicker(!displayColorPicker)}
+ data-tid="editTagGroupBackgroundColor"
+ style={{
+ height: 30,
+ borderRadius: 2,
+ borderWidth: 1,
+ borderStyle: 'solid',
+ borderColor: 'gray',
+ padding: '5px',
+ background: color,
+ }}
+ >
+ &nbsp;
+ </TsButton>
+ </TransparentBackground>
+ {displayColorPicker && (
+ <ColorPickerDialog
+ open={displayColorPicker}
+ setColor={(value) => setColor(value)}
+ onClose={() => setDisplayColorPicker(false)}
+ color={color}
+ />
)}
- <ListItem style={{ paddingLeft: 0, paddingRight: 0 }}>
- <ListItemText primary={t('tagBackgroundColor')} />
- <TransparentBackground>
- <TsButton
- onClick={() => setDisplayColorPicker(!displayColorPicker)}
- data-tid="editTagGroupBackgroundColor"
- style={{
- height: 30,
- borderRadius: 2,
- borderWidth: 1,
- borderStyle: 'solid',
- borderColor: 'gray',
- padding: '5px',
- background: color,
- }}
- >
- &nbsp;
- </TsButton>
- </TransparentBackground>
- {displayColorPicker && (
- <ColorPickerDialog
- open={displayColorPicker}
- setColor={(value) => setColor(value)}
- onClose={() => setDisplayColorPicker(false)}
- color={color}
- />
- )}
- </ListItem>
- <ListItem style={{ paddingLeft: 0, paddingRight: 0 }}>
- <ListItemText primary={t('core:tagForegroundColor')} />
- <TransparentBackground>
- <TsButton
- onClick={() => setDisplayTextColorPicker(!displayTextColorPicker)}
- data-tid="editTagGroupForegroundColor"
- style={{
- height: 30,
- borderRadius: 2,
- borderWidth: 1,
- borderStyle: 'solid',
- borderColor: 'gray',
- padding: '5px',
- background: textcolor,
- }}
- role="presentation"
- >
- &nbsp;
- </TsButton>
- </TransparentBackground>
- {displayTextColorPicker && (
- <ColorPickerDialog
- open={displayTextColorPicker}
- setColor={(txtcolor) => setTextcolor(txtcolor)}
- onClose={() => setDisplayTextColorPicker(!displayTextColorPicker)}
- color={textcolor}
- />
- )}
- </ListItem>
- <ListItem style={{ paddingLeft: 0, paddingRight: 0 }}>
- <ListItemText primary={t('core:colorChangesToAllTags')} />
- <Switch
- data-tid="editTagGroupSwitch"
- onClick={() => setApplyChanges(!applyChanges)}
- checked={applyChanges}
+ </ListItem>
+ <ListItem style={{ paddingLeft: 0, paddingRight: 0 }}>
+ <ListItemText primary={t('core:tagForegroundColor')} />
+ <TransparentBackground>
+ <TsButton
+ onClick={() => setDisplayTextColorPicker(!displayTextColorPicker)}
+ data-tid="editTagGroupForegroundColor"
+ style={{
+ height: 30,
+ borderRadius: 2,
+ borderWidth: 1,
+ borderStyle: 'solid',
+ borderColor: 'gray',
+ padding: '5px',
+ background: textcolor,
+ }}
+ role="presentation"
+ >
+ &nbsp;
+ </TsButton>
+ </TransparentBackground>
+ {displayTextColorPicker && (
+ <ColorPickerDialog
+ open={displayTextColorPicker}
+ setColor={(txtcolor) => setTextcolor(txtcolor)}
+ onClose={() => setDisplayTextColorPicker(!displayTextColorPicker)}
+ color={textcolor}
/>
- </ListItem>
- </DialogContent>
- );
- };
-
- const renderActions = () => (
- <TsDialogActions>
- <TsButton onClick={onClose}>{t('core:cancel')}</TsButton>
- <TsButton
- disabled={disableConfirmButton()}
- onClick={onConfirm}
- data-tid="editTagGroupConfirmButton"
- variant="contained"
- >
- {t('core:ok')}
- </TsButton>
- </TsDialogActions>
+ )}
+ </ListItem>
+ <ListItem style={{ paddingLeft: 0, paddingRight: 0 }}>
+ <ListItemText primary={t('core:tagPreview')} />
+ <Tag backgroundColor={color} textColor={textcolor} isDragging={false}>
+ tag-preview
+ <span style={{ margin: 3 }} />
+ </Tag>
+ </ListItem>
+ <ListItem style={{ paddingLeft: 0, paddingRight: 0 }}>
+ <ListItemText primary={t('core:colorChangesToAllTags')} />
+ <Switch
+ data-tid="editTagGroupSwitch"
+ onClick={() => setApplyChanges(!applyChanges)}
+ checked={applyChanges}
+ />
+ </ListItem>
+ </DialogContent>
);
- // const theme = useTheme();
- // const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
- // fullScreen={fullScreen}
+ fullScreen={smallScreen}
onClose={onClose}
onKeyDown={(event) => {
if (event.key === 'Enter' || event.keyCode === 13) {
@@ -290,9 +280,19 @@ function EditTagGroupDialog(props: Props) {
}*/
}}
>
- {renderTitle()}
- {renderContent()}
- {renderActions()}
+ <TsDialogTitle
+ dialogTitle={t('core:editTagGroupTitle')}
+ closeButtonTestId="closeEditTagGroupTID"
+ onClose={onClose}
+ actionSlot={okButton}
+ ></TsDialogTitle>
+ {renderContent}
+ {!smallScreen && (
+ <TsDialogActions>
+ <TsButton onClick={onClose}>{t('core:cancel')}</TsButton>
+ {okButton}
+ </TsDialogActions>
+ )}
</Dialog>
);
}
diff --git a/src/renderer/components/dialogs/NewAudioDialog.tsx b/src/renderer/components/dialogs/NewAudioDialog.tsx
index 38da674a0..2df5ac621 100644
--- a/src/renderer/components/dialogs/NewAudioDialog.tsx
+++ b/src/renderer/components/dialogs/NewAudioDialog.tsx
@@ -18,13 +18,12 @@
import React from 'react';
import DialogContent from '@mui/material/DialogContent';
-import DialogTitle from '@mui/material/DialogTitle';
import Dialog from '@mui/material/Dialog';
import Paper from '@mui/material/Paper';
import DraggablePaper from '-/components/DraggablePaper';
-import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
+import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';
import { TargetPathContextProvider } from '-/components/dialogs/hooks/TargetPathContextProvider';
import { useTranslation } from 'react-i18next';
import { Pro } from '-/pro';
@@ -62,15 +61,13 @@ function NewAudioDialog(props: Props) {
PaperComponent={fullScreen ? Paper : DraggablePaper}
scroll="paper"
>
- <DialogTitle style={{ cursor: 'move' }} id="draggable-dialog-title">
- {t('core:audioRecorder')}
- <DialogCloseButton
- testId="closeCreateDialogTID"
- onClose={() => {
- intOnClose(undefined, 'escapeKeyDown');
- }}
- />
- </DialogTitle>
+ <TsDialogTitle
+ dialogTitle={t('core:audioRecorder')}
+ closeButtonTestId="closeCreateDialogTID"
+ onClose={() => {
+ intOnClose(undefined, 'escapeKeyDown');
+ }}
+ />
<DialogContent
style={{
minWidth: 200,