TagSpaces is an offline, open source, document manager with tagging support
feat: redesign create new file dialog
Ilian Sapundshievbf6fb6678095
diff --git a/app/components/Spacer.tsx b/app/components/Spacer.tsxnew file mode 100644index 000000000..722feeeb1--- /dev/null+++ b/app/components/Spacer.tsx@@ -0,0 +1,23 @@+/**+ * 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';++export default function Spacer({ height }) {+ const h = height || 50;+ return <div style={{ height: h }} />;+}diff --git a/app/components/dialogs/CreateDialog.tsx b/app/components/dialogs/CreateDialog.tsxindex b4c460a3e..0e2be855b 100644--- a/app/components/dialogs/CreateDialog.tsx+++ b/app/components/dialogs/CreateDialog.tsx@@ -21,13 +21,14 @@ import { connect } from 'react-redux';import { bindActionCreators } from 'redux';import Button from '@material-ui/core/Button';import Container from '@material-ui/core/Container';-import NoteFileIcon from '@material-ui/icons/DescriptionOutlined';+import HTMLFileIcon from '@material-ui/icons/PhotoAlbumOutlined';import TextFileIcon from '@material-ui/icons/InsertDriveFileOutlined';-import MarkdownFileIcon from '@material-ui/icons/GetAppOutlined';+import MarkdownFileIcon from '@material-ui/icons/DescriptionOutlined';import AddFileIcon from '@material-ui/icons/NoteAddOutlined';-import DialogActions from '@material-ui/core/DialogActions';+import Typography from '@material-ui/core/Typography';import DialogContent from '@material-ui/core/DialogContent';import DialogTitle from '@material-ui/core/DialogTitle';+import Avatar from '@material-ui/core/Avatar';import Grid from '@material-ui/core/Grid';import { withStyles } from '@material-ui/core/styles';import withMobileDialog from '@material-ui/core/withMobileDialog';@@ -41,6 +42,7 @@ import { formatDateTime4Tag } from '-/utils/misc';import IOActions from '-/reducers/io-actions';import { TS } from '-/tagspaces.namespace';import DialogCloseButton from '-/components/dialogs/DialogCloseButton';+import Spacer from '-/components/Spacer';const styles: any = () => ({root: {@@ -58,7 +60,8 @@ const styles: any = () => ({createButton: {minHeight: 100,width: '100%',- textAlign: 'center'+ textAlign: 'center',+ textTransform: 'none'}});@@ -270,7 +273,7 @@ const CreateDialog = (props: Props) => {}}}>- <DialogTitle style={{ alignSelf: 'center' }}>+ <DialogTitle>{i18n.t('createNewContent')}<DialogCloseButton onClose={onClose} /></DialogTitle>@@ -280,54 +283,92 @@ const CreateDialog = (props: Props) => {data-tid="keyboardShortCutsDialog"><Grid className={classes.grid} container spacing={1}>- <Grid item xs>+ <Grid item xs={12}><Button- onClick={createRichTextFile}+ variant="outlined"+ onClick={createMarkdownFile}className={classes.createButton}- title={i18n.t('createNoteTitle')}- data-tid="createRichTextFileButton"+ // title={i18n.t('createMarkdownTitle')}+ data-tid="createMarkdownButton">- <div>- <NoteFileIcon />- </div>- <div>- <Container>{i18n.t('createNote')}</Container>- </div>+ <Avatar>+ <MarkdownFileIcon />+ </Avatar>+ <Container>+ <Typography variant="button" display="block" gutterBottom>+ {i18n.t('createMarkdown')}+ </Typography>+ <Spacer height={10} />+ <Typography variant="caption" display="block" gutterBottom>+ {i18n.t('createMarkdownTitle')}+ </Typography>+ </Container></Button></Grid>- <Grid item xs>+ <Grid item xs={12}><Button- onClick={createTextFile}+ variant="outlined"+ onClick={createRichTextFile}className={classes.createButton}- title={i18n.t('createTextFileTitle')}- data-tid="createTextFileButton"+ // title={i18n.t('createNoteTitle')}+ data-tid="createRichTextFileButton">- <TextFileIcon />- <Container>{i18n.t('createTextFile')}</Container>+ <Avatar>+ <HTMLFileIcon />+ </Avatar>+ <Container>+ <Typography variant="button" display="block" gutterBottom>+ {i18n.t('createRichTextFile')}+ </Typography>+ <Spacer height={10} />+ <Typography variant="caption" display="block" gutterBottom>+ {i18n.t('createNoteTitle')}+ </Typography>+ </Container></Button></Grid>- </Grid>- <Grid className={classes.grid} container spacing={1}>- <Grid item xs>+ <Grid item xs={12}><Button- onClick={createMarkdownFile}+ variant="outlined"+ onClick={createTextFile}className={classes.createButton}- title={i18n.t('createMarkdownTitle')}- data-tid="createMarkdownButton"+ // title={i18n.t('createTextFileTitle')}+ data-tid="createTextFileButton">- <MarkdownFileIcon />- <Container>{i18n.t('createMarkdown')}</Container>+ <Avatar>+ <TextFileIcon />+ </Avatar>+ <Container>+ <Typography variant="button" display="block" gutterBottom>+ {i18n.t('createTextFile')}+ </Typography>+ <Spacer height={10} />+ <Typography variant="caption" display="block" gutterBottom>+ {i18n.t('createTextFileTitle')}+ </Typography>+ </Container></Button></Grid>- <Grid item xs>+ <Grid item xs={12}><Button+ variant="outlined"onClick={addFile}className={classes.createButton}- title={i18n.t('addFilesTitle')}+ // title={i18n.t('addFilesTitle')}data-tid="addFilesButton">- <AddFileIcon />- <Container>{i18n.t('addFiles')}</Container>+ <Avatar>+ <AddFileIcon />+ </Avatar>+ <Container>+ <Typography variant="button" display="block" gutterBottom>+ {i18n.t('addFiles')}+ </Typography>+ <Spacer height={10} />+ <Typography variant="caption" display="block" gutterBottom>+ {i18n.t('addFilesTitle')}+ </Typography>+ </Container></Button></Grid></Grid>@@ -342,15 +383,6 @@ const CreateDialog = (props: Props) => {onChange={handleFileInputChange}/></DialogContent>- <DialogActions style={{ alignSelf: 'center' }}>- <Button- data-tid="closeKeyboardDialog"- onClick={onClose}- color="primary"- >- {i18n.t('core:close')}- </Button>- </DialogActions></Dialog>);};diff --git a/app/locales/en/core.json b/app/locales/en/core.jsonindex 8b6ce66c8..95d465c53 100644--- a/app/locales/en/core.json+++ b/app/locales/en/core.json@@ -34,9 +34,7 @@"createTagGroupTitle": "Create Tag Group","createTagGroupName": "Tag Group Name","createNewDirectoryTitle": "Create New Directory",- "createFileTitle": "Create File / Note",- "createNote": "Create Note",- "createNoteTitle": "Press 'N' to create a note (rich text formatting)",+"createNewDirectoryTitleName": "New Directory Name","deleteDirectoryTitleConfirm": "Confirm Delete Directory","deleteDirectoryContentConfirm": "Do you want to delete the directory '{{dirPath}}' ?",@@ -245,15 +243,18 @@"searchSubFolder": "Search in subfolders","file": "File","newFileNote": "New File / Note",- "createNewContent": "Create New Content",+ "createNewContent": "Create...",+ "createFileTitle": "Create File / Note",+ "createNote": "Create Note",+ "createNoteTitle": "Use it to create documents with rich text formatting. Press 'N' to proceed","createTextFile": "Create Text File",- "createTextFileTitle": "Press 'T' to create a simple text file",+ "createTextFileTitle": "Use it to create plain text files with no formatting. Press 'T' to proceed.","createMarkdown": "Create Markdown File",- "createMarkdownTitle": "Press 'M' to create a markdown file",- "createRichTextFile": "Rich Text (html)",+ "createMarkdownTitle": "Use it to create notes or other documents with simple formatting. Press 'M' to proceed.",+ "createRichTextFile": "Create HTML File","createDirectory": "New Directory","addFiles": "Add Files",- "addFilesTitle": "Press 'A' to add a files",+ "addFilesTitle": "Add or upload files from your computer. Press 'A' to proceed.","exitApp": "Exit","closeWin": "Close Window","openNewInstance": "New Application Window",