Skip to content

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

add-history-to-welcomePanel (#1800)

Stanimir1ed932763c1f
diff --git a/app/components/CommonIcons.tsx b/app/components/CommonIcons.tsx
index 8af221685..33d4666b2 100644
--- a/app/components/CommonIcons.tsx
+++ b/app/components/CommonIcons.tsx
@@ -19,16 +19,34 @@
import React from 'react';
import ParentFolder from '@mui/icons-material/ReplyOutlined';
import Help from '@mui/icons-material/Help';
+import Remove from '@mui/icons-material/RemoveCircleOutline';
+import History from '@mui/icons-material/ChangeHistoryTwoTone';
import Settings from '@mui/icons-material/Settings';
import InfoIcon from '@mui/icons-material/Info';
+import AddIcon from '@mui/icons-material/Add';
+import Suitcase from '@mui/icons-material/WorkOutline';
+import Link from '@mui/icons-material/Link';
+import KeyShortcuts from '@mui/icons-material/Keyboard';
-export const ParentFolderIcon = () => (
+export const ParentFolderIcon = props => (
// <ParentDirIcon style={{ transform: 'rotate(-90deg)' }} /> SubdirectoryArrowLeft
- <ParentFolder />
+ <ParentFolder {...props} />
);
-export const HelpIcon = () => <Help />;
+export const HelpIcon = props => <Help {...props} />;
-export const PerspectiveSettingsIcon = () => <Settings />;
+export const RemoveIcon = props => <Remove {...props} />;
-export const FolderPropertiesIcon = () => <InfoIcon />;
+export const HistoryIcon = props => <History {...props} />;
+
+export const PerspectiveSettingsIcon = props => <Settings {...props} />;
+
+export const FolderPropertiesIcon = props => <InfoIcon {...props} />;
+
+export const CreateFileIcon = props => <AddIcon {...props} />;
+
+export const LocalLocationIcon = props => <Suitcase {...props} />;
+
+export const OpenLinkIcon = props => <Link {...props} />;
+
+export const KeyShortcutsIcon = props => <KeyShortcuts {...props} />;
diff --git a/app/components/HelpFeedbackPanel.tsx b/app/components/HelpFeedbackPanel.tsx
index a53db925d..36965f6fc 100644
--- a/app/components/HelpFeedbackPanel.tsx
+++ b/app/components/HelpFeedbackPanel.tsx
@@ -24,7 +24,6 @@ import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import ListItemIcon from '@mui/material/ListItemIcon';
import Divider from '@mui/material/Divider';
-import DocumentationIcon from '@mui/icons-material/Help';
import AboutIcon from '@mui/icons-material/BlurOn';
import ChangeLogIcon from '@mui/icons-material/ImportContacts';
import OnboardingIcon from '@mui/icons-material/Explore';
@@ -34,13 +33,12 @@ import CancelSubscriptionIcon from '@mui/icons-material/EventBusy';
import IssueIcon from '@mui/icons-material/BugReport';
import TranslationIcon from '@mui/icons-material/Translate';
import NewFeatureIcon from '@mui/icons-material/Gesture';
-// import SocialIcon from '@mui/icons-material/ThumbUp';
import TwitterIcon from '@mui/icons-material/Twitter';
-import KeyShortcutsIcon from '@mui/icons-material/Keyboard';
import ProTeaserIcon from '@mui/icons-material/FlightTakeoff';
import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
-import styles from './SidePanels.css';
-import i18n from '../services/i18n';
+import styles from '-/components/SidePanels.css';
+import i18n from '-/services/i18n';
+import { KeyShortcutsIcon, HelpIcon } from '-/components/CommonIcons';
import Links from '-/links';
import { connect } from 'react-redux';
import { getCurrentLanguage } from '-/reducers/settings';
@@ -117,7 +115,7 @@ function HelpFeedbackPanel(props: Props) {
}
>
<ListItemIcon>
- <DocumentationIcon />
+ <HelpIcon />
</ListItemIcon>
<Typography style={{ color: theme.palette.text.primary }}>
{i18n.t('core:documentation')}
diff --git a/app/components/LocationManager.tsx b/app/components/LocationManager.tsx
index 0a8d1d687..e2236c97e 100644
--- a/app/components/LocationManager.tsx
+++ b/app/components/LocationManager.tsx
@@ -23,20 +23,17 @@ import withStyles from '@mui/styles/withStyles';
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
import { List } from '@mui/material';
import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
-import styles from './SidePanels.css';
-import LocationManagerMenu from './menus/LocationManagerMenu';
-import ConfirmDialog from './dialogs/ConfirmDialog';
-import {
- actions as LocationActions,
- getLocations
-} from '../reducers/locations';
-import { actions as AppActions, isLoading } from '../reducers/app';
+import styles from '-/components/SidePanels.css';
+import LocationManagerMenu from '-/components/menus/LocationManagerMenu';
+import ConfirmDialog from '-/components/dialogs/ConfirmDialog';
+import { actions as LocationActions, getLocations } from '-/reducers/locations';
+import { actions as AppActions, isLoading } from '-/reducers/app';
import {
getCurrentLanguage,
getPersistTagsInSidecarFile,
isDesktopMode
} from '-/reducers/settings';
-import i18n from '../services/i18n';
+import i18n from '-/services/i18n';
import LoadingLazy from '-/components/LoadingLazy';
import LocationView from '-/components/LocationView';
import { Pro } from '-/pro';
diff --git a/app/components/MobileNavigation.tsx b/app/components/MobileNavigation.tsx
index 4df3f2392..9c96b0a69 100644
--- a/app/components/MobileNavigation.tsx
+++ b/app/components/MobileNavigation.tsx
@@ -28,8 +28,6 @@ import ButtonGroup from '@mui/material/ButtonGroup';
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
import IconButton from '@mui/material/IconButton';
import ThemingIcon from '@mui/icons-material/InvertColors';
-import LocationsIcon from '@mui/icons-material/WorkOutline';
-import CreateIcon from '@mui/icons-material/Add';
import TagLibraryIcon from '@mui/icons-material/LocalOfferOutlined';
import RecentThingsIcon from '@mui/icons-material/BookmarksOutlined';
import HelpIcon from '@mui/icons-material/HelpOutline';
@@ -64,6 +62,7 @@ import {
import Links from '-/links';
import StoredSearches from '-/components/StoredSearches';
import UserDetailsPopover from '-/components/UserDetailsPopover';
+import { CreateFileIcon, LocalLocationIcon } from '-/components/CommonIcons';
import { getUuid } from '-/services/utils-io';
const styles: any = (theme: any) => ({
@@ -128,6 +127,7 @@ function MobileNavigation(props: Props) {
const {
classes,
toggleCreateFileDialog,
+ toggleLocationDialog,
toggleOnboardingDialog,
toggleSettingsDialog,
toggleKeysDialog,
@@ -175,31 +175,25 @@ function MobileNavigation(props: Props) {
<Button
data-tid="createNewFileTID"
onClick={() => {
- if (props.isReadOnlyMode || !directoryPath) {
- showNotification(
- 'You are in read-only mode or there is no opened location'
- );
- } else {
- toggleCreateFileDialog();
- if (hideDrawer) {
- hideDrawer();
- }
+ toggleCreateFileDialog();
+ if (hideDrawer) {
+ hideDrawer();
}
}}
size="small"
color="primary"
>
- <CreateIcon />
+ <CreateFileIcon />
</Button>
</Tooltip>
<Tooltip title={i18n.t('core:createLocationTitle')}>
<Button
data-tid="createNewLocation"
- onClick={props.toggleLocationDialog}
+ onClick={toggleLocationDialog}
size="small"
color="primary"
>
- <LocationsIcon />
+ <LocalLocationIcon />
&nbsp;
<span
style={{
@@ -267,7 +261,7 @@ function MobileNavigation(props: Props) {
data-tid="locationManager"
value="check"
>
- <LocationsIcon />
+ <LocalLocationIcon />
</ToggleButton>
</Tooltip>
<Tooltip title={i18n.t('core:tagLibrary')}>
diff --git a/app/components/RenderHistory.tsx b/app/components/RenderHistory.tsx
new file mode 100644
index 000000000..863d0e7f0
--- /dev/null
+++ b/app/components/RenderHistory.tsx
@@ -0,0 +1,125 @@
+import { TS } from '-/tagspaces.namespace';
+import Grid from '@mui/material/Grid';
+import React from 'react';
+import Button from '@mui/material/Button';
+import ListItem from '@mui/material/ListItem';
+import PlatformIO from '-/services/platform-facade';
+import { Tooltip } from '@mui/material';
+import i18n from '-/services/i18n';
+import { Pro } from '-/pro';
+import BookmarkTwoToneIcon from '@mui/icons-material/BookmarkTwoTone';
+import {
+ extractDirectoryName,
+ extractFileName
+} from '@tagspaces/tagspaces-platforms/paths';
+import IconButton from '@mui/material/IconButton';
+import { RemoveIcon, HistoryIcon } from '-/components/CommonIcons';
+
+/**
+ * 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/>.
+ *
+ */
+
+export const renderHistory = (
+ key: string,
+ items: Array<TS.HistoryItem> | Array<TS.BookmarkItem>,
+ update: () => void,
+ currentLocationId: string,
+ openLink: (url: string, options: any) => void,
+ openLocationById: (locationId: string) => void,
+ openFsEntry: (fsEntry: TS.FileSystemEntry) => void,
+ maxItems: number | undefined = undefined,
+ showDelete: boolean = true
+) => (
+ <>
+ {items &&
+ items.slice(0, maxItems || items.length).map(item => (
+ <ListItem dense style={{ paddingLeft: 0 }} key={item.creationTimeStamp}>
+ <Grid item xs={10} style={{ width: '100%' }}>
+ <Button
+ style={{
+ textTransform: 'none',
+ fontWeight: 'normal',
+ justifyContent: 'start'
+ }}
+ onClick={() =>
+ Pro.history.openItem(
+ item,
+ currentLocationId,
+ openLink,
+ openLocationById,
+ openFsEntry
+ )
+ }
+ >
+ <Tooltip
+ title={
+ <span style={{ fontSize: 14 }}>
+ <b>{i18n.t('core:filePath')}:</b> {item.path}
+ <br />
+ <br />
+ {/* <b>Opened on: </b>{' '} */}
+ {new Date(item.creationTimeStamp)
+ .toISOString()
+ .substring(0, 19)
+ .split('T')
+ .join(' ')}
+ </span>
+ }
+ >
+ {key === Pro.bookmarks.bookmarksKey ? (
+ <BookmarkTwoToneIcon fontSize="small" />
+ ) : (
+ <HistoryIcon fontSize="small" />
+ )}
+ </Tooltip>
+ &nbsp;
+ <span
+ style={{
+ whiteSpace: 'nowrap',
+ textOverflow: 'ellipsis',
+ overflow: 'hidden',
+ maxWidth: 220
+ }}
+ >
+ {item.path.endsWith(PlatformIO.getDirSeparator())
+ ? extractDirectoryName(
+ item.path,
+ PlatformIO.getDirSeparator()
+ )
+ : extractFileName(item.path, PlatformIO.getDirSeparator())}
+ </span>
+ </Button>
+ </Grid>
+ {showDelete && (
+ <Grid item xs={2}>
+ <IconButton
+ aria-label={i18n.t('core:clearHistory')}
+ onClick={() => {
+ Pro.history.delItem(item, key);
+ update();
+ }}
+ data-tid="editSearchTID"
+ size="small"
+ >
+ <RemoveIcon />
+ </IconButton>
+ </Grid>
+ )}
+ </ListItem>
+ ))}
+ </>
+);
diff --git a/app/components/StoredSearches.tsx b/app/components/StoredSearches.tsx
index 5408d3ae1..fb6bbc9cf 100644
--- a/app/components/StoredSearches.tsx
+++ b/app/components/StoredSearches.tsx
@@ -34,6 +34,8 @@ import HistoryIcon from '@mui/icons-material/ChangeHistoryTwoTone';
import ArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import ArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
import Typography from '@mui/material/Typography';
+import ListItem from '@mui/material/ListItem';
+import List from '@mui/material/List';
import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import {
actions as LocationIndexActions,
@@ -64,6 +66,7 @@ import {
import PlatformIO from '-/services/platform-facade';
import HistoryMenu from '-/components/menus/HistoryMenu';
import BookmarksMenu from '-/components/menus/BookmarksMenu';
+import { renderHistory } from '-/components/RenderHistory';
interface Props {
style?: any;
@@ -192,103 +195,6 @@ function StoredSearches(props: Props) {
const openedFoldersAvailable =
folderOpenHistoryItems && folderOpenHistoryItems.length > 0;
- const renderItem = (
- key,
- items: Array<TS.HistoryItem> | Array<TS.BookmarkItem>
- ) => (
- <Grid container direction="row">
- {items &&
- items.map(item => (
- <React.Fragment key={item.creationTimeStamp}>
- <Grid item xs={10} style={{ display: 'flex' }}>
- <Button
- style={{
- textTransform: 'none',
- fontWeight: 'normal',
- width: '240px',
- justifyContent: 'start',
- whiteSpace: 'nowrap',
- textOverflow: 'ellipsis',
- overflow: 'hidden'
- }}
- onClick={() => {
- if (item.url) {
- props.openLink(item.url, { fullWidth: false });
- } else {
- PlatformIO.disableObjectStoreSupport();
- if (item.lid !== props.currentLocationId) {
- props.openLocationById(item.lid);
- }
- getAllPropertiesPromise(item.path)
- .then((fsEntry: TS.FileSystemEntry) => {
- props.openFsEntry(fsEntry);
- return true;
- })
- .catch(error =>
- console.warn(
- 'Error getting properties for entry: ' +
- item.path +
- ' - ' +
- error
- )
- );
- }
- }}
- >
- <Tooltip
- title={
- <span style={{ fontSize: 14 }}>
- <b>{i18n.t('core:filePath')}:</b> {item.path}
- <br />
- <br />
- {/* <b>Opened on: </b>{' '} */}
- {new Date(item.creationTimeStamp)
- .toISOString()
- .substring(0, 19)
- .split('T')
- .join(' ')}
- </span>
- }
- >
- {key === Pro.bookmarks.bookmarksKey ? (
- <BookmarkTwoToneIcon fontSize="small" />
- ) : (
- <HistoryIcon fontSize="small" />
- )}
- </Tooltip>
- &nbsp;
- {item.path.endsWith(PlatformIO.getDirSeparator())
- ? extractDirectoryName(
- item.path,
- PlatformIO.getDirSeparator()
- )
- : extractFileName(item.path, PlatformIO.getDirSeparator())}
- </Button>
- </Grid>
- <Grid item xs={2} style={{ display: 'flex' }}>
- <IconButton
- aria-label={i18n.t('core:clearHistory')}
- onClick={() => {
- if (Pro) {
- if (key === Pro.bookmarks.bookmarksKey) {
- Pro.bookmarks.delBookmark(item.path);
- } else {
- Pro.history.delHistory(key, item.creationTimeStamp);
- }
- }
- forceUpdate();
- }}
- data-tid="editSearchTID"
- size="small"
- >
- <DeleteIcon />
- </IconButton>
- </Grid>
- </React.Fragment>
- ))}
- </Grid>
- );
-
return (
<div
className={classes.panel}
@@ -373,38 +279,44 @@ function StoredSearches(props: Props) {
</Grid>
)}
</Grid>
- <Grid container direction="row">
- {props.storedSearchesVisible &&
- props.searches.map(search => (
- <React.Fragment key={search.uuid}>
- <Grid item xs={10} style={{ display: 'flex' }}>
- <Button
+ {props.storedSearchesVisible &&
+ props.searches.map(search => (
+ <ListItem dense style={{ paddingLeft: 0 }} key={search.uuid}>
+ <Grid item xs={10} style={{ width: '100%' }}>
+ <Button
+ style={{
+ textTransform: 'none',
+ fontWeight: 'normal',
+ justifyContent: 'start'
+ }}
+ onClick={() => handleSavedSearchClick(search.uuid)}
+ >
+ <SearchIcon />
+ &nbsp;
+ <span
style={{
- textTransform: 'none',
- fontWeight: 'normal',
- width: '100%',
- justifyContent: 'start'
+ whiteSpace: 'nowrap',
+ textOverflow: 'ellipsis',
+ overflow: 'hidden',
+ maxWidth: 220
}}
- onClick={() => handleSavedSearchClick(search.uuid)}
>
- <SearchIcon />
- &nbsp;
{search.title}
- </Button>
- </Grid>
- <Grid item xs={2} style={{ display: 'flex' }}>
- <IconButton
- aria-label={i18n.t('core:searchEditBtn')}
- onClick={() => editSearch(search.uuid)}
- data-tid="editSearchTID"
- size="small"
- >
- <EditIcon />
- </IconButton>
- </Grid>
- </React.Fragment>
- ))}
- </Grid>
+ </span>
+ </Button>
+ </Grid>
+ <Grid item xs={2}>
+ <IconButton
+ aria-label={i18n.t('core:searchEditBtn')}
+ onClick={() => editSearch(search.uuid)}
+ data-tid="editSearchTID"
+ size="small"
+ >
+ <EditIcon />
+ </IconButton>
+ </Grid>
+ </ListItem>
+ ))}
<Grid container direction="row">
<Grid item xs={10} style={{ alignSelf: 'center' }}>
<IconButton
@@ -445,7 +357,15 @@ function StoredSearches(props: Props) {
</Grid>
{Pro &&
props.showBookmarks &&
- renderItem(Pro.bookmarks.bookmarksKey, bookmarkItems)}
+ renderHistory(
+ Pro.bookmarks.bookmarksKey,
+ bookmarkItems,
+ forceUpdate,
+ props.currentLocationId,
+ props.openLink,
+ props.openLocationById,
+ props.openFsEntry
+ )}
<Grid container direction="row">
<Grid item xs={10} style={{ alignSelf: 'center' }}>
<IconButton
@@ -485,7 +405,15 @@ function StoredSearches(props: Props) {
)}
</Grid>
{props.fileOpenHistory &&
- renderItem(historyKeys.fileOpenKey, fileOpenHistoryItems)}
+ renderHistory(
+ historyKeys.fileOpenKey,
+ fileOpenHistoryItems,
+ forceUpdate,
+ props.currentLocationId,
+ props.openLink,
+ props.openLocationById,
+ props.openFsEntry
+ )}
<Grid container direction="row">
<Grid item xs={10} style={{ alignSelf: 'center' }}>
<IconButton
@@ -526,7 +454,15 @@ function StoredSearches(props: Props) {
)}
</Grid>
{props.fileEditHistory &&
- renderItem(historyKeys.fileEditKey, fileEditHistoryItems)}
+ renderHistory(
+ historyKeys.fileEditKey,
+ fileEditHistoryItems,
+ forceUpdate,
+ props.currentLocationId,
+ props.openLink,
+ props.openLocationById,
+ props.openFsEntry
+ )}
<Grid container direction="row">
<Grid item xs={10} style={{ alignSelf: 'center' }}>
<IconButton
@@ -594,7 +530,15 @@ function StoredSearches(props: Props) {
)}
</Grid>
{props.folderOpenHistory &&
- renderItem(historyKeys.folderOpenKey, folderOpenHistoryItems)}
+ renderHistory(
+ historyKeys.folderOpenKey,
+ folderOpenHistoryItems,
+ forceUpdate,
+ props.currentLocationId,
+ props.openLink,
+ props.openLocationById,
+ props.openFsEntry
+ )}
{SaveSearchDialog && saveSearchDialogOpened !== undefined && (
<SaveSearchDialog
open={true}
diff --git a/app/components/WelcomePanel.tsx b/app/components/WelcomePanel.tsx
index ba4c86467..774d37f8a 100644
--- a/app/components/WelcomePanel.tsx
+++ b/app/components/WelcomePanel.tsx
@@ -16,28 +16,34 @@
*
*/
-import React from 'react';
+import React, { useReducer } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import withStyles from '@mui/styles/withStyles';
import Button from '@mui/material/Button';
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
+import ListItemIcon from '@mui/material/ListItemIcon';
+import ListItemText from '@mui/material/ListItemText';
+import Grid from '@mui/material/Grid';
import Divider from '@mui/material/Divider';
-import DocumentationIcon from '@mui/icons-material/Help';
-import LocationIcon from '@mui/icons-material/WorkOutline';
import ChangeLogIcon from '@mui/icons-material/ImportContacts';
import WebClipperIcon from '@mui/icons-material/Transform';
import EmailIcon from '@mui/icons-material/Email';
import IssueIcon from '@mui/icons-material/BugReport';
import TranslationIcon from '@mui/icons-material/Translate';
import NewFeatureIcon from '@mui/icons-material/Gesture';
-import SocialIcon from '@mui/icons-material/ThumbUp';
import TwitterIcon from '@mui/icons-material/Twitter';
-import KeyShortcutsIcon from '@mui/icons-material/Keyboard';
import WelcomeBackground from '../assets/images/background.png';
import WelcomeLogo from '../assets/images/welcome-logo.png';
-import { actions as AppActions } from '../reducers/app';
+import {
+ CreateFileIcon,
+ LocalLocationIcon,
+ OpenLinkIcon,
+ KeyShortcutsIcon,
+ HelpIcon
+} from '-/components/CommonIcons';
+import { actions as AppActions, getCurrentLocationId } from '../reducers/app';
import i18n from '../services/i18n';
import {
isFirstRun,
@@ -45,156 +51,407 @@ import {
actions as SettingsActions
} from '../reducers/settings';
import Links from '../links';
-
-const styles: any = (theme: any) => ({
- mainPanel: {
- flex: '1 1 100%',
- width: '100%',
- height: '100%',
- overflowY: 'hidden',
- backgroundColor: theme.palette.background.default,
- backgroundImage: 'url(' + WelcomeBackground + ')',
- backgroundRepeat: 'repeat',
- opacity: '0.4'
- },
- slogan: {
- top: '45%',
- width: '100%',
- textAlign: 'center',
- position: 'absolute'
- },
- links: {
- width: 300,
- height: 'calc(100% - 100px)',
- margin: 'auto',
- marginTop: 15,
- marginBottom: 15,
- overflowY: 'overlay',
- backgroundColor: theme.palette.background.default
- }
-});
+import { Pro } from '-/pro';
+import { TS } from '-/tagspaces.namespace';
+import { renderHistory } from '-/components/RenderHistory';
+import Typography from '@mui/material/Typography';
interface Props {
+ theme: any;
classes: any;
+ toggleCreateFileDialog: () => void;
+ toggleLocationDialog: () => void;
+ toggleOpenLinkDialog: () => void;
toggleKeysDialog: () => void;
openURLExternally: (url: string, skipConfirmation?: boolean) => void;
toggleAboutDialog: () => void;
isDesktopMode: boolean;
+ openFsEntry: (fsEntry: TS.FileSystemEntry) => void;
+ openLink: (url: string, options: any) => void;
+ openLocationById: (locationId: string) => void;
+ currentLocationId: string;
}
+const styles: any = (theme: any) => ({
+ listItem: {
+ color: theme.palette.text.primary,
+ textTransform: 'uppercase'
+ },
+ recentTitle: {
+ color: theme.palette.text.primary,
+ textTransform: 'uppercase',
+ textAlign: 'center'
+ }
+});
+
function WelcomePanel(props: Props) {
- const { classes, openURLExternally, toggleKeysDialog, isDesktopMode } = props;
+ const {
+ theme,
+ classes,
+ currentLocationId,
+ openLink,
+ openLocationById,
+ openFsEntry,
+ openURLExternally,
+ toggleKeysDialog,
+ toggleCreateFileDialog,
+ toggleLocationDialog,
+ toggleOpenLinkDialog,
+ isDesktopMode
+ } = props;
+ const [ignored, forceUpdate] = useReducer(x => x + 1, 0);
+
+ const historyKeys = Pro && Pro.history ? Pro.history.historyKeys : {};
+ const fileOpenHistoryItems: Array<TS.HistoryItem> = Pro
+ ? Pro.history.getHistory(historyKeys.fileOpenKey)
+ : [];
+ const fileEditHistoryItems: Array<TS.HistoryItem> = Pro
+ ? Pro.history.getHistory(historyKeys.fileEditKey)
+ : [];
+ const folderOpenHistoryItems: Array<TS.HistoryItem> = Pro
+ ? Pro.history.getHistory(historyKeys.folderOpenKey)
+ : [];
+
+ const showDelete = false;
+ const maxRecentItems = 5;
+
+ function triggerOpenLocation() {
+ const button = document.getElementById(
+ isDesktopMode ? 'locationMenuButton' : 'mobileMenuButton'
+ );
+ button.click();
+ }
+
return (
- <div className={classes.mainPanel}>
- <List
- dense={false}
- component="nav"
- aria-label="main help area"
- className={classes.links}
+ <div
+ style={{
+ overflow: 'hidden',
+ position: 'relative',
+ height: '100%'
+ }}
+ >
+ <div
+ style={{
+ backgroundColor: theme.palette.background.default,
+ backgroundImage: 'url(' + WelcomeBackground + ')',
+ backgroundRepeat: 'repeat',
+ opacity: '0.4',
+ position: 'absolute',
+ left: 0,
+ top: 0,
+ width: '100%',
+ height: '100%'
+ }}
+ />
+ <Grid
+ style={{
+ position: 'relative',
+ height: '100%'
+ }}
+ container
+ spacing={3}
>
- <div
- role="button"
- aria-hidden="true"
- tabIndex={0}
- onClick={props.toggleAboutDialog}
- >
- <img src={WelcomeLogo} alt="Organize your files" />
- </div>
- {/* <ListItem
- button
- onClick={() => {
- const button = document.getElementById(
- isDesktopMode ? 'locationMenuButton' : 'mobileMenuButton'
- );
- button.click();
- }}
- >
- <Button startIcon={<LocationIcon />}>
- {i18n.t('core:chooseLocation')}
- </Button>
- </ListItem> */}
- <ListItem
- button
- onClick={() =>
- openURLExternally(Links.documentationLinks.general, true)
- }
- >
- <Button startIcon={<DocumentationIcon />}>
- {i18n.t('documentation')}
- </Button>
- </ListItem>
- <ListItem button onClick={() => toggleKeysDialog()}>
- <Button startIcon={<KeyShortcutsIcon />}>
- {i18n.t('core:shortcutKeys')}
- </Button>
- </ListItem>
- <ListItem
- button
- onClick={() => openURLExternally(Links.links.changelogURL, true)}
- >
- <Button
- startIcon={<ChangeLogIcon />}
- title="Opens the changelog of the app"
+ <Grid item xs={isDesktopMode ? 4 : 12} style={{ height: '100%' }}>
+ <List
+ dense={false}
+ component="nav"
+ aria-label="main help area"
+ style={{
+ width: 300,
+ height: 'calc(100% - 70px)',
+ margin: 'auto',
+ marginTop: 15,
+ marginBottom: 15,
+ // @ts-ignore
+ overflowY: 'overlay',
+ backgroundColor: theme.palette.background.default
+ }}
>
- {i18n.t('core:whatsNew')}
- </Button>
- </ListItem>
- <ListItem
- button
- onClick={() => openURLExternally(Links.links.webClipper, true)}
- >
- <Button startIcon={<WebClipperIcon />}>
- {i18n.t('core:webClipper')}
- </Button>
- </ListItem>
- <Divider />
- <ListItem
- button
- onClick={() => openURLExternally(Links.links.suggestFeature, true)}
- >
- <Button startIcon={<NewFeatureIcon />}>
- {i18n.t('core:suggestNewFeatures')}
- </Button>
- </ListItem>
- <ListItem
- button
- onClick={() => openURLExternally(Links.links.reportIssue, true)}
- >
- <Button startIcon={<IssueIcon />}>
- {i18n.t('core:reportIssues')}
- </Button>
- </ListItem>
- <ListItem
- button
- onClick={() => openURLExternally(Links.links.helpTranslating)}
- >
- <Button startIcon={<TranslationIcon />}>
- {i18n.t('core:helpWithTranslation')}
- </Button>
- </ListItem>
- <Divider />
- <ListItem
- button
- onClick={() => openURLExternally(Links.links.emailContact, true)}
- >
- <Button startIcon={<EmailIcon />}>
- {i18n.t('core:emailContact')}
- </Button>
- </ListItem>
- <ListItem button onClick={() => openURLExternally(Links.links.twitter)}>
- <Button startIcon={<TwitterIcon />}>
- {i18n.t('core:followOnTwitter')}
- </Button>
- </ListItem>
- {/* <ListItem
- button
- onClick={() => openURLExternally(Links.links.facebook)}
- >
- <Button startIcon={<SocialIcon />}>
- {i18n.t('core:likeUsOnFacebook')}
- </Button>
- </ListItem> */}
- </List>
+ <div
+ role="button"
+ aria-hidden="true"
+ tabIndex={0}
+ onClick={props.toggleAboutDialog}
+ >
+ <img src={WelcomeLogo} alt="Organize your files" />
+ </div>
+ <ListItem button onClick={triggerOpenLocation}>
+ <ListItemIcon>
+ <LocalLocationIcon />
+ </ListItemIcon>
+ <ListItemText
+ primary={i18n.t('chooseLocation')}
+ className={classes.listItem}
+ />
+ </ListItem>
+ <ListItem button onClick={toggleCreateFileDialog}>
+ <ListItemIcon>
+ <CreateFileIcon />
+ </ListItemIcon>
+ <ListItemText
+ primary={i18n.t('createFileTitle')}
+ className={classes.listItem}
+ />
+ </ListItem>
+ <ListItem button onClick={toggleLocationDialog}>
+ <ListItemIcon>
+ <LocalLocationIcon />
+ </ListItemIcon>
+ <ListItemText
+ primary={i18n.t('createLocationTitle')}
+ className={classes.listItem}
+ />
+ </ListItem>
+ <ListItem button onClick={toggleOpenLinkDialog}>
+ <ListItemIcon>
+ <OpenLinkIcon />
+ </ListItemIcon>
+ <ListItemText
+ primary={i18n.t('openLink')}
+ className={classes.listItem}
+ />
+ </ListItem>
+ <Divider />
+ <ListItem
+ button
+ onClick={() =>
+ openURLExternally(Links.documentationLinks.general, true)
+ }
+ >
+ <ListItemIcon>
+ <HelpIcon />
+ </ListItemIcon>
+ <ListItemText
+ primary={i18n.t('documentation')}
+ className={classes.listItem}
+ />
+ </ListItem>
+ <ListItem button onClick={toggleKeysDialog}>
+ <ListItemIcon>
+ <KeyShortcutsIcon />
+ </ListItemIcon>
+ <ListItemText
+ primary={i18n.t('shortcutKeys')}
+ className={classes.listItem}
+ />
+ </ListItem>
+ <ListItem
+ button
+ onClick={() => openURLExternally(Links.links.changelogURL, true)}
+ >
+ <ListItemIcon>
+ <ChangeLogIcon />
+ </ListItemIcon>
+ <ListItemText
+ primary={i18n.t('core:whatsNew')}
+ className={classes.listItem}
+ />
+ </ListItem>
+ <ListItem
+ button
+ onClick={() => openURLExternally(Links.links.webClipper, true)}
+ >
+ <ListItemIcon>
+ <WebClipperIcon />
+ </ListItemIcon>
+ <ListItemText
+ primary={i18n.t('core:webClipper')}
+ className={classes.listItem}
+ />
+ </ListItem>
+ <Divider />
+ <ListItem
+ button
+ onClick={() =>
+ openURLExternally(Links.links.suggestFeature, true)
+ }
+ >
+ <ListItemIcon>
+ <NewFeatureIcon />
+ </ListItemIcon>
+ <ListItemText
+ primary={i18n.t('core:suggestNewFeatures')}
+ className={classes.listItem}
+ />
+ </ListItem>
+ <ListItem
+ button
+ onClick={() => openURLExternally(Links.links.reportIssue, true)}
+ >
+ <ListItemIcon>
+ <IssueIcon />
+ </ListItemIcon>
+ <ListItemText
+ primary={i18n.t('core:reportIssues')}
+ className={classes.listItem}
+ />
+ </ListItem>
+ <ListItem
+ button
+ onClick={() =>
+ openURLExternally(Links.links.helpTranslating, true)
+ }
+ >
+ <ListItemIcon>
+ <TranslationIcon />
+ </ListItemIcon>
+ <ListItemText
+ primary={i18n.t('core:helpWithTranslation')}
+ className={classes.listItem}
+ />
+ </ListItem>
+ <Divider />
+ <ListItem
+ button
+ onClick={() => openURLExternally(Links.links.emailContact, true)}
+ >
+ <ListItemIcon>
+ <EmailIcon />
+ </ListItemIcon>
+ <ListItemText
+ primary={i18n.t('core:emailContact')}
+ className={classes.listItem}
+ />
+ </ListItem>
+ <ListItem
+ button
+ onClick={() => openURLExternally(Links.links.twitter, true)}
+ >
+ <ListItemIcon>
+ <TwitterIcon />
+ </ListItemIcon>
+ <ListItemText
+ primary={i18n.t('core:followOnTwitter')}
+ className={classes.listItem}
+ />
+ </ListItem>
+ </List>
+ </Grid>
+ {isDesktopMode && (
+ <>
+ <Grid item xs={4} style={{ height: '100%' }}>
+ <div
+ style={{
+ width: 300,
+ margin: 'auto',
+ marginTop: 15,
+ marginBottom: 15,
+ // @ts-ignore
+ overflowY: 'overlay',
+ height: 'calc(100% - 50px)',
+ backgroundColor: theme.palette.background.default
+ }}
+ >
+ <div>
+ <Typography
+ variant="inherit"
+ style={{
+ paddingTop: 20
+ }}
+ className={classes.recentTitle}
+ noWrap
+ >
+ {i18n.t('How to start')}
+ </Typography>
+ <div style={{ height: 400 }}></div>
+ </div>
+ </div>
+ </Grid>
+ <Grid item xs={4} style={{ height: '100%' }}>
+ <div
+ style={{
+ width: 300,
+ margin: 'auto',
+ marginTop: 15,
+ marginBottom: 15,
+ // @ts-ignore
+ overflowY: 'overlay',
+ height: 'calc(100% - 50px)',
+ backgroundColor: theme.palette.background.default
+ }}
+ >
+ <div>
+ {fileOpenHistoryItems && (
+ <>
+ <Typography
+ variant="inherit"
+ style={{
+ paddingTop: 20
+ }}
+ className={classes.recentTitle}
+ noWrap
+ >
+ {i18n.t('core:fileOpenHistory')}
+ </Typography>
+ <List>
+ {renderHistory(
+ historyKeys.fileOpenKey,
+ fileOpenHistoryItems,
+ forceUpdate,
+ currentLocationId,
+ openLink,
+ openLocationById,
+ openFsEntry,
+ maxRecentItems,
+ showDelete
+ )}
+ </List>
+ </>
+ )}
+ {fileEditHistoryItems && (
+ <>
+ <Typography
+ variant="inherit"
+ className={classes.recentTitle}
+ noWrap
+ >
+ {i18n.t('core:fileEditHistory')}
+ </Typography>
+ <List>
+ {renderHistory(
+ historyKeys.fileEditKey,
+ fileEditHistoryItems,
+ forceUpdate,
+ props.currentLocationId,
+ props.openLink,
+ props.openLocationById,
+ props.openFsEntry,
+ maxRecentItems,
+ showDelete
+ )}
+ </List>
+ </>
+ )}
+ {folderOpenHistoryItems && (
+ <>
+ <Typography
+ variant="inherit"
+ className={classes.recentTitle}
+ noWrap
+ >
+ {i18n.t('core:folderOpenHistory')}
+ </Typography>
+ <List>
+ {renderHistory(
+ historyKeys.folderOpenKey,
+ folderOpenHistoryItems,
+ forceUpdate,
+ props.currentLocationId,
+ props.openLink,
+ props.openLocationById,
+ props.openFsEntry,
+ maxRecentItems,
+ showDelete
+ )}
+ </List>
+ </>
+ )}
+ </div>
+ </div>
+ </Grid>
+ </>
+ )}
+ </Grid>
</div>
);
}
@@ -202,7 +459,8 @@ function WelcomePanel(props: Props) {
function mapStateToProps(state) {
return {
isFirstRun: isFirstRun(state),
- isDesktopMode: getDesktopMode(state)
+ isDesktopMode: getDesktopMode(state),
+ currentLocationId: getCurrentLocationId(state)
};
}
@@ -210,9 +468,15 @@ function mapActionCreatorsToProps(dispatch) {
return bindActionCreators(
{
setFirstRun: SettingsActions.setFirstRun,
+ toggleCreateFileDialog: AppActions.toggleCreateFileDialog,
+ toggleLocationDialog: AppActions.toggleLocationDialog,
+ toggleOpenLinkDialog: AppActions.toggleOpenLinkDialog,
openURLExternally: AppActions.openURLExternally,
toggleKeysDialog: AppActions.toggleKeysDialog,
- toggleAboutDialog: AppActions.toggleAboutDialog
+ toggleAboutDialog: AppActions.toggleAboutDialog,
+ openFsEntry: AppActions.openFsEntry,
+ openLink: AppActions.openLink,
+ openLocationById: AppActions.openLocationById
},
dispatch
);
@@ -221,4 +485,4 @@ function mapActionCreatorsToProps(dispatch) {
export default connect(
mapStateToProps,
mapActionCreatorsToProps
-)(withStyles(styles)(WelcomePanel));
+)(withStyles(styles, { withTheme: true })(WelcomePanel));
diff --git a/app/components/dialogs/CreateDialog.tsx b/app/components/dialogs/CreateDialog.tsx
index c7e52a2b6..869d1993c 100644
--- a/app/components/dialogs/CreateDialog.tsx
+++ b/app/components/dialogs/CreateDialog.tsx
@@ -43,6 +43,7 @@ import {
getSelectedEntries
} from '-/reducers/app';
import IOActions from '-/reducers/io-actions';
+import { getLocations, getFirstRWLocation } from '-/reducers/locations';
import { TS } from '-/tagspaces.namespace';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import Spacer from '-/components/Spacer';
@@ -65,11 +66,14 @@ const styles: any = () => ({
interface Props {
open: boolean;
classes: any;
+ locations: Array<TS.Location>;
+ firstRWLocation: TS.Location;
selectedEntries: Array<TS.FileSystemEntry>;
currentDirectoryPath: string | null;
+ openLocation: (location: TS.Location) => void;
// selectedDirectoryPath: string;
// chooseDirectoryPath: (path: string) => void;
- showNotification: (message: string, type: string, autohide: boolean) => void;
+ showNotification: (message: string, type: string) => void;
reflectCreateEntries: (fsEntries: Array<TS.FileSystemEntry>) => void;
createFileAdvanced: (
targetPath: string,
@@ -89,7 +93,18 @@ interface Props {
}
function CreateDialog(props: Props) {
- const { classes, open, onClose } = props;
+ const {
+ classes,
+ open,
+ onClose,
+ createFileAdvanced,
+ openLocation,
+ currentDirectoryPath,
+ selectedEntries,
+ // locations,
+ showNotification,
+ firstRWLocation
+ } = props;
const fileName = useRef<string>(
'note' +
AppConfig.beginTagContainer +
@@ -101,14 +116,17 @@ function CreateDialog(props: Props) {
let fileInput: HTMLInputElement;
const fileContent = '';
- const selectedDirectoryPath =
- props.selectedEntries && props.selectedEntries.length === 1
- ? props.selectedEntries[0].path
- : props.currentDirectoryPath;
- if (!selectedDirectoryPath) {
- return null;
+ let selectedDirectoryPath =
+ selectedEntries && selectedEntries.length === 1
+ ? selectedEntries[0].path
+ : currentDirectoryPath;
+
+ if (!selectedDirectoryPath && firstRWLocation) {
+ selectedDirectoryPath = firstRWLocation.path;
}
+ const noSuitableLocation = !selectedDirectoryPath;
+
// function handleKeyPress(event: any) {
// if (event.key === 'n') {
// event.stopPropagation();
@@ -125,43 +143,53 @@ function CreateDialog(props: Props) {
// }
// }
+ function loadLocation() {
+ if (!currentDirectoryPath && firstRWLocation) {
+ openLocation(firstRWLocation);
+ }
+ }
+
function createRichTextFile() {
if (selectedDirectoryPath && !fileNameValidation(fileName.current)) {
- props.createFileAdvanced(
+ loadLocation();
+ createFileAdvanced(
selectedDirectoryPath,
fileName.current,
fileContent,
'html'
);
- props.onClose();
+ onClose();
}
}
function createTextFile() {
if (selectedDirectoryPath && !fileNameValidation(fileName.current)) {
- props.createFileAdvanced(
+ loadLocation();
+ createFileAdvanced(
selectedDirectoryPath,
fileName.current,
fileContent,
'txt'
);
- props.onClose();
+ onClose();
}
}
function createMarkdownFile() {
if (selectedDirectoryPath && !fileNameValidation(fileName.current)) {
- props.createFileAdvanced(
+ loadLocation();
+ createFileAdvanced(
selectedDirectoryPath,
fileName.current,
fileContent,
'md'
);
- props.onClose();
+ onClose();
}
}
function addFile() {
+ loadLocation();
fileInput.click();
}
@@ -183,7 +211,7 @@ function CreateDialog(props: Props) {
.catch(error => {
console.log('uploadFiles', error);
});
- props.onClose();
+ onClose();
}
const onInputFocus = event => {
@@ -230,20 +258,17 @@ function CreateDialog(props: Props) {
fullScreen={fullScreen}
keepMounted
scroll="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
- /* if (event.key === 'Escape') {
- onClose();
- } */
- }}
+ // 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')}
@@ -255,12 +280,20 @@ function CreateDialog(props: Props) {
display: 'flex',
minWidth: 200,
minHeight: 300,
+ marginBottom: 20,
overflow: 'overlay',
alignSelf: 'center'
}}
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!
+ </Typography>
+ </Grid>
+ )}
<Grid item xs={12}>
<FormControl fullWidth={true} error={inputError}>
<TextField
@@ -272,8 +305,12 @@ function CreateDialog(props: Props) {
onChange={handleInputChange}
onFocus={onInputFocus}
defaultValue={fileName.current}
+ disabled={noSuitableLocation}
fullWidth={true}
data-tid="newEntryDialogInputTID"
+ helperText={
+ 'File will be created in : ' + selectedDirectoryPath
+ }
/>
{inputError && (
<FormHelperText>{i18n.t('core:fileNameHelp')}</FormHelperText>
@@ -287,6 +324,7 @@ function CreateDialog(props: Props) {
className={classes.createButton}
// title={i18n.t('createMarkdownTitle')}
data-tid="createMarkdownButton"
+ disabled={noSuitableLocation}
>
<Avatar>
<MarkdownFileIcon />
@@ -309,6 +347,7 @@ function CreateDialog(props: Props) {
className={classes.createButton}
// title={i18n.t('createNoteTitle')}
data-tid="createRichTextFileButton"
+ disabled={noSuitableLocation}
>
<Avatar>
<HTMLFileIcon />
@@ -331,6 +370,7 @@ function CreateDialog(props: Props) {
className={classes.createButton}
// title={i18n.t('createTextFileTitle')}
data-tid="createTextFileButton"
+ disabled={noSuitableLocation}
>
<Avatar>
<TextFileIcon />
@@ -353,6 +393,7 @@ function CreateDialog(props: Props) {
className={classes.createButton}
// title={i18n.t('addFilesTitle')}
data-tid="addFilesButton"
+ disabled={noSuitableLocation}
>
<Avatar>
<AddFileIcon />
@@ -386,6 +427,8 @@ function CreateDialog(props: Props) {
function mapStateToProps(state) {
return {
+ locations: getLocations(state),
+ firstRWLocation: getFirstRWLocation(state),
keyBindings: getKeyBindingObject(state),
selectedEntries: getSelectedEntries(state),
currentDirectoryPath: getDirectoryPath(state)
@@ -395,6 +438,7 @@ function mapStateToProps(state) {
function mapActionCreatorsToProps(dispatch) {
return bindActionCreators(
{
+ openLocation: AppActions.openLocation,
createFileAdvanced: AppActions.createFileAdvanced,
showNotification: AppActions.showNotification,
reflectCreateEntries: AppActions.reflectCreateEntries,
diff --git a/app/components/dialogs/KeyboardDialog.tsx b/app/components/dialogs/KeyboardDialog.tsx
index f83d2339b..01b54c2dc 100644
--- a/app/components/dialogs/KeyboardDialog.tsx
+++ b/app/components/dialogs/KeyboardDialog.tsx
@@ -36,11 +36,8 @@ import useTheme from '@mui/styles/useTheme';
import useMediaQuery from '@mui/material/useMediaQuery';
const styles = theme => ({
- root: {
- minWidth: 350
- },
shortcutKey: {
- backgroundColor: '#D6D6D6',
+ backgroundColor: theme.palette.primary.main,
font: 'Console',
fontFamily: 'monospace',
padding: '5px',
@@ -56,7 +53,7 @@ interface Props {
}
function KeyboardDialog(props: Props) {
- const { open, onClose } = props;
+ const { open, onClose, keyBindings, classes } = props;
const theme = useTheme();
const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
@@ -72,17 +69,19 @@ function KeyboardDialog(props: Props) {
<DialogCloseButton onClose={onClose} />
</DialogTitle>
<DialogContent
- className={props.classes.root}
data-tid="keyboardShortCutsDialog"
- style={{ overflow: AppConfig.isFirefox ? 'auto' : 'overlay' }}
+ style={{
+ minWidth: 350,
+ overflow: AppConfig.isFirefox ? 'auto' : 'overlay'
+ }}
>
<List dense={false}>
- {props.keyBindings &&
- Object.keys(props.keyBindings).map(shortcutKey => (
+ {keyBindings &&
+ Object.keys(keyBindings).map(shortcutKey => (
<ListItem key={shortcutKey}>
<ListItemText primary={i18n.t('core:' + shortcutKey)} />
- <ListItemSecondaryAction className={props.classes.shortcutKey}>
- {props.keyBindings[shortcutKey].toUpperCase()}
+ <ListItemSecondaryAction className={classes.shortcutKey}>
+ {keyBindings[shortcutKey].toUpperCase()}
</ListItemSecondaryAction>
</ListItem>
))}
@@ -91,7 +90,7 @@ function KeyboardDialog(props: Props) {
<DialogActions>
<Button
data-tid="closeKeyboardDialog"
- onClick={props.onClose}
+ onClick={onClose}
color="primary"
>
{i18n.t('core:ok')}
diff --git a/app/components/menus/LocationManagerMenu.tsx b/app/components/menus/LocationManagerMenu.tsx
index 88682714a..c0b2d6f2d 100644
--- a/app/components/menus/LocationManagerMenu.tsx
+++ b/app/components/menus/LocationManagerMenu.tsx
@@ -23,8 +23,6 @@ import Menu from '@mui/material/Menu';
import MenuItem from '@mui/material/MenuItem';
import CreateLocationIcon from '@mui/icons-material/CreateNewFolder';
import ExportImportIcon from '@mui/icons-material/SwapHoriz';
-import OpenLinkIcon from '@mui/icons-material/Link';
-import HelpIcon from '@mui/icons-material/Help';
import CloseIcon from '@mui/icons-material/Close';
import UpdateIndexIcon from '@mui/icons-material/Update';
import classNames from 'classnames';
@@ -40,6 +38,7 @@ import { actions as AppActions } from '-/reducers/app';
import Links from '-/links';
import { ProLabel } from '-/components/HelperComponents';
import { actions as LocationIndexActions } from '-/reducers/location-index';
+import { OpenLinkIcon, HelpIcon } from '-/components/CommonIcons';
interface Props {
classes: any;
diff --git a/app/locales/en/core.json b/app/locales/en/core.json
index c9f757e6c..6955bd0c3 100644
--- a/app/locales/en/core.json
+++ b/app/locales/en/core.json
@@ -707,6 +707,7 @@
"moveToTop": "Move to top",
"moveToBottom": "Move to bottom",
"openInMainArea": "Open in main area",
+ "importing": "Importing",
"changeDate": "Change Date",
"changeTime": "Change Time",
"toDate": "To Date",
diff --git a/app/reducers/locations.ts b/app/reducers/locations.ts
index 078225cc2..1d8db4871 100644
--- a/app/reducers/locations.ts
+++ b/app/reducers/locations.ts
@@ -285,12 +285,17 @@ export const getLocationByPath = (
): TS.Location | null =>
state.locations.find(location => location.path === path);
export const getDefaultLocationId = (state: any): string | undefined => {
- let defaultLocationID;
- state.locations.map(location => {
- if (location.isDefault) {
- defaultLocationID = location.uuid;
- }
- return true;
- });
- return defaultLocationID;
+ let foundLocation = state.locations.find(
+ location => location.isDefault && !location.isReadOnly
+ );
+ return foundLocation ? foundLocation.uuid : undefined;
+};
+export const getFirstRWLocation = (state: any): string | undefined => {
+ let foundLocation = state.locations.find(
+ location => location.isDefault && !location.isReadOnly
+ );
+ if (!foundLocation) {
+ foundLocation = state.locations.find(location => !location.isReadOnly);
+ }
+ return foundLocation;
};
diff --git a/package-lock.json b/package-lock.json
index 9753d82b9..ad0b4ede6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -16,6 +16,7 @@
"@emotion/styled": "11.10.0",
"@gorillastack/jmespath": "^1.3.0",
"@mui/icons-material": "^5.8.4",
+ "@mui/lab": "^5.0.0-alpha.109",
"@mui/material": "^5.9.2",
"@mui/styles": "^5.9.2",
"@mui/x-date-pickers": "^5.0.8",
@@ -8402,11 +8403,11 @@
}
},
"node_modules/@babel/runtime": {
- "version": "7.19.4",
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.4.tgz",
- "integrity": "sha512-EXpLCrk55f+cYqmHsSR+yD/0gAIMxxA9QK9lnQWzhMCvt+YmoBN7Zx94s++Kv0+unHk39vxNO8t+CMA2WSS3wA==",
+ "version": "7.20.1",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.1.tgz",
+ "integrity": "sha512-mrzLkl6U9YLF8qpqI7TB82PESyEGjm/0Ly91jG575eVxMMlb8fYfOXFZIJ8XfLrJZQbm7dlKry2bJmXBUEkdFg==",
"dependencies": {
- "regenerator-runtime": "^0.13.4"
+ "regenerator-runtime": "^0.13.10"
},
"engines": {
"node": ">=6.9.0"
@@ -11530,6 +11531,79 @@
}
}
},
+ "node_modules/@mui/lab": {
+ "version": "5.0.0-alpha.109",
+ "resolved": "https://registry.npmjs.org/@mui/lab/-/lab-5.0.0-alpha.109.tgz",
+ "integrity": "sha512-9ZyzM4AHA1qWh48ZcvqxqwWRH1CzBhQuP9VYP2eEprEjEeraiuvvsZILCNhCemc9WWN04GJh8UiD1FeCaU4kWg==",
+ "dependencies": {
+ "@babel/runtime": "^7.20.1",
+ "@mui/base": "5.0.0-alpha.107",
+ "@mui/system": "^5.10.15",
+ "@mui/types": "^7.2.1",
+ "@mui/utils": "^5.10.15",
+ "clsx": "^1.2.1",
+ "prop-types": "^15.8.1",
+ "react-is": "^18.2.0"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/mui"
+ },
+ "peerDependencies": {
+ "@emotion/react": "^11.5.0",
+ "@emotion/styled": "^11.3.0",
+ "@mui/material": "^5.0.0",
+ "@types/react": "^17.0.0 || ^18.0.0",
+ "react": "^17.0.0 || ^18.0.0",
+ "react-dom": "^17.0.0 || ^18.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@emotion/react": {
+ "optional": true
+ },
+ "@emotion/styled": {
+ "optional": true
+ },
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@mui/lab/node_modules/@mui/base": {
+ "version": "5.0.0-alpha.107",
+ "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.107.tgz",
+ "integrity": "sha512-HX/BD8CSe+Y/dpbZ5aKJScJhKQ/Hw6du2yd68Upv2cO67bwixyZ64h3aNcdDu7RQzI7nrZQm0JykffP1Orgq0g==",
+ "dependencies": {
+ "@babel/runtime": "^7.20.1",
+ "@emotion/is-prop-valid": "^1.2.0",
+ "@mui/types": "^7.2.1",
+ "@mui/utils": "^5.10.15",
+ "@popperjs/core": "^2.11.6",
+ "clsx": "^1.2.1",
+ "prop-types": "^15.8.1",
+ "react-is": "^18.2.0"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/mui"
+ },
+ "peerDependencies": {
+ "@types/react": "^17.0.0 || ^18.0.0",
+ "react": "^17.0.0 || ^18.0.0",
+ "react-dom": "^17.0.0 || ^18.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@mui/material": {
"version": "5.10.10",
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.10.10.tgz",
@@ -11575,12 +11649,12 @@
}
},
"node_modules/@mui/private-theming": {
- "version": "5.10.9",
- "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.10.9.tgz",
- "integrity": "sha512-BN7/CnsVPVyBaQpDTij4uV2xGYHHHhOgpdxeYLlIu+TqnsVM7wUeF+37kXvHovxM6xmL5qoaVUD98gDC0IZnHg==",
+ "version": "5.10.15",
+ "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.10.15.tgz",
+ "integrity": "sha512-l7CsUj5kYdYz118/JHSvZZTYE9WnIWwln0td5jYATnYw9cNX4ygD6AkKOUYZ1Jitp1YLJqcO8jCP9E5/Nql9IQ==",
"dependencies": {
- "@babel/runtime": "^7.19.0",
- "@mui/utils": "^5.10.9",
+ "@babel/runtime": "^7.20.1",
+ "@mui/utils": "^5.10.15",
"prop-types": "^15.8.1"
},
"engines": {
@@ -11601,12 +11675,12 @@
}
},
"node_modules/@mui/styled-engine": {
- "version": "5.10.8",
- "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.10.8.tgz",
- "integrity": "sha512-w+y8WI18EJV6zM/q41ug19cE70JTeO6sWFsQ7tgePQFpy6ToCVPh0YLrtqxUZXSoMStW5FMw0t9fHTFAqPbngw==",
+ "version": "5.10.14",
+ "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.10.14.tgz",
+ "integrity": "sha512-bgKdM57ExogWpIfhL/ngSlzF4FhbH00vYF+Y5VALTob4uslFqje0xzoWmbfcCn4cZt2NXxZJIwhsq4vzo5itlw==",
"dependencies": {
- "@babel/runtime": "^7.19.0",
- "@emotion/cache": "^11.10.3",
+ "@babel/runtime": "^7.20.1",
+ "@emotion/cache": "^11.10.5",
"csstype": "^3.1.1",
"prop-types": "^15.8.1"
},
@@ -11672,15 +11746,15 @@
}
},
"node_modules/@mui/system": {
- "version": "5.10.10",
- "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.10.10.tgz",
- "integrity": "sha512-TXwtKN0adKpBrZmO+eilQWoPf2veh050HLYrN78Kps9OhlvO70v/2Kya0+mORFhu9yhpAwjHXO8JII/R4a5ZLA==",
- "dependencies": {
- "@babel/runtime": "^7.19.0",
- "@mui/private-theming": "^5.10.9",
- "@mui/styled-engine": "^5.10.8",
- "@mui/types": "^7.2.0",
- "@mui/utils": "^5.10.9",
+ "version": "5.10.15",
+ "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.10.15.tgz",
+ "integrity": "sha512-WZmgmpYTMXAaD++QetaaM/miwhNh1JJY1dH7MJH/3Fuv3r3gnhfzE6A55lDqWxkQmlWUO2DCn/cnNZ0FkSdZUg==",
+ "dependencies": {
+ "@babel/runtime": "^7.20.1",
+ "@mui/private-theming": "^5.10.15",
+ "@mui/styled-engine": "^5.10.14",
+ "@mui/types": "^7.2.1",
+ "@mui/utils": "^5.10.15",
"clsx": "^1.2.1",
"csstype": "^3.1.1",
"prop-types": "^15.8.1"
@@ -11711,9 +11785,9 @@
}
},
"node_modules/@mui/types": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.0.tgz",
- "integrity": "sha512-lGXtFKe5lp3UxTBGqKI1l7G8sE2xBik8qCfrLHD5olwP/YU0/ReWoWT7Lp1//ri32dK39oPMrJN8TgbkCSbsNA==",
+ "version": "7.2.1",
+ "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.1.tgz",
+ "integrity": "sha512-c5mSM7ivD8EsqK6HUi9hQPr5V7TJ/IRThUQ9nWNYPdhCGriTSQV4vL6DflT99LkM+wLiIS1rVjphpEWxERep7A==",
"peerDependencies": {
"@types/react": "*"
},
@@ -11724,11 +11798,11 @@
}
},
"node_modules/@mui/utils": {
- "version": "5.10.9",
- "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.10.9.tgz",
- "integrity": "sha512-2tdHWrq3+WCy+G6TIIaFx3cg7PorXZ71P375ExuX61od1NOAJP1mK90VxQ8N4aqnj2vmO3AQDkV4oV2Ktvt4bA==",
+ "version": "5.10.15",
+ "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.10.15.tgz",
+ "integrity": "sha512-6AW4MLBUijJi31hxx+6utTJM2q/4hbO+QiMdtwM+f4Iy+BfFnh/elhb08apxNYLfuugPnXXpkDmzEjg+8uDU9g==",
"dependencies": {
- "@babel/runtime": "^7.19.0",
+ "@babel/runtime": "^7.20.1",
"@types/prop-types": "^15.7.5",
"@types/react-is": "^16.7.1 || ^17.0.0",
"prop-types": "^15.8.1",
@@ -55410,11 +55484,11 @@
}
},
"@babel/runtime": {
- "version": "7.19.4",
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.4.tgz",
- "integrity": "sha512-EXpLCrk55f+cYqmHsSR+yD/0gAIMxxA9QK9lnQWzhMCvt+YmoBN7Zx94s++Kv0+unHk39vxNO8t+CMA2WSS3wA==",
+ "version": "7.20.1",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.1.tgz",
+ "integrity": "sha512-mrzLkl6U9YLF8qpqI7TB82PESyEGjm/0Ly91jG575eVxMMlb8fYfOXFZIJ8XfLrJZQbm7dlKry2bJmXBUEkdFg==",
"requires": {
- "regenerator-runtime": "^0.13.4"
+ "regenerator-runtime": "^0.13.10"
}
},
"@babel/runtime-corejs3": {
@@ -57851,6 +57925,38 @@
"@babel/runtime": "^7.19.0"
}
},
+ "@mui/lab": {
+ "version": "5.0.0-alpha.109",
+ "resolved": "https://registry.npmjs.org/@mui/lab/-/lab-5.0.0-alpha.109.tgz",
+ "integrity": "sha512-9ZyzM4AHA1qWh48ZcvqxqwWRH1CzBhQuP9VYP2eEprEjEeraiuvvsZILCNhCemc9WWN04GJh8UiD1FeCaU4kWg==",
+ "requires": {
+ "@babel/runtime": "^7.20.1",
+ "@mui/base": "5.0.0-alpha.107",
+ "@mui/system": "^5.10.15",
+ "@mui/types": "^7.2.1",
+ "@mui/utils": "^5.10.15",
+ "clsx": "^1.2.1",
+ "prop-types": "^15.8.1",
+ "react-is": "^18.2.0"
+ },
+ "dependencies": {
+ "@mui/base": {
+ "version": "5.0.0-alpha.107",
+ "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.107.tgz",
+ "integrity": "sha512-HX/BD8CSe+Y/dpbZ5aKJScJhKQ/Hw6du2yd68Upv2cO67bwixyZ64h3aNcdDu7RQzI7nrZQm0JykffP1Orgq0g==",
+ "requires": {
+ "@babel/runtime": "^7.20.1",
+ "@emotion/is-prop-valid": "^1.2.0",
+ "@mui/types": "^7.2.1",
+ "@mui/utils": "^5.10.15",
+ "@popperjs/core": "^2.11.6",
+ "clsx": "^1.2.1",
+ "prop-types": "^15.8.1",
+ "react-is": "^18.2.0"
+ }
+ }
+ }
+ },
"@mui/material": {
"version": "5.10.10",
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.10.10.tgz",
@@ -57871,22 +57977,22 @@
}
},
"@mui/private-theming": {
- "version": "5.10.9",
- "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.10.9.tgz",
- "integrity": "sha512-BN7/CnsVPVyBaQpDTij4uV2xGYHHHhOgpdxeYLlIu+TqnsVM7wUeF+37kXvHovxM6xmL5qoaVUD98gDC0IZnHg==",
+ "version": "5.10.15",
+ "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.10.15.tgz",
+ "integrity": "sha512-l7CsUj5kYdYz118/JHSvZZTYE9WnIWwln0td5jYATnYw9cNX4ygD6AkKOUYZ1Jitp1YLJqcO8jCP9E5/Nql9IQ==",
"requires": {
- "@babel/runtime": "^7.19.0",
- "@mui/utils": "^5.10.9",
+ "@babel/runtime": "^7.20.1",
+ "@mui/utils": "^5.10.15",
"prop-types": "^15.8.1"
}
},
"@mui/styled-engine": {
- "version": "5.10.8",
- "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.10.8.tgz",
- "integrity": "sha512-w+y8WI18EJV6zM/q41ug19cE70JTeO6sWFsQ7tgePQFpy6ToCVPh0YLrtqxUZXSoMStW5FMw0t9fHTFAqPbngw==",
+ "version": "5.10.14",
+ "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.10.14.tgz",
+ "integrity": "sha512-bgKdM57ExogWpIfhL/ngSlzF4FhbH00vYF+Y5VALTob4uslFqje0xzoWmbfcCn4cZt2NXxZJIwhsq4vzo5itlw==",
"requires": {
- "@babel/runtime": "^7.19.0",
- "@emotion/cache": "^11.10.3",
+ "@babel/runtime": "^7.20.1",
+ "@emotion/cache": "^11.10.5",
"csstype": "^3.1.1",
"prop-types": "^15.8.1"
}
@@ -57916,32 +58022,32 @@
}
},
"@mui/system": {
- "version": "5.10.10",
- "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.10.10.tgz",
- "integrity": "sha512-TXwtKN0adKpBrZmO+eilQWoPf2veh050HLYrN78Kps9OhlvO70v/2Kya0+mORFhu9yhpAwjHXO8JII/R4a5ZLA==",
- "requires": {
- "@babel/runtime": "^7.19.0",
- "@mui/private-theming": "^5.10.9",
- "@mui/styled-engine": "^5.10.8",
- "@mui/types": "^7.2.0",
- "@mui/utils": "^5.10.9",
+ "version": "5.10.15",
+ "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.10.15.tgz",
+ "integrity": "sha512-WZmgmpYTMXAaD++QetaaM/miwhNh1JJY1dH7MJH/3Fuv3r3gnhfzE6A55lDqWxkQmlWUO2DCn/cnNZ0FkSdZUg==",
+ "requires": {
+ "@babel/runtime": "^7.20.1",
+ "@mui/private-theming": "^5.10.15",
+ "@mui/styled-engine": "^5.10.14",
+ "@mui/types": "^7.2.1",
+ "@mui/utils": "^5.10.15",
"clsx": "^1.2.1",
"csstype": "^3.1.1",
"prop-types": "^15.8.1"
}
},
"@mui/types": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.0.tgz",
- "integrity": "sha512-lGXtFKe5lp3UxTBGqKI1l7G8sE2xBik8qCfrLHD5olwP/YU0/ReWoWT7Lp1//ri32dK39oPMrJN8TgbkCSbsNA==",
+ "version": "7.2.1",
+ "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.1.tgz",
+ "integrity": "sha512-c5mSM7ivD8EsqK6HUi9hQPr5V7TJ/IRThUQ9nWNYPdhCGriTSQV4vL6DflT99LkM+wLiIS1rVjphpEWxERep7A==",
"requires": {}
},
"@mui/utils": {
- "version": "5.10.9",
- "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.10.9.tgz",
- "integrity": "sha512-2tdHWrq3+WCy+G6TIIaFx3cg7PorXZ71P375ExuX61od1NOAJP1mK90VxQ8N4aqnj2vmO3AQDkV4oV2Ktvt4bA==",
+ "version": "5.10.15",
+ "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.10.15.tgz",
+ "integrity": "sha512-6AW4MLBUijJi31hxx+6utTJM2q/4hbO+QiMdtwM+f4Iy+BfFnh/elhb08apxNYLfuugPnXXpkDmzEjg+8uDU9g==",
"requires": {
- "@babel/runtime": "^7.19.0",
+ "@babel/runtime": "^7.20.1",
"@types/prop-types": "^15.7.5",
"@types/react-is": "^16.7.1 || ^17.0.0",
"prop-types": "^15.8.1",
diff --git a/package.json b/package.json
index 88fa942ce..8e20a9e24 100644
--- a/package.json
+++ b/package.json
@@ -153,6 +153,7 @@
"@emotion/styled": "11.10.0",
"@gorillastack/jmespath": "^1.3.0",
"@mui/icons-material": "^5.8.4",
+ "@mui/lab": "^5.0.0-alpha.109",
"@mui/material": "^5.9.2",
"@mui/styles": "^5.9.2",
"@mui/x-date-pickers": "^5.0.8",