Skip to content

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

polish: improving ux of dialogs, adding close button icon component (#1460)

Ilianc82add05df8a
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsx
index 57352a76f..8a56b9d8b 100644
--- a/app/components/EntryProperties.tsx
+++ b/app/components/EntryProperties.tsx
@@ -659,7 +659,6 @@ const EntryProperties = (props: Props) => {
<div>
<Button
data-tid="cancelRenameEntryTID"
- color="primary"
onClick={deactivateEditNameField}
>
{i18n.t('core:cancel')}
@@ -805,7 +804,6 @@ const EntryProperties = (props: Props) => {
>
{editDescription !== undefined && (
<Button
- color="primary"
className={classes.button}
onClick={() => setEditDescription(undefined)}
>
diff --git a/app/components/InfoIcon.tsx b/app/components/InfoIcon.tsx
new file mode 100644
index 000000000..bf3d14cc1
--- /dev/null
+++ b/app/components/InfoIcon.tsx
@@ -0,0 +1,39 @@
+/**
+ * TagSpaces - universal file and folder organizer
+ * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)
+ *
+ * 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 IconButton from '@material-ui/core/IconButton';
+import HelpIcon from '@material-ui/icons/InfoOutlined';
+import Tooltip from '@material-ui/core/Tooltip';
+
+interface Props {
+ tooltip?: string;
+}
+
+const InfoIcon = (props: Props) => {
+ const { tooltip } = props;
+ return (
+ <Tooltip arrow title={tooltip}>
+ <IconButton edge="end" aria-label="delete">
+ <HelpIcon />
+ </IconButton>
+ </Tooltip>
+ );
+};
+
+export default InfoIcon;
diff --git a/app/components/WelcomePanel.tsx b/app/components/WelcomePanel.tsx
index ceefc30d3..ad8038c47 100644
--- a/app/components/WelcomePanel.tsx
+++ b/app/components/WelcomePanel.tsx
@@ -20,12 +20,12 @@ import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { withStyles } from '@material-ui/core/styles';
-// import { getLocations, type Location } from '../reducers/locations';
import Button from '@material-ui/core/Button';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import Divider from '@material-ui/core/Divider';
import DocumentationIcon from '@material-ui/icons/Help';
+import LocationIcon from '@material-ui/icons/WorkOutline';
import ChangeLogIcon from '@material-ui/icons/ImportContacts';
import WebClipperIcon from '@material-ui/icons/Transform';
import EmailIcon from '@material-ui/icons/Email';
@@ -34,7 +34,6 @@ import TranslationIcon from '@material-ui/icons/Translate';
import NewFeatureIcon from '@material-ui/icons/Gesture';
import SocialIcon from '@material-ui/icons/ThumbUp';
import Social2Icon from '@material-ui/icons/Mood';
-// import LogoutIcon from '@material-ui/icons/MeetingRoom';
import KeyShortcutsIcon from '@material-ui/icons/Keyboard';
import WelcomeBackground from '../assets/images/background.png';
import WelcomeLogo from '../assets/images/welcome-logo.png';
@@ -87,16 +86,18 @@ const WelcomePanel = (props: Props) => {
const { classes, openURLExternally, toggleKeysDialog, isDesktopMode } = props;
return (
<div className={classes.mainPanel}>
- {/* <div className={classes.slogan}>
-
- </div> */}
<List
dense={false}
component="nav"
aria-label="main help area"
className={classes.links}
>
- <div role="button" tabIndex={0} onClick={props.toggleAboutDialog}>
+ <div
+ role="button"
+ aria-hidden="true"
+ tabIndex={0}
+ onClick={props.toggleAboutDialog}
+ >
<img src={WelcomeLogo} alt="Organize your files" />
</div>
<ListItem
@@ -108,7 +109,7 @@ const WelcomePanel = (props: Props) => {
button.click();
}}
>
- <Button startIcon={<DocumentationIcon />}>
+ <Button startIcon={<LocationIcon />}>
{i18n.t('core:chooseLocation')}
</Button>
</ListItem>
diff --git a/app/components/dialogs/AboutDialog.tsx b/app/components/dialogs/AboutDialog.tsx
index 921c6705c..93e1baa1e 100644
--- a/app/components/dialogs/AboutDialog.tsx
+++ b/app/components/dialogs/AboutDialog.tsx
@@ -22,8 +22,6 @@ import Typography from '@material-ui/core/Typography';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import Tooltip from '@material-ui/core/Tooltip';
import withMobileDialog from '@material-ui/core/withMobileDialog';
import Dialog from '@material-ui/core/Dialog';
@@ -34,6 +32,7 @@ import versionMeta from '-/version.json';
import { Pro } from '-/pro';
import { getLastVersionPromise } from '-/reducers/settings';
import AppConfig from '-/config';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -102,18 +101,8 @@ const AboutDialog = (props: Props) => {
scroll="paper"
>
<DialogTitle>
- {productName}{' '}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ {productName}
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent>
<img
diff --git a/app/components/dialogs/AddRemoveTagsDialog.tsx b/app/components/dialogs/AddRemoveTagsDialog.tsx
index fd2761336..532923c03 100644
--- a/app/components/dialogs/AddRemoveTagsDialog.tsx
+++ b/app/components/dialogs/AddRemoveTagsDialog.tsx
@@ -22,8 +22,6 @@ import Button from '@material-ui/core/Button';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon';
@@ -36,6 +34,7 @@ import i18n from '-/services/i18n';
import { extractFileName, extractDirectoryName } from '-/utils/paths';
import PlatformIO from '-/services/platform-io';
import { TS } from '-/tagspaces.namespace';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -61,7 +60,7 @@ const AddRemoveTagsDialog = (props: Props) => {
}
};
- const onClose = (event: React.MouseEvent<HTMLElement>) => {
+ const onClose = () => {
onCloseDialog();
};
@@ -113,17 +112,7 @@ const AddRemoveTagsDialog = (props: Props) => {
>
<DialogTitle>
{i18n.t('core:tagOperationTitle')}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent style={{ minHeight: 330 }}>
<TagsSelect
@@ -160,7 +149,6 @@ const AddRemoveTagsDialog = (props: Props) => {
<Button
data-tid="cancelTagsMultipleEntries"
onClick={() => onCloseDialog()}
- color="primary"
>
{i18n.t('core:cancel')}
</Button>
diff --git a/app/components/dialogs/AddTagToTagGroupDialog.tsx b/app/components/dialogs/AddTagToTagGroupDialog.tsx
index 04efd3420..aaf4b4587 100644
--- a/app/components/dialogs/AddTagToTagGroupDialog.tsx
+++ b/app/components/dialogs/AddTagToTagGroupDialog.tsx
@@ -115,9 +115,7 @@ const AddTagToTagGroupDialog = (props: Props) => {
</FormControl>
</DialogContent>
<DialogActions>
- <Button onClick={onClose} color="primary">
- {i18n.t('core:cancel')}
- </Button>
+ <Button onClick={onClose}>{i18n.t('core:cancel')}</Button>
<Button
disabled={tagGroup === undefined}
onClick={onConfirm}
diff --git a/app/components/dialogs/ColorPickerDialog.tsx b/app/components/dialogs/ColorPickerDialog.tsx
index dd1ac3d06..fa72f7762 100644
--- a/app/components/dialogs/ColorPickerDialog.tsx
+++ b/app/components/dialogs/ColorPickerDialog.tsx
@@ -21,12 +21,11 @@ import Button from '@material-ui/core/Button';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import { withStyles } from '@material-ui/core/styles';
import Dialog from '@material-ui/core/Dialog';
import { SketchPicker } from 'react-color';
import i18n from '-/services/i18n';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
const presetColors = [
'#ffffff',
@@ -109,17 +108,7 @@ const ColorPickerDialog = (props: Props) => {
>
<DialogTitle data-tid="colorPickerDialogTitle">
{i18n.t('core:colorPickerDialogTitle')}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent
data-tid="colorPickerDialogContent"
@@ -137,11 +126,7 @@ const ColorPickerDialog = (props: Props) => {
/>
</DialogContent>
<DialogActions>
- <Button
- data-tid="colorPickerCloseDialog"
- onClick={props.onClose}
- color="primary"
- >
+ <Button data-tid="colorPickerCloseDialog" onClick={props.onClose}>
{i18n.t('core:cancel')}
</Button>
<Button
diff --git a/app/components/dialogs/ConfirmDialog.tsx b/app/components/dialogs/ConfirmDialog.tsx
index f06d906c9..a112fd430 100644
--- a/app/components/dialogs/ConfirmDialog.tsx
+++ b/app/components/dialogs/ConfirmDialog.tsx
@@ -22,8 +22,6 @@ import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
import DialogContentText from '@material-ui/core/DialogContentText';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import BulletIcon from '@material-ui/icons/Remove';
@@ -31,6 +29,7 @@ import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';
import Dialog from '@material-ui/core/Dialog';
import i18n from '-/services/i18n';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -45,28 +44,18 @@ interface Props {
}
const ConfirmDialog = (props: Props) => {
- const { open, onClose } = props;
+ const { open, onClose, confirmCallback } = props;
function onConfirm(result) {
- props.confirmCallback(result);
- props.onClose();
+ confirmCallback(result);
+ onClose();
}
return (
<Dialog open={open} onClose={onClose} keepMounted scroll="paper">
<DialogTitle>
{props.title}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent>
<DialogContentText
diff --git a/app/components/dialogs/CreateDialog.tsx b/app/components/dialogs/CreateDialog.tsx
index 48b1db023..b4c460a3e 100644
--- a/app/components/dialogs/CreateDialog.tsx
+++ b/app/components/dialogs/CreateDialog.tsx
@@ -28,8 +28,6 @@ import AddFileIcon from '@material-ui/icons/NoteAddOutlined';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import Grid from '@material-ui/core/Grid';
import { withStyles } from '@material-ui/core/styles';
import withMobileDialog from '@material-ui/core/withMobileDialog';
@@ -42,6 +40,7 @@ import AppConfig from '-/config';
import { formatDateTime4Tag } from '-/utils/misc';
import IOActions from '-/reducers/io-actions';
import { TS } from '-/tagspaces.namespace';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
const styles: any = () => ({
root: {
@@ -273,17 +272,7 @@ const CreateDialog = (props: Props) => {
>
<DialogTitle style={{ alignSelf: 'center' }}>
{i18n.t('createNewContent')}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent
onKeyPress={handleKeyPress}
diff --git a/app/components/dialogs/CreateDirectoryDialog.tsx b/app/components/dialogs/CreateDirectoryDialog.tsx
index 692547b92..19159afc4 100644
--- a/app/components/dialogs/CreateDirectoryDialog.tsx
+++ b/app/components/dialogs/CreateDirectoryDialog.tsx
@@ -27,11 +27,10 @@ import DialogTitle from '@material-ui/core/DialogTitle';
import FormControl from '@material-ui/core/FormControl';
import FormHelperText from '@material-ui/core/FormHelperText';
import Dialog from '@material-ui/core/Dialog';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import i18n from '-/services/i18n';
import { actions as AppActions } from '-/reducers/app';
import PlatformIO from '-/services/platform-io';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -75,7 +74,7 @@ const CreateDirectoryDialog = (props: Props) => {
function onCancel() {
resetState();
- props.onClose();
+ onClose();
}
function resetState() {
@@ -103,17 +102,7 @@ const CreateDirectoryDialog = (props: Props) => {
>
<DialogTitle>
{i18n.t('core:createNewDirectoryTitle')}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent>
<FormControl fullWidth={true} error={inputError}>
@@ -136,11 +125,7 @@ const CreateDirectoryDialog = (props: Props) => {
</FormControl>
</DialogContent>
<DialogActions>
- <Button
- data-tid="closeCreateNewDirectory"
- onClick={onCancel}
- color="primary"
- >
+ <Button data-tid="closeCreateNewDirectory" onClick={onCancel}>
{i18n.t('core:cancel')}
</Button>
<Button
diff --git a/app/components/dialogs/CreateEditLocationDialog.tsx b/app/components/dialogs/CreateEditLocationDialog.tsx
index c28ac6a15..f44d7c922 100644
--- a/app/components/dialogs/CreateEditLocationDialog.tsx
+++ b/app/components/dialogs/CreateEditLocationDialog.tsx
@@ -41,11 +41,8 @@ import ListItemText from '@material-ui/core/ListItemText';
import Input from '@material-ui/core/Input';
import ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
import ToggleButton from '@material-ui/lab/ToggleButton';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import CheckIcon from '@material-ui/icons/Check';
-import InfoIcon from '@material-ui/icons/InfoOutlined';
-import AddIcon from '@material-ui/icons/AddCircleOutline';
+import HelpIcon from '@material-ui/icons/InfoOutlined';
import RemoveIcon from '@material-ui/icons/RemoveCircleOutline';
import i18n from '-/services/i18n';
import { Pro } from '-/pro';
@@ -57,6 +54,8 @@ import { TS } from '-/tagspaces.namespace';
import { locationType } from '-/utils/misc';
import { getLocationPath } from '-/utils/paths';
import IgnorePatternDialog from '-/components/dialogs/IgnorePatternDialog';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
+import InfoIcon from '-/components/InfoIcon';
const styles: any = theme => ({
formControl: {
@@ -393,20 +392,12 @@ const CreateEditLocationDialog = (props: Props) => {
<DialogTitle>
{props.location
? i18n.t('core:editLocationTitle')
- : i18n.t('core:createLocationTitle')}{' '}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ : i18n.t('core:createLocationTitle')}
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
- <DialogContent>
+ <DialogContent
+ style={{ overflow: AppConfig.isFirefox ? 'auto' : 'overlay' }}
+ >
<Grid container spacing={2}>
<Grid item xs={2} style={{ marginTop: 13, textAlign: 'left' }}>
<Typography>{i18n.t('core:locationType')}</Typography>
@@ -566,9 +557,10 @@ const CreateEditLocationDialog = (props: Props) => {
/>
}
label={
- <Tooltip arrow title={i18n.t('core:maxIndexAgeHelp')}>
- <Typography>{i18n.t('core:maxIndexAge')}</Typography>
- </Tooltip>
+ <Typography>
+ {i18n.t('core:maxIndexAge')}
+ <InfoIcon tooltip={i18n.t('core:maxIndexAgeHelp')} />
+ </Typography>
}
/>
)}
@@ -593,7 +585,7 @@ const CreateEditLocationDialog = (props: Props) => {
<FormControlLabel
labelPlacement="top"
className={classes.formControl}
- style={{ alignItems: 'start' }}
+ style={{ alignItems: 'start', marginBottom: 10 }}
control={
<ToggleButtonGroup
value={persistTagsInSidecarFile}
@@ -621,7 +613,7 @@ const CreateEditLocationDialog = (props: Props) => {
<div style={{ display: 'flex' }}>
{persistTagsInSidecarFile === null && <CheckIcon />}
&nbsp;{i18n.t('core:default')}&nbsp;&nbsp;
- <InfoIcon />
+ {/* <HelpIcon /> */}
</div>
</Tooltip>
</ToggleButton>
@@ -644,7 +636,7 @@ const CreateEditLocationDialog = (props: Props) => {
{persistTagsInSidecarFile !== null &&
!persistTagsInSidecarFile && <CheckIcon />}
&nbsp;Rename Files&nbsp;&nbsp;
- <InfoIcon />
+ {/* <HelpIcon /> */}
</div>
</Tooltip>
</ToggleButton>
@@ -669,14 +661,14 @@ const CreateEditLocationDialog = (props: Props) => {
{persistTagsInSidecarFile !== null &&
persistTagsInSidecarFile && <CheckIcon />}
&nbsp;Use Sidecar Files&nbsp;&nbsp;
- <InfoIcon />
+ {/* <HelpIcon /> */}
</div>
</Tooltip>
</ToggleButton>
</ToggleButtonGroup>
}
label={
- <Typography variant="caption" display="block" gutterBottom>
+ <Typography gutterBottom>
{i18n.t('core:fileTaggingSetting')}
</Typography>
}
@@ -684,15 +676,35 @@ const CreateEditLocationDialog = (props: Props) => {
))}
{showAdvancedMode && (
<>
- <Typography
- variant="caption"
- display="block"
- gutterBottom
- style={{ marginTop: 10 }}
+ <FormControlLabel
+ className={classes.formControl}
+ labelPlacement="start"
+ style={{ justifyContent: 'space-between' }}
+ control={
+ <Button
+ color="primary"
+ onClick={() => {
+ setIgnorePatternDialogOpen(true);
+ }}
+ >
+ {i18n.t('ignorePatternDialogTitle')}
+ </Button>
+ }
+ label={
+ <Typography>
+ {i18n.t('core:ignorePatterns')}
+ <InfoIcon tooltip={i18n.t('core:ignorePatternsHelp')} />
+ </Typography>
+ }
+ />
+ <List
+ style={{
+ padding: 5,
+ backgroundColor: '#d3d3d34a',
+ borderRadius: 10
+ }}
+ dense
>
- {i18n.t('core:ignorePatterns')}
- </Typography>
- <List style={{ padding: 0 }} dense>
{ignorePatternPaths &&
ignorePatternPaths.map(ignorePatternPath => (
<ListItem style={{ padding: 0 }}>
@@ -714,16 +726,6 @@ const CreateEditLocationDialog = (props: Props) => {
</ListItem>
))}
</List>
- <Button
- endIcon={<AddIcon />}
- color="primary"
- size="small"
- onClick={() => {
- setIgnorePatternDialogOpen(true);
- }}
- >
- {i18n.t('ignorePatternDialogTitle')}
- </Button>
{isIgnorePatternDialogOpen && (
<IgnorePatternDialog
open={isIgnorePatternDialogOpen}
@@ -747,9 +749,7 @@ const CreateEditLocationDialog = (props: Props) => {
: i18n.t('core:switchAdvancedMode')}
</Button>
<div>
- <Button onClick={() => onClose()} color="primary">
- {i18n.t('core:cancel')}
- </Button>
+ <Button onClick={() => onClose()}>{i18n.t('core:cancel')}</Button>
<Button
disabled={disableConfirmButton()}
onClick={onConfirm}
diff --git a/app/components/dialogs/CreateFileDialog.tsx b/app/components/dialogs/CreateFileDialog.tsx
index a026235f6..4cee44f7f 100644
--- a/app/components/dialogs/CreateFileDialog.tsx
+++ b/app/components/dialogs/CreateFileDialog.tsx
@@ -291,11 +291,7 @@ const CreateFileDialog = (props: Props) => {
</FormControl>
</DialogContent>
<DialogActions>
- <Button
- data-tid="closeCreateFileDialog"
- onClick={props.onClose}
- color="primary"
- >
+ <Button data-tid="closeCreateFileDialog" onClick={props.onClose}>
{i18n.t('core:cancel')}
</Button>
<Button
diff --git a/app/components/dialogs/CreateTagGroupDialog.tsx b/app/components/dialogs/CreateTagGroupDialog.tsx
index 0bcb13f9c..f35de78a1 100644
--- a/app/components/dialogs/CreateTagGroupDialog.tsx
+++ b/app/components/dialogs/CreateTagGroupDialog.tsx
@@ -29,14 +29,13 @@ import Dialog from '@material-ui/core/Dialog';
import MenuItem from '@material-ui/core/MenuItem';
import Select from '@material-ui/core/Select';
import { connect } from 'react-redux';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import ColorPickerDialog from './ColorPickerDialog';
import i18n from '-/services/i18n';
import TransparentBackground from '../TransparentBackground';
import { TS } from '-/tagspaces.namespace';
import { getLocations } from '-/reducers/locations';
import { getCurrentLocationId } from '-/reducers/app';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -180,17 +179,7 @@ const CreateTagGroupDialog = (props: Props) => {
>
<DialogTitle>
{i18n.t('core:createTagGroupTitle')}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent>
{props.saveTagInLocation && (
@@ -279,11 +268,7 @@ const CreateTagGroupDialog = (props: Props) => {
</FormControl>
</DialogContent>
<DialogActions>
- <Button
- data-tid="createTagGroupCancelButton"
- onClick={props.onClose}
- color="primary"
- >
+ <Button data-tid="createTagGroupCancelButton" onClick={props.onClose}>
{i18n.t('core:cancel')}
</Button>
<Button
diff --git a/app/components/dialogs/CreateTagsDialog.tsx b/app/components/dialogs/CreateTagsDialog.tsx
index 75c6ca39f..9ec99f9ad 100644
--- a/app/components/dialogs/CreateTagsDialog.tsx
+++ b/app/components/dialogs/CreateTagsDialog.tsx
@@ -25,11 +25,10 @@ import DialogTitle from '@material-ui/core/DialogTitle';
import FormControl from '@material-ui/core/FormControl';
import FormHelperText from '@material-ui/core/FormHelperText';
import Dialog from '@material-ui/core/Dialog';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import i18n from '-/services/i18n';
import useFirstRender from '-/utils/useFirstRender';
import { TS } from '-/tagspaces.namespace';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -100,17 +99,7 @@ const CreateTagsDialog = (props: Props) => {
>
<DialogTitle>
{i18n.t('core:addTagsToGroupTitle')}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent style={{ minWidth: 400 }}>
<FormControl fullWidth={true} error={inputError}>
@@ -130,9 +119,7 @@ const CreateTagsDialog = (props: Props) => {
</FormControl>
</DialogContent>
<DialogActions>
- <Button onClick={onClose} color="primary">
- {i18n.t('core:cancel')}
- </Button>
+ <Button onClick={onClose}>{i18n.t('core:cancel')}</Button>
<Button
disabled={inputError}
onClick={onConfirm}
diff --git a/app/components/dialogs/DialogCloseButton.tsx b/app/components/dialogs/DialogCloseButton.tsx
new file mode 100644
index 000000000..42dd7565c
--- /dev/null
+++ b/app/components/dialogs/DialogCloseButton.tsx
@@ -0,0 +1,46 @@
+/**
+ * TagSpaces - universal file and folder organizer
+ * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)
+ *
+ * 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 IconButton from '@material-ui/core/IconButton';
+import CloseIcon from '@material-ui/icons/Close';
+import i18n from '-/services/i18n';
+
+interface Props {
+ onClose: () => void;
+}
+
+const DialogCloseButton = (props: Props) => {
+ const { onClose } = props;
+ return (
+ <IconButton
+ title={i18n.t('closeButton')}
+ aria-label="close"
+ style={{
+ position: 'absolute',
+ right: 5,
+ top: 5
+ }}
+ onClick={onClose}
+ >
+ <CloseIcon />
+ </IconButton>
+ );
+};
+
+export default DialogCloseButton;
diff --git a/app/components/dialogs/EditEntryTagDialog.tsx b/app/components/dialogs/EditEntryTagDialog.tsx
index e403546d6..e4fcb10d2 100644
--- a/app/components/dialogs/EditEntryTagDialog.tsx
+++ b/app/components/dialogs/EditEntryTagDialog.tsx
@@ -29,8 +29,6 @@ import { withStyles } from '@material-ui/core/styles';
import FormControl from '@material-ui/core/FormControl';
import FormHelperText from '@material-ui/core/FormHelperText';
import Dialog from '@material-ui/core/Dialog';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import i18n from '-/services/i18n';
import { isPlusCode } from '-/utils/misc';
import { Pro } from '-/pro';
@@ -41,6 +39,7 @@ import { AppConfig } from '-/config';
import { TS } from '-/tagspaces.namespace';
import useValidation from '-/utils/useValidation';
import { getMapTileServer } from '-/reducers/settings';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
const styles = () => ({
root: {
@@ -56,7 +55,6 @@ interface Props {
fullScreen: boolean;
onClose: () => void;
editTagForEntry: (path: string, tag: TS.Tag, title: string) => void;
- // currentEntryPath: string;
selectedEntries: Array<TS.FileSystemEntry>;
selectedTag: TS.Tag;
tileServer: TS.MapTileServer;
@@ -120,18 +118,7 @@ const EditEntryTagDialog = (props: Props) => {
function renderTitle() {
return (
<DialogTitle>
- {i18n.t('core:tagProperties')}{' '}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ {i18n.t('core:tagProperties')} <DialogCloseButton onClose={onClose} />
</DialogTitle>
);
}
@@ -201,11 +188,7 @@ const EditEntryTagDialog = (props: Props) => {
<div />
)}
<div>
- <Button
- data-tid="closeEditTagEntryDialog"
- onClick={props.onClose}
- color="primary"
- >
+ <Button data-tid="closeEditTagEntryDialog" onClick={props.onClose}>
{i18n.t('core:cancel')}
</Button>
<Button
diff --git a/app/components/dialogs/EditTagDialog.tsx b/app/components/dialogs/EditTagDialog.tsx
index 8c7858c55..45de18f10 100644
--- a/app/components/dialogs/EditTagDialog.tsx
+++ b/app/components/dialogs/EditTagDialog.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useEffect, useRef, useState } from 'react';
+import React, { useEffect, useState } from 'react';
import Button from '@material-ui/core/Button';
import TextField from '@material-ui/core/TextField';
import format from 'date-fns/format';
@@ -26,12 +26,11 @@ import DialogTitle from '@material-ui/core/DialogTitle';
import FormControl from '@material-ui/core/FormControl';
import FormHelperText from '@material-ui/core/FormHelperText';
import Dialog from '@material-ui/core/Dialog';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import ColorPickerDialog from './ColorPickerDialog';
import TransparentBackground from '../TransparentBackground';
import i18n from '-/services/i18n';
import { TS } from '-/tagspaces.namespace';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -93,7 +92,6 @@ const EditTagDialog = (props: Props) => {
props.selectedTagGroupEntry.uuid,
props.selectedTag.title
);
- // setInputError(false);
props.onClose();
}
};
@@ -146,17 +144,7 @@ const EditTagDialog = (props: Props) => {
<DialogTitle style={{ overflow: 'visible' }}>
{i18n.t('core:editTagTitle')}
{` '${title}'`}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent style={{ overflow: 'visible' }}>
<FormControl
@@ -250,11 +238,7 @@ const EditTagDialog = (props: Props) => {
</FormControl>
</DialogContent>
<DialogActions>
- <Button
- onClick={props.onClose}
- data-tid="closeEditTagDialog"
- color="primary"
- >
+ <Button onClick={props.onClose} data-tid="closeEditTagDialog">
{i18n.t('core:cancel')}
</Button>
<Button
diff --git a/app/components/dialogs/EditTagGroupDialog.tsx b/app/components/dialogs/EditTagGroupDialog.tsx
index 5e5517653..e0e4ad7c4 100644
--- a/app/components/dialogs/EditTagGroupDialog.tsx
+++ b/app/components/dialogs/EditTagGroupDialog.tsx
@@ -26,8 +26,6 @@ import FormControl from '@material-ui/core/FormControl';
import FormHelperText from '@material-ui/core/FormHelperText';
import Switch from '@material-ui/core/Switch';
import Dialog from '@material-ui/core/Dialog';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import Select from '@material-ui/core/Select';
import MenuItem from '@material-ui/core/MenuItem';
import { connect } from 'react-redux';
@@ -37,6 +35,7 @@ import TransparentBackground from '../TransparentBackground';
import { TS } from '-/tagspaces.namespace';
import { getLocations } from '-/reducers/locations';
import { Pro } from '-/pro';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -63,6 +62,7 @@ const EditTagGroupDialog = (props: Props) => {
const [textcolor, setTextcolor] = useState<string>(
props.selectedTagGroupEntry.textcolor
);
+ const { selectedTagGroupEntry, onClose } = props;
useEffect(() => {
handleValidation();
@@ -90,7 +90,6 @@ const EditTagGroupDialog = (props: Props) => {
const disableConfirmButton = () => inputError;
const onConfirm = () => {
- const { selectedTagGroupEntry } = props;
if (disableConfirmButton()) {
return;
}
@@ -120,7 +119,7 @@ const EditTagGroupDialog = (props: Props) => {
style: tag.style
}))
});
- props.onClose();
+ onClose();
}
};
@@ -128,17 +127,7 @@ const EditTagGroupDialog = (props: Props) => {
<DialogTitle style={{ overflow: 'visible' }}>
{i18n.t('core:editTagGroupTitle')}
{` '${title}'`}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={props.onClose}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
);
@@ -274,9 +263,7 @@ const EditTagGroupDialog = (props: Props) => {
const renderActions = () => (
<DialogActions>
- <Button onClick={props.onClose} color="primary">
- {i18n.t('core:cancel')}
- </Button>
+ <Button onClick={props.onClose}>{i18n.t('core:cancel')}</Button>
<Button
disabled={disableConfirmButton()}
onClick={onConfirm}
diff --git a/app/components/dialogs/FileUploadDialog.tsx b/app/components/dialogs/FileUploadDialog.tsx
index 382e17d15..1f7ab6f89 100644
--- a/app/components/dialogs/FileUploadDialog.tsx
+++ b/app/components/dialogs/FileUploadDialog.tsx
@@ -22,7 +22,6 @@ import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
import Dialog from '@material-ui/core/Dialog';
-import IconButton from '@material-ui/core/IconButton';
import CloseIcon from '@material-ui/icons/Close';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@@ -34,6 +33,7 @@ import PlatformIO from '-/services/platform-io';
import { actions as AppActions, getProgress } from '-/reducers/app';
import { extractFileName } from '-/utils/paths';
import i18n from '-/services/i18n';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -86,17 +86,7 @@ const FileUploadDialog = (props: Props) => {
>
<DialogTitle data-tid="importDialogTitle">
{i18n.t('core:importDialogTitle')}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent
style={{
diff --git a/app/components/dialogs/GenericDialog.tsx b/app/components/dialogs/GenericDialog.tsx
index f6b1db28f..61fee4a3c 100644
--- a/app/components/dialogs/GenericDialog.tsx
+++ b/app/components/dialogs/GenericDialog.tsx
@@ -42,32 +42,6 @@ export function onEnterKeyHandler(event: any, confirmFunction: () => void) {
}
const GenericDialog = (props: Props) => {
- // function renderTitle() {
- // return (
- // <DialogTitle>Dialog</DialogTitle>
- // );
- // }
-
- // function renderContent() {
- // return (
- // <DialogContent>
- // <DialogContentText>
- // Some content
- // </DialogContentText>
- // </DialogContent>
- // );
- // }
-
- // function renderActions() {
- // return (
- // <DialogActions>
- // <Button onClick={props.onClose} color="primary">
- // {i18n.t('core:cancel')}
- // </Button>
- // </DialogActions>
- // );
- // }
-
const { fullScreen, open, onEnterKey, onClose, onBackdropClick } = props;
return (
<Dialog
diff --git a/app/components/dialogs/IgnorePatternDialog.tsx b/app/components/dialogs/IgnorePatternDialog.tsx
index 8e734d529..346a7136e 100644
--- a/app/components/dialogs/IgnorePatternDialog.tsx
+++ b/app/components/dialogs/IgnorePatternDialog.tsx
@@ -25,16 +25,16 @@ import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
import FormControl from '@material-ui/core/FormControl';
import Dialog from '@material-ui/core/Dialog';
+import IconButton from '@material-ui/core/IconButton';
import Input from '@material-ui/core/Input';
-import AddIcon from '@material-ui/icons/Add';
import InputLabel from '@material-ui/core/InputLabel';
import InputAdornment from '@material-ui/core/InputAdornment';
-import IconButton from '@material-ui/core/IconButton';
import FolderIcon from '@material-ui/icons/FolderOpen';
import FormHelperText from '@material-ui/core/FormHelperText';
import i18n from '-/services/i18n';
import PlatformIO from '-/services/platform-io';
import useValidation from '-/utils/useValidation';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
const styles: any = theme => ({
root: {
@@ -124,7 +124,10 @@ const CreateEditLocationDialog = (props: Props) => {
}
}}
>
- <DialogTitle>{i18n.t('core:ignorePatternDialogTitle')}</DialogTitle>
+ <DialogTitle>
+ {i18n.t('core:ignorePatternDialogTitle')}{' '}
+ <DialogCloseButton onClose={onClose} />
+ </DialogTitle>
<DialogContent>
<FormControl
fullWidth={true}
@@ -167,9 +170,7 @@ const CreateEditLocationDialog = (props: Props) => {
</FormControl>
</DialogContent>
<DialogActions>
- <Button onClick={() => onClose()} color="primary">
- {i18n.t('core:cancel')}
- </Button>
+ <Button onClick={() => onClose()}>{i18n.t('core:cancel')}</Button>
<Button
disabled={selectedDirectoryPath.length === 0 || haveError()}
onClick={onConfirm}
diff --git a/app/components/dialogs/ImportExportTagGroupsDialog.tsx b/app/components/dialogs/ImportExportTagGroupsDialog.tsx
index 7e8848abe..6536fa682 100644
--- a/app/components/dialogs/ImportExportTagGroupsDialog.tsx
+++ b/app/components/dialogs/ImportExportTagGroupsDialog.tsx
@@ -36,6 +36,7 @@ import i18n from '-/services/i18n';
import { isFunc } from '-/utils/misc';
import AppConfig from '-/config';
import { TS } from '-/tagspaces.namespace';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
const styles: any = {
root: {
@@ -135,42 +136,14 @@ const ImportExportTagGroupsDialog = (props: Props) => {
</div>
);
- const renderTitle = () => {
- if (props.dialogModeImport) {
- return (
- <DialogTitle>
- {i18n.t('core:importGroupTagsTitle')}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
- </DialogTitle>
- );
- }
- return (
- <DialogTitle>
- {i18n.t('core:exportGroupTagsTitle')}{' '}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
- </DialogTitle>
- );
- };
+ const renderTitle = () => (
+ <DialogTitle>
+ {props.dialogModeImport
+ ? i18n.t('core:importGroupTagsTitle')
+ : i18n.t('core:exportGroupTagsTitle')}
+ <DialogCloseButton onClose={onClose} />
+ </DialogTitle>
+ );
const renderContent = () => (
<DialogContent className={props.classes.root}>
@@ -185,9 +158,7 @@ const ImportExportTagGroupsDialog = (props: Props) => {
const renderActions = () => (
<DialogActions>
- <Button onClick={props.onClose} color="primary">
- {i18n.t('core:cancel')}
- </Button>
+ <Button onClick={props.onClose}>{i18n.t('core:cancel')}</Button>
<Button
disabled={!isSelected()}
onClick={onConfirm}
diff --git a/app/components/dialogs/KeyboardDialog.tsx b/app/components/dialogs/KeyboardDialog.tsx
index 54e0b8aa2..ad9bb0b19 100644
--- a/app/components/dialogs/KeyboardDialog.tsx
+++ b/app/components/dialogs/KeyboardDialog.tsx
@@ -23,8 +23,6 @@ import Button from '@material-ui/core/Button';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
@@ -34,6 +32,7 @@ import Dialog from '@material-ui/core/Dialog';
import i18n from '-/services/i18n';
import AppConfig from '-/config';
import { getKeyBindingObject } from '-/reducers/settings';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
const styles = theme => ({
root: {
@@ -68,17 +67,7 @@ const KeyboardDialog = (props: Props) => {
>
<DialogTitle>
{i18n.t('core:shortcutKeys')}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent
className={props.classes.root}
diff --git a/app/components/dialogs/LicenseDialog.tsx b/app/components/dialogs/LicenseDialog.tsx
index 3195c7a2b..45dd1b1ba 100644
--- a/app/components/dialogs/LicenseDialog.tsx
+++ b/app/components/dialogs/LicenseDialog.tsx
@@ -23,13 +23,12 @@ import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
import withMobileDialog from '@material-ui/core/withMobileDialog';
import Dialog from '@material-ui/core/Dialog';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import i18n from '-/services/i18n';
import { Pro } from '-/pro';
import AppConfig from '-/config';
import LicenseContent from '-/LICENSE.txt';
import PlatformIO from '-/services/platform-io';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -70,17 +69,7 @@ const LicenseDialog = (props: Props) => {
>
<DialogTitle>
{i18n.t('core:license')}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent
// inputRef={ref => {
diff --git a/app/components/dialogs/MoveCopyFilesDialog.tsx b/app/components/dialogs/MoveCopyFilesDialog.tsx
index 605b72d5b..f4916722a 100644
--- a/app/components/dialogs/MoveCopyFilesDialog.tsx
+++ b/app/components/dialogs/MoveCopyFilesDialog.tsx
@@ -36,12 +36,12 @@ import FormHelperText from '@material-ui/core/FormHelperText';
import Typography from '@material-ui/core/Typography';
import Dialog from '@material-ui/core/Dialog';
import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import i18n from '-/services/i18n';
import PlatformIO from '-/services/platform-io';
import AppConfig from '-/config';
import IOActions from '-/reducers/io-actions';
import { extractFileName } from '-/utils/paths';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -103,7 +103,7 @@ const MoveCopyFilesDialog = (props: Props) => {
});
}
- function onCloseDialog(event: React.MouseEvent<HTMLElement>) {
+ function onCloseDialog() {
onClose();
}
@@ -117,17 +117,7 @@ const MoveCopyFilesDialog = (props: Props) => {
>
<DialogTitle>
{i18n.t('core:copyMoveFilesTitle')}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onCloseDialog}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={onCloseDialog} />
</DialogTitle>
<DialogContent>
<List dense style={{ width: 550 }}>
diff --git a/app/components/dialogs/OnboardingDialog.tsx b/app/components/dialogs/OnboardingDialog.tsx
index 0bb628f0a..4948abcc4 100644
--- a/app/components/dialogs/OnboardingDialog.tsx
+++ b/app/components/dialogs/OnboardingDialog.tsx
@@ -24,8 +24,6 @@ import Button from '@material-ui/core/Button';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import Typography from '@material-ui/core/Typography';
import Radio from '@material-ui/core/Radio';
import RadioGroup from '@material-ui/core/RadioGroup';
@@ -50,6 +48,7 @@ import {
} from '-/reducers/settings';
import { actions as AppActions } from '-/reducers/app';
import AppConfig from '-/config';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
classes: any;
@@ -96,17 +95,7 @@ const OnboardingDialog = (props: Props) => {
>
<DialogTitle style={{ justifyContent: 'center', textAlign: 'center' }}>
Welcome to TagSpaces
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent
style={{
@@ -126,7 +115,6 @@ const OnboardingDialog = (props: Props) => {
overflowX: 'hidden'
}}
>
- <Typography variant="h5">Welcome to TagSpaces</Typography>
<Typography variant="h6">&nbsp;</Typography>
<img
style={{ maxHeight: 300, marginTop: 15 }}
diff --git a/app/components/dialogs/OpenLinkDialog.tsx b/app/components/dialogs/OpenLinkDialog.tsx
index 6228640e0..1643ee35d 100644
--- a/app/components/dialogs/OpenLinkDialog.tsx
+++ b/app/components/dialogs/OpenLinkDialog.tsx
@@ -26,10 +26,9 @@ import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
import FormControl from '@material-ui/core/FormControl';
import Dialog from '@material-ui/core/Dialog';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import i18n from '-/services/i18n';
import { actions as AppActions } from '-/reducers/app';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -101,17 +100,7 @@ const OpenLinkDialog = (props: Props) => {
>
<DialogTitle>
{i18n.t('core:openLink')}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent style={{ minWidth: 400 }}>
<FormControl fullWidth={true} error={inputError}>
@@ -131,11 +120,7 @@ const OpenLinkDialog = (props: Props) => {
</FormControl>
</DialogContent>
<DialogActions>
- <Button
- data-tid="closeOpenLinkDialog"
- onClick={onCancel}
- color="primary"
- >
+ <Button data-tid="closeOpenLinkDialog" onClick={onCancel}>
{i18n.t('core:cancel')}
</Button>
<Button
diff --git a/app/components/dialogs/ProTeaserDialog.tsx b/app/components/dialogs/ProTeaserDialog.tsx
index dd248eb30..514b0fcfb 100644
--- a/app/components/dialogs/ProTeaserDialog.tsx
+++ b/app/components/dialogs/ProTeaserDialog.tsx
@@ -22,8 +22,6 @@ import Button from '@material-ui/core/Button';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import Typography from '@material-ui/core/Typography';
import withMobileDialog from '@material-ui/core/withMobileDialog';
import MobileStepper from '@material-ui/core/MobileStepper';
@@ -37,6 +35,7 @@ import AnnotateImage from '-/assets/images/annotate-undraw.svg';
import EnterpriseImage from '-/assets/images/world-undraw.svg';
import i18n from '-/services/i18n';
import AppConfig from '-/config';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -77,17 +76,7 @@ const ProTeaserDialog = (props: Props) => {
scroll="paper"
>
<DialogTitle style={{ justifyContent: 'center', textAlign: 'center' }}>
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent style={{ paddingBottom: 0 }}>
<SwipeableViews
diff --git a/app/components/dialogs/ProgressDialog.tsx b/app/components/dialogs/ProgressDialog.tsx
index 8c2ac1c5e..e21bcec8f 100644
--- a/app/components/dialogs/ProgressDialog.tsx
+++ b/app/components/dialogs/ProgressDialog.tsx
@@ -20,9 +20,8 @@ import React from 'react';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
import Dialog from '@material-ui/core/Dialog';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import { CircularProgress } from '@material-ui/core';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -32,18 +31,7 @@ interface Props {
const ProgressDialog = (props: Props) => (
<Dialog open={props.open} onClose={props.onClose}>
<DialogTitle data-tid="progressDialogTitle">
- {/* {i18n.t('core:importDialogTitle')} */}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={props.onClose}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={props.onClose} />
</DialogTitle>
<DialogContent
style={{
diff --git a/app/components/dialogs/RenameEntryDialog.tsx b/app/components/dialogs/RenameEntryDialog.tsx
index cb6e727b0..caa4950b5 100644
--- a/app/components/dialogs/RenameEntryDialog.tsx
+++ b/app/components/dialogs/RenameEntryDialog.tsx
@@ -27,8 +27,6 @@ import DialogTitle from '@material-ui/core/DialogTitle';
import FormControl from '@material-ui/core/FormControl';
import FormHelperText from '@material-ui/core/FormHelperText';
import Dialog from '@material-ui/core/Dialog';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import i18n from '-/services/i18n';
import {
extractContainingDirectoryPath,
@@ -38,6 +36,7 @@ import {
import { actions as AppActions, getLastSelectedEntry } from '-/reducers/app';
import PlatformIO from '-/services/platform-io';
import AppConfig from '-/config';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -179,17 +178,7 @@ const RenameEntryDialog = (props: Props) => {
>
<DialogTitle>
{i18n.t('core:' + (isFile ? 'renameFileTitle' : 'renameDirectory'))}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent>
<FormControl fullWidth={true} error={inputError}>
@@ -215,11 +204,7 @@ const RenameEntryDialog = (props: Props) => {
</FormControl>
</DialogContent>
<DialogActions>
- <Button
- data-tid="closeRenameEntryDialog"
- onClick={props.onClose}
- color="primary"
- >
+ <Button data-tid="closeRenameEntryDialog" onClick={props.onClose}>
{i18n.t('core:cancel')}
</Button>
<Button
diff --git a/app/components/dialogs/ThirdPartyLibsDialog.tsx b/app/components/dialogs/ThirdPartyLibsDialog.tsx
index 4934f0cb7..318a8e69c 100644
--- a/app/components/dialogs/ThirdPartyLibsDialog.tsx
+++ b/app/components/dialogs/ThirdPartyLibsDialog.tsx
@@ -21,12 +21,11 @@ import Button from '@material-ui/core/Button';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import withMobileDialog from '@material-ui/core/withMobileDialog';
import Dialog from '@material-ui/core/Dialog';
import i18n from '-/services/i18n';
import ThirdPartyLibs from '-/third-party.txt';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -45,18 +44,7 @@ const ThirdPartyLibsDialog = (props: Props) => {
scroll="paper"
>
<DialogTitle>
- {i18n.t('core:thirdPartyLibs')}{' '}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ {i18n.t('core:thirdPartyLibs')} <DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent style={{ overflowX: 'auto' }}>
<pre style={{ whiteSpace: 'pre-wrap', userSelect: 'text' }}>
@@ -66,7 +54,7 @@ const ThirdPartyLibsDialog = (props: Props) => {
<DialogActions>
<Button
data-tid="confirmThirdPartyLibsDialog"
- onClick={props.onClose}
+ onClick={onClose}
color="primary"
>
{i18n.t('core:ok')}
diff --git a/app/components/dialogs/settings/MapTileServerDialog.tsx b/app/components/dialogs/settings/MapTileServerDialog.tsx
index ed09ceb62..bb99d028e 100644
--- a/app/components/dialogs/settings/MapTileServerDialog.tsx
+++ b/app/components/dialogs/settings/MapTileServerDialog.tsx
@@ -22,8 +22,6 @@ import Dialog from '@material-ui/core/Dialog';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import TextField from '@material-ui/core/TextField';
import FormHelperText from '@material-ui/core/FormHelperText';
import FormControl from '@material-ui/core/FormControl';
@@ -34,6 +32,7 @@ import i18n from '-/services/i18n';
import useValidation from '-/utils/useValidation';
import { TS } from '-/tagspaces.namespace';
import { actions as SettingsActions } from '-/reducers/settings';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -58,18 +57,8 @@ const MapTileServerDialog = (props: Props) => {
props.tileServer.uuid
? 'core:tileServerDialogEdit'
: 'core:tileServerDialogAdd'
- )}{' '}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={props.onClose}
- >
- <CloseIcon />
- </IconButton>
+ )}
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
);
diff --git a/app/components/dialogs/settings/SettingsAdvanced.tsx b/app/components/dialogs/settings/SettingsAdvanced.tsx
index 039ffdaf8..8c3050bb5 100644
--- a/app/components/dialogs/settings/SettingsAdvanced.tsx
+++ b/app/components/dialogs/settings/SettingsAdvanced.tsx
@@ -20,7 +20,6 @@ import React, { useState } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { withStyles } from '@material-ui/core/styles';
-import Paper from '@material-ui/core/Paper';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemText from '@material-ui/core/ListItemText';
@@ -128,19 +127,24 @@ const SettingsAdvanced = (props: Props) => {
</ListItem>
<ListItem className={classes.listItem}>
<ListItemText primary={i18n.t('core:tileServerTitle')} />
- <ListItemSecondaryAction>
- <IconButton
- aria-label={i18n.t('core:add')}
- aria-haspopup="true"
- edge="end"
- data-tid="addTileServerTID"
+ <ListItemSecondaryAction style={{ right: 0 }}>
+ <Button
+ color="primary"
onClick={event => handleEditTileServerClick(event, {}, true)}
>
- <AddIcon />
- </IconButton>
+ {i18n.t('tileServerDialogAdd')}
+ </Button>
</ListItemSecondaryAction>
</ListItem>
- <Paper elevation={2} style={{ margin: 2, padding: 5 }}>
+ <List
+ style={{
+ padding: 5,
+ paddingLeft: 10,
+ backgroundColor: '#d3d3d34a',
+ borderRadius: 10
+ }}
+ dense
+ >
{props.tileServers.length > 0 ? (
props.tileServers.map((tileServer, index) => (
<ListItem key={tileServer.uuid} className={classes.listItem}>
@@ -179,7 +183,7 @@ const SettingsAdvanced = (props: Props) => {
/>
</ListItem>
)}
- </Paper>
+ </List>
{/* <ListItem className={classes.listItem}>
<ListItemText primary={i18n.t('core:coloredFileExtensionsEnabled')} />
<Switch
diff --git a/app/components/dialogs/settings/SettingsDialog.tsx b/app/components/dialogs/settings/SettingsDialog.tsx
index 9ad2aef9e..eab09bba0 100644
--- a/app/components/dialogs/settings/SettingsDialog.tsx
+++ b/app/components/dialogs/settings/SettingsDialog.tsx
@@ -27,8 +27,6 @@ import Dialog from '@material-ui/core/Dialog';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
-import IconButton from '@material-ui/core/IconButton';
-import CloseIcon from '@material-ui/icons/Close';
import withMobileDialog from '@material-ui/core/withMobileDialog';
import uuidv1 from 'uuid';
import { useStateWithCallbackLazy } from 'use-state-with-callback';
@@ -41,6 +39,7 @@ import { actions, getSupportedFileTypes } from '-/reducers/settings';
import { extend } from '-/utils/misc';
import AppConfig from '-/config';
import SettingsAdvanced from '-/components/dialogs/settings/SettingsAdvanced';
+import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
const styles: any = () => ({
mainContent: {
@@ -189,18 +188,8 @@ const SettingsDialog = (props: Props) => {
const renderTitle = () => (
<>
<DialogTitle>
- {i18n.t('core:settings')}{' '}
- <IconButton
- aria-label="close"
- style={{
- position: 'absolute',
- right: 5,
- top: 5
- }}
- onClick={onClose}
- >
- <CloseIcon />
- </IconButton>
+ {i18n.t('core:settings')}
+ <DialogCloseButton onClose={onClose} />
</DialogTitle>
<AppBar position="static" color="default">
<Tabs
diff --git a/app/components/menus/TagGroupMenu.tsx b/app/components/menus/TagGroupMenu.tsx
index ea6709dca..51eb75cb5 100644
--- a/app/components/menus/TagGroupMenu.tsx
+++ b/app/components/menus/TagGroupMenu.tsx
@@ -26,10 +26,7 @@ import DeleteTagGroupIcon from '@material-ui/icons/DeleteForever';
import SortTagGroupIcon from '@material-ui/icons/SortByAlpha';
import ShowEntriesWithTagIcon from '@material-ui/icons/SearchOutlined';
import TagIcon from '@material-ui/icons/LocalOffer';
-import InfoIcon from '@material-ui/icons/InfoOutlined';
-import Tooltip from '@material-ui/core/Tooltip';
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
-import IconButton from '@material-ui/core/IconButton';
import CollectTagsIcon from '@material-ui/icons/Voicemail';
import Menu from '@material-ui/core/Menu';
import MenuItem from '@material-ui/core/MenuItem';
@@ -41,6 +38,7 @@ import { getMaxSearchResults } from '-/reducers/settings';
import { actions as AppActions } from '-/reducers/app';
import { actions as LocationIndexActions } from '-/reducers/location-index';
import { TS } from '-/tagspaces.namespace';
+import InfoIcon from '-/components/InfoIcon';
interface Props {
classes?: any;
@@ -149,11 +147,7 @@ const TagGroupMenu = (props: Props) => {
</ListItemIcon>
<ListItemText primary={i18n.t('core:showFilesWithTags')} />
<ListItemSecondaryAction>
- <Tooltip arrow title={i18n.t('core:showFilesWithTagsTooltip')}>
- <IconButton edge="end" aria-label="delete">
- <InfoIcon />
- </IconButton>
- </Tooltip>
+ <InfoIcon tooltip={i18n.t('core:showFilesWithTagsTooltip')} />
</ListItemSecondaryAction>
</MenuItem>
<MenuItem
diff --git a/app/locales/en/core.json b/app/locales/en/core.json
index cebd30514..9e74eea9c 100644
--- a/app/locales/en/core.json
+++ b/app/locales/en/core.json
@@ -575,6 +575,7 @@
"default": "Default",
"ignoredFolder": "ignorer folder",
"ignorePatterns": "Ignore patterns",
+ "ignorePatternsHelp": "The app will not index folders added here",
"ignorePatternPath": "Path to ignore pattern folder",
"ignorePatternPlaceholder": "Ignore pattern",
"ignorePatternDialogTitle": "Add Ignore Pattern",