TagSpaces is an offline, open source, document manager with tagging support
chore: redesign of the creation dialog
Ilian Sapundshiev6fc6fecad77b
diff --git a/app/components/CustomLogo.tsx b/app/components/CustomLogo.tsxindex 6f8543048..75ba00400 100644--- a/app/components/CustomLogo.tsx+++ b/app/components/CustomLogo.tsx@@ -24,7 +24,6 @@ import withStyles from '@mui/styles/withStyles';import Badge from '@mui/material/Badge';import Tooltip from '-/components/Tooltip';import AppConfig from '-/AppConfig';-import PlatformIO from '-/services/platform-facade';import { Pro } from '../pro';import TextLogoIcon from '../assets/images/text-logo.svg';import WebLogoIcon from '../assets/images/text-logo-web.svg';@@ -64,15 +63,10 @@ if (AppConfig.customLogo) {function CustomLogo(props: Props) {return (<AppVersionBadge badgeContent={'v' + versionMeta.version} color="primary">- <Tooltip title={i18n.t('core:openNewInstance')}>+ <Tooltip title={i18n.t('core:aboutTitle')}><IconButton- onClick={() => {- AppConfig.isCordova- ? props.toggleAboutDialog()- : PlatformIO.createNewInstance();- }}+ onClick={props.toggleAboutDialog}style={{ padding: 0, paddingLeft: 5, height: 50 }}- data-tid="createNewInstance"><imgstyle={{diff --git a/app/components/MobileNavigation.tsx b/app/components/MobileNavigation.tsxindex 8d2030ca0..795a2149f 100644--- a/app/components/MobileNavigation.tsx+++ b/app/components/MobileNavigation.tsx@@ -31,6 +31,7 @@ import ThemingIcon from '@mui/icons-material/InvertColors';import TagLibraryIcon from '@mui/icons-material/LocalOfferOutlined';import RecentThingsIcon from '@mui/icons-material/BookmarksOutlined';import HelpIcon from '@mui/icons-material/HelpOutline';+import OpenInNewIcon from '@mui/icons-material/OpenInNew';import AccountCircleIcon from '@mui/icons-material/AccountCircle';import SettingsIcon from '@mui/icons-material/Settings';import withStyles from '@mui/styles/withStyles';@@ -60,6 +61,8 @@ import {import StoredSearches from '-/components/StoredSearches';import UserDetailsPopover from '-/components/UserDetailsPopover';import { CreateFileIcon, LocalLocationIcon } from '-/components/CommonIcons';+import PlatformIO from '-/services/platform-facade';+import AppConfig from '-/AppConfig';const styles: any = (theme: any) => ({selectedButton: {@@ -147,7 +150,8 @@ function MobileNavigation(props: Props) {textAlign: 'center',display: 'block',whiteSpace: 'nowrap',- marginBottom: 10+ marginBottom: 10,+ marginLeft: 15}}><Tooltip title={i18n.t('core:createFileTitle')}>@@ -163,17 +167,6 @@ function MobileNavigation(props: Props) {color="primary"><CreateFileIcon />- </Button>- </Tooltip>- <Tooltip title={i18n.t('core:createLocationTitle')}>- <Button- data-tid="createNewLocation"- onClick={toggleLocationDialog}- size="small"- color="primary"- >- <LocalLocationIcon />- <spanstyle={{maxWidth: 180,@@ -181,10 +174,32 @@ function MobileNavigation(props: Props) {overflow: 'hidden'}}>- {i18n.t('core:createLocationTitle')}+ {i18n.t('core:create')}</span></Button></Tooltip>+ {!AppConfig.isCordova && (+ <Tooltip title={i18n.t('core:openNewInstance')}>+ <Button+ data-tid="newAppWindow"+ onClick={() => PlatformIO.createNewInstance()}+ size="small"+ color="primary"+ >+ <OpenInNewIcon />+ + <span+ style={{+ maxWidth: 180,+ textOverflow: 'ellipsis',+ overflow: 'hidden'+ }}+ >+ {i18n.t('core:newWindow')}+ </span>+ </Button>+ </Tooltip>+ )}</ButtonGroup><LocationManagerreduceHeightBy={170}diff --git a/app/components/Revisions.tsx b/app/components/Revisions.tsxindex e3e5c5b7b..33de0ea2d 100644--- a/app/components/Revisions.tsx+++ b/app/components/Revisions.tsx@@ -180,7 +180,7 @@ function Revisions(props: Props) {<TableRow><TableCell>{i18n.t('revisions')}- <Tooltip title={i18n.t('core:deleteAll')}>+ <Tooltip title={i18n.t('core:deleteAllRevisions')}><IconButtonaria-label="delete all revisions"onClick={() =>diff --git a/app/components/dialogs/CreateDialog.tsx b/app/components/dialogs/CreateDialog.tsxindex 6c3eec756..dee23936e 100644--- a/app/components/dialogs/CreateDialog.tsx+++ b/app/components/dialogs/CreateDialog.tsx@@ -21,16 +21,10 @@ import { connect } from 'react-redux';import { bindActionCreators } from 'redux';import { saveAs } from 'file-saver';import Button from '@mui/material/Button';-import Container from '@mui/material/Container';-import HTMLFileIcon from '@mui/icons-material/PhotoAlbumOutlined';-import InputAdornment from '@mui/material/InputAdornment';-import TextFileIcon from '@mui/icons-material/InsertDriveFileOutlined';-import MarkdownFileIcon from '@mui/icons-material/DescriptionOutlined';-import AddFileIcon from '@mui/icons-material/NoteAddOutlined';+import ButtonGroup from '@mui/material/ButtonGroup';import Typography from '@mui/material/Typography';import DialogContent from '@mui/material/DialogContent';import DialogTitle from '@mui/material/DialogTitle';-import Avatar from '@mui/material/Avatar';import Grid from '@mui/material/Grid';import withStyles from '@mui/styles/withStyles';import Dialog from '@mui/material/Dialog';@@ -46,11 +40,11 @@ import {getCurrentDirectoryPerspective} from '-/reducers/app';import IOActions from '-/reducers/io-actions';-import { getFirstRWLocation } from '-/reducers/locations';+import { getFirstRWLocation, getCurrentLocation } from '-/reducers/locations';import { TS } from '-/tagspaces.namespace';import PlatformIO from '-/services/platform-facade';import DialogCloseButton from '-/components/dialogs/DialogCloseButton';-import Spacer from '-/components/Spacer';+import Tooltip from '-/components/Tooltip';import useTheme from '@mui/styles/useTheme';import useMediaQuery from '@mui/material/useMediaQuery';import TextField from '@mui/material/TextField';@@ -61,26 +55,23 @@ import { PerspectiveIDs } from '-/perspectives';const styles: any = () => ({createButton: {- minHeight: 100,width: '100%',- textAlign: 'center',- textTransform: 'none'+ textAlign: 'center'}});interface Props {open: boolean;classes: any;- // locations: Array<TS.Location>;firstRWLocation: TS.Location;- // currentLocation: TS.Location;+ currentLocation: TS.Location;selectedEntries: Array<TS.FileSystemEntry>;currentDirectoryPath: string | null;currentDirectoryPerspective: string;openLocation: (location: TS.Location) => void;- // selectedDirectoryPath: string;- // chooseDirectoryPath: (path: string) => void;showNotification: (message: string, type: string) => void;+ toggleLocationDialog: () => void;+ toggleCreateDirectoryDialog: () => void;reflectCreateEntries: (fsEntries: Array<TS.FileSystemEntry>) => void;createFileAdvanced: (targetPath: string,@@ -115,9 +106,11 @@ function CreateDialog(props: Props) {currentDirectoryPath,currentDirectoryPerspective,selectedEntries,- // currentLocation,showNotification,- firstRWLocation+ currentLocation,+ firstRWLocation,+ toggleLocationDialog,+ toggleCreateDirectoryDialog} = props;const fileUrl = useRef<string>();const fileName = useRef<string>(@@ -148,22 +141,6 @@ function CreateDialog(props: Props) {const noSuitableLocation = !targetDirectoryPath;- // function handleKeyPress(event: any) {- // if (event.key === 'n') {- // event.stopPropagation();- // createRichTextFile();- // } else if (event.key === 't') {- // event.stopPropagation();- // createTextFile();- // } else if (event.key === 'm') {- // event.stopPropagation();- // createMarkdownFile();- // } else if (event.key === 'a') {- // event.stopPropagation();- // addFile();- // }- // }-function loadLocation() {if (!currentDirectoryPath && firstRWLocation) {openLocation(firstRWLocation);@@ -339,24 +316,12 @@ function CreateDialog(props: Props) {fullScreen={fullScreen}keepMountedscroll="paper"- // onKeyDown={event => {- // // if (event.key === 'N' || event.key === 'n') {- // // createRichTextFile();- // // } else if (event.key === 'T' || event.key === 't') {- // // createTextFile();- // // } else if (event.key === 'M' || event.key === 'm') {- // // createMarkdownFile();- // // } else if (event.key === 'A' || event.key === 'a') {- // // addFile();- // // } else- // }}><DialogTitle>- {i18n.t('createNewContent')}+ {i18n.t('core:create') + '...'}<DialogCloseButton onClose={onClose} /></DialogTitle><DialogContent- // onKeyPress={handleKeyPress}style={{display: 'flex',minWidth: 200,@@ -368,13 +333,21 @@ function CreateDialog(props: Props) {data-tid="keyboardShortCutsDialog"><Grid style={{ flexGrow: 1, width: '100%' }} container spacing={1}>- {noSuitableLocation && (- <Grid item xs={12}>- <Typography>- File can not be created. No suitable location found!+ <Grid item xs={12}>+ {noSuitableLocation ? (+ <Typography variant="caption">+ {i18n.t('noSuitableLocation')}+ </Typography>+ ) : (+ <Typography variant="caption">+ {i18n.t('core:entriesWillBeCreatedIn') ++ ' ' ++ (currentLocation ? currentLocation.name : '') ++ ' ' ++ targetDirectoryPath}</Typography>- </Grid>- )}+ )}+ </Grid><Grid item xs={12}><FormControl fullWidth={true} error={inputError}><TextField@@ -389,7 +362,6 @@ function CreateDialog(props: Props) {disabled={noSuitableLocation}fullWidth={true}data-tid="newEntryDialogInputTID"- helperText={'File will be created in : ' + targetDirectoryPath}/>{inputError && (<FormHelperText>{i18n.t('core:fileNameHelp')}</FormHelperText>@@ -397,98 +369,98 @@ function CreateDialog(props: Props) {</FormControl></Grid><Grid item xs={12}>- <Button- variant="outlined"- onClick={createMarkdownFile}- className={classes.createButton}- // title={i18n.t('createMarkdownTitle')}- data-tid="createMarkdownButton"- disabled={noSuitableLocation}+ <ButtonGroup+ style={{+ textAlign: 'center',+ width: '100%'+ }}>- <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>+ <Button+ variant="contained"+ onClick={createMarkdownFile}+ className={classes.createButton}+ data-tid="createMarkdownButton"+ disabled={noSuitableLocation}+ >+ <Tooltip title={i18n.t('createMarkdownTitle')}>+ <Typography variant="button" display="block" gutterBottom>+ {i18n.t('createMarkdown')}+ </Typography>+ </Tooltip>+ </Button>+ <Button+ variant="contained"+ onClick={createRichTextFile}+ className={classes.createButton}+ data-tid="createRichTextFileButton"+ disabled={noSuitableLocation}+ >+ <Tooltip title={i18n.t('createNoteTitle')}>+ <Typography variant="button" display="block" gutterBottom>+ {i18n.t('createRichTextFile')}+ </Typography>+ </Tooltip>+ </Button>+ <Button+ variant="contained"+ onClick={createTextFile}+ className={classes.createButton}+ data-tid="createTextFileButton"+ disabled={noSuitableLocation}+ >+ <Tooltip title={i18n.t('createTextFileTitle')}>+ <Typography variant="button" display="block" gutterBottom>+ {i18n.t('createTextFile')}+ </Typography>+ </Tooltip>+ </Button>+ </ButtonGroup></Grid>- <Grid item xs={12}>+ <Grid style={{ marginTop: 20 }} item xs={12}><Buttonvariant="outlined"- onClick={createRichTextFile}+ onClick={() => {+ onClose();+ toggleLocationDialog();+ }}className={classes.createButton}- // title={i18n.t('createNoteTitle')}- data-tid="createRichTextFileButton"- disabled={noSuitableLocation}+ data-tid="createLocationButton">- <Avatar>- <HTMLFileIcon />- </Avatar>- <Container>+ <Tooltip title={i18n.t('createLocationTitle')}><Typography variant="button" display="block" gutterBottom>- {i18n.t('createRichTextFile')}+ {i18n.t('core:createLocation')}</Typography>- <Spacer height={10} />- <Typography variant="caption" display="block" gutterBottom>- {i18n.t('createNoteTitle')}- </Typography>- </Container>+ </Tooltip></Button></Grid>- <Grid item xs={12}>+ <Grid style={{ marginTop: 20 }} item xs={12}><Buttonvariant="outlined"- onClick={createTextFile}+ onClick={() => {+ onClose();+ toggleCreateDirectoryDialog();+ }}className={classes.createButton}- // title={i18n.t('createTextFileTitle')}- data-tid="createTextFileButton"+ data-tid="newSubDirectory"disabled={noSuitableLocation}>- <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>+ {i18n.t('core:newSubdirectory')}</Button></Grid>- <Grid style={{ marginTop: 40 }} item xs={12}>- <Button- variant="outlined"- onClick={addFile}- className={classes.createButton}- // title={i18n.t('addFilesTitle')}- data-tid="addFilesButton"- disabled={noSuitableLocation}- >- <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 item xs={12}>+ <Tooltip title={i18n.t('core:addFilesTitle')}>+ <Button+ variant="outlined"+ onClick={addFile}+ className={classes.createButton}+ data-tid="addFilesButton"+ disabled={noSuitableLocation}+ >+ {i18n.t('addFiles')}+ </Button>+ </Tooltip></Grid>- <Grid style={{ marginTop: 40 }} item xs={12}>+ <Grid item xs={12}><TextFielderror={invalidURL}label={i18n.t('core:url')}@@ -496,18 +468,6 @@ function CreateDialog(props: Props) {name="name"fullWidth={true}data-tid="newUrlTID"- InputProps={{- endAdornment: (- <InputAdornment position="end">- <Button- data-tid="cancelRenameEntryTID"- onClick={() => downloadURL()}- >- {i18n.t('core:downloadFile')}- </Button>- </InputAdornment>- )- }}onKeyDown={event => {if (event.key === 'Enter') {downloadURL();@@ -516,6 +476,22 @@ function CreateDialog(props: Props) {onChange={handleUrlChange}/></Grid>+ <Grid item xs={12}>+ <ButtonGroup+ style={{+ textAlign: 'center',+ width: '100%'+ }}+ >+ <Button+ data-tid="cancelRenameEntryTID"+ className={classes.createButton}+ onClick={() => downloadURL()}+ >+ {i18n.t('core:downloadFile')}+ </Button>+ </ButtonGroup>+ </Grid></Grid><inputstyle={{ display: 'none' }}@@ -534,13 +510,12 @@ function CreateDialog(props: Props) {function mapStateToProps(state) {return {- // locations: getLocations(state),firstRWLocation: getFirstRWLocation(state),keyBindings: getKeyBindingObject(state),selectedEntries: getSelectedEntries(state),currentDirectoryPath: getDirectoryPath(state),- currentDirectoryPerspective: getCurrentDirectoryPerspective(state)- // currentLocation: getCurrentLocation(state)+ currentDirectoryPerspective: getCurrentDirectoryPerspective(state),+ currentLocation: getCurrentLocation(state)};}@@ -551,6 +526,8 @@ function mapActionCreatorsToProps(dispatch) {createFileAdvanced: AppActions.createFileAdvanced,showNotification: AppActions.showNotification,reflectCreateEntries: AppActions.reflectCreateEntries,+ toggleLocationDialog: AppActions.toggleLocationDialog,+ toggleCreateDirectoryDialog: AppActions.toggleCreateDirectoryDialog,uploadFilesAPI: IOActions.uploadFilesAPI,downloadFile: IOActions.downloadFile,onUploadProgress: AppActions.onUploadProgress,diff --git a/app/locales/en/core.json b/app/locales/en/core.jsonindex 0a5b5b124..5239ca62f 100644--- a/app/locales/en/core.json+++ b/app/locales/en/core.json@@ -43,6 +43,7 @@"filePropertiesDescription": "Description","directoryPropertiesTitle": "Directory Properties","createLocationTitle": "Connect a Location",+ "createLocation": "New location","exportLocationTitle": "Export Location Configuration","importLocationTitle": "Import Location Configuration","closeAllLocations": "Close All Locations",@@ -142,7 +143,7 @@"fileOperations": "File Operations","addRemoveTags": "Add / Remove Tags","openFile": "Open File",- "downloadFile": "Download",+ "downloadFile": "Start the download","openFileNatively": "Open File Natively","openParentFolder": "Open Parent Folder","openContainingFolder": "Open Containing Folder",@@ -249,10 +250,10 @@"searchUntaggedEntries": "Untagged files or folders","searchSubFolder": "Search in subfolders","file": "File",- "newFileNote": "New File / Note",+ "newFileNote": "New File","createNewContent": "Add or create new files","createNewColumn": "Create new column",- "createFileTitle": "Create File / Note",+ "createFileTitle": "Create new files, folders or locations","createNote": "Create Note","createNoteTitle": "Use to create a document with rich text formatting.","createTextFile": "Create Text File",@@ -743,7 +744,7 @@"autosave": "Toggle auto save","restore": "Restore","created": "Created",- "url": "Insert a URL here",+ "url": "Insert a URL for downloading","relevance": "Relevance","duplicateLocationTitle": "Duplicate Location","minutes": "minutes",@@ -759,5 +760,9 @@"saveAs": "Save As","resolveConflictTitle": "File was modified externally","resolveConflictDesc": "For saving your changes as new file click on 'Save As' button, for override the external changes click the 'Override' button.",+ "create": "Create",+ "newWindow": "New window",+ "entriesWillBeCreatedIn": "Files and folders will be created in:",+ "noSuitableLocation": "Files or folders can't be created. No suitable location found!","-": "-"}