Skip to content

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

New design with react-split (#1504)

Iliancb0bb5fd95ea
diff --git a/app/app.global.css b/app/app.global.css
index 6780f508c..b5215c47d 100644
--- a/app/app.global.css
+++ b/app/app.global.css
@@ -1,6 +1,5 @@
@import 'assets/loading.css';
@import 'assets/scrollbars.css';
-@import 'assets/splitpane.css';
@import 'assets/minireset.css';
@import 'assets/fonts/roboto/index.css';
@import '~rc-table/assets/index.css';
@@ -20,4 +19,21 @@ div[tabindex='-1']:focus {
html,
body {
overscroll-behavior-x: none;
+ height: 100vh;
+ position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ overflow: hidden;
+ padding: 0;
+ margin: 0;
+}
+
+.react-split > .split-container.vertical > .splitter {
+ z-index: 1;
+}
+
+#root {
+ height: 100%;
}
diff --git a/app/assets/scrollbars.css b/app/assets/scrollbars.css
index 0db5382f7..982cbe81e 100644
--- a/app/assets/scrollbars.css
+++ b/app/assets/scrollbars.css
@@ -11,8 +11,8 @@
}
:hover::-webkit-scrollbar {
- width: 5px;
- height: 5px;
+ width: 8px;
+ height: 8px;
}
::-webkit-scrollbar-track,
@@ -21,7 +21,7 @@
}
::-webkit-scrollbar-thumb {
- border-radius: 0;
+ border-radius: 5px;
background-color: #787f8b;
border: none;
box-shadow: none !important;
diff --git a/app/assets/splitpane.css b/app/assets/splitpane.css
deleted file mode 100644
index 4adcfffcb..000000000
--- a/app/assets/splitpane.css
+++ /dev/null
@@ -1,55 +0,0 @@
-.Resizer {
- background: #000;
- opacity: 1;
- z-index: 2;
- -moz-box-sizing: border-box;
- -webkit-box-sizing: border-box;
- box-sizing: border-box;
- -moz-background-clip: padding;
- -webkit-background-clip: padding;
- background-clip: padding-box;
-}
-
-.Resizer:hover {
- -webkit-transition: border-color 2s;
- transition: border-color 2s;
-}
-
-.Resizer.horizontal {
- height: 11px;
- margin: -5px 0;
- border-top: 5px solid rgba(255, 255, 255, 0);
- border-bottom: 5px solid rgba(255, 255, 255, 0);
- cursor: row-resize;
- width: 100%;
-}
-
-.Resizer.horizontal:hover {
- border-top: 5px solid rgba(0, 0, 0, 0.5);
- border-bottom: 5px solid rgba(0, 0, 0, 0.5);
-}
-
-.Resizer.vertical {
- width: 6px;
- margin: 0 -5px 0 0px;
- border-left: 0px solid rgba(255, 255, 255, 0);
- border-right: 5px solid rgba(255, 255, 255, 0);
- cursor: col-resize;
-}
-
-.Resizer.vertical:hover {
- width: 11px;
- margin: 0 -5px 0 -5px;
- border-left: 5px solid rgba(0, 0, 0, 0.5);
- border-right: 5px solid rgba(0, 0, 0, 0.5);
-}
-.Resizer.disabled {
- cursor: not-allowed;
-}
-.Resizer.disabled:hover {
- border-color: transparent;
-}
-
-.Pane.horizontal {
- display: flex;
-}
diff --git a/app/components/CustomLogo.tsx b/app/components/CustomLogo.tsx
index 4a343c9c0..58984cb60 100644
--- a/app/components/CustomLogo.tsx
+++ b/app/components/CustomLogo.tsx
@@ -25,7 +25,9 @@ import Badge from '@material-ui/core/Badge';
import { Pro } from '../pro';
import TextLogoIcon from '../assets/images/text-logo.svg';
import WebLogoIcon from '../assets/images/text-logo-web.svg';
+import LogoIcon from '../assets/images/icon100x100.svg';
import { actions as AppActions } from '../reducers/app';
+import i18n from '../services/i18n';
import versionMeta from '../version.json';
import AppConfig from '-/config';
@@ -62,6 +64,21 @@ const CustomLogo = (props: Props) => (
badgeContent={'v' + versionMeta.version}
color="primary"
>
+ <IconButton
+ onClick={props.toggleAboutDialog}
+ style={{ padding: 0, paddingLeft: 5, height: 50 }}
+ title={i18n.t('core:aboutTitle')}
+ data-tid="aboutTagSpaces"
+ >
+ <img
+ style={{
+ width: 40
+ // color: props.theme.palette.text.primary
+ }}
+ src={LogoIcon}
+ alt="TagSpaces Logo"
+ />
+ </IconButton>
<IconButton
style={{ height: 50, padding: 0, marginBottom: 15 }}
data-tid="aboutTagSpaces"
diff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsx
index 1bb98e0dc..5e4a69995 100644
--- a/app/components/EntryContainer.tsx
+++ b/app/components/EntryContainer.tsx
@@ -16,12 +16,17 @@
*
*/
-import React, { useEffect, useRef, useState } from 'react';
+import React, {
+ MutableRefObject,
+ useEffect,
+ useReducer,
+ useRef,
+ useState
+} from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { GlobalHotKeys } from 'react-hotkeys';
import Button from '@material-ui/core/Button';
-import Fab from '@material-ui/core/Fab';
import Tooltip from '@material-ui/core/Tooltip';
import IconButton from '@material-ui/core/IconButton';
import SaveIcon from '@material-ui/icons/Save';
@@ -34,12 +39,12 @@ import ArrowRightIcon from '@material-ui/icons/KeyboardArrowRight';
import FileDownloadIcon from '@material-ui/icons/AssignmentReturned';
import DetailsIcon from '@material-ui/icons/Info';
import ExpandIcon from '@material-ui/icons/SettingsEthernet';
-import SplitPane from 'react-split-pane';
import DeleteIcon from '@material-ui/icons/Delete';
import ShareIcon from '@material-ui/icons/Share';
import { withStyles } from '@material-ui/core/styles';
import RefreshIcon from '@material-ui/icons/Refresh';
import Box from '@material-ui/core/Box';
+import { Split } from 'ts-react-splitter';
import EntryProperties from '-/components/EntryProperties';
import ConfirmDialog from '-/components/dialogs/ConfirmDialog';
import AppConfig from '-/config';
@@ -54,7 +59,7 @@ import {
extractFileName,
extractDirectoryName
} from '-/utils/paths';
-import { buffer } from '-/utils/misc';
+// import { buffer } from '-/utils/misc';
import {
actions as SettingsActions,
isDesktopMode,
@@ -70,11 +75,14 @@ import {
} from '-/reducers/app';
import useEventListener from '-/utils/useEventListener';
import { TS } from '-/tagspaces.namespace';
+import FileView from '-/components/FileView';
+import { buffer } from '-/utils/misc';
-const defaultSplitSize = 103;
-const openedSplitSize = AppConfig.isElectron ? 560 : 360;
-const fullSplitSize = 750;
+const defaultSplitSize = '7.86%'; // '7.2%'; // 103;
+// const openedSplitSize = AppConfig.isElectron ? 560 : 360;
+/* const fullSplitSize = 750;
// const maxCharactersTitleLength = 50;
+*/
const bufferedSplitResize = buffer({
timeout: 300,
id: 'buffered-split-resize'
@@ -88,23 +96,17 @@ const styles: any = (theme: any) => ({
display: 'flex',
backgroundColor: theme.palette.background.default
},
- fileContent: {
- width: '100%',
- flex: '1 1 100%',
- display: 'flex',
- backgroundColor: theme.palette.background.default
- },
entryProperties: {
display: 'inline',
flex: '1 1 100%',
backgroundColor: theme.palette.background.default,
- zIndex: 1,
- padding: '0 0 60px 0',
- height: '50%'
+ // zIndex: 1,
+ padding: '0',
+ height: '100%'
},
fileOpener: {
width: '100%',
- zIndex: 3,
+ // zIndex: 3,
border: 0
},
toolbar: {
@@ -168,7 +170,7 @@ const styles: any = (theme: any) => ({
top: 55,
right: 0,
backgroundColor: theme.palette.background.default,
- boxShadow: '-15px 0px 24px 3px ' + theme.palette.background.default
+ boxShadow: '-15px -5px 20px 3px ' + theme.palette.background.default
}
});
@@ -199,8 +201,7 @@ interface Props {
deleteFile: (path: string) => void;
toggleEntryFullWidth: () => void;
isReadOnlyMode: boolean;
- setEntryPropertiesSplitSize: (size: number) => void;
- entryPropertiesSplitSize?: number;
+ setEntryPropertiesSplitSize: (size: string) => void;
updateOpenedFile: (
entryPath: string,
fsEntryMeta: any // FileSystemEntryMeta
@@ -215,13 +216,17 @@ interface Props {
}
const EntryContainer = (props: Props) => {
+ // const [percent, setPercent] = React.useState<number | undefined>(undefined);
+ const percent = useRef<number | undefined>(undefined);
const openedFile = props.openedFiles[0];
// const [currentEntry, setCurrentEntry] = useState<OpenedEntry>(openedFile);
const [isPropertiesPanelVisible, setPropertiesPanelVisible] = useState<
boolean
>(false);
- const [isFullscreen, setFullscreen] = useState<boolean>(false);
+ // const [isFullscreen, setFullscreen] = useState<boolean>(false);
+ // eslint-disable-next-line no-unused-vars
+ const [ignored, forceUpdate] = useReducer(x => x + 1, 0);
// const [editingSupported, setEditingSupported] = useState<boolean>(true);
const [
isSaveBeforeCloseConfirmDialogOpened,
@@ -237,30 +242,14 @@ const EntryContainer = (props: Props) => {
const [isDeleteEntryModalOpened, setDeleteEntryModalOpened] = useState<
boolean
>(false);
- // const [selectedItem, setSelectedItem] = useState<any>({});
- // const [shouldCopyFile, setShouldCopyFile] = useState<boolean>(false);
- // const entryPropertiesKey: string = uuidv1();
-
- const fileViewer = useRef<HTMLIFrameElement>(null);
- const fileViewerContainer = useRef<HTMLDivElement>(null);
+ const fileViewer: MutableRefObject<HTMLIFrameElement> = useRef<
+ HTMLIFrameElement
+ >(null);
+ const fileViewerContainer: MutableRefObject<HTMLDivElement> = useRef<
+ HTMLDivElement
+ >(null);
- useEventListener('toggle-resume', () => {
- // if (AppConfig.isElectron && this.fileViewer) {
- // this.fileViewer.executeJavaScript(
- // 'window.dispatchEvent(new Event("resume"));'
- // );
- // } else
- if (
- fileViewer &&
- fileViewer.current &&
- fileViewer.current.contentWindow &&
- // @ts-ignore
- fileViewer.current.contentWindow.togglePlay
- ) {
- // @ts-ignore
- fileViewer.current.contentWindow.togglePlay();
- }
- });
+ const fileChanged = useRef<Boolean>(false);
useEventListener('message', e => {
if (typeof e.data === 'string') {
@@ -277,22 +266,31 @@ const EntryContainer = (props: Props) => {
}
});
+ useEffect(() => {
+ if (
+ fileViewer &&
+ fileViewer.current &&
+ fileViewer.current.contentWindow &&
+ // @ts-ignore
+ fileViewer.current.contentWindow.setTheme
+ ) {
+ // @ts-ignore call setContent from iframe
+ fileViewer.current.contentWindow.setTheme(props.settings.currentTheme);
+ }
+ }, [props.settings.currentTheme]);
+
useEffect(() => {
if (props.openedFiles.length > 0) {
- // / setPropertiesPanelVisible
- /* if (!openedFile.isFile && !isPropertiesPanelVisible) {
- // always open for dirs
- setPropertiesPanelVisible(true);
- } */
if (
- openedFile.editMode &&
- openedFile.changed &&
- openedFile.shouldReload === false
+ // openedFile.editMode &&
+ // openedFile.changed &&
+ fileChanged.current
+ // openedFile.shouldReload === false
) {
setSaveBeforeReloadConfirmDialogOpened(true);
}
}
- }, [props.openedFiles, props.isReadOnlyMode, props.settings]);
+ }, [props.openedFiles, props.isReadOnlyMode]); // , props.settings]);
/**
* always open for dirs
@@ -301,13 +299,6 @@ const EntryContainer = (props: Props) => {
? isPropertiesPanelVisible
: true;
- useEffect(() => {
- // TODO rethink this
- if (props.settings.entryPropertiesSplitSize === defaultSplitSize) {
- props.setEntryPropertiesSplitSize(openedSplitSize);
- }
- }, [isPropertiesPanelVisible]);
-
const editingSupported: boolean =
!props.isReadOnlyMode &&
openedFile.editingExtensionId !== undefined &&
@@ -328,7 +319,9 @@ const EntryContainer = (props: Props) => {
startSavingFile();
break;
case 'editDocument':
- editFile();
+ if (editingSupported) {
+ editFile();
+ }
break;
case 'playbackEnded':
props.openNextFile(openedFile.path);
@@ -343,6 +336,19 @@ const EntryContainer = (props: Props) => {
break;
}
textFilePath = openedFile.path;
+
+ if (
+ fileViewer &&
+ fileViewer.current &&
+ fileViewer.current.contentWindow &&
+ // @ts-ignore
+ fileViewer.current.contentWindow.setTheme
+ ) {
+ // @ts-ignore call setContent from iframe
+ fileViewer.current.contentWindow.setTheme(
+ props.settings.currentTheme
+ );
+ }
// TODO make loading index.html for folders configurable
// if (!this.state.currentEntry.isFile) {
// textFilePath += '/index.html';
@@ -352,6 +358,11 @@ const EntryContainer = (props: Props) => {
data.preview ? data.preview : false
)
.then(content => {
+ const UTF8_BOM = '\ufeff';
+ if (content.indexOf(UTF8_BOM) === 0) {
+ // eslint-disable-next-line no-param-reassign
+ content = content.substr(1);
+ }
let fileDirectory = extractContainingDirectoryPath(
textFilePath,
PlatformIO.getDirSeparator()
@@ -366,18 +377,6 @@ const EntryContainer = (props: Props) => {
'/' +
fileDirectory;
}
- // if (AppConfig.isElectron && this.fileViewer) {
- // this.fileViewer.executeJavaScript(
- // 'setContent(' +
- // JSON.stringify(content) +
- // ',' +
- // JSON.stringify(fileDirectory) +
- // ',' +
- // !this.state.currentEntry.editMode +
- // ')',
- // false
- // );
- // } else
if (
fileViewer &&
fileViewer.current &&
@@ -399,14 +398,10 @@ const EntryContainer = (props: Props) => {
});
break;
case 'contentChangedInEditor': {
- if (openedFile.editMode && !openedFile.changed) {
- // dummy state change to render DOT before file name (only first time)
- props.updateOpenedFile(openedFile.path, {
- ...openedFile,
- changed: true,
- editMode: true,
- shouldReload: undefined
- });
+ if (!fileChanged.current) {
+ fileChanged.current = true;
+ // to render DOT before file name (only first time)
+ forceUpdate();
}
break;
}
@@ -420,7 +415,8 @@ const EntryContainer = (props: Props) => {
const reloadDocument = () => {
if (openedFile) {
- if (openedFile.editMode && openedFile.changed) {
+ if (openedFile.editMode && fileChanged.current) {
+ // openedFile.changed) {
setSaveBeforeReloadConfirmDialogOpened(true);
} else {
props.updateOpenedFile(openedFile.path, {
@@ -432,26 +428,13 @@ const EntryContainer = (props: Props) => {
}
};
- /* const cancelEditing = () => {
- if (currentEntry && isChanged) {
- props.showNotification(
- i18n.t('core:currentlyFileChangedSaveOrClose')
- );
- return true;
- }
- shouldReload = true;
- setCurrentEntry({
- ...currentEntry,
- editMode: false
- });
- }; */
-
const startClosingFile = event => {
if (event) {
event.preventDefault(); // Let's stop this event.
event.stopPropagation();
}
- if (openedFile && openedFile.changed && openedFile.editMode) {
+ if (openedFile && fileChanged.current && openedFile.editMode) {
+ // openedFile.changed
setSaveBeforeCloseConfirmDialogOpened(true);
} else {
closeFile();
@@ -464,17 +447,6 @@ const EntryContainer = (props: Props) => {
};
const startSavingFile = () => {
- // if (AppConfig.isElectron) {
- // if (this.fileViewer) {
- // this.fileViewer.executeJavaScript(
- // 'getContent()',
- // false,
- // textContent => {
- // this.saveFile(textContent);
- // }
- // );
- // }
- // } else
if (
fileViewer &&
fileViewer.current &&
@@ -499,9 +471,10 @@ const EntryContainer = (props: Props) => {
props.updateOpenedFile(openedFile.path, {
...openedFile,
editMode: false,
- changed: false,
+ // changed: false,
shouldReload: undefined
});
+ fileChanged.current = false;
props.showNotification(
i18n.t('core:fileSavedSuccessfully'),
NotificationTypes.default
@@ -523,12 +496,32 @@ const EntryContainer = (props: Props) => {
editMode: true,
shouldReload: undefined
});
+ // setFileView(renderFileView());
};
const shareFile = (filePath: string) => {
PlatformIO.shareFiles([filePath]);
};
+ document.addEventListener('fullscreenchange', exitFullScreenHandler);
+ document.addEventListener('webkitfullscreenchange', exitFullScreenHandler);
+ document.addEventListener('mozfullscreenchange', exitFullScreenHandler);
+ document.addEventListener('MSFullscreenChange', exitFullScreenHandler);
+
+ function exitFullScreenHandler() {
+ if (
+ !document.fullscreenElement &&
+ // @ts-ignore
+ !document.webkitIsFullScreen &&
+ // @ts-ignore
+ !document.mozFullScreen &&
+ // @ts-ignore
+ !document.msFullscreenElement
+ ) {
+ forceUpdate();
+ }
+ }
+
const toggleFullScreen = () => {
// this.fileViewerContainer.addEventListener('onfullscreenchange', () => {
// alert('Fullscreen change');
@@ -540,25 +533,29 @@ const EntryContainer = (props: Props) => {
// });
// https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullScreen#examples
- if (document.fullscreenElement && document.webkitExitFullscreen) {
- document.webkitExitFullscreen();
- setFullscreen(false);
- return;
- }
+
if (document.fullscreenElement && document.exitFullscreen) {
// TODO exit fullscreen firefox does not work
document
.exitFullscreen()
.then(() => {
console.log('Fullscreen exit successful');
+ // setFullscreen(false);
+ forceUpdate();
return true;
})
.catch(e => {
console.log('Error exiting fullscreen', e);
});
- setFullscreen(false);
return;
- } /* else if (this.state.isFullscreen && document.mozExitFullscreen) {
+ }
+ if (document.fullscreenElement && document.webkitExitFullscreen) {
+ document.webkitExitFullscreen();
+ // setFullscreen(false);
+ forceUpdate();
+ return;
+ }
+ /* else if (this.state.isFullscreen && document.mozExitFullscreen) {
document.mozExitFullscreen();
this.setState({ isFullscreen: false });
return;
@@ -566,18 +563,31 @@ const EntryContainer = (props: Props) => {
if (!document.fullscreenElement && fileViewerContainer) {
if (
fileViewerContainer &&
- // @ts-ignore
- fileViewerContainer.current.webkitRequestFullscreen
+ fileViewerContainer.current.requestFullscreen
) {
- // @ts-ignore
- fileViewerContainer.current.webkitRequestFullscreen();
- setFullscreen(true);
+ fileViewerContainer.current
+ .requestFullscreen()
+ .then(() => {
+ forceUpdate();
+ return true;
+ })
+ .catch(ex => {
+ console.error('webkitRequestFullscreen:', ex);
+ });
+ // setFullscreen(true);
} else if (
fileViewerContainer &&
- fileViewerContainer.current.requestFullscreen
+ // @ts-ignore
+ fileViewerContainer.current.webkitRequestFullscreen
) {
- fileViewerContainer.current.requestFullscreen();
- setFullscreen(true);
+ try {
+ // @ts-ignore
+ fileViewerContainer.current.webkitRequestFullscreen();
+ } catch (ex) {
+ console.error('webkitRequestFullscreen:', ex);
+ }
+ forceUpdate();
+ // setFullscreen(true);
} else if (
fileViewerContainer &&
// @ts-ignore
@@ -585,17 +595,43 @@ const EntryContainer = (props: Props) => {
) {
// @ts-ignore
fileViewerContainer.current.mozRequestFullScreen();
- setFullscreen(true);
+ forceUpdate();
}
}
};
+ const setPercent = (p: number | undefined) => {
+ percent.current = p;
+ // console.log('Percent ' + percent.current);
+ if (p !== undefined) {
+ bufferedSplitResize(() => {
+ // Threshold >10% for automatically close Properties panel
+ if (p <= 10) {
+ // parseInt(defaultSplitSize, 10)) {
+ closePanel();
+ } else {
+ if (props.settings.entrySplitSize !== p + '%') {
+ props.setEntryPropertiesSplitSize(p + '%');
+ }
+ openPanel();
+ }
+ });
+ }
+ forceUpdate();
+ };
+
const openPanel = () => {
- setPropertiesPanelVisible(true);
+ if (!isPropertiesPanelVisible) {
+ percent.current = parseFloat(props.settings.entrySplitSize);
+ setPropertiesPanelVisible(true);
+ }
};
const closePanel = () => {
- setPropertiesPanelVisible(false);
+ if (isPropertiesPanelVisible) {
+ percent.current = undefined;
+ setPropertiesPanelVisible(false);
+ }
};
const togglePanel = () => {
@@ -789,7 +825,10 @@ const EntryContainer = (props: Props) => {
<IconButton
data-tid="openInFullWidthTID"
aria-label={i18n.t('core:openInFullWidth')}
- onClick={props.toggleEntryFullWidth}
+ onClick={() => {
+ props.toggleEntryFullWidth();
+ closePanel();
+ }}
>
<ExpandIcon />
</IconButton>
@@ -854,231 +893,30 @@ const EntryContainer = (props: Props) => {
</div>
);
- const renderFileView = fileOpenerURL => (
- <iframe
- ref={fileViewer}
- className={props.classes.fileOpener}
- src={fileOpenerURL}
- allowFullScreen
- sandbox="allow-same-origin allow-scripts allow-modals"
- title={i18n.t('core:fileViewer')}
- id="FileViewer"
- />
- );
-
- /* const setPropertiesEditMode = (editMode: boolean) => {
- this.isPropertiesEditMode = editMode;
- }; */
-
- /* TODO rethink this
- const resetState = key => {
- // this.isPropertiesEditMode = false;
- // @ts-ignore
- this.setState({
- [key]: uuidv1()
- });
- }; */
-
const { classes, keyBindings } = props;
- let fileOpenerURL: string;
- let fileTitle: string = '';
-
- if (openedFile.path) {
- fileTitle = extractTitle(
- openedFile.path,
- !openedFile.isFile,
- PlatformIO.getDirSeparator()
- );
- // if (fileTitle.length > maxCharactersTitleLength) {
- // fileTitle = fileTitle.substr(0, maxCharactersTitleLength) + '...';
- // }
+ const fileTitle: string = openedFile.path
+ ? extractTitle(
+ openedFile.path,
+ !openedFile.isFile,
+ PlatformIO.getDirSeparator()
+ )
+ : '';
- const locale = '&locale=' + i18n.language;
- const theme = '&theme=' + props.settings.currentTheme;
+ const filePropsHeight =
+ Math.floor((percent.current * window.innerHeight) / 100) - 125;
+ // console.log('filePropsHeight: ' + filePropsHeight);
- if (openedFile.editMode && openedFile.editingExtensionPath) {
- fileOpenerURL =
- openedFile.editingExtensionPath +
- '/index.html?file=' +
- encodeURIComponent(openedFile.url ? openedFile.url : openedFile.path) +
- locale +
- theme +
- '&edit=true' +
- (openedFile.shouldReload === true ? '&t=' + new Date().getTime() : '');
- // } else if (!currentEntry.isFile) { // TODO needed for loading folder's default html
- // fileOpenerURL = 'node_modules/@tagspaces/html-viewer/index.html?locale=' + i18n.language;
- } else {
- fileOpenerURL =
- openedFile.viewingExtensionPath +
- '/index.html?file=' +
- encodeURIComponent(openedFile.url ? openedFile.url : openedFile.path) +
- locale +
- theme +
- (openedFile.shouldReload === true ? '&t=' + new Date().getTime() : '');
- }
- // this.shouldReload = false;
-
- // if (!currentEntry.isFile) {
- // fileOpenerURL = currentEntry.path + '/index.html';
- // }
-
- // // Idea for using mhtml native browser in chrome
- // if (
- // !AppConfig.isFirefox && (
- // currentEntry.path.endsWith('mht') ||
- // currentEntry.path.endsWith('mhtml')
- // )
- // ) {
- // fileOpenerURL = currentEntry.path;
- // }
- } else {
- fileOpenerURL = 'about:blank';
- }
-
- function getSplitPanelSize() {
- if (isPropPanelVisible) {
- return openedFile.isFile
- ? props.settings.entryPropertiesSplitSize
- : '100%';
- }
- return defaultSplitSize;
- }
-
- return (
- <GlobalHotKeys
- handlers={{
- closeViewer: startClosingFile,
- saveDocument: startSavingFile,
- editDocument: editFile,
- nextDocument: openNextFile,
- prevDocument: openPrevFile,
- toggleFullScreen
- }}
- keyMap={{
- nextDocument: keyBindings.nextDocument,
- prevDocument: keyBindings.prevDocument,
- closeViewer: keyBindings.closeViewer,
- saveDocument: keyBindings.saveDocument,
- editDocument: keyBindings.editDocument,
- toggleFullScreen: keyBindings.toggleFullScreen
- }}
- >
- {isSaveBeforeCloseConfirmDialogOpened && (
- <ConfirmDialog
- open={isSaveBeforeCloseConfirmDialogOpened}
- onClose={() => {
- setSaveBeforeCloseConfirmDialogOpened(false);
- }}
- title={i18n.t('core:confirm')}
- content={i18n.t('core:saveFileBeforeClosingFile')}
- confirmCallback={result => {
- if (result) {
- startSavingFile();
- } else {
- closeFile();
- setSaveBeforeCloseConfirmDialogOpened(false);
- }
- }}
- cancelDialogTID="cancelSaveBeforeCloseDialog"
- confirmDialogTID="confirmSaveBeforeCloseDialog"
- confirmDialogContentTID="confirmDialogContent"
- />
- )}
- {isSaveBeforeReloadConfirmDialogOpened && (
- <ConfirmDialog
- open={isSaveBeforeReloadConfirmDialogOpened}
- onClose={() => {
- setSaveBeforeReloadConfirmDialogOpened(false);
- }}
- title={i18n.t('core:confirm')}
- content="File was modified, do you want to save the changes?"
- confirmCallback={result => {
- if (result) {
- setSaveBeforeReloadConfirmDialogOpened(false);
- startSavingFile();
- } else {
- setSaveBeforeReloadConfirmDialogOpened(false);
- props.updateOpenedFile(openedFile.path, {
- ...openedFile,
- editMode: false,
- changed: false,
- shouldReload: true
- });
- }
- }}
- cancelDialogTID="cancelSaveBeforeCloseDialog"
- confirmDialogTID="confirmSaveBeforeCloseDialog"
- confirmDialogContentTID="confirmDialogContent"
- />
- )}
- {isDeleteEntryModalOpened && (
- <ConfirmDialog
- open={isDeleteEntryModalOpened}
- onClose={() => {
- setDeleteEntryModalOpened(false);
- }}
- title={
- openedFile.isFile
- ? i18n.t('core:deleteConfirmationTitle')
- : i18n.t('core:deleteDirectory')
- }
- content={
- openedFile.isFile
- ? i18n.t('core:doYouWantToDeleteFile')
- : i18n.t('core:deleteDirectoryContentConfirm', {
- dirPath: openedFile.path
- ? extractDirectoryName(
- decodeURIComponent(openedFile.path),
- PlatformIO.getDirSeparator()
- )
- : ''
- })
- }
- confirmCallback={result => {
- if (result) {
- props.deleteFile(openedFile.path);
- }
- }}
- cancelDialogTID="cancelSaveBeforeCloseDialog"
- confirmDialogTID="confirmSaveBeforeCloseDialog"
- confirmDialogContentTID="confirmDialogContent"
- />
- )}
- {isEditTagsModalOpened && (
- <AddRemoveTagsDialog
- open={isEditTagsModalOpened}
- onClose={() => setEditTagsModalOpened(false)}
- addTags={props.addTags}
- removeTags={props.removeTags}
- removeAllTags={props.removeAllTags}
- selectedEntries={openedFile ? [openedFile] : []}
- />
- )}
- <a href="#" id="downloadFile">
- &nbsp;
- </a>
- <SplitPane
- split="horizontal"
- resizerStyle={{
- backgroundColor: props.theme.palette.divider
- }}
- style={{ zIndex: 1300 }}
- size={getSplitPanelSize()}
- minSize={openedFile.isFile ? defaultSplitSize : '100%'}
- maxSize={openedFile.isFile ? fullSplitSize : '100%'}
- defaultSize={
- openedFile.isFile ? props.settings.entryPropertiesSplitSize : '100%'
- }
- onChange={size => {
- const propertiesPanelVisible = size > defaultSplitSize;
- if (isPropPanelVisible !== propertiesPanelVisible) {
- setPropertiesPanelVisible(propertiesPanelVisible);
- }
- bufferedSplitResize(() => props.setEntryPropertiesSplitSize(size));
- }}
- >
- {openedFile.path ? (
- <Box className={classes.panel}>
+ const renderPanels = () => {
+ const toolbarButtons = () => {
+ if (openedFile.path) {
+ return (
+ <Box
+ key="toolbarButtonsID"
+ className={classes.panel}
+ style={{
+ height: filePropsHeight || 'initial'
+ }}
+ >
<Box className={classes.toolbar}>
<Box className={classes.flexLeft}>
{openedFile.isFile ? (
@@ -1093,7 +931,7 @@ const EntryContainer = (props: Props) => {
color: props.theme.palette.text.primary
}}
>
- {openedFile.editMode && openedFile.changed
+ {fileChanged.current // openedFile.editMode && openedFile.changed
? String.fromCharCode(0x25cf) + ' '
: ''}
{fileTitle}
@@ -1203,61 +1041,177 @@ const EntryContainer = (props: Props) => {
</div>
)}
</Box>
- <div className={classes.entryProperties}>
- {openedFile.isFile
- ? renderFileToolbar(classes)
- : renderFolderToolbar()}
- {isPropPanelVisible && (
- <EntryProperties
- key={openedFile.path}
- // resetState={this.resetState}
- // setPropertiesEditMode={this.setPropertiesEditMode}
- // entryPath={openedFile.path}
- // perspective={openedFile.perspective}
- openedEntry={openedFile}
- tagDelimiter={props.settings.tagDelimiter}
- // entryURL={currentEntry.url}
- // shouldReload={reload}
- renameFile={props.renameFile}
- renameDirectory={props.renameDirectory}
- // editTagForEntry={props.editTagForEntry}
- // shouldCopyFile={shouldCopyFile}
- // normalizeShouldCopyFile={() => setShouldCopyFile(false)}
- addTags={props.addTags}
- removeTags={props.removeTags}
- removeAllTags={props.removeAllTags}
- updateOpenedFile={props.updateOpenedFile}
- updateThumbnailUrl={props.updateThumbnailUrl}
- showNotification={props.showNotification}
- isReadOnlyMode={props.isReadOnlyMode}
- currentDirectoryPath={props.currentDirectoryPath}
- tileServer={props.tileServer}
- />
- )}
- </div>
+ {entryProperties}
</Box>
- ) : (
- <div>{i18n.t('core:noEntrySelected')}</div>
- )}
- <div ref={fileViewerContainer} className={classes.fileContent}>
- {isFullscreen && (
- <Fab
- data-tid="fullscreenTID"
- color="primary"
- style={{
- position: 'absolute',
- top: 20,
- right: 20,
- zIndex: 10000
- }}
- onClick={toggleFullScreen}
- >
- <CloseIcon />
- </Fab>
- )}
- {renderFileView(fileOpenerURL)}
- </div>
- </SplitPane>
+ );
+ }
+ return <div>{i18n.t('core:noEntrySelected')}</div>;
+ };
+
+ const entryProperties = (
+ <div className={classes.entryProperties}>
+ {openedFile.isFile ? renderFileToolbar(classes) : renderFolderToolbar()}
+ <EntryProperties
+ key={openedFile.path}
+ openedEntry={openedFile}
+ tagDelimiter={props.settings.tagDelimiter}
+ renameFile={props.renameFile}
+ renameDirectory={props.renameDirectory}
+ addTags={props.addTags}
+ removeTags={props.removeTags}
+ removeAllTags={props.removeAllTags}
+ updateOpenedFile={props.updateOpenedFile}
+ updateThumbnailUrl={props.updateThumbnailUrl}
+ showNotification={props.showNotification}
+ isReadOnlyMode={props.isReadOnlyMode}
+ currentDirectoryPath={props.currentDirectoryPath}
+ tileServer={props.tileServer}
+ />
+ </div>
+ );
+
+ let initSize;
+ if (isPropPanelVisible) {
+ initSize = openedFile.isFile ? props.settings.entrySplitSize : '100%';
+ } else {
+ initSize = defaultSplitSize; // '0%';
+ }
+
+ return (
+ <Split
+ horizontal
+ minPrimarySize="103px"
+ initialPrimarySize={initSize}
+ percent={percent.current}
+ setPercent={setPercent}
+ >
+ {toolbarButtons()}
+ <FileView
+ key="FileViewID"
+ openedFile={props.openedFiles[0]}
+ isFullscreen={document.fullscreenElement !== null}
+ fileViewer={fileViewer}
+ fileViewerContainer={fileViewerContainer}
+ toggleFullScreen={toggleFullScreen}
+ />
+ </Split>
+ );
+ };
+
+ return (
+ <GlobalHotKeys
+ handlers={{
+ closeViewer: startClosingFile,
+ saveDocument: startSavingFile,
+ editDocument: editFile,
+ nextDocument: openNextFile,
+ prevDocument: openPrevFile,
+ toggleFullScreen
+ }}
+ keyMap={{
+ nextDocument: keyBindings.nextDocument,
+ prevDocument: keyBindings.prevDocument,
+ closeViewer: keyBindings.closeViewer,
+ saveDocument: keyBindings.saveDocument,
+ editDocument: keyBindings.editDocument,
+ toggleFullScreen: keyBindings.toggleFullScreen
+ }}
+ >
+ {isSaveBeforeCloseConfirmDialogOpened && (
+ <ConfirmDialog
+ open={isSaveBeforeCloseConfirmDialogOpened}
+ onClose={() => {
+ setSaveBeforeCloseConfirmDialogOpened(false);
+ }}
+ title={i18n.t('core:confirm')}
+ content={i18n.t('core:saveFileBeforeClosingFile')}
+ confirmCallback={result => {
+ if (result) {
+ startSavingFile();
+ } else {
+ closeFile();
+ setSaveBeforeCloseConfirmDialogOpened(false);
+ }
+ }}
+ cancelDialogTID="cancelSaveBeforeCloseDialog"
+ confirmDialogTID="confirmSaveBeforeCloseDialog"
+ confirmDialogContentTID="confirmDialogContent"
+ />
+ )}
+ {isSaveBeforeReloadConfirmDialogOpened && (
+ <ConfirmDialog
+ open={isSaveBeforeReloadConfirmDialogOpened}
+ onClose={() => {
+ setSaveBeforeReloadConfirmDialogOpened(false);
+ }}
+ title={i18n.t('core:confirm')}
+ content="File was modified, do you want to save the changes?"
+ confirmCallback={result => {
+ if (result) {
+ setSaveBeforeReloadConfirmDialogOpened(false);
+ startSavingFile();
+ } else {
+ setSaveBeforeReloadConfirmDialogOpened(false);
+ props.updateOpenedFile(openedFile.path, {
+ ...openedFile,
+ editMode: false,
+ // changed: false,
+ shouldReload: true
+ });
+ fileChanged.current = false;
+ }
+ }}
+ cancelDialogTID="cancelSaveBeforeCloseDialog"
+ confirmDialogTID="confirmSaveBeforeCloseDialog"
+ confirmDialogContentTID="confirmDialogContent"
+ />
+ )}
+ {isDeleteEntryModalOpened && (
+ <ConfirmDialog
+ open={isDeleteEntryModalOpened}
+ onClose={() => {
+ setDeleteEntryModalOpened(false);
+ }}
+ title={
+ openedFile.isFile
+ ? i18n.t('core:deleteConfirmationTitle')
+ : i18n.t('core:deleteDirectory')
+ }
+ content={
+ openedFile.isFile
+ ? i18n.t('core:doYouWantToDeleteFile')
+ : i18n.t('core:deleteDirectoryContentConfirm', {
+ dirPath: openedFile.path
+ ? extractDirectoryName(
+ decodeURIComponent(openedFile.path),
+ PlatformIO.getDirSeparator()
+ )
+ : ''
+ })
+ }
+ confirmCallback={result => {
+ if (result) {
+ props.deleteFile(openedFile.path);
+ }
+ }}
+ cancelDialogTID="cancelSaveBeforeCloseDialog"
+ confirmDialogTID="confirmSaveBeforeCloseDialog"
+ confirmDialogContentTID="confirmDialogContent"
+ />
+ )}
+ {isEditTagsModalOpened && (
+ <AddRemoveTagsDialog
+ open={isEditTagsModalOpened}
+ onClose={() => setEditTagsModalOpened(false)}
+ addTags={props.addTags}
+ removeTags={props.removeTags}
+ removeAllTags={props.removeAllTags}
+ selectedEntries={openedFile ? [openedFile] : []}
+ />
+ )}
+ {/* eslint-disable-next-line jsx-a11y/anchor-has-content,jsx-a11y/anchor-is-valid */}
+ <a href="#" id="downloadFile" />
+ {renderPanels()}
</GlobalHotKeys>
);
};
@@ -1298,9 +1252,20 @@ function mapActionCreatorsToProps(dispatch) {
dispatch
);
}
+const areEqual = (prevProp, nextProp) =>
+ // JSON.stringify(nextProp.theme) === JSON.stringify(prevProp.theme) &&
+ nextProp.settings.currentTheme === prevProp.settings.currentTheme &&
+ nextProp.settings.entrySplitSize === prevProp.settings.entrySplitSize &&
+ JSON.stringify(nextProp.openedFiles) === JSON.stringify(prevProp.openedFiles);
+/* nextProp.openedFiles[0].path === prevProp.openedFiles[0].path &&
+ nextProp.openedFiles[0].shouldReload ===
+ prevProp.openedFiles[0].shouldReload &&
+ nextProp.openedFiles[0].editMode === prevProp.openedFiles[0].editMode; */
export default connect(
mapStateToProps,
mapActionCreatorsToProps
+)(
// @ts-ignore
-)(withStyles(styles, { withTheme: true })(EntryContainer));
+ React.memo(withStyles(styles, { withTheme: true })(EntryContainer), areEqual)
+);
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsx
index 663ea8a8f..69d4e73b5 100644
--- a/app/components/EntryProperties.tsx
+++ b/app/components/EntryProperties.tsx
@@ -341,10 +341,7 @@ const EntryProperties = (props: Props) => {
Pro.MetaOperations.saveDescription(currentEntry.path, editDescription)
.then(entryMeta => {
setEditDescription(undefined);
- props.updateOpenedFile(currentEntry.path, {
- ...entryMeta,
- changed: true
- });
+ props.updateOpenedFile(currentEntry.path, entryMeta);
return true;
})
.catch(error => {
@@ -432,10 +429,7 @@ const EntryProperties = (props: Props) => {
Pro.MetaOperations.saveColor(currentEntry.path, color)
.then(entryMeta => {
// if (props.entryPath === props.currentDirectoryPath) {
- props.updateOpenedFile(currentEntry.path, {
- ...entryMeta,
- changed: true
- });
+ props.updateOpenedFile(currentEntry.path, entryMeta);
/* } else {
setCurrentEntry({ ...currentEntry, color });
} */
@@ -470,7 +464,7 @@ const EntryProperties = (props: Props) => {
if (!value) {
// no tags left in the select element
props.removeAllTags([currentEntry.path]); // TODO return promise
- props.updateOpenedFile(currentEntry.path, { tags: [], changed: true });
+ props.updateOpenedFile(currentEntry.path, { tags: [] });
} else {
props.removeTags([currentEntry.path], value);
}
@@ -528,10 +522,7 @@ const EntryProperties = (props: Props) => {
const perspective = event.target.value;
savePerspective(currentEntry.path, perspective)
.then((entryMeta: TS.FileSystemEntryMeta) => {
- props.updateOpenedFile(currentEntry.path, {
- ...entryMeta,
- changed: true
- });
+ props.updateOpenedFile(currentEntry.path, entryMeta);
return true;
})
.catch(error => {
diff --git a/app/components/FileView.tsx b/app/components/FileView.tsx
new file mode 100644
index 000000000..45a836ba6
--- /dev/null
+++ b/app/components/FileView.tsx
@@ -0,0 +1,143 @@
+/**
+ * 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, { MutableRefObject } from 'react';
+import { withStyles } from '@material-ui/core/styles';
+import Fab from '@material-ui/core/Fab';
+import CloseIcon from '@material-ui/icons/Close';
+import i18n from '-/services/i18n';
+import { OpenedEntry } from '-/reducers/app';
+import useEventListener from '-/utils/useEventListener';
+
+interface Props {
+ openedFile: OpenedEntry;
+ isFullscreen: boolean;
+ fileViewer: MutableRefObject<HTMLIFrameElement>;
+ fileViewerContainer: MutableRefObject<HTMLDivElement>;
+ toggleFullScreen: () => void;
+ theme: any;
+}
+
+const FileView = (props: Props) => {
+ const {
+ openedFile,
+ theme,
+ fileViewer,
+ isFullscreen,
+ fileViewerContainer,
+ toggleFullScreen
+ } = props; // .openedFiles[0];
+
+ useEventListener('toggle-resume', () => {
+ if (
+ fileViewer &&
+ fileViewer.current &&
+ fileViewer.current.contentWindow &&
+ // @ts-ignore
+ fileViewer.current.contentWindow.togglePlay
+ ) {
+ // @ts-ignore
+ fileViewer.current.contentWindow.togglePlay();
+ }
+ });
+
+ let fileOpenerURL: string;
+
+ if (openedFile.path) {
+ // if (fileTitle.length > maxCharactersTitleLength) {
+ // fileTitle = fileTitle.substr(0, maxCharactersTitleLength) + '...';
+ // }
+
+ const locale = '&locale=' + i18n.language;
+
+ if (openedFile.editMode && openedFile.editingExtensionPath) {
+ fileOpenerURL =
+ openedFile.editingExtensionPath +
+ '/index.html?file=' +
+ encodeURIComponent(openedFile.url ? openedFile.url : openedFile.path) +
+ locale +
+ '&edit=true' +
+ (openedFile.shouldReload === true ? '&t=' + new Date().getTime() : '');
+ // } else if (!currentEntry.isFile) { // TODO needed for loading folder's default html
+ // fileOpenerURL = 'node_modules/@tagspaces/html-viewer/index.html?locale=' + i18n.language;
+ } else {
+ fileOpenerURL =
+ openedFile.viewingExtensionPath +
+ '/index.html?file=' +
+ encodeURIComponent(openedFile.url ? openedFile.url : openedFile.path) +
+ locale +
+ (openedFile.shouldReload === true ? '&t=' + new Date().getTime() : '');
+ }
+ } else {
+ fileOpenerURL = 'about:blank';
+ }
+ return (
+ <div
+ ref={fileViewerContainer}
+ style={{
+ width: '100%',
+ height: '100%',
+ flex: '1 1 100%',
+ display: 'flex',
+ backgroundColor: theme.palette.background.default
+ }}
+ >
+ {isFullscreen && (
+ <Fab
+ data-tid="fullscreenTID"
+ color="primary"
+ style={{
+ position: 'absolute',
+ top: 20,
+ right: 20,
+ zIndex: 10000
+ }}
+ onClick={toggleFullScreen}
+ >
+ <CloseIcon />
+ </Fab>
+ )}
+ <iframe
+ ref={fileViewer}
+ style={{
+ width: '100%',
+ zIndex: 3,
+ border: 0
+ }}
+ src={fileOpenerURL}
+ allowFullScreen
+ sandbox="allow-same-origin allow-scripts allow-modals"
+ title={i18n.t('core:fileViewer')}
+ id="FileViewer"
+ />
+ </div>
+ );
+};
+
+const areEqual = (prevProp, nextProp) =>
+ nextProp.openedFile.path === prevProp.openedFile.path &&
+ nextProp.openedFile.editMode === prevProp.openedFile.editMode &&
+ nextProp.isFullscreen === prevProp.isFullscreen;
+/* ((nextProp.openedFile.editMode === undefined &&
+ prevProp.openedFile.editMode === true) ||
+ nextProp.openedFile.editMode === prevProp.openedFile.editMode); */
+
+export default React.memo(
+ withStyles(undefined, { withTheme: true })(FileView),
+ areEqual
+);
diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsx
index 4545426f2..6d57394b6 100644
--- a/app/components/FolderContainer.tsx
+++ b/app/components/FolderContainer.tsx
@@ -20,14 +20,17 @@ import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import Button from '@material-ui/core/Button';
-import MoreVertIcon from '@material-ui/icons/MoreVert';
-import BackButtonIcon from '@material-ui/icons/ArrowBack';
-import IconButton from '@material-ui/core/IconButton';
-import FolderSeparatorIcon from '@material-ui/icons/ChevronRight';
-import MenuIcon from '@material-ui/icons/Menu';
+import SearchIcon from '@material-ui/icons/Search';
+import MenuIcon from '@material-ui/icons/MenuOpen';
import Badge from '@material-ui/core/Badge';
-import { Tooltip } from '@material-ui/core';
-import { withStyles, withTheme } from '@material-ui/core/styles';
+import {
+ Box,
+ CircularProgress,
+ IconButton,
+ Tooltip,
+ Typography
+} from '@material-ui/core';
+import { withStyles } from '@material-ui/core/styles';
import ToggleButton from '@material-ui/lab/ToggleButton';
import ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
import DefaultPerspectiveIcon from '@material-ui/icons/GridOn';
@@ -35,7 +38,6 @@ import GalleryPerspectiveIcon from '@material-ui/icons/Camera';
import MapiquePerspectiveIcon from '@material-ui/icons/Map';
// import KanBanPerspectiveIcon from '@material-ui/icons/Dashboard';
import LocationMenu from './menus/LocationMenu';
-import DirectoryMenu from './menus/DirectoryMenu';
import i18n from '../services/i18n';
import { getMaxSearchResults, getDesktopMode } from '-/reducers/settings';
import { getLocations } from '-/reducers/locations';
@@ -48,17 +50,17 @@ import {
getCurrentDirectoryPerspective,
OpenedEntry,
perspectives,
- getSelectedEntries
+ getSelectedEntries,
+ getProgress
} from '../reducers/app';
import TaggingActions from '../reducers/tagging-actions';
-import { normalizePath, extractShortDirectoryName } from '-/utils/paths';
-import PlatformIO from '../services/platform-io';
import LoadingLazy from '../components/LoadingLazy';
import { Pro } from '../pro';
-import { enhanceOpenedEntry } from '-/services/utils-io';
import AppConfig from '-/config';
import RenameEntryDialog from '-/components/dialogs/RenameEntryDialog';
import { TS } from '-/tagspaces.namespace';
+import PathBreadcrumbs from './PathBreadcrumbs';
+import { enhanceOpenedEntry } from '-/services/utils-io';
const GridPerspective = React.lazy(() =>
import(
@@ -158,7 +160,7 @@ const styles: any = (theme: any) => ({
paddingRight: 5,
paddingTop: 5,
display: 'flex',
- justifyContent: 'center'
+ overflowX: AppConfig.isFirefox ? 'auto' : 'overlay'
},
topPanel: {
height: 50,
@@ -190,7 +192,7 @@ const styles: any = (theme: any) => ({
alignItems: 'center'
},
perspecitveSwitch: {
- bottom: 30,
+ bottom: 80,
right: 30,
zIndex: 1000,
opacity: 0.9,
@@ -224,7 +226,8 @@ interface Props {
isDesktopMode: boolean;
showNotification: (content: string) => void;
openSearchPanel: () => void;
- showDrawer?: () => void;
+ toggleDrawer?: () => void;
+ drawerOpened: boolean;
setCurrentDirectoryPerspective: (perspective: string) => void;
maxSearchResults: number;
currentDirectoryPerspective: string;
@@ -234,18 +237,11 @@ interface Props {
updateCurrentDirEntry: (path: string, entry: Object) => void;
setCurrentDirectoryColor: (color: string) => void;
selectedEntries: Array<TS.FileSystemEntry>;
+ toggleUploadDialog: () => void;
+ progress?: Array<any>;
}
const FolderContainer = (props: Props) => {
- const [
- directoryContextMenuAnchorEl,
- setDirectoryContextMenuAnchorEl
- ] = useState<null | HTMLElement>(null);
-
- const [isRenameEntryDialogOpened, setIsRenameEntryDialogOpened] = useState<
- boolean
- >(false);
-
useEffect(() => {
if (props.selectedEntries.length < 2) {
if (props.openedFiles.length > 0) {
@@ -253,11 +249,13 @@ const FolderContainer = (props: Props) => {
if (openedFile.path === props.currentDirectoryPath) {
if (openedFile.color) {
props.setCurrentDirectoryColor(openedFile.color);
+ } else if(openedFile.color === undefined){
+ props.setCurrentDirectoryColor(undefined);
}
if (openedFile.perspective) {
props.setCurrentDirectoryPerspective(openedFile.perspective);
}
- } else if (openedFile.changed) {
+ } else { // if (openedFile.editMode) {// changed) {
const currentEntry = enhanceOpenedEntry(
openedFile,
props.settings.tagDelimiter
@@ -268,56 +266,9 @@ const FolderContainer = (props: Props) => {
}
}, [props.openedFiles]);
- let pathParts: Array<string> = [];
-
- if (props.currentDirectoryPath) {
- // Make the path unix like ending always with /
- const addSlash = PlatformIO.haveObjectStoreSupport() ? '//' : '/';
- let normalizedCurrentPath =
- addSlash +
- normalizePath(props.currentDirectoryPath.split('\\').join('/'));
-
- let normalizedCurrentLocationPath = '';
- if (props.currentLocationPath) {
- normalizedCurrentLocationPath =
- addSlash +
- normalizePath(props.currentLocationPath.split('\\').join('/'));
- }
-
- while (
- normalizedCurrentPath.lastIndexOf('/') > 0 &&
- normalizedCurrentPath.startsWith(normalizedCurrentLocationPath)
- ) {
- pathParts.push(
- normalizedCurrentPath
- .substring(PlatformIO.haveObjectStoreSupport() ? 2 : 1)
- .split('/')
- .join(PlatformIO.getDirSeparator())
- ); // TODO: optimization needed
- normalizedCurrentPath = normalizedCurrentPath.substring(
- 0,
- normalizedCurrentPath.lastIndexOf('/')
- );
- }
-
- // console.log('Path parts : ' + JSON.stringify(pathParts));
- if (pathParts.length >= 1) {
- pathParts = pathParts.slice(1, pathParts.length); // remove current directory
- }
- pathParts = pathParts.reverse();
- if (pathParts.length > 2) {
- pathParts = pathParts.slice(pathParts.length - 2, pathParts.length); // leave only the last 2 dirs in the path
- }
- }
-
- const openDirectoryMenu = (event: React.MouseEvent<HTMLButtonElement>) => {
- props.setSelectedEntries([]);
- setDirectoryContextMenuAnchorEl(event.currentTarget);
- };
-
- const closeDirectoryMenu = () => {
- setDirectoryContextMenuAnchorEl(null);
- };
+ const [isRenameEntryDialogOpened, setIsRenameEntryDialogOpened] = useState<
+ boolean
+ >(false);
const switchPerspective = (perspectiveId: string) => {
props.setCurrentDirectoryPerspective(perspectiveId);
@@ -416,15 +367,20 @@ const FolderContainer = (props: Props) => {
classes,
maxSearchResults,
openSearchPanel,
- showDrawer,
+ toggleDrawer,
+ drawerOpened,
isDesktopMode,
theme,
loadParentDirectoryContent,
- currentDirectoryPerspective
+ currentDirectoryPerspective,
+ currentLocationPath,
+ setSelectedEntries,
+ openDirectory,
+ reflectCreateEntry,
+ openFsEntry
+ // rightPanelWidth
} = props;
- const normalizedCurrentDirPath = normalizePath(
- currentDirectoryPath.split('\\').join('/')
- );
+
let searchResultCounterText = searchResultCount + ' ' + i18n.t('entries');
if (searchResultCount >= maxSearchResults) {
searchResultCounterText =
@@ -436,23 +392,59 @@ const FolderContainer = (props: Props) => {
const currentPerspective =
currentDirectoryPerspective || perspectives.DEFAULT;
+ function CircularProgressWithLabel(prop) {
+ return (
+ <Box position="relative" display="inline-flex">
+ <CircularProgress variant="static" {...prop} />
+ <Box
+ top={0}
+ left={0}
+ bottom={0}
+ right={0}
+ position="absolute"
+ display="flex"
+ alignItems="center"
+ justifyContent="center"
+ >
+ <Typography
+ variant="caption"
+ component="div"
+ style={{ color: 'white' }}
+ >
+ {`${prop.value}%`}
+ </Typography>
+ </Box>
+ </Box>
+ );
+ }
+
+ const getProgressValue = () => {
+ const objProgress = props.progress.find(
+ fileProgress => fileProgress.progress < 100 && fileProgress.progress > -1
+ );
+ if (objProgress !== undefined) {
+ return objProgress.progress;
+ }
+ return 100;
+ };
+
return (
- <div data-tid="folderContainerTID">
+ <div data-tid="folderContainerTID" style={{ position: 'relative' }}>
<div className={classes.mainPanel}>
<div className={classes.topPanel}>
<div className={classes.toolbar}>
- {isDesktopMode ? (
- <LocationMenu />
- ) : (
- <Button
- id="mobileMenuButton"
- style={{ marginLeft: -8 }}
- onClick={showDrawer}
- >
- <MenuIcon />
- </Button>
- )}
- <CounterBadge
+ <Button
+ id="mobileMenuButton"
+ style={{
+ marginLeft: -8,
+ transform: drawerOpened ? 'rotate(0deg)' : 'rotate(180deg)',
+ maxHeight: 40
+ }}
+ onClick={toggleDrawer}
+ >
+ <MenuIcon />
+ </Button>
+ {/* <CounterBadge
showZero={true}
title={searchResultCounterText}
badgeContent={searchResultCount}
@@ -461,85 +453,46 @@ const FolderContainer = (props: Props) => {
onClick={() => {
openSearchPanel();
}}
- />
+ /> */}
+ <Button
+ id="toggleSearch"
+ style={{
+ marginLeft: -8,
+ maxHeight: 40
+ }}
+ onClick={toggleDrawer}
+ >
+ <SearchIcon />
+ </Button>
<div className={classes.flexMiddle} />
- <React.Fragment>
- {isDesktopMode &&
- pathParts.length > 0 &&
- pathParts.map(pathPart => (
- <Button
- key={pathPart}
- onClick={() => loadDirectoryContent(pathPart, false)}
- title={'Navigate to: ' + pathPart}
- style={{
- paddingLeft: 3,
- paddingRight: 0,
- minWidth: 10,
- lineHeight: '17px',
- overflow: 'hidden',
- backgroundColor: theme.palette.background.default
- }}
- >
- {extractShortDirectoryName(
- pathPart,
- PlatformIO.getDirSeparator()
- )}
- <FolderSeparatorIcon />
- </Button>
- ))}
- {!isDesktopMode && pathParts.length >= 0 && (
- <React.Fragment>
- <IconButton
- onClick={loadParentDirectoryContent}
- data-tid="openParentDirectory"
- size="small"
- style={{
- overflow: 'hidden',
- backgroundColor: theme.palette.background.default
- }}
- title={i18n.t('core:navigateToParentDirectory')}
- >
- <BackButtonIcon />
- </IconButton>
- </React.Fragment>
- )}
- {props.currentDirectoryPath && (
- <React.Fragment>
- <Button
- data-tid="folderContainerOpenDirMenu"
- title={
- i18n.t('core:openDirectoryMenu') +
- ' - ' +
- (currentDirectoryPath || '')
- }
- className={classes.folderButton}
- onClick={openDirectoryMenu}
- onContextMenu={openDirectoryMenu}
- >
- {extractShortDirectoryName(
- normalizePath(normalizedCurrentDirPath),
- '/'
- )}
- <MoreVertIcon />
- </Button>
- <DirectoryMenu
- open={Boolean(directoryContextMenuAnchorEl)}
- onClose={closeDirectoryMenu}
- anchorEl={directoryContextMenuAnchorEl}
- directoryPath={currentDirectoryPath}
- loadDirectoryContent={props.loadDirectoryContent}
- openRenameDirectoryDialog={() =>
- setIsRenameEntryDialogOpened(true)
- }
- openDirectory={props.openDirectory}
- reflectCreateEntry={props.reflectCreateEntry}
- openFsEntry={props.openFsEntry}
- switchPerspective={switchPerspective}
- isReadOnlyMode={props.isReadOnlyMode}
- />
- </React.Fragment>
- )}
- </React.Fragment>
+ {props.progress && props.progress.length > 0 && (
+ <IconButton
+ id="progressButton"
+ title={i18n.t('core:progress')}
+ data-tid="uploadProgress"
+ onClick={() => props.toggleUploadDialog()}
+ // @ts-ignore
+ className={[classes.button, classes.upgradeButton].join(' ')}
+ >
+ <CircularProgressWithLabel value={getProgressValue()} />
+ </IconButton>
+ )}
+ <LocationMenu />
+ <PathBreadcrumbs
+ currentDirectoryPath={currentDirectoryPath}
+ currentLocationPath={currentLocationPath}
+ loadDirectoryContent={loadDirectoryContent}
+ switchPerspective={switchPerspective}
+ setSelectedEntries={setSelectedEntries}
+ openDirectory={openDirectory}
+ reflectCreateEntry={reflectCreateEntry}
+ openFsEntry={openFsEntry}
+ isReadOnlyMode={props.isReadOnlyMode}
+ isDesktopMode={isDesktopMode}
+ openRenameDirectoryDialog={() =>
+ setIsRenameEntryDialogOpened(true)
+ }
+ />
</div>
</div>
<div
@@ -563,6 +516,9 @@ const FolderContainer = (props: Props) => {
aria-label="change perspective"
exclusive
className={classes.perspecitveSwitch}
+ /* style={{
+ right: rightPanelWidth + 30
+ }} */
>
<ToggleButton
value={perspectives.DEFAULT}
@@ -617,13 +573,15 @@ function mapStateToProps(state) {
locations: getLocations(state),
maxSearchResults: getMaxSearchResults(state),
isDesktopMode: getDesktopMode(state),
- isReadOnlyMode: isReadOnlyMode(state)
+ isReadOnlyMode: isReadOnlyMode(state),
+ progress: getProgress(state)
};
}
function mapActionCreatorsToProps(dispatch) {
return bindActionCreators(
{
+ toggleUploadDialog: AppActions.toggleUploadDialog,
addTags: TaggingActions.addTags,
removeTags: TaggingActions.removeTags,
removeAllTags: TaggingActions.removeAllTags,
@@ -646,7 +604,10 @@ function mapActionCreatorsToProps(dispatch) {
);
}
-const areEqual = (prevProp, nextProp) =>
+const areEqual = (prevProp: Props, nextProp: Props) =>
+ // nextProp.rightPanelWidth === prevProp.rightPanelWidth &&
+ nextProp.drawerOpened === prevProp.drawerOpened &&
+ nextProp.isDesktopMode === prevProp.isDesktopMode &&
nextProp.currentDirectoryPath === prevProp.currentDirectoryPath &&
nextProp.currentDirectoryPerspective ===
prevProp.currentDirectoryPerspective &&
@@ -662,5 +623,7 @@ const areEqual = (prevProp, nextProp) =>
export default connect(
mapStateToProps,
mapActionCreatorsToProps
+)(
// @ts-ignore
-)(withStyles(styles)(withTheme(React.memo(FolderContainer, areEqual))));
+ React.memo(withStyles(styles, { withTheme: true })(FolderContainer), areEqual)
+);
diff --git a/app/components/HelpFeedbackPanel.tsx b/app/components/HelpFeedbackPanel.tsx
index c386f934c..3fab03e1b 100644
--- a/app/components/HelpFeedbackPanel.tsx
+++ b/app/components/HelpFeedbackPanel.tsx
@@ -20,8 +20,6 @@ import React, { useState } from 'react';
import { withStyles } from '@material-ui/core/styles';
import classNames from 'classnames';
import Typography from '@material-ui/core/Typography';
-import CardActions from '@material-ui/core/CardActions';
-import CardContent from '@material-ui/core/CardContent';
import Button from '@material-ui/core/Button';
import Tooltip from '@material-ui/core/Tooltip';
import Avatar from '@material-ui/core/Avatar';
@@ -35,7 +33,6 @@ import AboutIcon from '@material-ui/icons/BlurOn';
import ChangeLogIcon from '@material-ui/icons/ImportContacts';
import OnboardingIcon from '@material-ui/icons/Explore';
import WebClipperIcon from '@material-ui/icons/Transform';
-// import AccountIcon from '@material-ui/icons/AccountCircle';
import EmailIcon from '@material-ui/icons/Email';
import IssueIcon from '@material-ui/icons/BugReport';
import TranslationIcon from '@material-ui/icons/Translate';
@@ -44,20 +41,18 @@ import SocialIcon from '@material-ui/icons/ThumbUp';
import Social2Icon from '@material-ui/icons/Mood';
import KeyShortcutsIcon from '@material-ui/icons/Keyboard';
import ProTeaserIcon from '@material-ui/icons/FlightTakeoff';
-// import { AmplifySignOut } from '@aws-amplify/ui-react';
import ExitToAppIcon from '@material-ui/icons/ExitToApp';
import { connect } from 'react-redux';
import { CognitoUserInterface } from '@aws-amplify/ui-components';
import Auth from '@aws-amplify/auth';
import { bindActionCreators } from 'redux';
-import CustomLogo from './CustomLogo';
-import ProTeaser from '../assets/images/spacerocket_undraw.svg';
import styles from './SidePanels.css';
import i18n from '../services/i18n';
import { clearAllURLParams } from '-/utils/misc';
import { Pro } from '-/pro';
import { actions as AppActions } from '-/reducers/app';
import Links from '-/links';
+import { AppConfig } from '-/config';
interface Props {
classes?: any;
@@ -70,6 +65,7 @@ interface Props {
user: CognitoUserInterface;
style?: any;
closeAllVerticalPanels: () => void;
+ reduceHeightBy?: number;
}
const HelpFeedbackPanel = (props: Props) => {
@@ -84,7 +80,8 @@ const HelpFeedbackPanel = (props: Props) => {
toggleKeysDialog,
toggleOnboardingDialog,
toggleProTeaser,
- theme
+ theme,
+ reduceHeightBy
} = props;
const signOut = () => {
@@ -107,8 +104,13 @@ const HelpFeedbackPanel = (props: Props) => {
}
return (
- <div className={classes.panel} style={props.style}>
- <CustomLogo />
+ <div
+ className={classes.panel}
+ style={{
+ display: 'flex',
+ flexDirection: 'column'
+ }}
+ >
{props.user && (
<>
<Typography
@@ -224,219 +226,168 @@ const HelpFeedbackPanel = (props: Props) => {
</Box>
</>
)}
- <Typography
- className={classNames(classes.panelTitle, classes.header)}
- variant="subtitle1"
+ <div className={classes.toolbar}>
+ <Typography
+ className={classNames(classes.panelTitle, classes.header)}
+ variant="subtitle1"
+ >
+ {i18n.t('core:helpFeedback')}
+ </Typography>
+ </div>
+ <List
+ dense={false}
+ component="nav"
+ aria-label="main help area"
+ style={{
+ height: 'calc(100% - ' + reduceHeightBy + 'px)',
+ //@ts-ignore
+ overflowY: AppConfig.isFirefox ? 'auto' : 'overlay'
+ }}
>
- Help & Feedback
- </Typography>
- <div className={classes.helpFeedbackArea}>
- <List dense={false} component="nav" aria-label="main help area">
- <ListItem
- button
- onClick={toggleAboutDialog}
- title="Opens the about dialog"
- data-tid="aboutDialog"
- >
- <ListItemIcon>
- <AboutIcon />
- </ListItemIcon>
- <Typography style={{ color: theme.palette.text.primary }}>
- {i18n.t('core:aboutTitle')}
- </Typography>
- </ListItem>
- <ListItem
- button
- onClick={() =>
- openURLExternally(Links.documentationLinks.general, true)
- }
- >
- <ListItemIcon>
- <DocumentationIcon />
- </ListItemIcon>
- <Typography style={{ color: theme.palette.text.primary }}>
- {i18n.t('core:documentation')}
- </Typography>
- </ListItem>
- <ListItem button onClick={toggleKeysDialog}>
- <ListItemIcon>
- <KeyShortcutsIcon />
- </ListItemIcon>
- <Typography style={{ color: theme.palette.text.primary }}>
- {i18n.t('core:shortcutKeys')}
- </Typography>
- </ListItem>
- <ListItem
- button
- onClick={() => openURLExternally(Links.links.changelogURL, true)}
- title="Opens the changelog of the app"
- >
- <ListItemIcon>
- <ChangeLogIcon />
- </ListItemIcon>
- <Typography style={{ color: theme.palette.text.primary }}>
- {i18n.t('core:whatsNew')}
- </Typography>
- </ListItem>
- <ListItem button onClick={toggleOnboardingDialog}>
- <ListItemIcon>
- <OnboardingIcon />
- </ListItemIcon>
- <Typography style={{ color: theme.palette.text.primary }}>
- {i18n.t('core:onboardingWizard')}
- </Typography>
- </ListItem>
- <ListItem
- button
- onClick={() => openURLExternally(Links.links.webClipper, true)}
- >
- <ListItemIcon>
- <WebClipperIcon />
- </ListItemIcon>
- <Typography style={{ color: theme.palette.text.primary }}>
- {i18n.t('core:webClipper')}
- </Typography>
- </ListItem>
- <Divider />
- <ListItem
- button
- onClick={() => openURLExternally(Links.links.suggestFeature, true)}
- >
- <ListItemIcon>
- <NewFeatureIcon />
- </ListItemIcon>
- <Typography style={{ color: theme.palette.text.primary }}>
- {i18n.t('core:suggestNewFeatures')}
- </Typography>
- </ListItem>
- <ListItem
- button
- onClick={() => openURLExternally(Links.links.reportIssue, true)}
- >
- <ListItemIcon>
- <IssueIcon />
- </ListItemIcon>
- <Typography style={{ color: theme.palette.text.primary }}>
- {i18n.t('core:reportIssues')}
- </Typography>
- </ListItem>
- <ListItem
- button
- onClick={() => openURLExternally(Links.links.helpTranslating, true)}
- >
- <ListItemIcon>
- <TranslationIcon />
- </ListItemIcon>
- <Typography style={{ color: theme.palette.text.primary }}>
- {i18n.t('core:helpWithTranslation')}
- </Typography>
- </ListItem>
- <Divider />
- <ListItem
- button
- onClick={() => openURLExternally(Links.links.emailContact, true)}
- >
- <ListItemIcon>
- <EmailIcon />
- </ListItemIcon>
- <Typography style={{ color: theme.palette.text.primary }}>
- {i18n.t('core:emailContact')}
- </Typography>
- </ListItem>
- <ListItem
- button
- onClick={() => openURLExternally(Links.links.twitter)}
- >
- <ListItemIcon>
- <Social2Icon />
- </ListItemIcon>
- <Typography style={{ color: theme.palette.text.primary }}>
- {i18n.t('core:followOnTwitter')}
- </Typography>
- </ListItem>
- <ListItem
- button
- onClick={() => openURLExternally(Links.links.facebook)}
- >
- <ListItemIcon>
- <SocialIcon />
- </ListItemIcon>
- <Typography style={{ color: theme.palette.text.primary }}>
- {i18n.t('core:likeUsOnFacebook')}
- </Typography>
- </ListItem>
- {Pro && (
- <React.Fragment>
- <Divider />
- <ListItem button onClick={toggleProTeaser}>
- <ListItemIcon>
- <ProTeaserIcon />
- </ListItemIcon>
- <Typography style={{ color: theme.palette.text.primary }}>
- {i18n.t('TagSpaces Pro Overview')}
- </Typography>
- </ListItem>
- </React.Fragment>
- )}
- </List>
- {!Pro && (
- <React.Fragment>
- {/* <Divider /> */}
- <div
- onClick={toggleProTeaser}
- role="button"
- tabIndex={0}
- style={{
- backgroundColor: 'rgba(29, 209, 159, 0.08)',
- textAlign: 'center'
- }}
- >
- <CardContent
- style={{
- paddingBottom: 0
- }}
- >
- <Typography color="textSecondary" gutterBottom>
- Achieve more with
- </Typography>
- <Typography variant="h6" component="h2" color="textPrimary">
- TagSpaces Pro
- </Typography>
- <img
- style={{ maxHeight: 80, marginTop: 10 }}
- src={ProTeaser}
- alt=""
- />
- </CardContent>
- <CardActions
- style={{ flexDirection: 'row', justifyContent: 'center' }}
- >
- <Button
- size="small"
- onClick={(event: any) => {
- event.preventDefault();
- event.stopPropagation();
- toggleProTeaser();
- }}
- >
- Learn More
- </Button>
- <Button
- size="small"
- onClick={(event: any) => {
- event.preventDefault();
- event.stopPropagation();
- openURLExternally(Links.links.productsOverview, true);
- }}
- >
- Get It
- </Button>
- </CardActions>
- </div>
- {/* <Divider /> */}
- </React.Fragment>
+ <ListItem
+ button
+ onClick={toggleAboutDialog}
+ title="Opens the about dialog"
+ data-tid="aboutDialog"
+ >
+ <ListItemIcon>
+ <AboutIcon />
+ </ListItemIcon>
+ <Typography style={{ color: theme.palette.text.primary }}>
+ {i18n.t('core:aboutTitle')}
+ </Typography>
+ </ListItem>
+ <ListItem
+ button
+ onClick={() =>
+ openURLExternally(Links.documentationLinks.general, true)
+ }
+ >
+ <ListItemIcon>
+ <DocumentationIcon />
+ </ListItemIcon>
+ <Typography style={{ color: theme.palette.text.primary }}>
+ {i18n.t('core:documentation')}
+ </Typography>
+ </ListItem>
+ <ListItem button onClick={toggleKeysDialog}>
+ <ListItemIcon>
+ <KeyShortcutsIcon />
+ </ListItemIcon>
+ <Typography style={{ color: theme.palette.text.primary }}>
+ {i18n.t('core:shortcutKeys')}
+ </Typography>
+ </ListItem>
+ <ListItem
+ button
+ onClick={() => openURLExternally(Links.links.changelogURL, true)}
+ title="Opens the changelog of the app"
+ >
+ <ListItemIcon>
+ <ChangeLogIcon />
+ </ListItemIcon>
+ <Typography style={{ color: theme.palette.text.primary }}>
+ {i18n.t('core:whatsNew')}
+ </Typography>
+ </ListItem>
+ <ListItem button onClick={toggleOnboardingDialog}>
+ <ListItemIcon>
+ <OnboardingIcon />
+ </ListItemIcon>
+ <Typography style={{ color: theme.palette.text.primary }}>
+ {i18n.t('core:onboardingWizard')}
+ </Typography>
+ </ListItem>
+ <ListItem
+ button
+ onClick={() => openURLExternally(Links.links.webClipper, true)}
+ >
+ <ListItemIcon>
+ <WebClipperIcon />
+ </ListItemIcon>
+ <Typography style={{ color: theme.palette.text.primary }}>
+ {i18n.t('core:webClipper')}
+ </Typography>
+ </ListItem>
+ <Divider />
+ <ListItem
+ button
+ onClick={() => openURLExternally(Links.links.suggestFeature, true)}
+ >
+ <ListItemIcon>
+ <NewFeatureIcon />
+ </ListItemIcon>
+ <Typography style={{ color: theme.palette.text.primary }}>
+ {i18n.t('core:suggestNewFeatures')}
+ </Typography>
+ </ListItem>
+ <ListItem
+ button
+ onClick={() => openURLExternally(Links.links.reportIssue, true)}
+ >
+ <ListItemIcon>
+ <IssueIcon />
+ </ListItemIcon>
+ <Typography style={{ color: theme.palette.text.primary }}>
+ {i18n.t('core:reportIssues')}
+ </Typography>
+ </ListItem>
+ <ListItem
+ button
+ onClick={() => openURLExternally(Links.links.helpTranslating, true)}
+ >
+ <ListItemIcon>
+ <TranslationIcon />
+ </ListItemIcon>
+ <Typography style={{ color: theme.palette.text.primary }}>
+ {i18n.t('core:helpWithTranslation')}
+ </Typography>
+ </ListItem>
+ <Divider />
+ <ListItem
+ button
+ onClick={() => openURLExternally(Links.links.emailContact, true)}
+ >
+ <ListItemIcon>
+ <EmailIcon />
+ </ListItemIcon>
+ <Typography style={{ color: theme.palette.text.primary }}>
+ {i18n.t('core:emailContact')}
+ </Typography>
+ </ListItem>
+ <ListItem button onClick={() => openURLExternally(Links.links.twitter)}>
+ <ListItemIcon>
+ <Social2Icon />
+ </ListItemIcon>
+ <Typography style={{ color: theme.palette.text.primary }}>
+ {i18n.t('core:followOnTwitter')}
+ </Typography>
+ </ListItem>
+ <ListItem
+ button
+ onClick={() => openURLExternally(Links.links.facebook)}
+ >
+ <ListItemIcon>
+ <SocialIcon />
+ </ListItemIcon>
+ <Typography style={{ color: theme.palette.text.primary }}>
+ {i18n.t('core:likeUsOnFacebook')}
+ </Typography>
+ </ListItem>
+ {Pro && (
+ <>
+ <Divider />
+ <ListItem button onClick={toggleProTeaser}>
+ <ListItemIcon>
+ <ProTeaserIcon />
+ </ListItemIcon>
+ <Typography style={{ color: theme.palette.text.primary }}>
+ {i18n.t('TagSpaces Pro Overview')}
+ </Typography>
+ </ListItem>
+ </>
)}
- </div>
+ </List>
</div>
);
};
diff --git a/app/components/LocationManager.tsx b/app/components/LocationManager.tsx
index 1d3230564..4d91831a1 100644
--- a/app/components/LocationManager.tsx
+++ b/app/components/LocationManager.tsx
@@ -20,13 +20,11 @@ import React, { useEffect, useRef, useState } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { withStyles } from '@material-ui/core/styles';
-import Button from '@material-ui/core/Button';
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
import { List } from '@material-ui/core';
import styles from './SidePanels.css';
import LocationManagerMenu from './menus/LocationManagerMenu';
import ConfirmDialog from './dialogs/ConfirmDialog';
-import CustomLogo from './CustomLogo';
import {
actions as LocationActions,
getLocations
@@ -62,13 +60,14 @@ interface Props {
openURLExternally: (path: string) => void;
toggleOpenLinkDialog: () => void;
setDefaultLocations: () => void;
- addLocation: (location: TS.Location, openAfterCreate?: boolean) => void;
addLocations: (locations: Array<TS.Location>) => void;
editLocation: () => void;
removeLocation: (location: TS.Location) => void;
moveLocation: (uuid: string, position: number) => void;
isDesktop: boolean;
isPersistTagsInSidecar: boolean;
+ reduceHeightBy: number;
+ toggleLocationDialog: () => void;
}
type SubFolder = {
@@ -81,10 +80,6 @@ type SubFolder = {
const LocationManager = (props: Props) => {
const fileInputRef = useRef<HTMLInputElement>(null);
const [selectedLocation, setSelectedLocation] = useState<TS.Location>(null);
- const [
- isCreateLocationDialogOpened,
- setCreateLocationDialogOpened
- ] = useState<boolean>(false);
const [isEditLocationDialogOpened, setEditLocationDialogOpened] = useState<
boolean
>(false);
@@ -118,20 +113,6 @@ const LocationManager = (props: Props) => {
target.value = null;
}
- /* const getItemStyle = (isDragging, draggableStyle) => ({
- // some basic styles to make the items look a bit nicer
- userSelect: 'none',
- // change background colour if dragging
- background: isDragging ? 'lightgreen' : 'transparent',
-
- // styles we need to apply on draggables
- ...draggableStyle
- });
-
- const getListStyle = isDraggingOver => ({
- background: isDraggingOver ? 'lightblue' : 'transparent',
- }); */
-
const onDragEnd = result => {
// dropped outside the list
if (!result.destination) {
@@ -141,11 +122,15 @@ const LocationManager = (props: Props) => {
props.moveLocation(result.draggableId, result.destination.index);
};
- const { classes, isDesktop } = props;
+ const { classes, reduceHeightBy } = props;
return (
- <div className={classes.panel} style={props.style}>
- <CustomLogo />
-
+ <div
+ className={classes.panel}
+ style={{
+ display: 'flex',
+ flexDirection: 'column'
+ }}
+ >
<LocationManagerMenu
importLocations={() => {
fileInputRef.current.click();
@@ -154,129 +139,66 @@ const LocationManager = (props: Props) => {
exportLocations={() => setExportLocationsDialogOpened(true)}
classes={classes}
openURLExternally={props.openURLExternally}
- showCreateLocationDialog={() => {
- setCreateLocationDialogOpened(true);
- }}
+ showCreateLocationDialog={props.toggleLocationDialog}
toggleOpenLinkDialog={props.toggleOpenLinkDialog}
/>
- {!AppConfig.locationsReadOnly && (
- <div
- style={{
- width: '100%',
- textAlign: 'center',
- marginBottom: 10
- }}
- >
- <Button
- data-tid="createNewLocation"
- onClick={() => setCreateLocationDialogOpened(true)}
- title={i18n.t('core:createLocationTitle')}
- className={classes.mainActionButton}
- size="small"
- variant="outlined"
- color="primary"
- style={{ width: '95%' }}
- >
- {/* <CreateLocationIcon className={classNames(classes.leftIcon)} /> */}
- {i18n.t('core:createLocationTitle')}
- </Button>
- </div>
- )}
- <div>
- {isCreateLocationDialogOpened && (
- <CreateEditLocationDialogAsync
- open={isCreateLocationDialogOpened}
- onClose={() => setCreateLocationDialogOpened(false)}
- addLocation={props.addLocation}
- isPersistTagsInSidecar={props.isPersistTagsInSidecar}
- />
- )}
- {isEditLocationDialogOpened && (
- <CreateEditLocationDialogAsync
- open={isEditLocationDialogOpened}
- onClose={() => setEditLocationDialogOpened(false)}
- location={selectedLocation}
- editLocation={props.editLocation}
- isPersistTagsInSidecar={props.isPersistTagsInSidecar}
- />
- )}
- {isDeleteLocationDialogOpened && (
- <ConfirmDialog
- open={isDeleteLocationDialogOpened}
- onClose={() => setDeleteLocationDialogOpened(false)}
- title={i18n.t('core:deleteLocationTitleAlert')}
- content={i18n.t('core:deleteLocationContentAlert', {
- locationName: selectedLocation ? selectedLocation.name : ''
- })}
- confirmCallback={result => {
- if (result && selectedLocation) {
- props.removeLocation(selectedLocation);
- }
- }}
- cancelDialogTID="cancelDeleteLocationDialog"
- confirmDialogTID="confirmDeleteLocationDialog"
- />
- )}
- <List
- className={classes.locationListArea}
- data-tid="locationList"
- style={{
- maxHeight: isDesktop
- ? 'calc(100vh - 175px)'
- : 'calc(100vh - 225px)',
- // @ts-ignore
- overflowY: AppConfig.isFirefox ? 'auto' : 'overlay'
- }}
- >
- <DragDropContext onDragEnd={onDragEnd}>
- <Droppable droppableId="droppable">
- {(provided, snapshot) => (
- <div
- {...provided.droppableProps}
- ref={provided.innerRef}
- /* style={getListStyle(snapshot.isDraggingOver)} */
- >
- {props.locations.map((location, index) => (
- <Draggable
- key={location.uuid}
- draggableId={location.uuid}
- index={index}
- >
- {(prov, snap) => (
- <div
- ref={prov.innerRef}
- {...prov.draggableProps}
- {...prov.dragHandleProps}
- /* style={getItemStyle(
+ <List
+ className={classes.locationListArea}
+ data-tid="locationList"
+ style={{
+ height: 'calc(100% - ' + reduceHeightBy + 'px)',
+ // @ts-ignore
+ overflowY: AppConfig.isFirefox ? 'auto' : 'overlay'
+ }}
+ >
+ <DragDropContext onDragEnd={onDragEnd}>
+ <Droppable droppableId="droppable">
+ {(provided, snapshot) => (
+ <div
+ {...provided.droppableProps}
+ ref={provided.innerRef}
+ /* style={getListStyle(snapshot.isDraggingOver)} */
+ >
+ {props.locations.map((location, index) => (
+ <Draggable
+ key={location.uuid}
+ draggableId={location.uuid}
+ index={index}
+ >
+ {(prov, snap) => (
+ <div
+ ref={prov.innerRef}
+ {...prov.draggableProps}
+ {...prov.dragHandleProps}
+ /* style={getItemStyle(
snap.isDragging,
prov.draggableProps.style
)} */
- >
- <LocationView
- key={location.uuid}
- classes={props.classes}
- location={location}
- hideDrawer={props.hideDrawer}
- setEditLocationDialogOpened={
- setEditLocationDialogOpened
- }
- setDeleteLocationDialogOpened={
- setDeleteLocationDialogOpened
- }
- selectedLocation={selectedLocation}
- setSelectedLocation={setSelectedLocation}
- />
- </div>
- )}
- </Draggable>
- ))}
- {provided.placeholder}
- </div>
- )}
- </Droppable>
- </DragDropContext>
- </List>
- </div>
+ >
+ <LocationView
+ key={location.uuid}
+ classes={props.classes}
+ location={location}
+ hideDrawer={props.hideDrawer}
+ setEditLocationDialogOpened={
+ setEditLocationDialogOpened
+ }
+ setDeleteLocationDialogOpened={
+ setDeleteLocationDialogOpened
+ }
+ selectedLocation={selectedLocation}
+ setSelectedLocation={setSelectedLocation}
+ />
+ </div>
+ )}
+ </Draggable>
+ ))}
+ {provided.placeholder}
+ </div>
+ )}
+ </Droppable>
+ </DragDropContext>
+ </List>
<input
style={{ display: 'none' }}
ref={fileInputRef}
@@ -284,6 +206,32 @@ const LocationManager = (props: Props) => {
type="file"
onChange={handleFileInputChange}
/>
+ {isEditLocationDialogOpened && (
+ <CreateEditLocationDialogAsync
+ open={isEditLocationDialogOpened}
+ onClose={() => setEditLocationDialogOpened(false)}
+ location={selectedLocation}
+ editLocation={props.editLocation}
+ isPersistTagsInSidecar={props.isPersistTagsInSidecar}
+ />
+ )}
+ {isDeleteLocationDialogOpened && (
+ <ConfirmDialog
+ open={isDeleteLocationDialogOpened}
+ onClose={() => setDeleteLocationDialogOpened(false)}
+ title={i18n.t('core:deleteLocationTitleAlert')}
+ content={i18n.t('core:deleteLocationContentAlert', {
+ locationName: selectedLocation ? selectedLocation.name : ''
+ })}
+ confirmCallback={result => {
+ if (result && selectedLocation) {
+ props.removeLocation(selectedLocation);
+ }
+ }}
+ cancelDialogTID="cancelDeleteLocationDialog"
+ confirmDialogTID="confirmDeleteLocationDialog"
+ />
+ )}
{ExportLocationsDialog && isExportLocationsDialogOpened && (
<ExportLocationsDialog
open={isExportLocationsDialogOpened}
@@ -318,13 +266,13 @@ function mapDispatchToProps(dispatch) {
return bindActionCreators(
{
setDefaultLocations: LocationActions.setDefaultLocations,
- addLocation: LocationActions.addLocation,
addLocations: LocationActions.addLocations,
editLocation: LocationActions.editLocation,
removeLocation: LocationActions.removeLocation,
moveLocation: LocationActions.moveLocation,
toggleOpenLinkDialog: AppActions.toggleOpenLinkDialog,
- openURLExternally: AppActions.openURLExternally
+ openURLExternally: AppActions.openURLExternally,
+ toggleLocationDialog: AppActions.toggleLocationDialog
},
dispatch
);
diff --git a/app/components/MobileNavigation.tsx b/app/components/MobileNavigation.tsx
index 9c52ec909..6b0281d52 100644
--- a/app/components/MobileNavigation.tsx
+++ b/app/components/MobileNavigation.tsx
@@ -23,17 +23,27 @@ import { bindActionCreators } from 'redux';
import classNames from 'classnames';
import Tooltip from '@material-ui/core/Tooltip';
import ToggleButton from '@material-ui/lab/ToggleButton';
+import Button from '@material-ui/core/Button';
+import ButtonGroup from '@material-ui/core/ButtonGroup';
import ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
import IconButton from '@material-ui/core/IconButton';
-import NewFileIcon from '@material-ui/icons/AddCircle';
+import Typography from '@material-ui/core/Typography';
+import ThemingIcon from '@material-ui/icons/InvertColors';
import LocationsIcon from '@material-ui/icons/WorkOutline';
+import CreateIcon from '@material-ui/icons/Add';
import TagLibraryIcon from '@material-ui/icons/LocalOfferOutlined';
-import SearchIcon from '@material-ui/icons/SearchOutlined';
+import RecentThingsIcon from '@material-ui/icons/History';
import HelpIcon from '@material-ui/icons/HelpOutline';
import AccountCircleIcon from '@material-ui/icons/AccountCircle';
import SettingsIcon from '@material-ui/icons/Settings';
import { withStyles } from '@material-ui/core/styles';
+import CardActions from '@material-ui/core/CardActions';
+import CardContent from '@material-ui/core/CardContent';
import { CognitoUserInterface } from '@aws-amplify/ui-components';
+import CloseIcon from '@material-ui/icons/Close';
+import ProTeaser from '../assets/images/spacerocket_undraw.svg';
+import { Pro } from '-/pro';
+import CustomLogo from './CustomLogo';
import TagLibrary from '../components/TagLibrary';
import Search from '../components/Search';
import LocationManager from '../components/LocationManager';
@@ -51,16 +61,11 @@ import {
} from '../reducers/app';
import LoadingLazy from './LoadingLazy';
import { actions as SettingsActions, isFirstRun } from '../reducers/settings';
+import Links from '-/links';
const styles: any = (theme: any) => ({
- bottomToolbar: {
- paddingTop: 9,
- paddingBottom: 3,
- textAlign: 'center',
- backgroundColor: theme.palette.background.default
- },
selectedButton: {
- backgroundColor: '#880E4F'
+ backgroundColor: theme.palette.primary.light
}
});
@@ -92,22 +97,28 @@ interface Props {
isHelpFeedbackPanelOpened: boolean;
openHelpFeedbackPanel: () => void;
closeAllVerticalPanels: () => void;
- openURLExternally: (url: string) => void;
+ toggleLocationDialog: () => void;
+ openURLExternally: (url: string, skipConfirmation?: boolean) => void;
switchTheme: () => void;
- hideDrawer: () => void;
+ hideDrawer?: () => void;
isReadOnlyMode: boolean;
showNotification: (message: string) => void;
directoryPath: string;
user: CognitoUserInterface;
+ width?: number;
+ theme: any;
}
const MobileNavigation = (props: Props) => {
const [isProTeaserVisible, setIsProTeaserVisible] = useState<boolean>(false);
+ const [showTeaserBanner, setShowTeaserBanner] = useState<boolean>(true);
const toggleProTeaser = () => {
setIsProTeaserVisible(!isProTeaserVisible);
};
+ const showProTeaser = !Pro && showTeaserBanner;
+
const {
classes,
toggleCreateFileDialog,
@@ -123,25 +134,82 @@ const MobileNavigation = (props: Props) => {
hideDrawer,
openURLExternally,
directoryPath,
+ width,
+ theme,
+ switchTheme,
user
} = props;
return (
- <div style={{ height: '100%' }}>
- <style>
- {`
- #verticalNavButton:hover {
- background-color: #880E4F;
- }
- `}
- </style>
- <div style={{ width: 300, maxWidth: 300, height: 'calc(100% - 60px)' }}>
+ <div
+ className={classes.root}
+ style={{
+ backgroundColor: theme.palette.background.paper,
+ height: '100%',
+ overflow: 'hidden',
+ width: width || 320,
+ maxWidth: width || 320
+ }}
+ >
+ <div
+ style={{
+ overflow: 'hidden',
+ height: showProTeaser ? 'calc(100% - 220px)' : 'calc(100% - 55px)'
+ }}
+ >
+ <CustomLogo />
+ <ButtonGroup
+ // variant="text"
+ color="primary"
+ aria-label="text primary button group"
+ style={{
+ textAlign: 'center',
+ display: 'block',
+ whiteSpace: 'nowrap',
+ marginBottom: 20
+ }}
+ >
+ <Tooltip title={i18n.t('core:createFileTitle')}>
+ <Button
+ data-tid="createNewLocation"
+ onClick={() => {
+ if (props.isReadOnlyMode || !directoryPath) {
+ showNotification(
+ 'You are in read-only mode or there is no opened location'
+ );
+ } else {
+ toggleCreateFileDialog();
+ hideDrawer();
+ }
+ }}
+ size="small"
+ color="primary"
+ >
+ <CreateIcon />
+ &nbsp;
+ {i18n.t('core:new')}
+ </Button>
+ </Tooltip>
+ <Tooltip title={i18n.t('core:createLocationTitle')}>
+ <Button
+ data-tid="createNewLocation"
+ onClick={props.toggleLocationDialog}
+ size="small"
+ color="primary"
+ >
+ <LocationsIcon />
+ &nbsp;
+ {i18n.t('core:createLocationTitle')}
+ </Button>
+ </Tooltip>
+ </ButtonGroup>
{props.isLocationManagerPanelOpened && (
- <LocationManager hideDrawer={hideDrawer} />
+ <LocationManager reduceHeightBy={180} />
)}
- {props.isTagLibraryPanelOpened && <TagLibrary />}
- {props.isSearchPanelOpened && <Search hideDrawer={hideDrawer} />}
+ {props.isTagLibraryPanelOpened && <TagLibrary reduceHeightBy={180} />}
+ {props.isSearchPanelOpened && <Search />}
{props.isHelpFeedbackPanelOpened && (
<HelpFeedbackPanel
+ reduceHeightBy={180}
openURLExternally={openURLExternally}
toggleAboutDialog={toggleAboutDialog}
toggleKeysDialog={toggleKeysDialog}
@@ -150,14 +218,73 @@ const MobileNavigation = (props: Props) => {
/>
)}
</div>
- <div className={classes.bottomToolbar}>
+ <div
+ style={{
+ textAlign: 'center'
+ }}
+ >
+ {showProTeaser && (
+ <>
+ <CardContent
+ onClick={toggleProTeaser}
+ style={{
+ padding: 5,
+ paddingBottom: 0,
+ textAlign: 'center'
+ }}
+ >
+ <Typography color="textSecondary" variant="caption">
+ achieve more with
+ <IconButton
+ style={{ right: 5, marginTop: -10, position: 'absolute' }}
+ size="small"
+ aria-label="close"
+ onClick={event => {
+ event.preventDefault();
+ event.stopPropagation();
+ setShowTeaserBanner(false);
+ }}
+ >
+ <CloseIcon fontSize="small" />
+ </IconButton>
+ </Typography>
+ <Typography variant="h6" component="h2" color="textPrimary">
+ TagSpaces Pro
+ </Typography>
+ <img style={{ maxHeight: 60 }} src={ProTeaser} alt="" />
+ </CardContent>
+ <CardActions
+ style={{ flexDirection: 'row', justifyContent: 'center' }}
+ >
+ <Button
+ size="small"
+ onClick={(event: any) => {
+ event.preventDefault();
+ event.stopPropagation();
+ toggleProTeaser();
+ }}
+ >
+ Learn More
+ </Button>
+ <Button
+ size="small"
+ onClick={(event: any) => {
+ event.preventDefault();
+ event.stopPropagation();
+ openURLExternally(Links.links.productsOverview, true);
+ }}
+ >
+ Get It
+ </Button>
+ </CardActions>
+ </>
+ )}
<Tooltip title={i18n.t('core:settings')}>
<IconButton
id="verticalNavButton"
data-tid="settings"
onClick={() => {
toggleSettingsDialog();
- hideDrawer();
}}
style={{ marginTop: -15, marginRight: 2 }}
>
@@ -167,7 +294,6 @@ const MobileNavigation = (props: Props) => {
<ToggleButtonGroup exclusive>
<Tooltip title={i18n.t('core:locationManager')}>
<ToggleButton
- id="verticalNavButton"
onClick={openLocationManagerPanel}
className={
props.isLocationManagerPanelOpened
@@ -181,7 +307,6 @@ const MobileNavigation = (props: Props) => {
</Tooltip>
<Tooltip title={i18n.t('core:tagLibrary')}>
<ToggleButton
- id="verticalNavButton"
data-tid="tagLibrary"
onClick={openTagLibraryPanel}
className={
@@ -195,7 +320,6 @@ const MobileNavigation = (props: Props) => {
</Tooltip>
<Tooltip title={i18n.t('core:searchTitle')}>
<ToggleButton
- id="verticalNavButton"
data-tid="search"
onClick={openSearchPanel}
className={
@@ -204,12 +328,11 @@ const MobileNavigation = (props: Props) => {
: classes.button
}
>
- <SearchIcon />
+ <RecentThingsIcon />
</ToggleButton>
</Tooltip>
<Tooltip title={i18n.t('core:helpFeedback')}>
<ToggleButton
- id="verticalNavButton"
data-tid="helpFeedback"
onClick={openHelpFeedbackPanel}
className={
@@ -222,23 +345,13 @@ const MobileNavigation = (props: Props) => {
</ToggleButton>
</Tooltip>
</ToggleButtonGroup>
- <Tooltip title={i18n.t('core:createFileTitle')}>
+ <Tooltip title={i18n.t('core:switchTheme')}>
<IconButton
- id="verticalNavButton"
- onClick={() => {
- if (props.isReadOnlyMode || !directoryPath) {
- showNotification(
- 'You are in read-only mode or there is no opened location'
- );
- } else {
- toggleCreateFileDialog();
- hideDrawer();
- }
- }}
- style={{ marginTop: -15, marginLeft: 2 }}
- data-tid="locationManager"
+ data-tid="switchTheme"
+ onClick={switchTheme}
+ style={{ marginTop: -15, marginRight: 2 }}
>
- <NewFileIcon />
+ <ThemingIcon className={classes.buttonIcon} />
</IconButton>
</Tooltip>
{isProTeaserVisible && (
@@ -279,6 +392,7 @@ function mapActionCreatorsToProps(dispatch) {
openLocationManagerPanel: AppActions.openLocationManagerPanel,
openTagLibraryPanel: AppActions.openTagLibraryPanel,
openSearchPanel: AppActions.openSearchPanel,
+ toggleLocationDialog: AppActions.toggleLocationDialog,
openHelpFeedbackPanel: AppActions.openHelpFeedbackPanel,
openURLExternally: AppActions.openURLExternally,
showNotification: AppActions.showNotification,
@@ -293,4 +407,4 @@ function mapActionCreatorsToProps(dispatch) {
export default connect(
mapStateToProps,
mapActionCreatorsToProps
-)(withStyles(styles)(MobileNavigation));
+)(withStyles(styles, { withTheme: true })(MobileNavigation));
diff --git a/app/components/PathBreadcrumbs.tsx b/app/components/PathBreadcrumbs.tsx
new file mode 100644
index 000000000..323d94dcb
--- /dev/null
+++ b/app/components/PathBreadcrumbs.tsx
@@ -0,0 +1,220 @@
+/**
+ * TagSpaces - universal file and folder organizer
+ * Copyright (C) 2021-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, { useState } from 'react';
+import { emphasize, withStyles, Theme } from '@material-ui/core/styles';
+import Breadcrumbs from '@material-ui/core/Breadcrumbs';
+import Chip from '@material-ui/core/Chip';
+import ExpandMoreIcon from '@material-ui/icons/MoreVert';
+import PlatformIO from '../services/platform-io';
+import LocationMenu from './menus/LocationMenu';
+import { normalizePath, extractShortDirectoryName } from '-/utils/paths';
+import i18n from '../services/i18n';
+import DirectoryMenu from './menus/DirectoryMenu';
+import { TS } from '-/tagspaces.namespace';
+
+const StyledBreadcrumb = withStyles((theme: Theme) => ({
+ root: {
+ backgroundColor: emphasize(theme.palette.background.default, 0.06),
+ height: theme.spacing(3),
+ color: theme.palette.text.primary,
+ fontWeight: theme.typography.fontWeightRegular,
+ '&:hover, &:focus': {
+ backgroundColor: emphasize(theme.palette.background.default, 0.22)
+ }
+ // '&:active': {
+ // boxShadow: theme.shadows[1],
+ // backgroundColor: emphasize(theme.palette.grey[300], 0.12)
+ // }
+ }
+}))(Chip) as typeof Chip;
+
+const NoWrapBreadcrumb = withStyles({
+ root: {
+ marginTop: 5
+ },
+ ol: {
+ flexWrap: 'nowrap'
+ }
+})(Breadcrumbs);
+
+interface Props {
+ currentDirectoryPath: string;
+ currentLocationPath: string;
+ loadDirectoryContent: (path: string, generateThumbnails: boolean) => void;
+ switchPerspective: (perspectiveId: string) => void;
+ setSelectedEntries: (selectedEntries: Array<Object>) => void;
+ openDirectory: () => void;
+ reflectCreateEntry: (path: string, isFile: boolean) => void;
+ openFsEntry: (fsEntry: TS.FileSystemEntry) => void;
+ isReadOnlyMode: boolean;
+ openRenameDirectoryDialog: () => void;
+ isDesktopMode: boolean;
+}
+
+function handleClick(event: React.MouseEvent<Element, MouseEvent>) {
+ event.preventDefault();
+ console.info('You clicked a breadcrumb.');
+}
+
+export default function PathBreadcrumbs(props: Props) {
+ let pathParts: Array<string> = [];
+
+ const [
+ directoryContextMenuAnchorEl,
+ setDirectoryContextMenuAnchorEl
+ ] = useState<null | HTMLElement>(null);
+
+ const {
+ currentDirectoryPath,
+ currentLocationPath,
+ loadDirectoryContent,
+ switchPerspective,
+ setSelectedEntries,
+ openDirectory,
+ reflectCreateEntry,
+ openFsEntry,
+ isReadOnlyMode,
+ openRenameDirectoryDialog,
+ isDesktopMode
+ } = props;
+
+ const openDirectoryMenu = (event: React.MouseEvent<Element, MouseEvent>) => {
+ event.preventDefault();
+ setSelectedEntries([]);
+ // @ts-ignore
+ setDirectoryContextMenuAnchorEl(event.currentTarget);
+ };
+
+ const closeDirectoryMenu = () => {
+ setDirectoryContextMenuAnchorEl(null);
+ };
+
+ const normalizedCurrentDirPath = normalizePath(
+ currentDirectoryPath.split('\\').join('/')
+ );
+
+ if (currentDirectoryPath) {
+ // Make the path unix like ending always with /
+ const addSlash = PlatformIO.haveObjectStoreSupport() ? '//' : '/';
+ let normalizedCurrentPath =
+ addSlash +
+ normalizePath(props.currentDirectoryPath.split('\\').join('/'));
+
+ let normalizedCurrentLocationPath = '';
+ if (currentLocationPath) {
+ normalizedCurrentLocationPath =
+ addSlash +
+ normalizePath(props.currentLocationPath.split('\\').join('/'));
+ }
+
+ while (
+ normalizedCurrentPath.lastIndexOf('/') > 0 &&
+ normalizedCurrentPath.startsWith(normalizedCurrentLocationPath)
+ ) {
+ pathParts.push(
+ normalizedCurrentPath
+ .substring(PlatformIO.haveObjectStoreSupport() ? 2 : 1)
+ .split('/')
+ .join(PlatformIO.getDirSeparator())
+ ); // TODO: optimization needed
+ normalizedCurrentPath = normalizedCurrentPath.substring(
+ 0,
+ normalizedCurrentPath.lastIndexOf('/')
+ );
+ }
+
+ // console.log('Path parts : ' + JSON.stringify(pathParts));
+ if (pathParts.length >= 1) {
+ pathParts = pathParts.slice(1, pathParts.length); // remove current directory
+ }
+ pathParts = pathParts.reverse();
+ // if (pathParts.length > 2) {
+ // pathParts = pathParts.slice(pathParts.length - 2, pathParts.length); // leave only the last 2 dirs in the path
+ // }
+ }
+
+ return (
+ <>
+ <NoWrapBreadcrumb
+ maxItems={isDesktopMode ? 3 : 1}
+ itemsAfterCollapse={isDesktopMode ? 2 : 1}
+ itemsBeforeCollapse={isDesktopMode ? 1 : 0}
+ aria-label="breadcrumb"
+ separator={
+ <span
+ style={{
+ marginLeft: -4,
+ marginRight: -4
+ }}
+ >
+ /
+ </span>
+ }
+ >
+ {/* <LocationMenu /> */}
+ {pathParts.length > 0 &&
+ pathParts.map(pathPart => (
+ <StyledBreadcrumb
+ key={pathPart}
+ component="a"
+ href="#"
+ label={extractShortDirectoryName(
+ pathPart,
+ PlatformIO.getDirSeparator()
+ )}
+ onClick={() => loadDirectoryContent(pathPart, false)}
+ title={'Navigate to: ' + pathPart}
+ />
+ ))}
+ {props.currentDirectoryPath && (
+ <StyledBreadcrumb
+ data-tid="folderContainerOpenDirMenu"
+ title={
+ i18n.t('core:openDirectoryMenu') +
+ ' - ' +
+ (currentDirectoryPath || '')
+ }
+ label={extractShortDirectoryName(
+ normalizePath(normalizedCurrentDirPath),
+ '/'
+ )}
+ deleteIcon={<ExpandMoreIcon />}
+ //onClick={handleClick}
+ onDelete={openDirectoryMenu}
+ onClick={openDirectoryMenu}
+ onContextMenu={openDirectoryMenu}
+ />
+ )}
+ </NoWrapBreadcrumb>
+ <DirectoryMenu
+ open={Boolean(directoryContextMenuAnchorEl)}
+ onClose={closeDirectoryMenu}
+ anchorEl={directoryContextMenuAnchorEl}
+ directoryPath={currentDirectoryPath}
+ loadDirectoryContent={loadDirectoryContent}
+ openRenameDirectoryDialog={openRenameDirectoryDialog}
+ openDirectory={openDirectory}
+ reflectCreateEntry={reflectCreateEntry}
+ openFsEntry={openFsEntry}
+ switchPerspective={switchPerspective}
+ isReadOnlyMode={isReadOnlyMode}
+ />
+ </>
+ );
+}
diff --git a/app/components/Search.tsx b/app/components/Search.tsx
index bc0a290fb..da6c11db5 100644
--- a/app/components/Search.tsx
+++ b/app/components/Search.tsx
@@ -54,7 +54,6 @@ import ToggleButton from '@material-ui/lab/ToggleButton';
import ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
// import { FormControlLabel, Switch } from '@material-ui/core';
import TagsSelect from './TagsSelect';
-import CustomLogo from './CustomLogo';
import { actions as AppActions, getDirectoryPath } from '../reducers/app';
import {
actions as LocationIndexActions,
@@ -607,7 +606,6 @@ const Search = (props: Props) => {
: '';
return (
<div className={classes.panel} style={props.style}>
- <CustomLogo />
<div className={classes.toolbar}>
<Typography
className={classNames(classes.panelTitle, classes.header)}
diff --git a/app/components/SidePanels.css.tsx b/app/components/SidePanels.css.tsx
index 7cac89c09..b0b2028b8 100644
--- a/app/components/SidePanels.css.tsx
+++ b/app/components/SidePanels.css.tsx
@@ -21,12 +21,8 @@ export default (theme: any) =>
({
panel: {
height: '100%',
- // maxHeight: '100%',
paddingLeft: 5,
- paddingRight: 5,
- // paddingBottom: 50,
- // overflowY: 'hidden',
- backgroundColor: theme.palette.background.default
+ paddingRight: 5
},
fontIcon: {
color: theme.palette.text.primary
@@ -38,25 +34,10 @@ export default (theme: any) =>
margin: theme.spacing(1)
},
locationListArea: {
- // paddingRight: 10, // place for scroll
paddingTop: 0,
marginTop: 0,
overflowY: AppConfig.isFirefox ? 'auto' : 'overlay'
},
- helpFeedbackArea: {
- paddingTop: 0,
- marginTop: 0,
- height: 'calc(100% - 110px)',
- maxHeight: 'calc(100% - 110px)',
- overflowY: AppConfig.isFirefox ? 'auto' : 'overlay'
- },
- taggroupsArea: {
- paddingTop: 0,
- marginTop: 0,
- height: 'calc(100% - 110px)',
- maxHeight: 'calc(100% - 110px)',
- overflowY: AppConfig.isFirefox ? 'auto' : 'overlay'
- },
searchArea: {
paddingTop: 0,
paddingLeft: 5,
diff --git a/app/components/TagContainer.tsx b/app/components/TagContainer.tsx
index 5d5c95587..0fef67052 100644
--- a/app/components/TagContainer.tsx
+++ b/app/components/TagContainer.tsx
@@ -26,8 +26,8 @@ import DateIcon from '@material-ui/icons/DateRange';
import RemoveTagIcon from '@material-ui/icons/Close';
import { getAllTags } from '-/reducers/taglibrary';
import { getTagColor, getTagTextColor } from '-/reducers/settings';
-import { isGeoTag } from '-/utils/misc';
-import { isDateTimeTag } from '-/utils/dates';
+import { isGeoTag, formatDateTime } from '-/utils/misc';
+import { isDateTimeTag, convertToDateTime, convertToDate } from '-/utils/dates';
import { TS } from '-/tagspaces.namespace';
interface Props {
@@ -81,9 +81,6 @@ const TagContainer = (props: Props) => {
isTagGeo = isGeoTag(title); // || isLatLong
isTagDate = !isTagGeo && isDateTimeTag(title);
}
- if (isTagDate && title.length > 8) {
- title = title.substr(0, 8) + '...';
- }
allTags.some((currentTag: TS.Tag) => {
if (currentTag.title === title) {
@@ -94,11 +91,6 @@ const TagContainer = (props: Props) => {
return false;
});
- let description = tag.title;
- if (tag.description) {
- description = tag.title + ' - ' + tag.description;
- }
-
let tid = 'tagContainer_';
if (title && title.length > 0) {
tid += title.replace(/ /g, '_');
@@ -129,6 +121,7 @@ const TagContainer = (props: Props) => {
color: tag.textcolor,
marginLeft: -5,
marginRight: -5,
+ height: 20,
top: 0
}}
/>
@@ -152,6 +145,25 @@ const TagContainer = (props: Props) => {
}
}
+ let tagTitle = tag.title;
+ if (isTagDate) {
+ let date;
+ if (tag.title.length > 8) {
+ date = new Date(convertToDateTime(tag.title)).getTime();
+ } else {
+ date = new Date(convertToDate(tag.title)).getTime();
+ }
+ tagTitle = formatDateTime(date, true);
+ }
+
+ if (tag.description) {
+ tagTitle = tagTitle + ' - ' + tag.description;
+ }
+
+ if (isTagDate && title.length > 8) {
+ title = title.substr(0, 8) + '...';
+ }
+
return (
<div
role="presentation"
@@ -188,7 +200,7 @@ const TagContainer = (props: Props) => {
}}
>
<Button
- title={description}
+ title={tagTitle}
size="small"
style={{
opacity: isDragging ? 0.5 : 1,
@@ -211,7 +223,7 @@ const TagContainer = (props: Props) => {
<PlaceIcon
style={{
color: tag.textcolor,
- fontSize: 18,
+ height: 20,
marginBottom: -5
}}
/>
@@ -220,7 +232,7 @@ const TagContainer = (props: Props) => {
<DateIcon
style={{
color: tag.textcolor,
- fontSize: 18,
+ height: 20,
marginBottom: -5,
marginRight: 4
}}
diff --git a/app/components/TagLibrary.tsx b/app/components/TagLibrary.tsx
index c522365b5..95789566d 100644
--- a/app/components/TagLibrary.tsx
+++ b/app/components/TagLibrary.tsx
@@ -34,7 +34,6 @@ import CreateTagsDialog from './dialogs/CreateTagsDialog';
import EditTagGroupDialog from './dialogs/EditTagGroupDialog';
import TagGroupContainer from './TagGroupContainer';
import TagMenu from './menus/TagMenu';
-import CustomLogo from './CustomLogo';
import TagLibraryMenu from './menus/TagLibraryMenu';
import TagGroupMenu from './menus/TagGroupMenu';
import {
@@ -101,6 +100,7 @@ interface Props {
locations: Array<TS.Location>;
saveTagInLocation: boolean;
moveTagGroup: (tagGroupUuid: TS.Uuid, position: number) => void;
+ reduceHeightBy: number;
}
const TagLibrary = (props: Props) => {
@@ -300,11 +300,22 @@ const TagLibrary = (props: Props) => {
}
}
- const { tagGroups, classes, allTags, showNotification } = props;
+ const {
+ tagGroups,
+ classes,
+ allTags,
+ showNotification,
+ reduceHeightBy
+ } = props;
return (
- <div className={classes.panel} style={props.style}>
- <CustomLogo />
+ <div
+ className={classes.panel}
+ style={{
+ display: 'flex',
+ flexDirection: 'column'
+ }}
+ >
<div className={classes.toolbar}>
<Typography
className={classNames(classes.panelTitle, classes.header)}
@@ -344,7 +355,6 @@ const TagLibrary = (props: Props) => {
)}
{isCreateTagGroupDialogOpened && (
<CreateTagGroupDialog
- // key={uuidv1()}
open={isCreateTagGroupDialogOpened}
onClose={() => setIsCreateTagGroupDialogOpened(false)}
createTagGroup={props.createTagGroup}
@@ -354,7 +364,6 @@ const TagLibrary = (props: Props) => {
)}
{isCreateTagDialogOpened && (
<CreateTagsDialog
- // key={uuidv1()}
open={isCreateTagDialogOpened}
onClose={() => setIsCreateTagDialogOpened(false)}
addTag={props.addTag}
@@ -435,7 +444,16 @@ const TagLibrary = (props: Props) => {
confirmDialogTID="confirmDeleteTagDialogTagMenu"
/>
)}
- <div className={classes.taggroupsArea} data-tid="tagLibraryTagGroupList">
+ <div
+ style={{
+ paddingTop: 0,
+ marginTop: 0,
+ height: 'calc(100% - ' + reduceHeightBy + 'px)',
+ // @ts-ignore
+ overflowY: AppConfig.isFirefox ? 'auto' : 'overlay'
+ }}
+ data-tid="tagLibraryTagGroupList"
+ >
{AppConfig.showSmartTags && (
<div style={{ paddingTop: 0, paddingBottom: 0 }}>
{SmartTags(i18n).map(renderTagGroup)}
diff --git a/app/components/TargetFileBox.tsx b/app/components/TargetFileBox.tsx
index c75d54537..69f100060 100644
--- a/app/components/TargetFileBox.tsx
+++ b/app/components/TargetFileBox.tsx
@@ -70,7 +70,7 @@ const TargetFileBox = (props: Props) => {
undefined
);
return connectDropTarget(
- <div>
+ <div style={{ height: '100%' }}>
{dragContent}
{children}
</div>
diff --git a/app/components/VerticalNavigation.tsx b/app/components/VerticalNavigation.tsx
index 4e14ce761..a8be5feda 100644
--- a/app/components/VerticalNavigation.tsx
+++ b/app/components/VerticalNavigation.tsx
@@ -1,4 +1,5 @@
-/**
+/*
+/!**
* TagSpaces - universal file and folder organizer
* Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)
*
@@ -14,7 +15,7 @@
* 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, { useState } from 'react';
import { connect } from 'react-redux';
@@ -31,7 +32,7 @@ import UpgradeIcon from '@material-ui/icons/FlightTakeoff';
import HelpIcon from '@material-ui/icons/HelpOutline';
import AccountCircleIcon from '@material-ui/icons/AccountCircle';
import { withStyles } from '@material-ui/core/styles';
-import SplitPane from 'react-split-pane';
+import { Split } from '@geoffcox/react-splitter';
import { CircularProgress, Typography } from '@material-ui/core';
import Box from '@material-ui/core/Box';
import { CognitoUserInterface } from '@aws-amplify/ui-components';
@@ -59,7 +60,7 @@ import LoadingLazy from './LoadingLazy';
import AppConfig from '-/config';
const ProTeaserDialog = React.lazy(() =>
- import(/* webpackChunkName: "ProTeaserDialog" */ './dialogs/ProTeaserDialog')
+ import(/!* webpackChunkName: "ProTeaserDialog" *!/ './dialogs/ProTeaserDialog')
);
const ProTeaserDialogAsync = props => (
<React.Suspense fallback={<LoadingLazy />}>
@@ -174,213 +175,205 @@ const VerticalNavigation = (props: Props) => {
user
} = props;
return (
- <div>
- <style>
- {`
+ <Split initialPrimarySize="44px">
+ <div style={{ width: 44 }} className={classes.panel}>
+ <style>
+ {`
#verticalNavButton:hover {
border-radius: 0;
background-color: ${AppConfig.sidebarSelectionColor}
}
`}
- </style>
- {isProTeaserVisible && (
- <ProTeaserDialogAsync
- open={isProTeaserVisible}
- onClose={toggleProTeaser}
- openURLExternally={openURLExternally}
- key={uuidv1()}
- />
- )}
- <SplitPane
- split="vertical"
- minSize={44}
- maxSize={44}
- defaultSize={44}
- resizerStyle={{ backgroundColor: theme.palette.divider }}
- >
- <div className={classes.panel}>
- <IconButton
- onClick={toggleAboutDialog}
- className={classes.button}
- style={{ marginTop: 10, marginBottom: 16 }}
- title={i18n.t('core:aboutTitle')}
- data-tid="aboutTagSpaces"
- >
- <img
- className={classes.buttonIcon}
- style={{
- color: props.theme.palette.text.primary
- }}
- src={LogoIcon}
- alt="TagSpaces Logo"
- />
- </IconButton>
- <IconButton
- id="verticalNavButton"
- onClick={() => {
- if (props.isReadOnlyMode || !directoryPath) {
- showNotification(
- 'You are in read-only mode or there is no opened location'
- );
- } else {
- toggleCreateFileDialog();
- }
- }}
- className={classes.button}
- style={{ marginBottom: 20 }}
- title={i18n.t('core:createFileTitle')}
- data-tid="locationManager"
- >
- <NewFileIcon className={classes.buttonIcon} />
- </IconButton>
- <IconButton
- id="verticalNavButton"
- onClick={() => {
- if (props.isLocationMngrPanelOpened) {
- closeAllVerticalPanels();
- } else {
- openLocationManagerPanel();
- }
+ </style>
+ {isProTeaserVisible && (
+ <ProTeaserDialogAsync
+ open={isProTeaserVisible}
+ onClose={toggleProTeaser}
+ openURLExternally={openURLExternally}
+ key={uuidv1()}
+ />
+ )}
+ <IconButton
+ onClick={toggleAboutDialog}
+ className={classes.button}
+ style={{ marginTop: 10, marginBottom: 16 }}
+ title={i18n.t('core:aboutTitle')}
+ data-tid="aboutTagSpaces"
+ >
+ <img
+ className={classes.buttonIcon}
+ style={{
+ color: props.theme.palette.text.primary
}}
- className={
- props.isLocationMngrPanelOpened
- ? [classes.button, classes.selectedButton].join(' ')
- : classes.button
+ src={LogoIcon}
+ alt="TagSpaces Logo"
+ />
+ </IconButton>
+ <IconButton
+ id="verticalNavButton"
+ onClick={() => {
+ if (props.isReadOnlyMode || !directoryPath) {
+ showNotification(
+ 'You are in read-only mode or there is no opened location'
+ );
+ } else {
+ toggleCreateFileDialog();
}
- title={i18n.t('core:locationManager')}
- data-tid="locationManagerPanel"
- >
- <LocationsIcon className={classes.buttonIcon} />
- </IconButton>
- <IconButton
- id="verticalNavButton"
- title={i18n.t('core:tagGroupOperations')}
- data-tid="tagLibrary"
- onClick={() => {
- if (isTagLibraryPanelOpened) {
- closeAllVerticalPanels();
- } else {
- openTagLibraryPanel();
- }
- }}
- className={
- isTagLibraryPanelOpened
- ? [classes.button, classes.selectedButton].join(' ')
- : classes.button
+ }}
+ className={classes.button}
+ style={{ marginBottom: 20 }}
+ title={i18n.t('core:createFileTitle')}
+ data-tid="locationManager"
+ >
+ <NewFileIcon className={classes.buttonIcon} />
+ </IconButton>
+ <IconButton
+ id="verticalNavButton"
+ onClick={() => {
+ if (props.isLocationMngrPanelOpened) {
+ closeAllVerticalPanels();
+ } else {
+ openLocationManagerPanel();
}
- >
- <TagLibraryIcon className={classes.buttonIcon} />
- </IconButton>
- <IconButton
- id="verticalNavButton"
- title={i18n.t('core:searchTitle')}
- data-tid="search"
- onClick={() => {
- if (isSearchPanelOpened) {
- closeAllVerticalPanels();
- } else {
- openSearchPanel();
- }
- }}
- className={
- isSearchPanelOpened
- ? [classes.button, classes.selectedButton].join(' ')
- : classes.button
+ }}
+ className={
+ props.isLocationMngrPanelOpened
+ ? [classes.button, classes.selectedButton].join(' ')
+ : classes.button
+ }
+ title={i18n.t('core:locationManager')}
+ data-tid="locationManagerPanel"
+ >
+ <LocationsIcon className={classes.buttonIcon} />
+ </IconButton>
+ <IconButton
+ id="verticalNavButton"
+ title={i18n.t('core:tagGroupOperations')}
+ data-tid="tagLibrary"
+ onClick={() => {
+ if (isTagLibraryPanelOpened) {
+ closeAllVerticalPanels();
+ } else {
+ openTagLibraryPanel();
}
- >
- <SearchIcon className={classes.buttonIcon} />
- </IconButton>
- <IconButton
- id="verticalNavButton"
- title={i18n.t('core:helpFeedback')}
- data-tid="helpFeedback"
- onClick={() => {
- if (isHelpFeedbackPanelOpened) {
- closeAllVerticalPanels();
- } else {
- openHelpFeedbackPanel();
- }
- }}
- className={
- isHelpFeedbackPanelOpened
- ? [classes.button, classes.selectedButton].join(' ')
- : classes.button
+ }}
+ className={
+ isTagLibraryPanelOpened
+ ? [classes.button, classes.selectedButton].join(' ')
+ : classes.button
+ }
+ >
+ <TagLibraryIcon className={classes.buttonIcon} />
+ </IconButton>
+ <IconButton
+ id="verticalNavButton"
+ title={i18n.t('core:searchTitle')}
+ data-tid="search"
+ onClick={() => {
+ if (isSearchPanelOpened) {
+ closeAllVerticalPanels();
+ } else {
+ openSearchPanel();
}
- >
- {user ? (
- <AccountCircleIcon className={classes.buttonIcon} />
- ) : (
- <HelpIcon className={classes.buttonIcon} />
- )}
- </IconButton>
- {!Pro && (
- <IconButton
- id="verticalNavButton"
- title={i18n.t('core:upgradeToPro')}
- data-tid="upgradeToPro"
- onClick={toggleProTeaser}
- // @ts-ignore
- className={[classes.button, classes.upgradeButton].join(' ')}
- >
- <UpgradeIcon className={classes.buttonIcon} />
- </IconButton>
- )}
- {props.progress && props.progress.length > 0 && (
- <IconButton
- id="progressButton"
- title={i18n.t('core:progress')}
- data-tid="uploadProgress"
- onClick={() => props.toggleUploadDialog()}
- // @ts-ignore
- className={[classes.button, classes.upgradeButton].join(' ')}
- >
- <CircularProgressWithLabel value={getProgressValue()} />
- </IconButton>
+ }}
+ className={
+ isSearchPanelOpened
+ ? [classes.button, classes.selectedButton].join(' ')
+ : classes.button
+ }
+ >
+ <SearchIcon className={classes.buttonIcon} />
+ </IconButton>
+ <IconButton
+ id="verticalNavButton"
+ title={i18n.t('core:helpFeedback')}
+ data-tid="helpFeedback"
+ onClick={() => {
+ if (isHelpFeedbackPanelOpened) {
+ closeAllVerticalPanels();
+ } else {
+ openHelpFeedbackPanel();
+ }
+ }}
+ className={
+ isHelpFeedbackPanelOpened
+ ? [classes.button, classes.selectedButton].join(' ')
+ : classes.button
+ }
+ >
+ {user ? (
+ <AccountCircleIcon className={classes.buttonIcon} />
+ ) : (
+ <HelpIcon className={classes.buttonIcon} />
)}
+ </IconButton>
+ {!Pro && (
<IconButton
id="verticalNavButton"
- title={i18n.t('core:switchTheme')}
- data-tid="switchTheme"
- onClick={switchTheme}
- className={[classes.button, classes.themingButton].join(' ')}
+ title={i18n.t('core:upgradeToPro')}
+ data-tid="upgradeToPro"
+ onClick={toggleProTeaser}
+ // @ts-ignore
+ className={[classes.button, classes.upgradeButton].join(' ')}
>
- <ThemingIcon className={classes.buttonIcon} />
+ <UpgradeIcon className={classes.buttonIcon} />
</IconButton>
+ )}
+ {props.progress && props.progress.length > 0 && (
<IconButton
- id="verticalNavButton"
- title={i18n.t('core:settings')}
- data-tid="settings"
- onClick={toggleSettingsDialog}
+ id="progressButton"
+ title={i18n.t('core:progress')}
+ data-tid="uploadProgress"
+ onClick={() => props.toggleUploadDialog()}
// @ts-ignore
- className={
- props.isSettingsDialogOpened
- ? [
- classes.button,
- classes.settingsButton,
- classes.selectedButton
- ].join(' ')
- : [classes.button, classes.settingsButton].join(' ')
- }
+ className={[classes.button, classes.upgradeButton].join(' ')}
>
- <SettingsIcon className={classes.buttonIcon} />
+ <CircularProgressWithLabel value={getProgressValue()} />
</IconButton>
- </div>
- <div className={classes.panel}>
- {isLocationMngrPanelOpened && <LocationManager />}
- {isTagLibraryPanelOpened && <TagLibrary />}
- {isSearchPanelOpened && <Search />}
- {isHelpFeedbackPanelOpened && (
- <HelpFeedbackPanel
- openURLExternally={openURLExternally}
- toggleAboutDialog={toggleAboutDialog}
- toggleKeysDialog={toggleKeysDialog}
- toggleOnboardingDialog={toggleOnboardingDialog}
- toggleProTeaser={toggleProTeaser}
- />
- )}
- </div>
- </SplitPane>
- </div>
+ )}
+ <IconButton
+ id="verticalNavButton"
+ title={i18n.t('core:switchTheme')}
+ data-tid="switchTheme"
+ onClick={switchTheme}
+ className={[classes.button, classes.themingButton].join(' ')}
+ >
+ <ThemingIcon className={classes.buttonIcon} />
+ </IconButton>
+ <IconButton
+ id="verticalNavButton"
+ title={i18n.t('core:settings')}
+ data-tid="settings"
+ onClick={toggleSettingsDialog}
+ // @ts-ignore
+ className={
+ props.isSettingsDialogOpened
+ ? [
+ classes.button,
+ classes.settingsButton,
+ classes.selectedButton
+ ].join(' ')
+ : [classes.button, classes.settingsButton].join(' ')
+ }
+ >
+ <SettingsIcon className={classes.buttonIcon} />
+ </IconButton>
+ </div>
+ <div className={classes.panel}>
+ {isLocationMngrPanelOpened && <LocationManager />}
+ {isTagLibraryPanelOpened && <TagLibrary />}
+ {isSearchPanelOpened && <Search />}
+ {isHelpFeedbackPanelOpened && (
+ <HelpFeedbackPanel
+ openURLExternally={openURLExternally}
+ toggleAboutDialog={toggleAboutDialog}
+ toggleKeysDialog={toggleKeysDialog}
+ toggleOnboardingDialog={toggleOnboardingDialog}
+ toggleProTeaser={toggleProTeaser}
+ />
+ )}
+ </div>
+ </Split>
);
};
@@ -452,3 +445,4 @@ export default connect(
mapStateToProps,
mapActionCreatorsToProps
)(withStyles(styles, { withTheme: true })(VerticalNavigation));
+*/
diff --git a/app/components/WelcomePanel.tsx b/app/components/WelcomePanel.tsx
index 6b312819e..62282832b 100644
--- a/app/components/WelcomePanel.tsx
+++ b/app/components/WelcomePanel.tsx
@@ -100,7 +100,7 @@ const WelcomePanel = (props: Props) => {
>
<img src={WelcomeLogo} alt="Organize your files" />
</div>
- <ListItem
+ {/* <ListItem
button
onClick={() => {
const button = document.getElementById(
@@ -112,7 +112,7 @@ const WelcomePanel = (props: Props) => {
<Button startIcon={<LocationIcon />}>
{i18n.t('core:chooseLocation')}
</Button>
- </ListItem>
+ </ListItem> */}
<ListItem
button
onClick={() =>
diff --git a/app/components/dialogs/CreateEditLocationDialog.tsx b/app/components/dialogs/CreateEditLocationDialog.tsx
index d4bd9ab61..26bd52dc5 100644
--- a/app/components/dialogs/CreateEditLocationDialog.tsx
+++ b/app/components/dialogs/CreateEditLocationDialog.tsx
@@ -43,6 +43,8 @@ import ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
import ToggleButton from '@material-ui/lab/ToggleButton';
import CheckIcon from '@material-ui/icons/Check';
import RemoveIcon from '@material-ui/icons/RemoveCircleOutline';
+import { bindActionCreators } from 'redux';
+import { connect } from 'react-redux';
import i18n from '-/services/i18n';
import { Pro } from '-/pro';
import ObjectStoreForm from './ObjectStoreForm';
@@ -55,6 +57,8 @@ import { getLocationPath } from '-/utils/paths';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import InfoIcon from '-/components/InfoIcon';
import { ProLabel, BetaLabel, ProTooltip } from '-/components/HelperComponents';
+import { actions as LocationActions } from '-/reducers/locations';
+import { getPersistTagsInSidecarFile } from '-/reducers/settings';
const styles: any = theme => ({
formControl: {
@@ -69,7 +73,7 @@ interface Props {
onClose: () => void;
classes: any;
fullScreen: boolean;
- addLocation?: (location: TS.Location) => void;
+ addLocation: (location: TS.Location, openAfterCreate?: boolean) => void;
editLocation?: (location: TS.Location) => void;
isPersistTagsInSidecar: boolean;
}
@@ -300,7 +304,7 @@ const CreateEditLocationDialog = (props: Props) => {
loc = { ...loc, persistTagsInSidecarFile };
}
- if (props.addLocation) {
+ if (!props.location && props.addLocation) {
props.addLocation(loc);
} else if (props.editLocation) {
loc.newuuid = newuuid;
@@ -776,4 +780,22 @@ const CreateEditLocationDialog = (props: Props) => {
);
};
-export default withMobileDialog()(withStyles(styles)(CreateEditLocationDialog));
+function mapStateToProps(state) {
+ return {
+ isPersistTagsInSidecar: getPersistTagsInSidecarFile(state)
+ };
+}
+
+function mapDispatchToProps(dispatch) {
+ return bindActionCreators(
+ {
+ addLocation: LocationActions.addLocation
+ },
+ dispatch
+ );
+}
+
+export default connect(
+ mapStateToProps,
+ mapDispatchToProps
+)(withMobileDialog()(withStyles(styles)(CreateEditLocationDialog)));
diff --git a/app/components/dialogs/ProTeaserDialog.tsx b/app/components/dialogs/ProTeaserDialog.tsx
index f9bfed1eb..0eeecbe9d 100644
--- a/app/components/dialogs/ProTeaserDialog.tsx
+++ b/app/components/dialogs/ProTeaserDialog.tsx
@@ -37,6 +37,7 @@ import EnterpriseImage from '-/assets/images/world-undraw.svg';
import i18n from '-/services/i18n';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import Links from '-/links';
+import AppConfig from '-/config';
interface Props {
open: boolean;
@@ -350,7 +351,13 @@ const ProTeaserDialog = (props: Props) => {
<DialogTitle style={{ justifyContent: 'center', textAlign: 'center' }}>
<DialogCloseButton onClose={onClose} />
</DialogTitle>
- <DialogContent style={{ paddingBottom: 0 }}>
+ <DialogContent
+ style={{
+ paddingBottom: 0,
+ // @ts-ignore
+ overflowY: AppConfig.isFirefox ? 'auto' : 'overlay'
+ }}
+ >
<SwipeableViews
index={activeStep}
onChangeIndex={handleStepChange}
diff --git a/app/containers/MainPage.tsx b/app/containers/MainPage.tsx
index ead00b3b2..b95b9c286 100644
--- a/app/containers/MainPage.tsx
+++ b/app/containers/MainPage.tsx
@@ -16,18 +16,19 @@
*
*/
-import React, { useEffect, useRef, useState } from 'react';
+import React, { useEffect, useReducer, useRef, useState } from 'react';
+import clsx from 'clsx';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { withStyles } from '@material-ui/core/styles';
import { translate } from 'react-i18next';
-import SplitPane from 'react-split-pane';
import SwipeableDrawer from '@material-ui/core/SwipeableDrawer';
+import Drawer from '@material-ui/core/Drawer';
import { HotKeys } from 'react-hotkeys';
import { NativeTypes } from 'react-dnd-html5-backend';
import { Progress } from 'aws-sdk/clients/s3';
import { CognitoUserInterface } from '@aws-amplify/ui-components';
-import VerticalNavigation from '../components/VerticalNavigation';
+import { Split } from 'ts-react-splitter';
import MobileNavigation from '../components/MobileNavigation';
import FolderContainer from '../components/FolderContainer';
import EntryContainer from '../components/EntryContainer';
@@ -37,7 +38,6 @@ import CreateFileDialog from '../components/dialogs/CreateDialog';
import {
getDesktopMode,
getKeyBindingObject,
- getLeftVerticalSplitSize,
getMainVerticalSplitSize,
actions as SettingsActions
} from '../reducers/settings';
@@ -67,7 +67,8 @@ import {
OpenedEntry,
isDeleteMultipleEntriesDialogOpened,
getSelectedEntries,
- currentUser
+ currentUser,
+ isLocationDialogOpened
} from '../reducers/app';
import { buffer } from '-/utils/misc';
import TargetFileBox from '../components/TargetFileBox';
@@ -85,11 +86,8 @@ import { TS } from '-/tagspaces.namespace';
import PageNotification from '-/containers/PageNotification';
import listen from '-/containers/RendererListener';
-const initialSplitSize = 44;
-const drawerWidth = 300;
+const drawerWidth = 320;
const body = document.getElementsByTagName('body')[0];
-// const showOneColumnThreshold = 600;
-// const bufferedMainSplitResize = buffer({ timeout: 50, id: 'buffered-mainsplit-resize' });
const bufferedLeftSplitResize = buffer({
timeout: 300,
id: 'buffered-leftsplit-resize'
@@ -97,31 +95,23 @@ const bufferedLeftSplitResize = buffer({
const styles: any = (theme: any) => ({
content: {
- width: '100%',
- marginLeft: drawerWidth,
+ height: '100%',
flexGrow: 1,
- backgroundColor: theme.palette.background.default,
+ padding: 0,
+ paddingLeft: drawerWidth,
transition: theme.transitions.create('margin', {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.leavingScreen
- }),
- [theme.breakpoints.up('sm')]: {
- content: {
- height: 'calc(100% - 64px)',
- marginTop: 64
- }
- }
+ })
},
contentShift: {
- marginLeft: 0,
+ height: '100%',
+ padding: 0,
transition: theme.transitions.create('margin', {
easing: theme.transitions.easing.easeOut,
duration: theme.transitions.duration.enteringScreen
- })
- },
- drawerPaper: {
- height: '100%',
- width: drawerWidth
+ }),
+ marginLeft: 0
}
});
@@ -141,6 +131,7 @@ interface Props {
isCreateDirectoryOpened: boolean;
toggleCreateDirectoryDialog: () => void;
isAboutDialogOpened: boolean;
+ isLocationDialogOpened: boolean;
isKeysDialogOpened: boolean;
isLicenseDialogOpened: boolean;
isThirdPartyLibsDialogOpened: boolean;
@@ -167,6 +158,7 @@ interface Props {
toggleLicenseDialog: () => void; // needed by electron-menus
toggleThirdPartyLibsDialog: () => void; // neede by electron-menus
toggleAboutDialog: () => void; // needed by electron-menus
+ toggleLocationDialog: () => void; // needed by electron-menus
toggleOnboardingDialog: () => void; // needed by electron-menus
// setLastSelectedEntry: (path: string) => void; // needed by electron-menus
setSelectedEntries: (selectedEntries: Array<Object>) => void; // needed by electron-menus
@@ -182,7 +174,6 @@ interface Props {
leftSplitSize: number;
mainSplitSize: any;
toggleShowUnixHiddenEntries: () => void;
- setLeftVerticalSplitSize: (splitSize: number) => void;
setMainVerticalSplitSize: (splitSize: string) => void;
isLocationManagerPanelOpened: boolean;
isOpenLinkDialogOpened: boolean;
@@ -210,6 +201,17 @@ interface Props {
user: CognitoUserInterface;
}
+const CreateEditLocationDialog = React.lazy(() =>
+ import(
+ /* webpackChunkName: "CreateEditLocationDialog" */ '../components/dialogs/CreateEditLocationDialog'
+ )
+);
+const CreateEditLocationDialogAsync = props => (
+ <React.Suspense fallback={<LoadingLazy />}>
+ <CreateEditLocationDialog {...props} />
+ </React.Suspense>
+);
+
const AboutDialog = React.lazy(() =>
import(
/* webpackChunkName: "AboutDialog" */ '../components/dialogs/AboutDialog'
@@ -287,25 +289,15 @@ const OpenLinkDialogAsync = props => (
</React.Suspense>
);
-// let showVerticalPanel = true;
-// if (window.ExtDefaultVerticalPanel === 'none') {
-// showVerticalPanel = false;
-// }
-
const MainPage = (props: Props) => {
- // useTraceUpdate(props);
- /* const [selectedDirectoryPath, setSelectedDirectoryPath] = useState<string>(
- ''
- ); */
+ // const [percent, setPercent] = React.useState<number | undefined>(undefined);
+ const percent = useRef<number | undefined>(undefined);
const selectedDirectoryPath = useRef<string>('');
const setSelectedDirectoryPath = (path: string) => {
selectedDirectoryPath.current = path;
};
- // const [isManagementPanelVisible, setManagementPanelVisible] = useState<
- // boolean
- // >(showVerticalPanel || !props.isEntryInFullWidth);
- // const [mainSplitSize, setMainSplitSize] = useState<any>('100%');
- // const [isDrawerOpened, setDrawerOpened] = useState<boolean>(true);
+ const [ignored, forceUpdate] = useReducer(x => x + 1, 0);
+
const width =
window.innerWidth ||
document.documentElement.clientWidth ||
@@ -319,6 +311,9 @@ const MainPage = (props: Props) => {
height
});
+ const [drawerOpened, setDrawerOpened] = useState<boolean>(true);
+ // const [rightPanelWidth, setRightPanelWidth] = useState<number>(0);
+
useEffect(() => {
if (!AppConfig.isCordova) {
updateDimensions();
@@ -327,42 +322,10 @@ const MainPage = (props: Props) => {
}, []);
useEffect(() => {
- if (props.isEntryInFullWidth) {
- props.closeAllVerticalPanels();
- } else {
- showDrawer();
- }
+ // setPercent(undefined);
+ setDrawerOpened(!props.isEntryInFullWidth);
}, [props.isEntryInFullWidth]);
- const getMainSplitSize = () => {
- if (props.openedFiles.length === 0) {
- return '100%';
- }
-
- if (props.isEntryInFullWidth) {
- return '0%';
- }
- const width =
- window.innerWidth ||
- document.documentElement.clientWidth ||
- body.clientWidth;
- const height =
- window.innerHeight ||
- document.documentElement.clientHeight ||
- body.clientHeight;
- if (height > width) {
- return '0%';
- }
-
- return props.mainSplitSize;
- };
-
- const isManagementPanelVisible = () =>
- props.isLocationManagerPanelOpened ||
- props.isTagLibraryPanelOpened ||
- props.isSearchPanelOpened ||
- props.isHelpFeedbackPanelOpened;
-
useEventListener('resize', () => {
if (!AppConfig.isCordova) {
updateDimensions();
@@ -370,49 +333,28 @@ const MainPage = (props: Props) => {
});
const updateDimensions = () => {
- const width =
+ const w =
window.innerWidth ||
document.documentElement.clientWidth ||
body.clientWidth;
- const height =
+ const h =
window.innerHeight ||
document.documentElement.clientHeight ||
body.clientHeight;
// console.log('Width: ' + width + ' Height: ' + height);
- setDimensions({ width, height });
+ setDimensions({ width: w, height: h });
if (props.openedFiles.length > 0) {
- const isFillWidth = height > width;
+ const isFillWidth = h > w;
if (isFillWidth !== props.isEntryInFullWidth) {
props.setEntryFullWidth(isFillWidth);
}
}
-
- // Hide folder container on windows resize or on mobile
- // Disable due a bug with the full width functionality
- /* if (this.props.isFileOpened) {
- if (width > showOneColumnThreshold) {
- // TODO hide management panel
- this.setState({
- mainSplitSize: this.props.mainSplitSize
- });
- } else {
- this.setState({
- mainSplitSize: '0%'
- });
- }
- } */
};
- const showDrawer = () => {
- /* if (
- !props.isLocationManagerPanelOpened && // TODO this is true in Cordova on closed Locations && LocationManagerPanel
- !props.isSearchPanelOpened &&
- !props.isTagLibraryPanelOpened
- ) { */
- props.openLocationManagerPanel();
- // setDrawerOpened(true);
+ const toggleDrawer = () => {
+ setDrawerOpened(prevOpen => !prevOpen);
};
const handleFileDrop = (item, monitor) => {
@@ -456,7 +398,6 @@ const MainPage = (props: Props) => {
showTagLibrary: props.openTagLibraryPanel,
openSearch: props.openSearchPanel,
showHelp: props.openHelpFeedbackPanel
- // openDevTools: props.openDevTools TODO Impl
};
const keyMap = {
@@ -466,17 +407,6 @@ const MainPage = (props: Props) => {
showTagLibrary: props.keyBindings.showTagLibrary,
openSearch: props.keyBindings.openSearch,
showHelp: props.keyBindings.showHelp
- // openDevTools: props.keyBindings.openDevTools
- };
-
- const handleSplitSizeChange = size => {
- if (size > 0 && dimensions.width) {
- const sizeInPercent =
- // @ts-ignore
- parseInt((size * 100) / dimensions.width, 10) + '%';
- // setMainSplitSize(sizeInPercent);
- props.setMainVerticalSplitSize(sizeInPercent);
- }
};
const {
@@ -487,6 +417,7 @@ const MainPage = (props: Props) => {
toggleLicenseDialog,
toggleThirdPartyLibsDialog,
toggleAboutDialog,
+ toggleLocationDialog,
toggleCreateDirectoryDialog,
toggleCreateFileDialog,
toggleUploadDialog,
@@ -495,12 +426,85 @@ const MainPage = (props: Props) => {
toggleOpenLinkDialog,
setFirstRun,
openURLExternally,
- directoryPath
+ directoryPath,
+ mainSplitSize,
+ openedFiles,
+ classes
} = props;
const { FILE } = NativeTypes;
+ const isFileOpened = openedFiles.length > 0;
+
+ const setPercent = (p: number | undefined) => {
+ percent.current = p;
+ if (p !== undefined) {
+ bufferedLeftSplitResize(() => {
+ if (props.mainSplitSize !== p + '%') {
+ props.setMainVerticalSplitSize(p + '%');
+ }
+ });
+ }
+ forceUpdate();
+ };
+
+ const renderContainers = () => {
+ let initialPrimarySize = mainSplitSize;
+ let minPrimarySize = '250px';
+ let minSecondarySize = '250px';
+ let renderSplitter;
+
+ if (!isFileOpened) {
+ percent.current = undefined;
+ initialPrimarySize = '100%';
+ minSecondarySize = '0%';
+ renderSplitter = () => null;
+ }
+ if (props.isEntryInFullWidth) {
+ percent.current = undefined;
+ initialPrimarySize = '0%';
+ minPrimarySize = '0%';
+ renderSplitter = () => null;
+ }
+ return (
+ <Split
+ initialPrimarySize={initialPrimarySize}
+ minPrimarySize={minPrimarySize}
+ minSecondarySize={minSecondarySize}
+ renderSplitter={renderSplitter}
+ percent={percent.current}
+ setPercent={setPercent}
+ >
+ <FolderContainer
+ windowHeight={dimensions.height}
+ windowWidth={dimensions.width}
+ toggleDrawer={toggleDrawer}
+ drawerOpened={drawerOpened}
+ openedFiles={openedFiles}
+ currentDirectoryPath={directoryPath}
+ />
+ {isFileOpened && (
+ <EntryContainer
+ key="EntryContainerID"
+ openedFiles={openedFiles}
+ currentDirectoryPath={directoryPath}
+ />
+ )}
+ </Split>
+ );
+ };
+
return (
- <HotKeys handlers={keyBindingHandlers} keyMap={keyMap}>
+ <HotKeys
+ handlers={keyBindingHandlers}
+ keyMap={keyMap}
+ style={{ height: '100%' }}
+ >
+ {props.isLocationDialogOpened && (
+ <CreateEditLocationDialogAsync
+ open={props.isLocationDialogOpened}
+ onClose={toggleLocationDialog}
+ />
+ )}
{props.isAboutDialogOpened && (
<AboutDialogAsync
open={props.isAboutDialogOpened}
@@ -618,89 +622,62 @@ const MainPage = (props: Props) => {
/>
)}
<PageNotification />
- {props.isDesktopMode || (AppConfig.isAmplify && !props.user) ? (
- <TargetFileBox
- // @ts-ignore
- accepts={[FILE]}
- onDrop={handleFileDrop}
- >
- <CustomDragLayer />
- <SplitPane
- split="vertical"
- minSize={200}
- maxSize={450}
- resizerStyle={{ backgroundColor: theme.palette.divider }}
- defaultSize={props.leftSplitSize}
- size={
- isManagementPanelVisible()
- ? props.leftSplitSize
- : initialSplitSize
- }
- onChange={size => {
- bufferedLeftSplitResize(() =>
- props.setLeftVerticalSplitSize(size)
- );
- }}
+ <div
+ style={{
+ backgroundColor: theme.palette.background.default,
+ height: '100%'
+ }}
+ >
+ {/* --default-splitter-line-hover-color: green !important; */}
+ <style>
+ {`
+ .default-splitter {
+ --default-splitter-line-margin: 4px !important;
+ --default-splitter-line-size: 1px !important;
+ --default-splitter-line-color: ${theme.palette.divider} !important;
+ }
+
+ .react-split .split-container.vertical .splitter {
+ background-color: ${theme.palette.background.default};
+ }
+ `}
+ </style>
+ {props.isDesktopMode || (AppConfig.isAmplify && !props.user) ? (
+ <TargetFileBox
+ // @ts-ignore
+ accepts={[FILE]}
+ onDrop={handleFileDrop}
>
- <VerticalNavigation />
- <SplitPane
- split="vertical"
- minSize="200"
- resizerStyle={{ backgroundColor: theme.palette.divider }}
- size={getMainSplitSize()}
- onChange={handleSplitSizeChange}
+ <CustomDragLayer />
+ <Drawer variant="persistent" anchor="left" open={drawerOpened}>
+ <MobileNavigation width={drawerWidth} />
+ </Drawer>
+ <main
+ className={clsx(classes.content, {
+ [classes.contentShift]: !drawerOpened
+ })}
>
- <FolderContainer
- windowHeight={dimensions.height}
- windowWidth={dimensions.width}
- openedFiles={props.openedFiles}
- currentDirectoryPath={props.directoryPath}
- />
- {props.openedFiles.length > 0 && (
- <EntryContainer
- openedFiles={props.openedFiles}
- currentDirectoryPath={props.directoryPath}
- />
- )}
- </SplitPane>
- </SplitPane>
- </TargetFileBox>
- ) : (
- <React.Fragment>
- <SwipeableDrawer
- open={isManagementPanelVisible()}
- onClose={() => props.closeAllVerticalPanels()}
- onOpen={showDrawer}
- hysteresis={0.1}
- disableBackdropTransition={!AppConfig.isIOS}
- >
- <MobileNavigation
- hideDrawer={() => props.closeAllVerticalPanels()}
- />
- </SwipeableDrawer>
- <SplitPane
- split="vertical"
- minSize="200"
- resizerStyle={{ backgroundColor: theme.palette.divider }}
- size={getMainSplitSize()}
- onChange={handleSplitSizeChange}
- >
- <FolderContainer
- windowHeight={dimensions.height}
- windowWidth={dimensions.width}
- showDrawer={showDrawer}
- openedFiles={props.openedFiles}
- currentDirectoryPath={props.directoryPath}
- />
- {props.openedFiles.length > 0 && (
- <EntryContainer
- openedFiles={props.openedFiles}
- currentDirectoryPath={props.directoryPath}
+ {renderContainers()}
+ </main>
+ </TargetFileBox>
+ ) : (
+ <>
+ <SwipeableDrawer
+ open={drawerOpened}
+ onClose={() => setDrawerOpened(false)}
+ onOpen={() => setDrawerOpened(true)}
+ hysteresis={0.1}
+ disableBackdropTransition={!AppConfig.isIOS}
+ >
+ <MobileNavigation
+ width={drawerWidth}
+ hideDrawer={() => props.closeAllVerticalPanels()}
/>
- )}
- </SplitPane>
- </React.Fragment>
- )}
+ </SwipeableDrawer>
+ {renderContainers()}
+ </>
+ )}
+ </div>
</HotKeys>
);
};
@@ -712,6 +689,7 @@ function mapStateToProps(state) {
isCreateFileDialogOpened: isCreateFileDialogOpened(state),
isSettingsDialogOpened: isSettingsDialogOpened(state),
isAboutDialogOpened: isAboutDialogOpened(state),
+ isLocationDialogOpened: isLocationDialogOpened(state),
isKeysDialogOpened: isKeysDialogOpened(state),
isOnboardingDialogOpened: isOnboardingDialogOpened(state),
isLicenseDialogOpened: isLicenseDialogOpened(state),
@@ -725,7 +703,6 @@ function mapStateToProps(state) {
isEntryInFullWidth: isEntryInFullWidth(state),
isDesktopMode: getDesktopMode(state),
keyBindings: getKeyBindingObject(state),
- leftSplitSize: getLeftVerticalSplitSize(state),
mainSplitSize: getMainVerticalSplitSize(state),
isLocationManagerPanelOpened: isLocationManagerPanelOpened(state),
isTagLibraryPanelOpened: isTagLibraryPanelOpened(state),
@@ -761,6 +738,7 @@ function mapDispatchToProps(dispatch) {
toggleLicenseDialog: AppActions.toggleLicenseDialog,
toggleThirdPartyLibsDialog: AppActions.toggleThirdPartyLibsDialog,
toggleAboutDialog: AppActions.toggleAboutDialog,
+ toggleLocationDialog: AppActions.toggleLocationDialog,
toggleOnboardingDialog: AppActions.toggleOnboardingDialog,
toggleOpenLinkDialog: AppActions.toggleOpenLinkDialog,
setSelectedEntries: AppActions.setSelectedEntries,
@@ -771,7 +749,6 @@ function mapDispatchToProps(dispatch) {
openNextFile: AppActions.openNextFile,
openPrevFile: AppActions.openPrevFile,
toggleShowUnixHiddenEntries: SettingsActions.toggleShowUnixHiddenEntries,
- setLeftVerticalSplitSize: SettingsActions.setLeftVerticalSplitSize,
setMainVerticalSplitSize: SettingsActions.setMainVerticalSplitSize,
showNotification: AppActions.showNotification,
reflectCreateEntries: AppActions.reflectCreateEntries,
@@ -792,6 +769,8 @@ function mapDispatchToProps(dispatch) {
}
const areEqual = (prevProp, nextProp) =>
+ /* JSON.stringify(nextProp.theme.palette) ===
+ JSON.stringify(prevProp.theme.palette) && */
nextProp.directoryPath === prevProp.directoryPath &&
nextProp.isAboutDialogOpened === prevProp.isAboutDialogOpened &&
nextProp.isCreateDirectoryOpened === prevProp.isCreateDirectoryOpened &&
@@ -804,6 +783,7 @@ const areEqual = (prevProp, nextProp) =>
nextProp.isHelpFeedbackPanelOpened === prevProp.isHelpFeedbackPanelOpened &&
nextProp.isKeysDialogOpened === prevProp.isKeysDialogOpened &&
nextProp.isLicenseDialogOpened === prevProp.isLicenseDialogOpened &&
+ nextProp.isLocationDialogOpened === prevProp.isLocationDialogOpened &&
nextProp.isLocationManagerPanelOpened ===
prevProp.isLocationManagerPanelOpened &&
nextProp.isOnboardingDialogOpened === prevProp.isOnboardingDialogOpened &&
@@ -817,8 +797,6 @@ const areEqual = (prevProp, nextProp) =>
prevProp.isThirdPartyLibsDialogOpened &&
nextProp.isUploadProgressDialogOpened ===
prevProp.isUploadProgressDialogOpened &&
- nextProp.leftSplitSize === prevProp.leftSplitSize &&
- nextProp.mainSplitSize === prevProp.mainSplitSize &&
JSON.stringify(nextProp.selectedEntries) ===
JSON.stringify(prevProp.selectedEntries) &&
JSON.stringify(nextProp.openedFiles) === JSON.stringify(prevProp.openedFiles);
@@ -829,7 +807,7 @@ export default withDnDContext(
mapDispatchToProps
)(
translate(['core'], { wait: true })(
- withStyles(styles, { withTheme: true })(React.memo(MainPage, areEqual))
+ React.memo(withStyles(styles, { withTheme: true })(MainPage), areEqual)
)
)
);
diff --git a/app/locales/en/core.json b/app/locales/en/core.json
index 4d1042b24..0c5d083ec 100644
--- a/app/locales/en/core.json
+++ b/app/locales/en/core.json
@@ -301,7 +301,7 @@
"minimize": "Minimize",
"closeAndClear": "Close & Clear",
"addNewFileType": "Add new file type",
- "dropHere": "Drop tags here",
+ "dropHere": "Type or drop tags here",
"confirmFileTypeDeletion": "Do you want to delete this file type?",
"confirmTagDeletion": "Are you sure you want to remove this tag?",
"confirmSelectedTagsDeletion": "Are you sure you want to delete the selected tags?",
@@ -474,7 +474,7 @@
"webClipperChrome": "Get Chrome Web Clipper",
"webClipperFirefox": "Get Firefox Web Clipper",
"helpWithTranslation": "Help with translation",
- "helpFeedback": "Get help, send feedback",
+ "helpFeedback": "Help & Feedback",
"emailContact": "Write us an email",
"onboardingWizard": "Start onboarding wizard",
"getItNow": "Get it now",
diff --git a/app/perspectives/grid-perspective/components/CellContent.tsx b/app/perspectives/grid-perspective/components/CellContent.tsx
index 13db5a7cb..ccf416462 100644
--- a/app/perspectives/grid-perspective/components/CellContent.tsx
+++ b/app/perspectives/grid-perspective/components/CellContent.tsx
@@ -31,7 +31,10 @@ import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { formatFileSize, formatDateTime } from '-/utils/misc';
import { extractTagsAsObjects, extractTitle } from '-/utils/paths';
-import { findColorForFileEntry } from '-/services/utils-io';
+import {
+ findBackgroundColorForFolder,
+ findColorForEntry
+} from '-/services/utils-io';
import TagContainerDnd from '-/components/TagContainerDnd';
import TagContainer from '-/components/TagContainer';
import i18n from '-/services/i18n';
@@ -109,11 +112,8 @@ const CellContent = (props: Props) => {
description = ' | ' + description;
}
- const fsEntryColor = findColorForFileEntry(
- fsEntry.extension,
- fsEntry.isFile,
- supportedFileTypes
- );
+ const fsEntryColor = findColorForEntry(fsEntry, supportedFileTypes);
+ const fsEntryBgColor = findBackgroundColorForFolder(fsEntry);
const fileNameTags = extractTagsAsObjects(
fsEntry.name,
@@ -147,6 +147,7 @@ const CellContent = (props: Props) => {
return (
<div
style={{
+ backgroundColor: fsEntryBgColor,
opacity: fsEntry.isIgnored ? 0.3 : 1
}}
>
diff --git a/app/perspectives/grid-perspective/components/GridPagination.tsx b/app/perspectives/grid-perspective/components/GridPagination.tsx
index 49441f1e0..b425ea3d4 100644
--- a/app/perspectives/grid-perspective/components/GridPagination.tsx
+++ b/app/perspectives/grid-perspective/components/GridPagination.tsx
@@ -66,7 +66,9 @@ const GridPagination = (props: Props) => {
const [page, setPage] = useState(currentPage);
useEffect(() => {
- setPage(props.currentPage);
+ if (page !== currentPage) {
+ setPage(props.currentPage);
+ }
if (containerEl && containerEl.current) {
containerEl.current.scrollTop = 0;
}
@@ -144,7 +146,7 @@ const GridPagination = (props: Props) => {
<Pagination
style={{
left: 30,
- bottom: 30,
+ bottom: 80,
zIndex: 1100,
position: 'absolute',
backgroundColor: theme.palette.background.default,
diff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsx
index a084326be..c851af51e 100644
--- a/app/perspectives/grid-perspective/components/MainContainer.tsx
+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx
@@ -28,7 +28,12 @@ import {
getKeyBindingObject,
isDesktopMode
} from '-/reducers/settings';
-import { locationType, sortByCriteria } from '-/utils/misc';
+import {
+ isObj,
+ isVisibleOnScreen,
+ locationType,
+ sortByCriteria
+} from '-/utils/misc';
import styles from './styles.css';
import FileMenu from '-/components/menus/FileMenu';
import DirectoryMenu from '-/components/menus/DirectoryMenu';
@@ -181,6 +186,10 @@ const GridPerspective = (props: Props) => {
settings && settings.gridPageLimit ? settings.gridPageLimit : 100
);
+ useEffect(() => {
+ makeFirstSelectedEntryVisible();
+ }, [props.selectedEntries]);
+
useEffect(() => {
const settingsObj = {
showDirectories,
@@ -229,7 +238,7 @@ const GridPerspective = (props: Props) => {
[props.directoryContent, sortBy, orderBy]
);
- /* const makeFirstSelectedEntryVisible = () => {
+ const makeFirstSelectedEntryVisible = () => {
const { selectedEntries } = props;
if (selectedEntries && selectedEntries.length > 0) {
const firstSelectedElement = document.querySelector(
@@ -243,7 +252,7 @@ const GridPerspective = (props: Props) => {
firstSelectedElement.scrollIntoView(false);
}
}
- }; */
+ };
const handleLayoutSwitch = (type: string) => {
setLayoutType(type);
diff --git a/app/perspectives/grid-perspective/components/MainToolbar.tsx b/app/perspectives/grid-perspective/components/MainToolbar.tsx
index 1d84f740f..53e156d63 100644
--- a/app/perspectives/grid-perspective/components/MainToolbar.tsx
+++ b/app/perspectives/grid-perspective/components/MainToolbar.tsx
@@ -83,17 +83,15 @@ const MainToolbar = (props: Props) => {
{allFilesSelected ? <SelectAllIcon /> : <DeSelectAllIcon />}
</IconButton>
</Tooltip>
- {isDesktopMode && (
- <Tooltip title={i18n.t('core:navigateToParentDirectory')}>
- <IconButton
- aria-label={i18n.t('core:navigateToParentDirectory')}
- data-tid="gridPerspectiveOnBackButton"
- onClick={loadParentDirectoryContent}
- >
- <ParentDirIcon />
- </IconButton>
- </Tooltip>
- )}
+ <Tooltip title={i18n.t('core:navigateToParentDirectory')}>
+ <IconButton
+ aria-label={i18n.t('core:navigateToParentDirectory')}
+ data-tid="gridPerspectiveOnBackButton"
+ onClick={loadParentDirectoryContent}
+ >
+ <ParentDirIcon />
+ </IconButton>
+ </Tooltip>
{layoutType === 'row' ? (
<Tooltip title={i18n.t('core:switchToGridView')}>
<IconButton
diff --git a/app/perspectives/grid-perspective/components/styles.css.tsx b/app/perspectives/grid-perspective/components/styles.css.tsx
index 1ff2fac9d..8f46baf5c 100644
--- a/app/perspectives/grid-perspective/components/styles.css.tsx
+++ b/app/perspectives/grid-perspective/components/styles.css.tsx
@@ -65,7 +65,9 @@ export default (theme: any): any => ({
},
gridCellThumb: {
backgroundRepeat: 'no-repeat',
- backgroundPosition: 'center'
+ backgroundPosition: 'center',
+ borderRadius: 5,
+ marginBottom: 5
},
gridCellTitle: {
padding: 5,
diff --git a/app/reducers/app.ts b/app/reducers/app.ts
index ee5ad8377..18f846db7 100644
--- a/app/reducers/app.ts
+++ b/app/reducers/app.ts
@@ -93,6 +93,7 @@ export const types = {
RENAME_FILE: 'APP/RENAME_FILE',
TOGGLE_EDIT_TAG_DIALOG: 'APP/TOGGLE_EDIT_TAG_DIALOG',
TOGGLE_ABOUT_DIALOG: 'APP/TOGGLE_ABOUT_DIALOG',
+ TOGGLE_LOCATION_DIALOG: 'APP/TOGGLE_LOCATION_DIALOG',
TOGGLE_ONBOARDING_DIALOG: 'APP/TOGGLE_ONBOARDING_DIALOG',
TOGGLE_KEYBOARD_DIALOG: 'APP/TOGGLE_KEYBOARD_DIALOG',
TOGGLE_LICENSE_DIALOG: 'APP/TOGGLE_LICENSE_DIALOG',
@@ -145,7 +146,7 @@ export type OpenedEntry = {
description?: string;
perspective?: string;
editMode?: boolean;
- changed?: boolean;
+ // changed?: boolean;
/**
* if its true iframe will be reloaded
* if its false && editMode==true and changed==true => show reload dialog
@@ -201,6 +202,7 @@ export const initialState = {
openedFiles: [],
editTagDialogOpened: false,
aboutDialogOpened: false,
+ locationDialogOpened: false,
openLinkDialogOpened: false,
onboardingDialogOpened: false,
keysDialogOpened: false,
@@ -316,6 +318,9 @@ export default (state: any = initialState, action: any) => {
case types.TOGGLE_ABOUT_DIALOG: {
return { ...state, aboutDialogOpened: !state.aboutDialogOpened };
}
+ case types.TOGGLE_LOCATION_DIALOG: {
+ return { ...state, locationDialogOpened: !state.locationDialogOpened };
+ }
case types.TOGGLE_ONBOARDING_DIALOG: {
return {
...state,
@@ -825,6 +830,7 @@ export const actions = {
tag
}),
toggleAboutDialog: () => ({ type: types.TOGGLE_ABOUT_DIALOG }),
+ toggleLocationDialog: () => ({ type: types.TOGGLE_LOCATION_DIALOG }),
toggleOnboardingDialog: () => ({ type: types.TOGGLE_ONBOARDING_DIALOG }),
toggleKeysDialog: () => ({ type: types.TOGGLE_KEYBOARD_DIALOG }),
toggleOpenLinkDialog: () => ({ type: types.TOGGLE_OPENLINK_DIALOG }),
@@ -1092,7 +1098,17 @@ export const actions = {
type: types.SET_CURRENDIRECTORYPERSPECTIVE,
perspective
}),
- setSelectedEntries: (selectedEntries: Array<Object>) => ({
+ setSelectedEntries: (selectedEntries: Array<Object>) => (
+ dispatch: (actions: Object) => void,
+ getState: () => any
+ ) => {
+ const { openedFiles } = getState().app;
+ // skip select other file if its have openedFiles in editMode
+ if (openedFiles.length === 0 || !openedFiles[0].editMode) {
+ dispatch(actions.setSelectedEntriesInt(selectedEntries));
+ }
+ },
+ setSelectedEntriesInt: (selectedEntries: Array<Object>) => ({
type: types.SET_SELECTED_ENTRIES,
selectedEntries
}),
@@ -1548,11 +1564,9 @@ export const actions = {
entryForOpening = { ...entryExist };
}
- if (fsEntryMeta.changed !== undefined) {
+ /* if (fsEntryMeta.changed !== undefined) {
entryForOpening.changed = fsEntryMeta.changed;
- } /* else {
- entryForOpening.changed = true;
- } */
+ } */
if (fsEntryMeta.editMode !== undefined) {
entryForOpening.editMode = fsEntryMeta.editMode;
}
@@ -1604,7 +1618,8 @@ export const actions = {
*/
if (openedFiles.length > 0) {
const openFile = openedFiles[0];
- if (openFile.editMode && openFile.changed) {
+ if (openFile.editMode) {
+ // && openFile.changed) {
entryForOpening = { ...openFile, shouldReload: false };
dispatch(actions.addToEntryContainer(entryForOpening));
return false;
@@ -2143,6 +2158,8 @@ export const isOnboardingDialogOpened = (state: any) =>
export const isEditTagDialogOpened = (state: any) =>
state.app.editTagDialogOpened;
export const isAboutDialogOpened = (state: any) => state.app.aboutDialogOpened;
+export const isLocationDialogOpened = (state: any) =>
+ state.app.locationDialogOpened;
export const isKeysDialogOpened = (state: any) => state.app.keysDialogOpened;
export const isLicenseDialogOpened = (state: any) =>
state.app.licenseDialogOpened;
diff --git a/app/reducers/settings-default.ts b/app/reducers/settings-default.ts
index a619812ad..e7e7048f1 100644
--- a/app/reducers/settings-default.ts
+++ b/app/reducers/settings-default.ts
@@ -165,9 +165,8 @@ export default {
enableGlobalKeyboardShortcuts: true,
zoomFactor: 1,
lastPublishedVersion: '',
- entryPropertiesSplitSize: 103,
- leftVerticalSplitSize: 350,
- mainVerticalSplitSize: '50%',
+ entrySplitSize: '45%', // AppConfig.isElectron ? '560px' : '360px',
+ mainVSplitSize: '50%',
supportedGeoTagging: ['pluscodes', 'mgrs'],
supportedThemes: ['light', 'dark'],
supportedLanguages: [
diff --git a/app/reducers/settings.ts b/app/reducers/settings.ts
index 6c444844a..045f9075c 100644
--- a/app/reducers/settings.ts
+++ b/app/reducers/settings.ts
@@ -69,7 +69,6 @@ export const types = {
SET_LAST_PUBLISHED_VERSION: 'SETTINGS/SET_LAST_PUBLISHED_VERSION',
SET_ENTRY_PROPERTIES_SPLIT_SIZE: 'SETTINGS/SET_ENTRY_PROPERTIES_SPLIT_SIZE',
SET_MAIN_VSPLIT_SIZE: 'SETTINGS/SET_MAIN_VSPLIT_SIZE',
- SET_LEFT_VSPLIT_SIZE: 'SETTINGS/SET_LEFT_VSPLIT_SIZE',
SET_FIRST_RUN: 'SETTINGS/SET_FIRST_RUN',
TOGGLE_TAGGROUP: 'TOGGLE_TAGGROUP',
ADD_MAPTILE_SERVER: 'SET_MAPTILE_SERVER',
@@ -302,19 +301,13 @@ export default (state: any = defaultSettings, action: any) => {
case types.SET_ENTRY_PROPERTIES_SPLIT_SIZE: {
return {
...state,
- entryPropertiesSplitSize: action.entryPropertiesSplitSize
+ entrySplitSize: action.entrySplitSize
};
}
case types.SET_MAIN_VSPLIT_SIZE: {
return {
...state,
- mainVerticalSplitSize: action.mainVerticalSplitSize
- };
- }
- case types.SET_LEFT_VSPLIT_SIZE: {
- return {
- ...state,
- leftVerticalSplitSize: action.leftVerticalSplitSize
+ mainVSplitSize: action.mainVSplitSize
};
}
case types.SET_LAST_PUBLISHED_VERSION: {
@@ -537,17 +530,13 @@ export const actions = {
type: types.SET_SUPPORTED_FILE_TYPES,
supportedFileTypes
}),
- setEntryPropertiesSplitSize: (entryPropertiesSplitSize: number) => ({
+ setEntryPropertiesSplitSize: (entrySplitSize: string) => ({
type: types.SET_ENTRY_PROPERTIES_SPLIT_SIZE,
- entryPropertiesSplitSize
+ entrySplitSize
}),
- setMainVerticalSplitSize: (mainVerticalSplitSize: any) => ({
+ setMainVerticalSplitSize: (mainVSplitSize: string) => ({
type: types.SET_MAIN_VSPLIT_SIZE,
- mainVerticalSplitSize
- }),
- setLeftVerticalSplitSize: (leftVerticalSplitSize: number) => ({
- type: types.SET_LEFT_VSPLIT_SIZE,
- leftVerticalSplitSize
+ mainVSplitSize
}),
setFirstRun: (firstRun: boolean) => ({
type: types.SET_FIRST_RUN,
@@ -673,8 +662,6 @@ export const getTagTextColor = (state: any) => state.settings.tagTextColor;
export const getCurrentTheme = (state: any) => state.settings.currentTheme;
export const isGlobalKeyBindingEnabled = (state: any) =>
state.settings.enableGlobalKeyboardShortcuts;
-export const getLeftVerticalSplitSize = (state: any) =>
- state.settings.leftVerticalSplitSize;
export const getMainVerticalSplitSize = (state: any) =>
state.settings.mainVerticalSplitSize;
export const getTagDelimiter = (state: any) => state.settings.tagDelimiter;
diff --git a/app/reducers/tagging-actions.ts b/app/reducers/tagging-actions.ts
index 1ec9b2dd2..6f9fc3acf 100644
--- a/app/reducers/tagging-actions.ts
+++ b/app/reducers/tagging-actions.ts
@@ -202,8 +202,7 @@ const actions = {
if (openedFiles.find(obj => obj.path === path)) {
dispatch(
AppActions.updateOpenedFile(path, {
- tags: newTags,
- changed: true
+ tags: newTags
})
);
}
@@ -433,8 +432,7 @@ const actions = {
.then(() => {
dispatch(
AppActions.updateOpenedFile(path, {
- tags: fsEntryMeta.tags,
- changed: true
+ tags: fsEntryMeta.tags
})
);
// TODO rethink this updateCurrentDirEntry and not need for KanBan
@@ -468,8 +466,7 @@ const actions = {
.then(() => {
dispatch(
AppActions.updateOpenedFile(path, {
- tags: fsEntryMeta.tags,
- changed: true
+ tags: fsEntryMeta.tags
})
);
// TODO rethink this updateCurrentDirEntry and not need for KanBan
@@ -559,8 +556,7 @@ const actions = {
if (openedFiles.find(obj => obj.path === path)) {
dispatch(
AppActions.updateOpenedFile(path, {
- tags: newTags,
- changed: true
+ tags: newTags
})
);
}
@@ -645,7 +641,7 @@ const actions = {
// TODO rethink this updateCurrentDirEntry and not need for KanBan
dispatch(AppActions.reflectUpdateSidecarTags(path, []));
dispatch(
- AppActions.updateOpenedFile(path, { tags: [], changed: true })
+ AppActions.updateOpenedFile(path, { tags: [] })
);
removeAllTagsFromFilename();
return true;
diff --git a/app/services/utils-io.ts b/app/services/utils-io.ts
index 28a31e0fb..510136fc4 100644
--- a/app/services/utils-io.ts
+++ b/app/services/utils-io.ts
@@ -289,7 +289,7 @@ export function findExtensionsForEntry(
viewingExtensionPath,
viewingExtensionId: '',
isFile,
- changed: false,
+ // changed: false,
lmdt: 0,
size: 0
};
@@ -992,26 +992,32 @@ export function setFolderThumbnailPromise(filePath: string): Promise<string> {
).then(() => directoryPath);
}
-export function findColorForFileEntry(
- fileExtension: string,
- isFile: boolean,
+export function findBackgroundColorForFolder(fsEntry: TS.FileSystemEntry) {
+ if (!fsEntry.isFile) {
+ if (fsEntry.color) {
+ return fsEntry.color;
+ }
+ }
+ return 'transparent';
+}
+
+export function findColorForEntry(
+ fsEntry: TS.FileSystemEntry,
supportedFileTypes: Array<any>
): string {
- if (!isFile) {
+ if (!fsEntry.isFile) {
return AppConfig.defaultFolderColor;
}
- let color = AppConfig.defaultFileColor;
- if (fileExtension !== undefined) {
- supportedFileTypes.map(fileType => {
- if (fileType.type.toLowerCase() === fileExtension.toLowerCase()) {
- if (fileType.color) {
- color = fileType.color;
- }
- }
- return true;
- });
+ if (fsEntry.extension !== undefined) {
+ const fileType = supportedFileTypes.find(
+ type => type.type.toLowerCase() === fsEntry.extension.toLowerCase()
+ );
+
+ if (fileType && fileType.color) {
+ return fileType.color;
+ }
}
- return color;
+ return AppConfig.defaultFileColor;
}
export function loadFileContentPromise(
diff --git a/app/utils/dates.ts b/app/utils/dates.ts
index 9bb7c693b..bacd5c52f 100644
--- a/app/utils/dates.ts
+++ b/app/utils/dates.ts
@@ -79,42 +79,42 @@ export function isYearMonthDayPeriod(tagDate: string): boolean {
/** Returns true if string is this format: 20151223~01 */
export function isYearMonthDayHour(tagDate: string): boolean {
- return /(^|\s)([0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789]~[0123456][0123456789])(\s|$)/.test(
+ return /(^|\s)([0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789][~T][0123456][0123456789])(\s|$)/.test(
tagDate
);
}
/** Returns true if string is this format: 20190712~17-20190712~17 */
export function isYearMonthDayHourPeriod(tagDate: string): boolean {
- return /(^|\s)([0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789]~[0123456][0123456789]-[0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789]~[0123456][0123456789])(\s|$)/.test(
+ return /(^|\s)([0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789][~T][0123456][0123456789]-[0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789][~T][0123456][0123456789])(\s|$)/.test(
tagDate
);
}
-/** Returns true if string is this format: 20151223~0112 */
+/** Returns true if string is this format: 20151223~0112 or 20151223T0112 */
export function isYearMonthDayHourMin(tagDate: string): boolean {
- return /(^|\s)([0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789]~[0123456][0123456789][0123456][0123456789])(\s|$)/.test(
+ return /(^|\s)([0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789][~T][0123456][0123456789][0123456][0123456789])(\s|$)/.test(
tagDate
);
}
/** Returns true if string is this format: 20190712~1740-20190712~1740 */
export function isYearMonthDayHourMinPeriod(tagDate: string): boolean {
- return /(^|\s)([0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789]~[0123456][0123456789][0123456][0123456789]-[0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789]~[0123456][0123456789][0123456][0123456789])(\s|$)/.test(
+ return /(^|\s)([0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789][~T][0123456][0123456789][0123456][0123456789]-[0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789][~T][0123456][0123456789][0123456][0123456789])(\s|$)/.test(
tagDate
);
}
/** Returns true if string is this format: 20151223~011358 */
export function isYearMonthDayHourMinSec(tagDate: string): boolean {
- return /(^|\s)([0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789]~[0123456][0123456789][0123456][0123456789][0123456][0123456789])(\s|$)/.test(
+ return /(^|\s)([0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789][~T][0123456][0123456789][0123456][0123456789][0123456][0123456789])(\s|$)/.test(
tagDate
);
}
/** Returns true if string is this format: 20190712~174031-20190712~174031 */
export function isYearMonthDayHourMinSecPeriod(tagDate: string): boolean {
- return /(^|\s)([0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789]~[0123456][0123456789][0123456][0123456789][0123456][0123456789]-[0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789]~[0123456][0123456789][0123456][0123456789][0123456][0123456789])(\s|$)/.test(
+ return /(^|\s)([0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789][~T][0123456][0123456789][0123456][0123456789][0123456][0123456789]-[0123][0123456789][0123456789][0123456789][01][0123456789][0123][0123456789][~T][0123456][0123456789][0123456][0123456789][0123456][0123456789])(\s|$)/.test(
tagDate
);
}
@@ -491,20 +491,21 @@ export function convertToDate(date: string) {
export function convertToDateTime(dateTime: string) {
const dateTimeRegExp = /^\d\d\d\d-(00|[0-9]|1[0-9]|2[0-3]):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9])$/g;
const dateTimeWinRegExp = /^(([0-1]?[0-9])|([2][0-3]))!([0-5]?[0-9])(!([0-5]?[0-9]))?$/g;
- const dateTimeWin1RegExp = /^(([0-1]?[0-9])|([2][0-3]))~([0-5]?[0-9])(!([0-5]?[0-9]))?$/g;
+ const dateTimeWin1RegExp = /^(([0-1]?[0-9])|([2][0-3]))[~T]([0-5]?[0-9])(!([0-5]?[0-9]))?$/g;
if (
dateTime.match(dateTimeRegExp) ||
dateTime.match(dateTimeWinRegExp) ||
dateTime.match(dateTimeWin1RegExp) ||
dateTime.search('!') ||
dateTime.search(':') ||
- dateTime.search('~')
+ dateTime.search('~') ||
+ dateTime.search('T')
) {
let time;
let firstTime;
let secondTime;
- if (dateTime.indexOf('!')) {
+ if (dateTime.includes('!')) {
time = dateTime.split('!');
if (parseInt(time[0], 10) && parseInt(time[1], 10)) {
firstTime = time[0];
@@ -517,13 +518,27 @@ export function convertToDateTime(dateTime: string) {
return time;
}
}
- if (dateTime.indexOf(':')) {
+ if (dateTime.includes(':')) {
time = dateTime.split(':');
if (parseInt(time[0], 10) && parseInt(time[1], 10)) {
return time;
}
}
- if (dateTime.indexOf('~')) {
+ if (dateTime.includes('T')) {
+ time = dateTime.split('T');
+ if (parseInt(time[0], 10) && parseInt(time[1], 10)) {
+ firstTime = time[0];
+ secondTime = time[1];
+ if (firstTime.length === 2 && secondTime.length === 2) {
+ time = firstTime + ':' + secondTime;
+ } else if (firstTime.length > 2 && firstTime.length <= 8) {
+ time = convertToDate(firstTime) + ' ' + toHHMMSS(secondTime);
+ }
+ return time;
+ }
+ }
+ if (dateTime.includes('~')) {
+ // for compatibility
time = dateTime.split('~');
if (parseInt(time[0], 10) && parseInt(time[1], 10)) {
firstTime = time[0];
diff --git a/app/utils/misc.ts b/app/utils/misc.ts
index b17e6b6e6..98ae07d12 100644
--- a/app/utils/misc.ts
+++ b/app/utils/misc.ts
@@ -407,10 +407,12 @@ export function formatDateTime(date: string | number, includeTime: boolean) {
if (includeTime) {
time = ' - ' + cHour + ':' + cMinute + ':' + cSecond;
}
- return cYear + '.' + cMonth + '.' + cDate + time;
+ return cYear + '-' + cMonth + '-' + cDate + time;
}
-/** Convert a date in the following format 20191204 or 20191204~124532 */
+/** Convert a date in the following format 20191204 or 20191204T124532
+ * https://en.wikipedia.org/wiki/ISO_8601
+ */
export function formatDateTime4Tag(
date: string | Date,
includeTime: boolean,
@@ -449,12 +451,12 @@ export function formatDateTime4Tag(
if (cSecond.length === 1) {
cSecond = '0' + cSecond;
}
- time = '~' + cHour + '' + cMinute + '' + cSecond; // TODO fix Chrome transforms ~ to _
+ time = 'T' + cHour + '' + cMinute + '' + cSecond;
}
let milliseconds = '';
if (includeMS) {
- milliseconds = '~' + d.getMilliseconds();
+ milliseconds = '.' + d.getMilliseconds();
}
return cYear + '' + cMonth + '' + cDate + time + milliseconds;
}
diff --git a/package.json b/package.json
index 4ef0e479a..ec7cc2432 100644
--- a/package.json
+++ b/package.json
@@ -162,6 +162,7 @@
"@types/react-redux": "^6.0.12",
"@types/react-router-dom": "^4.3.1",
"@types/redux-logger": "^3.0.6",
+ "@typescript-eslint/eslint-plugin": "^4.31.2",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^26.6.3",
@@ -187,14 +188,17 @@
"eslint": "^6.8.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^3.3.0",
+ "eslint-config-react-app": "^6.0.0",
"eslint-formatter-pretty": "^2.0.0",
"eslint-import-resolver-webpack": "^0.10.1",
"eslint-plugin-compat": "^2.6.3",
+ "eslint-plugin-flowtype": "^6.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jest": "^22.1.2",
"eslint-plugin-jsx-a11y": "6.1.2",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-react": "^7.12.3",
+ "eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-testcafe": "^0.2.1",
"express": "^4.17.1",
"extract-text-webpack-plugin": "^v4.0.0-beta.0",
@@ -298,11 +302,7 @@
"react-image-gallery": "^1.2.7",
"react-leaflet": "^2.8.0",
"react-redux": "^5.0.7",
- "react-router": "^4.3.1",
- "react-router-dom": "^4.3.1",
- "react-split-pane": "https://github.com/quarkw/react-split-pane",
"react-swipeable-views": "0.13.3",
- "react-virtualized": "^9.21.1",
"redux": "^3.7.2",
"redux-persist": "^5.10.0",
"redux-thunk": "^2.3.0",
@@ -310,6 +310,7 @@
"semver": "^5.5.0",
"source-map-support": "^0.5.11",
"tiff.js": "^1.0.0",
+ "ts-react-splitter": "^2.1.1",
"use-state-with-callback": "^2.0.3",
"winattr": "^3.0.0"
},
diff --git a/yarn.lock b/yarn.lock
index 5e2df444f..466c29aa4 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3339,7 +3339,7 @@
dependencies:
regenerator-runtime "^0.12.0"
-"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.2.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.0", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7":
+"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.2.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.0", "@babel/runtime@^7.8.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7":
version "7.11.2"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.11.2.tgz#f549c13c754cc40b87644b9fa9f09a6a95fe0736"
integrity sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw==
@@ -4201,6 +4201,11 @@
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.6.tgz#f4c7ec43e81b319a9815115031709f26987891f0"
integrity sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==
+"@types/json-schema@^7.0.7":
+ version "7.0.9"
+ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d"
+ integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==
+
"@types/json5@^0.0.29":
version "0.0.29"
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
@@ -4394,6 +4399,31 @@
dependencies:
"@types/node" "*"
+"@typescript-eslint/eslint-plugin@^4.31.2":
+ version "4.31.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.31.2.tgz#9f41efaee32cdab7ace94b15bd19b756dd099b0a"
+ integrity sha512-w63SCQ4bIwWN/+3FxzpnWrDjQRXVEGiTt9tJTRptRXeFvdZc/wLiz3FQUwNQ2CVoRGI6KUWMNUj/pk63noUfcA==
+ dependencies:
+ "@typescript-eslint/experimental-utils" "4.31.2"
+ "@typescript-eslint/scope-manager" "4.31.2"
+ debug "^4.3.1"
+ functional-red-black-tree "^1.0.1"
+ regexpp "^3.1.0"
+ semver "^7.3.5"
+ tsutils "^3.21.0"
+
+"@typescript-eslint/[email protected]":
+ version "4.31.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.31.2.tgz#98727a9c1e977dd5d20c8705e69cd3c2a86553fa"
+ integrity sha512-3tm2T4nyA970yQ6R3JZV9l0yilE2FedYg8dcXrTar34zC9r6JB7WyBQbpIVongKPlhEMjhQ01qkwrzWy38Bk1Q==
+ dependencies:
+ "@types/json-schema" "^7.0.7"
+ "@typescript-eslint/scope-manager" "4.31.2"
+ "@typescript-eslint/types" "4.31.2"
+ "@typescript-eslint/typescript-estree" "4.31.2"
+ eslint-scope "^5.1.1"
+ eslint-utils "^3.0.0"
+
"@typescript-eslint/experimental-utils@^1.13.0":
version "1.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-1.13.0.tgz#b08c60d780c0067de2fb44b04b432f540138301e"
@@ -4403,6 +4433,19 @@
"@typescript-eslint/typescript-estree" "1.13.0"
eslint-scope "^4.0.0"
+"@typescript-eslint/[email protected]":
+ version "4.31.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.31.2.tgz#1d528cb3ed3bcd88019c20a57c18b897b073923a"
+ integrity sha512-2JGwudpFoR/3Czq6mPpE8zBPYdHWFGL6lUNIGolbKQeSNv4EAiHaR5GVDQaLA0FwgcdcMtRk+SBJbFGL7+La5w==
+ dependencies:
+ "@typescript-eslint/types" "4.31.2"
+ "@typescript-eslint/visitor-keys" "4.31.2"
+
+"@typescript-eslint/[email protected]":
+ version "4.31.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.31.2.tgz#2aea7177d6d744521a168ed4668eddbd912dfadf"
+ integrity sha512-kWiTTBCTKEdBGrZKwFvOlGNcAsKGJSBc8xLvSjSppFO88AqGxGNYtF36EuEYG6XZ9vT0xX8RNiHbQUKglbSi1w==
+
"@typescript-eslint/[email protected]":
version "1.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.13.0.tgz#8140f17d0f60c03619798f1d628b8434913dc32e"
@@ -4411,6 +4454,27 @@
lodash.unescape "4.0.1"
semver "5.5.0"
+"@typescript-eslint/[email protected]":
+ version "4.31.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.31.2.tgz#abfd50594d8056b37e7428df3b2d185ef2d0060c"
+ integrity sha512-ieBq8U9at6PvaC7/Z6oe8D3czeW5d//Fo1xkF/s9394VR0bg/UaMYPdARiWyKX+lLEjY3w/FNZJxitMsiWv+wA==
+ dependencies:
+ "@typescript-eslint/types" "4.31.2"
+ "@typescript-eslint/visitor-keys" "4.31.2"
+ debug "^4.3.1"
+ globby "^11.0.3"
+ is-glob "^4.0.1"
+ semver "^7.3.5"
+ tsutils "^3.21.0"
+
+"@typescript-eslint/[email protected]":
+ version "4.31.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.31.2.tgz#7d5b4a4705db7fe59ecffb273c1d082760f635cc"
+ integrity sha512-PrBId7EQq2Nibns7dd/ch6S6/M4/iwLM9McbgeEbCXfxdwRUNxJ4UNreJ6Gh3fI2GNKNrWnQxKL7oCPmngKBug==
+ dependencies:
+ "@typescript-eslint/types" "4.31.2"
+ eslint-visitor-keys "^2.0.0"
+
"@webassemblyjs/[email protected]":
version "1.9.0"
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.9.0.tgz#bd850604b4042459a5a41cd7d338cbed695ed964"
@@ -6755,7 +6819,7 @@ configstore@^5.0.1:
write-file-atomic "^3.0.0"
xdg-basedir "^4.0.0"
-confusing-browser-globals@^1.0.5:
+confusing-browser-globals@^1.0.10, confusing-browser-globals@^1.0.5:
version "1.0.10"
resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.10.tgz#30d1e7f3d1b882b25ec4933d1d1adac353d20a59"
integrity sha512-gNld/3lySHwuhaVluJUKLePYirM3QNCKzVxqAdhJII9/WXKVX5PURzMVJspS1jTslSqjeuG4KMVTSouit5YPHA==
@@ -7752,7 +7816,7 @@ dom-helpers@^3.2.0, dom-helpers@^3.2.1:
dependencies:
"@babel/runtime" "^7.1.2"
-dom-helpers@^5.0.1, dom-helpers@^5.1.3:
+dom-helpers@^5.0.1:
version "5.2.0"
resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-5.2.0.tgz#57fd054c5f8f34c52a3eeffdb7e7e93cd357d95b"
integrity sha512-Ru5o9+V8CpunKnz5LGgWXkmrH/20cGKwcHwS4m73zIvs54CN9epEmT/HLqFJW3kXpakAFkEdzgy1hzlJe3E4OQ==
@@ -8319,6 +8383,13 @@ eslint-config-prettier@^3.3.0:
dependencies:
get-stdin "^6.0.0"
+eslint-config-react-app@^6.0.0:
+ version "6.0.0"
+ resolved "https://registry.yarnpkg.com/eslint-config-react-app/-/eslint-config-react-app-6.0.0.tgz#ccff9fc8e36b322902844cbd79197982be355a0e"
+ integrity sha512-bpoAAC+YRfzq0dsTk+6v9aHm/uqnDwayNAXleMypGl6CpxI9oXXscVHo4fk3eJPIn+rsbtNetB4r/ZIidFIE8A==
+ dependencies:
+ confusing-browser-globals "^1.0.10"
+
eslint-formatter-pretty@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/eslint-formatter-pretty/-/eslint-formatter-pretty-2.1.1.tgz#0794a1009195d14e448053fe99667413b7d02e44"
@@ -8374,6 +8445,14 @@ eslint-plugin-compat@^2.6.3:
caniuse-db "^1.0.30000935"
mdn-browser-compat-data "^0.0.65"
+eslint-plugin-flowtype@^6.1.0:
+ version "6.1.0"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-6.1.0.tgz#626f44d9adbdb681644accd5fa29dffcb0d6d531"
+ integrity sha512-md72y02Gq/1mmLkW31wPpUmjT0CSYHbFA1IVfkQ1kViaFrKYGR1yCWKS1THqz0hmoIUlx8Jm7NHa4B6lDvJj3g==
+ dependencies:
+ lodash "^4.17.21"
+ string-natural-compare "^3.0.1"
+
eslint-plugin-import@^2.14.0:
version "2.22.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.22.0.tgz#92f7736fe1fde3e2de77623c838dd992ff5ffb7e"
@@ -8419,6 +8498,11 @@ eslint-plugin-promise@^4.0.1:
resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz#845fd8b2260ad8f82564c1222fce44ad71d9418a"
integrity sha512-VoM09vT7bfA7D+upt+FjeBO5eHIJQBUWki1aPvB+vbNiHS3+oGIJGIeyBtKQTME6UPXXy3vV07OL1tHd3ANuDw==
+eslint-plugin-react-hooks@^4.2.0:
+ version "4.2.0"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.2.0.tgz#8c229c268d468956334c943bb45fc860280f5556"
+ integrity sha512-623WEiZJqxR7VdxFCKLI6d6LLpwJkGPYKODnkH3D7WpOG5KM8yWueBd8TLsNAetEJNF5iJmolaAKO3F8yzyVBQ==
+
eslint-plugin-react@^7.12.3:
version "7.20.6"
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.20.6.tgz#4d7845311a93c463493ccfa0a19c9c5d0fd69f60"
@@ -8462,6 +8546,14 @@ eslint-scope@^5.0.0:
esrecurse "^4.1.0"
estraverse "^4.1.1"
+eslint-scope@^5.1.1:
+ version "5.1.1"
+ resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
+ integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==
+ dependencies:
+ esrecurse "^4.3.0"
+ estraverse "^4.1.1"
+
eslint-utils@^1.4.3:
version "1.4.3"
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f"
@@ -8469,11 +8561,23 @@ eslint-utils@^1.4.3:
dependencies:
eslint-visitor-keys "^1.1.0"
+eslint-utils@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672"
+ integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==
+ dependencies:
+ eslint-visitor-keys "^2.0.0"
+
eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e"
integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==
+eslint-visitor-keys@^2.0.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303"
+ integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==
+
eslint@^6.8.0:
version "6.8.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb"
@@ -8538,7 +8642,7 @@ esquery@^1.0.1:
dependencies:
estraverse "^5.1.0"
-esrecurse@^4.1.0:
+esrecurse@^4.1.0, esrecurse@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921"
integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==
@@ -9419,6 +9523,11 @@ get-caller-file@^2.0.1, get-caller-file@^2.0.5:
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
+get-node-dimensions@^1.2.1:
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/get-node-dimensions/-/get-node-dimensions-1.2.1.tgz#fb7b4bb57060fb4247dd51c9d690dfbec56b0823"
+ integrity sha512-2MSPMu7S1iOTL+BOa6K1S62hB2zUAYNF/lV0gSVlOaacd087lc6nR1H1r0e3B1CerTo+RceOmi1iJW+vp21xcQ==
+
get-own-enumerable-property-symbols@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz#b5fde77f22cbe35f390b4e089922c50bce6ef664"
@@ -9614,6 +9723,18 @@ globby@^11.0.1:
merge2 "^1.3.0"
slash "^3.0.0"
+globby@^11.0.3:
+ version "11.0.4"
+ resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.4.tgz#2cbaff77c2f2a62e71e9b2813a67b97a3a3001a5"
+ integrity sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==
+ dependencies:
+ array-union "^2.1.0"
+ dir-glob "^3.0.1"
+ fast-glob "^3.1.1"
+ ignore "^5.1.4"
+ merge2 "^1.3.0"
+ slash "^3.0.0"
+
globby@^6.1.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c"
@@ -9886,18 +10007,6 @@ highlight.js@^9.3.0:
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.18.3.tgz#a1a0a2028d5e3149e2380f8a865ee8516703d634"
integrity sha512-zBZAmhSupHIl5sITeMqIJnYCDfAEc3Gdkqj65wC1lpI468MMQeeQkhcIAvk+RylAkxrCcI9xy9piHiXeQ1BdzQ==
-history@^4.7.2:
- version "4.10.1"
- resolved "https://registry.yarnpkg.com/history/-/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3"
- integrity sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==
- dependencies:
- "@babel/runtime" "^7.1.2"
- loose-envify "^1.2.0"
- resolve-pathname "^3.0.0"
- tiny-invariant "^1.0.2"
- tiny-warning "^1.0.0"
- value-equal "^1.0.1"
-
hmac-drbg@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
@@ -9917,11 +10026,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz#aa448cf0986d55cc40773b17174b7dd066cb7cfb"
integrity sha1-qkSM8JhtVcxAdzsXF0t90GbLfPs=
-hoist-non-react-statics@^2.5.0:
- version "2.5.5"
- resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47"
- integrity sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw==
-
hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
@@ -12408,7 +12512,7 @@ lodash@^4.0.0, lodash@^4.0.1, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15,
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
-lodash@^4.17.10:
+lodash@^4.17.10, lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
@@ -12463,7 +12567,7 @@ longest-streak@^2.0.1:
resolved "https://registry.yarnpkg.com/longest-streak/-/longest-streak-2.0.4.tgz#b8599957da5b5dab64dee3fe316fa774597d90e4"
integrity sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg==
-loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1, loose-envify@^1.4.0:
+loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1, loose-envify@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
@@ -15262,6 +15366,16 @@ react-lifecycles-compat@^3.0.0, react-lifecycles-compat@^3.0.4:
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==
+react-measure@^2.5.2:
+ version "2.5.2"
+ resolved "https://registry.yarnpkg.com/react-measure/-/react-measure-2.5.2.tgz#4ffc410e8b9cb836d9455a9ff18fc1f0fca67f89"
+ integrity sha512-M+rpbTLWJ3FD6FXvYV6YEGvQ5tMayQ3fGrZhRPHrE9bVlBYfDCLuDcgNttYfk8IqfOI03jz6cbpqMRTUclQnaA==
+ dependencies:
+ "@babel/runtime" "^7.2.0"
+ get-node-dimensions "^1.2.1"
+ prop-types "^15.6.2"
+ resize-observer-polyfill "^1.5.0"
+
react-native-get-random-values@^1.4.0:
version "1.5.1"
resolved "https://registry.yarnpkg.com/react-native-get-random-values/-/react-native-get-random-values-1.5.1.tgz#f335a37c09a4892deaf40187e73a888e14e82d60"
@@ -15293,46 +15407,6 @@ react-redux@^7.1.1:
prop-types "^15.7.2"
react-is "^16.9.0"
-react-router-dom@^4.3.1:
- version "4.3.1"
- resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-4.3.1.tgz#4c2619fc24c4fa87c9fd18f4fb4a43fe63fbd5c6"
- integrity sha512-c/MlywfxDdCp7EnB7YfPMOfMD3tOtIjrQlj/CKfNMBxdmpJP8xcz5P/UAFn3JbnQCNUxsHyVVqllF9LhgVyFCA==
- dependencies:
- history "^4.7.2"
- invariant "^2.2.4"
- loose-envify "^1.3.1"
- prop-types "^15.6.1"
- react-router "^4.3.1"
- warning "^4.0.1"
-
-react-router@^4.3.1:
- version "4.3.1"
- resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.3.1.tgz#aada4aef14c809cb2e686b05cee4742234506c4e"
- integrity sha512-yrvL8AogDh2X42Dt9iknk4wF4V8bWREPirFfS9gLU1huk6qK41sg7Z/1S81jjTrGHxa3B8R3J6xIkDAA6CVarg==
- dependencies:
- history "^4.7.2"
- hoist-non-react-statics "^2.5.0"
- invariant "^2.2.4"
- loose-envify "^1.3.1"
- path-to-regexp "^1.7.0"
- prop-types "^15.6.1"
- warning "^4.0.1"
-
-"react-split-pane@https://github.com/quarkw/react-split-pane":
- version "0.1.87"
- resolved "https://github.com/quarkw/react-split-pane#50ffccdfb012cd2159d04136a8e2a1ad42766617"
- dependencies:
- prop-types "^15.5.10"
- react-lifecycles-compat "^3.0.4"
- react-style-proptype "^3.0.0"
-
-react-style-proptype@^3.0.0:
- version "3.2.2"
- resolved "https://registry.yarnpkg.com/react-style-proptype/-/react-style-proptype-3.2.2.tgz#d8e998e62ce79ec35b087252b90f19f1c33968a0"
- integrity sha512-ywYLSjNkxKHiZOqNlso9PZByNEY+FTyh3C+7uuziK0xFXu9xzdyfHwg4S9iyiRRoPCR4k2LqaBBsWVmSBwCWYQ==
- dependencies:
- prop-types "^15.5.4"
-
react-swipeable-views-core@^0.13.1, react-swipeable-views-core@^0.13.7:
version "0.13.7"
resolved "https://registry.yarnpkg.com/react-swipeable-views-core/-/react-swipeable-views-core-0.13.7.tgz#c082b553f26e83fd20fc17f934200eb717023c8a"
@@ -15396,18 +15470,6 @@ react-transition-group@^4.0.0, react-transition-group@^4.4.0:
loose-envify "^1.4.0"
prop-types "^15.6.2"
-react-virtualized@^9.21.1:
- version "9.22.2"
- resolved "https://registry.yarnpkg.com/react-virtualized/-/react-virtualized-9.22.2.tgz#217a870bad91e5438f46f01a009e1d8ce1060a5a"
- integrity sha512-5j4h4FhxTdOpBKtePSs1yk6LDNT4oGtUwjT7Nkh61Z8vv3fTG/XeOf8J4li1AYaexOwTXnw0HFVxsV0GBUqwRw==
- dependencies:
- "@babel/runtime" "^7.7.2"
- clsx "^1.0.4"
- dom-helpers "^5.1.3"
- loose-envify "^1.4.0"
- prop-types "^15.7.2"
- react-lifecycles-compat "^3.0.4"
-
react@^16.13.1:
version "16.14.0"
resolved "https://registry.yarnpkg.com/react/-/react-16.14.0.tgz#94d776ddd0aaa37da3eda8fc5b6b18a4c9a3114d"
@@ -15741,6 +15803,11 @@ regexpp@^2.0.1:
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f"
integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==
+regexpp@^3.1.0:
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2"
+ integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==
+
regexpu-core@^4.7.0:
version "4.7.0"
resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.7.0.tgz#fcbf458c50431b0bb7b45d6967b8192d91f3d938"
@@ -16018,11 +16085,6 @@ resolve-from@^5.0.0:
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69"
integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==
-resolve-pathname@^3.0.0:
- version "3.0.0"
- resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-3.0.0.tgz#99d02224d3cf263689becbb393bc560313025dcd"
- integrity sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==
-
resolve-url@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
@@ -16365,7 +16427,7 @@ semver@^7.2.1, semver@^7.3.4:
dependencies:
lru-cache "^6.0.0"
-semver@^7.3.2:
+semver@^7.3.2, semver@^7.3.5:
version "7.3.5"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7"
integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==
@@ -17077,6 +17139,11 @@ string-length@^4.0.1:
char-regex "^1.0.2"
strip-ansi "^6.0.0"
+string-natural-compare@^3.0.1:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4"
+ integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw==
+
string-width@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
@@ -17640,12 +17707,12 @@ timsort@^0.3.0:
resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4"
integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=
-tiny-invariant@^1.0.2, tiny-invariant@^1.0.6:
+tiny-invariant@^1.0.6:
version "1.1.0"
resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.1.0.tgz#634c5f8efdc27714b7f386c35e6760991d230875"
integrity sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw==
-tiny-warning@^1.0.0, tiny-warning@^1.0.2:
+tiny-warning@^1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754"
integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==
@@ -17832,6 +17899,13 @@ ts-loader@^6.2.1:
micromatch "^4.0.0"
semver "^6.0.0"
+ts-react-splitter@^2.1.1:
+ version "2.1.1"
+ resolved "https://registry.yarnpkg.com/ts-react-splitter/-/ts-react-splitter-2.1.1.tgz#6627e3eb4980cf00848b65b9e6f66bb52c1cad70"
+ integrity sha512-BzVwGgJpwdDOPVzhlc8b5eIVtFff10CHZfvQuULoG+OsAHiikULUIMTMu2Vq0gmrTgvW9HIgoYsxhc28RPsSOw==
+ dependencies:
+ react-measure "^2.5.2"
+
tsconfig-paths@^3.9.0:
version "3.9.0"
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz#098547a6c4448807e8fcb8eae081064ee9a3c90b"
@@ -17842,7 +17916,7 @@ tsconfig-paths@^3.9.0:
minimist "^1.2.0"
strip-bom "^3.0.0"
-tslib@^1.11.1, tslib@^1.8.0, tslib@^1.9.3:
+tslib@^1.11.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.3:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
@@ -17862,6 +17936,13 @@ tslib@^2.1.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c"
integrity sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==
+tsutils@^3.21.0:
+ version "3.21.0"
+ resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"
+ integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==
+ dependencies:
+ tslib "^1.8.1"
+
version "0.0.0"
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"
@@ -18411,11 +18492,6 @@ validate-npm-package-name@^3.0.0, validate-npm-package-name@~3.0.0:
dependencies:
builtins "^1.0.3"
-value-equal@^1.0.1:
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c"
- integrity sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==
-
vary@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"