Skip to content

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

rerender-fixes-and-language-optimize (#1983)

Stanimir9f3cda88c955
diff --git a/app/AppConfig.ts b/app/AppConfig.ts
index c40c6a6fa..f211a6c0a 100644
--- a/app/AppConfig.ts
+++ b/app/AppConfig.ts
@@ -1,6 +1,5 @@
import { AppConfig } from '@tagspaces/tagspaces-common';
-AppConfig.mainToolbarHeight = 101;
AppConfig.editableFiles = [
'txt',
'md',
diff --git a/app/app.global.css b/app/app.global.css
index b5bd46ad7..23a8d6976 100644
--- a/app/app.global.css
+++ b/app/app.global.css
@@ -6,7 +6,7 @@
@import 'assets/rc-table.css';
@import '~leaflet/dist/leaflet.css';
@import '~react-image-gallery/styles/css/image-gallery.css';
-@import "~@tagspaces/tagspaces-md/lib/tailwind.css";
+/* @import "~@tagspaces/tagspaces-md/lib/tailwind.css"; */
/* @import '~@tagspaces/tagspaces-md/lib/milkdown.css'; */
/* Needed to disable border on focused HotKey element */
diff --git a/app/components/CustomLogo.tsx b/app/components/CustomLogo.tsx
index b966c3ea2..607e2b540 100644
--- a/app/components/CustomLogo.tsx
+++ b/app/components/CustomLogo.tsx
@@ -28,7 +28,6 @@ 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 versionMeta from '../version.json';
-import { getCurrentLanguage } from '-/reducers/settings';
import { actions } from '-/reducers/app';
import { useTranslation } from 'react-i18next';
@@ -50,7 +49,6 @@ const StyledAppVersionBadge = styled(Badge)(({ theme }) => ({
function CustomLogo() {
const { t } = useTranslation();
const dispatch = useDispatch();
- const language = useSelector(getCurrentLanguage);
const logo = useMemo(() => {
let customLogo = Pro ? Pro.TextLogoIcon : TextLogoIcon;
diff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsx
index 25a828802..d056ed513 100644
--- a/app/components/EntryContainer.tsx
+++ b/app/components/EntryContainer.tsx
@@ -52,7 +52,6 @@ import {
actions as SettingsActions,
isDesktopMode,
getKeyBindingObject,
- getCurrentLanguage,
isRevisionsEnabled,
getEntryContainerTab
} from '-/reducers/settings';
@@ -60,7 +59,8 @@ import {
OpenedEntry,
NotificationTypes,
isReadOnlyMode,
- actions as AppActions
+ actions as AppActions,
+ getDirectoryPath
} from '-/reducers/app';
import useEventListener from '-/utils/useEventListener';
import { TS } from '-/tagspaces.namespace';
@@ -150,7 +150,6 @@ interface Props {
generateThumbnails: boolean,
loadDirMeta?: boolean
) => void;
- currentDirectoryPath: string | null;
desktopMode: boolean;
switchLocationType: (locationId: string) => Promise<string | null>;
switchCurrentLocationType: (currentLocationId) => Promise<boolean>;
@@ -164,7 +163,6 @@ function EntryContainer(props: Props) {
keyBindings,
settings,
openedFiles,
- currentDirectoryPath,
desktopMode,
isReadOnlyMode,
updateOpenedFile,
@@ -174,6 +172,7 @@ function EntryContainer(props: Props) {
} = props;
const { t } = useTranslation();
const tabIndex = useSelector(getEntryContainerTab);
+ const currentDirectoryPath = useSelector(getDirectoryPath);
const theme = useTheme();
// const [percent, setPercent] = React.useState<number | undefined>(undefined);
const percent = useRef<number | undefined>(undefined);
@@ -1104,8 +1103,7 @@ function mapStateToProps(state) {
isReadOnlyMode: isReadOnlyMode(state),
keyBindings: getKeyBindingObject(state),
desktopMode: isDesktopMode(state),
- revisionsEnabled: isRevisionsEnabled(state),
- language: getCurrentLanguage(state)
+ revisionsEnabled: isRevisionsEnabled(state)
};
}
@@ -1126,7 +1124,6 @@ function mapActionCreatorsToProps(dispatch) {
}
const areEqual = (prevProp, nextProp) =>
// JSON.stringify(nextProp.theme) === JSON.stringify(prevProp.theme) &&
- nextProp.language === prevProp.language &&
nextProp.settings.currentTheme === prevProp.settings.currentTheme &&
nextProp.settings.entrySplitSize === prevProp.settings.entrySplitSize &&
JSON.stringify(nextProp.openedFiles) === JSON.stringify(prevProp.openedFiles);
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsx
index f58103df3..d42537ac2 100644
--- a/app/components/EntryProperties.tsx
+++ b/app/components/EntryProperties.tsx
@@ -74,7 +74,7 @@ import PlatformIO from '../services/platform-facade';
import TagsSelect from './TagsSelect';
import TransparentBackground from './TransparentBackground';
import { getThumbnailURLPromise } from '-/services/thumbsgenerator';
-import { getCurrentLanguage, getTagDelimiter } from '-/reducers/settings';
+import { getTagDelimiter } from '-/reducers/settings';
import {
getLastBackgroundImageChange,
getLastThumbnailImageChange,
@@ -188,7 +188,6 @@ const BgndImgChooserDialog =
Pro && Pro.UI ? Pro.UI.BgndImgChooserDialog : false;
interface Props {
- language: string;
openedEntry: OpenedEntry;
locations: Array<TS.Location>;
renameFile: (path: string, nextPath: string) => Promise<boolean>;
@@ -570,7 +569,7 @@ function EntryProperties(props: Props) {
});
};
- const { isReadOnlyMode, language } = props;
+ const { isReadOnlyMode } = props;
if (
!currentEntry ||
@@ -831,7 +830,7 @@ function EntryProperties(props: Props) {
url={props.tileServer.serverURL}
/>
) : (
- <NoTileServer language={language} />
+ <NoTileServer />
)}
<LayerGroup>
<Marker
@@ -1092,7 +1091,6 @@ function EntryProperties(props: Props) {
{!currentEntry.current.isFile && (
<Grid item xs={12} style={{ marginTop: 10 }}>
<PerspectiveSelector
- language={language}
onChange={changePerspective}
defaultValue={perspectiveDefault}
label={t('core:choosePerspective')}
@@ -1404,8 +1402,7 @@ function mapStateToProps(state) {
tagDelimiter: getTagDelimiter(state),
lastBackgroundImageChange: getLastBackgroundImageChange(state),
lastThumbnailImageChange: getLastThumbnailImageChange(state),
- locations: getLocations(state),
- language: getCurrentLanguage(state)
+ locations: getLocations(state)
};
}
diff --git a/app/components/FileView.tsx b/app/components/FileView.tsx
index 9ab0e799b..783458f21 100644
--- a/app/components/FileView.tsx
+++ b/app/components/FileView.tsx
@@ -22,7 +22,6 @@ import CloseIcon from '@mui/icons-material/Close';
import { OpenedEntry } from '-/reducers/app';
import useEventListener from '-/utils/useEventListener';
import { connect } from 'react-redux';
-import { getCurrentLanguage } from '-/reducers/settings';
import { getSearchQuery } from '-/reducers/location-index';
import { TS } from '-/tagspaces.namespace';
import { useTranslation } from 'react-i18next';
@@ -183,7 +182,6 @@ function FileView(props: Props) {
}
const areEqual = (prevProp, nextProp) =>
- nextProp.language === prevProp.language &&
nextProp.openedFile.path === prevProp.openedFile.path &&
nextProp.openedFile.url === prevProp.openedFile.url &&
nextProp.openedFile.editMode === prevProp.openedFile.editMode &&
@@ -197,7 +195,6 @@ const areEqual = (prevProp, nextProp) =>
function mapStateToProps(state) {
return {
- language: getCurrentLanguage(state),
searchQuery: getSearchQuery(state)
};
}
diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsx
index 779b9f5c3..f2cb70fb1 100644
--- a/app/components/FolderContainer.tsx
+++ b/app/components/FolderContainer.tsx
@@ -16,9 +16,9 @@
*
*/
-import React, { useEffect, useState } from 'react';
+import React, { useCallback, useEffect, useState } from 'react';
import { styled, useTheme } from '@mui/material/styles';
-import { connect } from 'react-redux';
+import { connect, useSelector } from 'react-redux';
import { bindActionCreators } from 'redux';
import IconButton from '@mui/material/IconButton';
import Box from '@mui/material/Box';
@@ -34,22 +34,20 @@ import AppConfig from '-/AppConfig';
import {
getMaxSearchResults,
getDesktopMode,
- getCurrentLanguage,
getDefaultPerspective
} from '-/reducers/settings';
import {
actions as AppActions,
getDirectoryContent,
isReadOnlyMode,
- getCurrentLocationPath,
getCurrentDirectoryPerspective,
OpenedEntry,
getSelectedEntries,
getProgress,
isSearchMode,
- getLastSearchTimestamp
+ getLastSearchTimestamp,
+ getDirectoryPath
} from '../reducers/app';
-import { getCurrentLocation } from '-/reducers/locations';
import TaggingActions from '../reducers/tagging-actions';
import LoadingLazy from '../components/LoadingLazy';
import {
@@ -82,6 +80,7 @@ const classes = {
const Root = styled('div')(({ theme }) => ({
position: 'relative',
+ height: '100%',
[`& .${classes.button}`]: {
position: 'relative',
padding: '8px 12px 6px 8px',
@@ -180,25 +179,14 @@ function WelcomePanelAsync(props) {
interface Props {
settings: any;
- windowHeight: number;
- windowWidth: number;
directoryContent: Array<TS.FileSystemEntry>;
- currentDirectoryPath: string | null;
//searchResultCount: number;
addTags: () => void;
- removeTags: () => void;
removeAllTags: () => void;
editTagForEntry: () => void;
renameFile: () => void;
- openDirectory: () => void;
- showInFileManager: () => void;
openEntry: (path: string) => void;
reflectCreateEntry: (path: string, isFile: boolean) => void;
- loadDirectoryContent: (
- path: string,
- generateThumbnails: boolean,
- loadDirMeta?: boolean
- ) => void;
loadParentDirectoryContent: () => void;
setSelectedEntries: (selectedEntries: Array<Object>) => void;
isReadOnlyMode: boolean;
@@ -211,8 +199,6 @@ interface Props {
maxSearchResults: number;
defaultPerspective: string;
currentDirectoryPerspective: string;
- currentLocationPath: string;
- currentLocation: TS.Location;
openedFiles: Array<OpenedEntry>;
updateCurrentDirEntry: (path: string, entry: Object) => void;
setCurrentDirectoryColor: (color: string) => void;
@@ -223,7 +209,6 @@ interface Props {
setSearchQuery: (searchQuery: TS.SearchQuery) => void;
enterSearchMode: () => void;
exitSearchMode: () => void;
- language: string;
// editedEntryPaths: Array<TS.EditedEntryPath>;
goBack: () => void;
goForward: () => void;
@@ -237,6 +222,7 @@ function FolderContainer(props: Props) {
const theme = useTheme();
const havePrevOpenedFile = React.useRef<boolean>(false);
const firstRender = useFirstRender();
+ const currentDirectoryPath = useSelector(getDirectoryPath) || '';
useEffect(() => {
if (
@@ -246,7 +232,7 @@ function FolderContainer(props: Props) {
) {
if (props.openedFiles.length > 0) {
const openedFile = props.openedFiles[0];
- if (openedFile.path === props.currentDirectoryPath) {
+ if (openedFile.path === currentDirectoryPath) {
if (openedFile.color) {
props.setCurrentDirectoryColor(openedFile.color);
} else if (openedFile.color === undefined) {
@@ -293,18 +279,12 @@ function FolderContainer(props: Props) {
>(false);
const {
- currentDirectoryPath = '',
- language,
- loadDirectoryContent,
directoryContent,
toggleDrawer,
toggleProTeaser,
isDesktopMode,
currentDirectoryPerspective,
- currentLocationPath,
- currentLocation,
setSelectedEntries,
- openDirectory,
reflectCreateEntry,
openEntry,
defaultPerspective,
@@ -324,6 +304,10 @@ function FolderContainer(props: Props) {
directoryContent.length < 1 &&
!(props.isSearchMode && props.lastSearchTimestamp);
+ const openRenameEntryDialog = useCallback(
+ () => setIsRenameEntryDialogOpened(true),
+ []
+ );
const renderPerspective = () => {
if (showWelcomePanel) {
return AppConfig.showWelcomePanel ? <WelcomePanelAsync /> : null;
@@ -331,21 +315,8 @@ function FolderContainer(props: Props) {
if (currentPerspective === PerspectiveIDs.LIST) {
return (
<ListPerspectiveAsync
- directoryContent={props.directoryContent}
- lastSearchTimestamp={props.lastSearchTimestamp}
- loadDirectoryContent={loadDirectoryContent}
- openEntry={openEntry}
- openRenameEntryDialog={() => setIsRenameEntryDialogOpened(true)}
- loadParentDirectoryContent={props.loadParentDirectoryContent}
- renameFile={props.renameFile}
- openDirectory={props.openDirectory}
- showInFileManager={props.showInFileManager}
- currentDirectoryPath={props.currentDirectoryPath}
- addTags={props.addTags}
- editTagForEntry={props.editTagForEntry}
- removeTags={props.removeTags}
- removeAllTags={props.removeAllTags}
- windowWidth={props.windowWidth}
+ openRenameEntryDialog={openRenameEntryDialog}
+ currentDirectoryPath={currentDirectoryPath}
/>
);
}
@@ -355,8 +326,7 @@ function FolderContainer(props: Props) {
directoryContent={props.directoryContent}
lastSearchTimestamp={props.lastSearchTimestamp}
openEntry={openEntry}
- currentDirectoryPath={props.currentDirectoryPath}
- windowWidth={props.windowWidth}
+ currentDirectoryPath={currentDirectoryPath}
switchPerspective={switchPerspective}
/>
);
@@ -366,8 +336,7 @@ function FolderContainer(props: Props) {
<MapiquePerspectiveAsync
directoryContent={props.directoryContent}
lastSearchTimestamp={props.lastSearchTimestamp}
- currentDirectoryPath={props.currentDirectoryPath}
- windowWidth={props.windowWidth}
+ currentDirectoryPath={currentDirectoryPath}
switchPerspective={switchPerspective}
openedFiles={props.openedFiles}
/>
@@ -378,19 +347,14 @@ function FolderContainer(props: Props) {
<KanBanPerspectiveAsync
directoryContent={props.directoryContent}
lastSearchTimestamp={props.lastSearchTimestamp}
- loadDirectoryContent={props.loadDirectoryContent}
openEntry={props.openEntry}
- openRenameEntryDialog={() => setIsRenameEntryDialogOpened(true)}
+ openRenameEntryDialog={openRenameEntryDialog}
loadParentDirectoryContent={props.loadParentDirectoryContent}
renameFile={props.renameFile}
- openDirectory={props.openDirectory}
- showInFileManager={props.showInFileManager}
- currentDirectoryPath={props.currentDirectoryPath}
+ currentDirectoryPath={currentDirectoryPath}
addTags={props.addTags}
editTagForEntry={props.editTagForEntry}
- removeTags={props.removeTags}
removeAllTags={props.removeAllTags}
- windowWidth={props.windowWidth}
switchPerspective={switchPerspective}
/>
);
@@ -398,21 +362,8 @@ function FolderContainer(props: Props) {
return (
<GridPerspectiveAsync
- directoryContent={props.directoryContent}
- lastSearchTimestamp={props.lastSearchTimestamp}
- loadDirectoryContent={props.loadDirectoryContent}
- openEntry={props.openEntry}
- openRenameEntryDialog={() => setIsRenameEntryDialogOpened(true)}
- loadParentDirectoryContent={props.loadParentDirectoryContent}
- renameFile={props.renameFile}
- openDirectory={props.openDirectory}
- showInFileManager={props.showInFileManager}
- currentDirectoryPath={props.currentDirectoryPath}
- addTags={props.addTags}
- editTagForEntry={props.editTagForEntry}
- removeTags={props.removeTags}
- removeAllTags={props.removeAllTags}
- windowWidth={props.windowWidth}
+ openRenameEntryDialog={openRenameEntryDialog}
+ currentDirectoryPath={currentDirectoryPath}
/>
);
};
@@ -523,9 +474,9 @@ function FolderContainer(props: Props) {
style={{
paddingLeft: 5,
display: 'flex',
- overflowY: 'hidden',
- alignItems: 'center',
- overflowX: 'auto'
+ //overflowY: 'hidden',
+ alignItems: 'center'
+ //overflowX: 'auto'
}}
>
<IconButton
@@ -615,19 +566,13 @@ function FolderContainer(props: Props) {
)}
{/* {isDesktopMode && <LocationMenu />} */}
<PathBreadcrumbs
- language={language}
- currentDirectoryPath={currentDirectoryPath}
- currentLocationPath={currentLocationPath}
- loadDirectoryContent={loadDirectoryContent}
switchPerspective={switchPerspective}
setSelectedEntries={setSelectedEntries}
- openDirectory={openDirectory}
reflectCreateEntry={reflectCreateEntry}
isDesktopMode={isDesktopMode}
openRenameDirectoryDialog={() =>
setIsRenameEntryDialogOpened(true)
}
- currentLocation={currentLocation}
openMoveCopyFilesDialog={props.openMoveCopyFilesDialog}
/>
</>
@@ -635,7 +580,7 @@ function FolderContainer(props: Props) {
</div>
<div
style={{
- height: props.windowHeight + 1,
+ height: '100%', // props.windowHeight + 1,
flex: '1 1 auto',
width: '100%'
}}
@@ -645,7 +590,6 @@ function FolderContainer(props: Props) {
{isRenameEntryDialogOpened && (
<RenameEntryDialog
open={isRenameEntryDialogOpened}
- currentDirectoryPath={props.currentDirectoryPath}
onClose={() => setIsRenameEntryDialogOpened(false)}
/>
)}
@@ -660,7 +604,7 @@ function FolderContainer(props: Props) {
aria-label="change perspective"
exclusive
style={{
- bottom: 65,
+ bottom: 15,
right: 15,
zIndex: 1000,
opacity: 0.9,
@@ -682,16 +626,13 @@ function mapStateToProps(state) {
directoryContent: getDirectoryContent(state),
currentDirectoryPerspective: getCurrentDirectoryPerspective(state),
//searchResultCount: getSearchResultCount(state),
- currentLocationPath: getCurrentLocationPath(state),
maxSearchResults: getMaxSearchResults(state),
isDesktopMode: getDesktopMode(state),
isReadOnlyMode: isReadOnlyMode(state),
- language: getCurrentLanguage(state),
progress: getProgress(state),
searchQuery: getSearchQuery(state),
defaultPerspective: getDefaultPerspective(state),
//editedEntryPaths: getEditedEntryPaths(state),
- currentLocation: getCurrentLocation(state),
lastSearchTimestamp: getLastSearchTimestamp(state),
isSearchMode: isSearchMode(state)
};
@@ -702,15 +643,11 @@ function mapActionCreatorsToProps(dispatch) {
{
toggleUploadDialog: AppActions.toggleUploadDialog,
addTags: TaggingActions.addTags,
- removeTags: TaggingActions.removeTags,
removeAllTags: TaggingActions.removeAllTags,
editTagForEntry: TaggingActions.editTagForEntry,
renameFile: AppActions.renameFile,
- openDirectory: AppActions.openDirectory,
- showInFileManager: AppActions.showInFileManager,
openEntry: AppActions.openEntry,
reflectCreateEntry: AppActions.reflectCreateEntry,
- loadDirectoryContent: AppActions.loadDirectoryContent,
loadParentDirectoryContent: AppActions.loadParentDirectoryContent,
setSelectedEntries: AppActions.setSelectedEntries,
showNotification: AppActions.showNotification,
@@ -729,11 +666,9 @@ const areEqual = (prevProp: Props, nextProp: Props) =>
nextProp.settings.currentTheme === prevProp.settings.currentTheme &&
nextProp.drawerOpened === prevProp.drawerOpened &&
nextProp.isDesktopMode === prevProp.isDesktopMode &&
- nextProp.currentDirectoryPath === prevProp.currentDirectoryPath &&
nextProp.currentDirectoryPerspective ===
prevProp.currentDirectoryPerspective &&
/* this props is set before currentDirectoryEntries is loaded and will reload FolderContainer */
- /* nextProp.currentLocationPath === prevProp.currentLocationPath && */
JSON.stringify(nextProp.progress) === JSON.stringify(prevProp.progress) &&
JSON.stringify(nextProp.directoryContent) ===
JSON.stringify(prevProp.directoryContent) &&
@@ -741,11 +676,8 @@ const areEqual = (prevProp: Props, nextProp: Props) =>
JSON.stringify(prevProp.openedFiles) &&
//JSON.stringify(nextProp.theme) === JSON.stringify(prevProp.theme) &&
// JSON.stringify(nextProp.editedEntryPaths) === JSON.stringify(prevProp.editedEntryPaths) &&
- nextProp.windowWidth === prevProp.windowWidth &&
- nextProp.windowHeight === prevProp.windowHeight &&
- nextProp.language === prevProp.language &&
- nextProp.windowHeight === prevProp.windowHeight &&
- nextProp.searchQuery === prevProp.searchQuery &&
+ JSON.stringify(nextProp.searchQuery) ===
+ JSON.stringify(prevProp.searchQuery) &&
nextProp.lastSearchTimestamp === prevProp.lastSearchTimestamp &&
nextProp.isSearchMode === prevProp.isSearchMode;
diff --git a/app/components/HelpFeedbackPanel.tsx b/app/components/HelpFeedbackPanel.tsx
index 6fd6e1333..b578ef5ac 100644
--- a/app/components/HelpFeedbackPanel.tsx
+++ b/app/components/HelpFeedbackPanel.tsx
@@ -40,7 +40,6 @@ import { KeyShortcutsIcon, HelpIcon } from '-/components/CommonIcons';
import Links from '-/content/links';
import { Pro } from '-/pro';
import { openURLExternally } from '-/services/utils-io';
-import { getCurrentLanguage } from '-/reducers/settings';
import { classes, SidePanel } from '-/components/SidePanels.css';
import { useTheme } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
@@ -57,7 +56,6 @@ interface Props {
function HelpFeedbackPanel(props: Props) {
const { t } = useTranslation();
const theme = useTheme();
- const language = useSelector(getCurrentLanguage);
const {
toggleAboutDialog,
toggleKeysDialog,
diff --git a/app/components/LoadingAnimation.tsx b/app/components/LoadingAnimation.tsx
index 7a32b3ce3..634543fd8 100644
--- a/app/components/LoadingAnimation.tsx
+++ b/app/components/LoadingAnimation.tsx
@@ -16,10 +16,10 @@
*
*/
-import React from 'react';
+/*import React from 'react';
import { useSelector } from 'react-redux';
import PlatformIO from '-/services/platform-facade';
-import { isLoading } from '-/reducers/app';
+//import { isLoading } from '-/reducers/app';
import { useTheme } from '@mui/material/styles';
function LoadingAnimation() {
@@ -57,4 +57,4 @@ function LoadingAnimation() {
);
}
-export default React.memo(LoadingAnimation);
+export default React.memo(LoadingAnimation);*/
diff --git a/app/components/LocationManager.tsx b/app/components/LocationManager.tsx
index d822b52c9..9addd0820 100644
--- a/app/components/LocationManager.tsx
+++ b/app/components/LocationManager.tsx
@@ -23,7 +23,7 @@ import { List } from '@mui/material';
import LocationManagerMenu from '-/components/menus/LocationManagerMenu';
import ConfirmDialog from '-/components/dialogs/ConfirmDialog';
import { actions as LocationActions, getLocations } from '-/reducers/locations';
-import { actions as AppActions, AppDispatch, isLoading } from '-/reducers/app';
+import { actions as AppActions, AppDispatch } from '-/reducers/app';
import LoadingLazy from '-/components/LoadingLazy';
import LocationView from '-/components/LocationView';
import { Pro } from '-/pro';
@@ -62,7 +62,7 @@ function LocationManager(props: Props) {
const { t } = useTranslation();
const dispatch: AppDispatch = useDispatch();
const locations: Array<TS.Location> = useSelector(getLocations);
- const loading: boolean = useSelector(isLoading);
+ // const loading: boolean = useSelector(isLoading);
//const language: string = useSelector(getCurrentLanguage);
const fileInputRef = useRef<HTMLInputElement>(null);
const [selectedLocation, setSelectedLocation] = useState<TS.Location>(null);
@@ -118,12 +118,12 @@ function LocationManager(props: Props) {
flexDirection: 'column'
}}
>
- {loading &&
- (PlatformIO.haveObjectStoreSupport() ||
- PlatformIO.haveWebDavSupport()) && (
- <>
- <style>
- {`
+ {//loading &&
+ (PlatformIO.haveObjectStoreSupport() ||
+ PlatformIO.haveWebDavSupport()) && (
+ <>
+ <style>
+ {`
@keyframes hide {
to {
width: 0;
@@ -131,22 +131,22 @@ function LocationManager(props: Props) {
}
}
`}
- </style>
- <div
- style={{
- position: 'absolute',
- zIndex: 1000,
- height: 'calc(100% - 180px)',
- width: 310,
- backdropFilter: 'grayscale(1)',
- animation: 'hide 1ms linear 5s 1 forwards'
- // backgroundColor: 'red'
- // backdropFilter: 'blur(2px)',
- // backgroundColor: '#fafafaAA' // red: '#eb585882' '#d9d9d980'
- }}
- />
- </>
- )}
+ </style>
+ <div
+ style={{
+ position: 'absolute',
+ zIndex: 1000,
+ height: 'calc(100% - 180px)',
+ width: 310,
+ backdropFilter: 'grayscale(1)',
+ animation: 'hide 1ms linear 5s 1 forwards'
+ // backgroundColor: 'red'
+ // backdropFilter: 'blur(2px)',
+ // backgroundColor: '#fafafaAA' // red: '#eb585882' '#d9d9d980'
+ }}
+ />
+ </>
+ )}
<LocationManagerMenu
importLocations={() => {
fileInputRef.current.click();
diff --git a/app/components/LocationView.tsx b/app/components/LocationView.tsx
index c7f7683a6..80f658e34 100644
--- a/app/components/LocationView.tsx
+++ b/app/components/LocationView.tsx
@@ -42,7 +42,6 @@ import IOActions from '../reducers/io-actions';
import DirectoryTreeView, {
DirectoryTreeViewRef
} from '-/components/DirectoryTreeView';
-import { getCurrentLanguage } from '-/reducers/settings';
import LocationContextMenu from '-/components/menus/LocationContextMenu';
import { TS } from '-/tagspaces.namespace';
import { classes, SidePanel } from '-/components/SidePanels.css';
@@ -66,7 +65,6 @@ function LocationView(props: Props) {
] = useState<null | HTMLElement>(null);
const dispatch: AppDispatch = useDispatch();
- const language = useSelector(getCurrentLanguage);
const currentLocationId: string = useSelector(getCurrentLocationId);
const readOnlyMode = useSelector(isReadOnlyMode);
diff --git a/app/components/NoTileServer.tsx b/app/components/NoTileServer.tsx
index ef36f4aef..e2eb5d5cf 100644
--- a/app/components/NoTileServer.tsx
+++ b/app/components/NoTileServer.tsx
@@ -1,11 +1,7 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
-interface Props {
- language: string;
-}
-
-function NoTileServer(props: Props) {
+function NoTileServer() {
const { t } = useTranslation();
return (
<div style={{ textAlign: 'center' }}>
diff --git a/app/components/PathBreadcrumbs.tsx b/app/components/PathBreadcrumbs.tsx
index 60c4e321b..f0d44e60e 100644
--- a/app/components/PathBreadcrumbs.tsx
+++ b/app/components/PathBreadcrumbs.tsx
@@ -33,6 +33,13 @@ import { TS } from '-/tagspaces.namespace';
import { LocalLocationIcon, CloudLocationIcon } from '-/components/CommonIcons';
import { locationType } from '@tagspaces/tagspaces-common/misc';
import { useTranslation } from 'react-i18next';
+import { useDispatch, useSelector } from 'react-redux';
+import { getCurrentLocation } from '-/reducers/locations';
+import {
+ actions as AppActions,
+ AppDispatch,
+ getDirectoryPath
+} from '-/reducers/app';
const StyledBreadcrumb = styled(Chip)(({ theme }) => {
const backgroundColor =
@@ -59,18 +66,8 @@ const NoWrapBreadcrumb = styled(StyledBreadcrumb)(({ theme }) => {
});
interface Props {
- currentDirectoryPath: string;
- currentLocationPath: string;
- currentLocation: TS.Location;
- loadDirectoryContent: (
- path: string,
- generateThumbnails: boolean,
- loadDirMeta?: boolean
- ) => void;
- language: string;
switchPerspective: (perspectiveId: string) => void;
setSelectedEntries: (selectedEntries: Array<Object>) => void;
- openDirectory: () => void;
reflectCreateEntry: (path: string, isFile: boolean) => void;
openRenameDirectoryDialog: () => void;
openMoveCopyFilesDialog: () => void;
@@ -79,7 +76,10 @@ interface Props {
function PathBreadcrumbs(props: Props) {
const { t } = useTranslation();
+ const dispatch: AppDispatch = useDispatch();
let pathParts: Array<string> = [];
+ const currentLocation = useSelector(getCurrentLocation);
+ const currentDirectoryPath = useSelector(getDirectoryPath);
const [
directoryContextMenuAnchorEl,
@@ -87,12 +87,7 @@ function PathBreadcrumbs(props: Props) {
] = useState<null | HTMLElement>(null);
const {
- currentDirectoryPath,
- currentLocationPath,
- currentLocation,
- loadDirectoryContent,
setSelectedEntries,
- openDirectory,
reflectCreateEntry,
openRenameDirectoryDialog,
openMoveCopyFilesDialog,
@@ -130,9 +125,9 @@ function PathBreadcrumbs(props: Props) {
addSlash + normalizePath(currentDirectoryPath.split('\\').join('/'));
let normalizedCurrentLocationPath = '';
- if (currentLocationPath) {
+ if (currentLocation && currentLocation.path) {
normalizedCurrentLocationPath =
- addSlash + normalizePath(currentLocationPath.split('\\').join('/'));
+ addSlash + normalizePath(currentLocation.path.split('\\').join('/'));
}
while (
@@ -182,7 +177,9 @@ function PathBreadcrumbs(props: Props) {
href="#"
label={folderName}
icon={index === 0 && locationTypeIcon}
- onClick={() => loadDirectoryContent(pathPart, false, true)}
+ onClick={() =>
+ dispatch(AppActions.loadDirectoryContent(pathPart, false, true))
+ }
/>
</Tooltip>
);
@@ -239,10 +236,8 @@ function PathBreadcrumbs(props: Props) {
onClose={closeDirectoryMenu}
anchorEl={directoryContextMenuAnchorEl}
directoryPath={currentDirectoryPath}
- loadDirectoryContent={loadDirectoryContent}
openRenameDirectoryDialog={openRenameDirectoryDialog}
openMoveCopyFilesDialog={openMoveCopyFilesDialog}
- openDirectory={openDirectory}
reflectCreateEntry={reflectCreateEntry}
/>
</>
diff --git a/app/components/PerspectiveSelector.tsx b/app/components/PerspectiveSelector.tsx
index 2a321d25d..f3b64009d 100644
--- a/app/components/PerspectiveSelector.tsx
+++ b/app/components/PerspectiveSelector.tsx
@@ -28,7 +28,7 @@ import { BetaLabel, ProLabel } from '-/components/HelperComponents';
import { useTranslation } from 'react-i18next';
interface Props {
- language: string;
+ //language: string;
defaultValue: string;
onChange: (event: any) => void;
testId: string;
diff --git a/app/components/Revisions.tsx b/app/components/Revisions.tsx
index 934d998e5..5a40995dd 100644
--- a/app/components/Revisions.tsx
+++ b/app/components/Revisions.tsx
@@ -29,7 +29,6 @@ import {
OpenedEntry
} from '-/reducers/app';
import { useSelector, useDispatch } from 'react-redux';
-import { getCurrentLanguage } from '-/reducers/settings';
import PlatformIO from '-/services/platform-facade';
import { TS } from '-/tagspaces.namespace';
import { format, formatDistanceToNow } from 'date-fns';
@@ -57,7 +56,6 @@ const initialRowsPerPage = 10;
function Revisions() {
const { t } = useTranslation();
const dispatch: AppDispatch = useDispatch();
- const language = useSelector(getCurrentLanguage);
const openedFiles: Array<OpenedEntry> = useSelector(getOpenedFiles);
const [rows, setRows] = useState<Array<TS.FileSystemEntry>>([]);
const [page, setPage] = useState<number>(0);
diff --git a/app/components/SearchAutocomplete.tsx b/app/components/SearchAutocomplete.tsx
index 9880e3d1e..8414f72e9 100644
--- a/app/components/SearchAutocomplete.tsx
+++ b/app/components/SearchAutocomplete.tsx
@@ -40,8 +40,7 @@ import {
} from '../reducers/location-index';
import {
getMaxSearchResults,
- getShowUnixHiddenEntries,
- getCurrentLanguage
+ getShowUnixHiddenEntries
} from '-/reducers/settings';
import { FileTypeGroups, haveSearchFilters } from '-/services/search';
import { TS } from '-/tagspaces.namespace';
@@ -100,7 +99,6 @@ function SearchAutocomplete(props: Props) {
const currentDirectory = useSelector(getDirectoryPath);
const maxSearchResults = useSelector(getMaxSearchResults);
const showUnixHiddenEntries = useSelector(getShowUnixHiddenEntries);
- const language = useSelector(getCurrentLanguage);
const locations: TS.Location[] = useSelector(getLocations);
const currentLocation: TS.Location = useSelector(getCurrentLocation);
const searchMode: boolean = useSelector(isSearchMode);
diff --git a/app/components/SearchPopover.tsx b/app/components/SearchPopover.tsx
index 233d98ddf..c1b4405a9 100644
--- a/app/components/SearchPopover.tsx
+++ b/app/components/SearchPopover.tsx
@@ -48,7 +48,6 @@ import {
getSearchQuery
} from '../reducers/location-index';
import {
- getCurrentLanguage,
getMaxSearchResults,
getShowUnixHiddenEntries
} from '-/reducers/settings';
@@ -1121,8 +1120,7 @@ function mapStateToProps(state) {
currentDirectory: getDirectoryPath(state),
maxSearchResults: getMaxSearchResults(state),
searches: getSearches(state),
- showUnixHiddenEntries: getShowUnixHiddenEntries(state),
- language: getCurrentLanguage(state)
+ showUnixHiddenEntries: getShowUnixHiddenEntries(state)
};
}
@@ -1140,7 +1138,6 @@ function mapDispatchToProps(dispatch) {
}
const areEqual = (prevProp, nextProp) =>
- nextProp.language === prevProp.language &&
nextProp.indexing === prevProp.indexing &&
nextProp.searchQuery === prevProp.searchQuery &&
nextProp.textQuery === prevProp.textQuery &&
diff --git a/app/components/StoredSearches.tsx b/app/components/StoredSearches.tsx
index 041f44609..a7b1f992e 100644
--- a/app/components/StoredSearches.tsx
+++ b/app/components/StoredSearches.tsx
@@ -36,7 +36,6 @@ import {
} from '-/reducers/location-index';
import {
actions as SettingsActions,
- getCurrentLanguage,
getFileEditHistory,
getFileOpenHistory,
getFolderOpenHistory,
@@ -601,7 +600,6 @@ function StoredSearches(props: Props) {
function mapStateToProps(state) {
return {
- language: getCurrentLanguage(state),
searchQuery: getSearchQuery(state),
searches: getSearches(state),
showUnixHiddenEntries: getShowUnixHiddenEntries(state),
@@ -640,7 +638,6 @@ const areEqual = (prevProp, nextProp) =>
nextProp.fileOpenHistory === prevProp.fileOpenHistory &&
nextProp.folderOpenHistory === prevProp.folderOpenHistory &&
nextProp.fileEditHistory === prevProp.fileEditHistory &&
- nextProp.language === prevProp.language &&
nextProp.indexing === prevProp.indexing &&
nextProp.searchQuery === prevProp.searchQuery &&
nextProp.currentDirectory === prevProp.currentDirectory &&
diff --git a/app/components/TagLibrary.tsx b/app/components/TagLibrary.tsx
index b66038dc9..c8cde3070 100644
--- a/app/components/TagLibrary.tsx
+++ b/app/components/TagLibrary.tsx
@@ -37,7 +37,6 @@ import TagGroupMenu from './menus/TagGroupMenu';
import TaggingActions from '../reducers/tagging-actions';
import {
actions as SettingsActions,
- getCurrentLanguage,
getSaveTagInLocation,
getTagColor,
getTagGroupCollapsed,
@@ -95,7 +94,6 @@ function TagLibrary(props: Props) {
const locations: Array<TS.Location> = useSelector(getLocations);
const saveTagInLocation: boolean = useSelector(getSaveTagInLocation);
const tagLibraryChanged = useSelector(isTagLibraryChanged);
- const language = useSelector(getCurrentLanguage);
const toggleTagGroupDispatch = uuid =>
dispatch(SettingsActions.toggleTagGroup(uuid));
diff --git a/app/components/TagsPreview.tsx b/app/components/TagsPreview.tsx
index d32803ca7..6f002262d 100644
--- a/app/components/TagsPreview.tsx
+++ b/app/components/TagsPreview.tsx
@@ -21,11 +21,7 @@ import { useSelector } from 'react-redux';
import Tooltip from '-/components/Tooltip';
import { TS } from '-/tagspaces.namespace';
-import {
- getCurrentLanguage,
- getTagColor,
- getTagTextColor
-} from '-/reducers/settings';
+import { getTagColor, getTagTextColor } from '-/reducers/settings';
import { getTagColors } from '-/services/taglibrary-utils';
import { useTranslation } from 'react-i18next';
@@ -37,7 +33,6 @@ function TagsPreview(props: Props) {
const { t } = useTranslation();
const defaultBackgroundColor = useSelector(getTagColor);
const defaultTextColor = useSelector(getTagTextColor);
- const language = useSelector(getCurrentLanguage);
const { tags } = props;
// const allTags = useRef<Array<TS.Tag>>(getAllTags(getTagLibrary()));
diff --git a/app/components/TargetFileBox.tsx b/app/components/TargetFileBox.tsx
index 28e74f6a2..b7ca83e1c 100644
--- a/app/components/TargetFileBox.tsx
+++ b/app/components/TargetFileBox.tsx
@@ -20,30 +20,103 @@ import React, { ReactNode, useRef } from 'react';
import { DropTargetMonitor, useDrop } from 'react-dnd';
import { classes, DnD } from '-/components/DnD.css';
import { useTranslation } from 'react-i18next';
+import AppConfig from '-/AppConfig';
+import PlatformIO from '-/services/platform-facade';
+import { useDispatch, useSelector } from 'react-redux';
+import {
+ actions as AppActions,
+ AppDispatch,
+ getDirectoryPath,
+ isReadOnlyMode
+} from '-/reducers/app';
+import IOActions from '-/reducers/io-actions';
+import { TS } from '-/tagspaces.namespace';
+import { Identifier } from 'dnd-core';
+
+type DragItem = { files: File[]; items: DataTransferItemList };
+type DragProps = { isActive: boolean; handlerId: Identifier | null };
interface Props {
children: ReactNode;
accepts: Array<string>;
- onDrop: (item) => void;
+ setMoveCopyDialogOpened: (files: Array<File>) => void;
}
function TargetFileBox(props: Props) {
const { t } = useTranslation();
+ const dispatch: AppDispatch = useDispatch();
const ref = useRef<HTMLDivElement>(null);
+ const readOnlyMode = useSelector(isReadOnlyMode);
+ const directoryPath = useSelector(getDirectoryPath);
+ const { setMoveCopyDialogOpened } = props;
+
+ const onUploadProgress = (progress, abort, fileName) => {
+ dispatch(AppActions.onUploadProgress(progress, abort, fileName));
+ };
+
+ const handleCopyFiles = (files: Array<File>) => {
+ if (readOnlyMode) {
+ dispatch(
+ AppActions.showNotification(
+ t('core:dndDisabledReadOnlyMode'),
+ 'error',
+ true
+ )
+ );
+ return Promise.reject(t('core:dndDisabledReadOnlyMode'));
+ }
+ if (files) {
+ console.log('Dropped files: ' + JSON.stringify(files));
+ if (!directoryPath) {
+ dispatch(
+ AppActions.showNotification(
+ 'Importing files failed, because no folder is opened in TagSpaces!',
+ 'error',
+ true
+ )
+ );
+ return Promise.reject(
+ new Error(
+ 'Importing files failed, because no folder is opened in TagSpaces!'
+ )
+ );
+ }
+ dispatch(AppActions.resetProgress());
+ dispatch(AppActions.toggleUploadDialog());
+ return dispatch(
+ IOActions.uploadFilesAPI(files, directoryPath, onUploadProgress)
+ )
+ .then((fsEntries: Array<TS.FileSystemEntry>) => {
+ dispatch(AppActions.reflectCreateEntries(fsEntries));
+ return true;
+ })
+ .catch(error => {
+ console.log('uploadFiles', error);
+ });
+ }
+ return Promise.reject(new Error('on files'));
+ };
- const [collectedProps, drop] = useDrop({
+ const [collectedProps, drop] = useDrop<DragItem, unknown, DragProps>(() => ({
accept: props.accepts,
- collect(monitor: DropTargetMonitor) {
- const isActive = monitor.isOver({ shallow: true }) && monitor.canDrop();
- return {
- handlerId: monitor.getHandlerId(),
- isActive
- };
+ drop: ({ files }) => {
+ if (files && files.length) {
+ if (
+ AppConfig.isElectron &&
+ !PlatformIO.haveObjectStoreSupport() &&
+ !PlatformIO.haveWebDavSupport()
+ ) {
+ return setMoveCopyDialogOpened(files);
+ } else {
+ return handleCopyFiles(files);
+ }
+ }
},
- drop(item, monitor) {
- return props.onDrop(item); // collectedProps, monitor);
- }
- });
+ collect: (m: DropTargetMonitor) => ({
+ handlerId: m.getHandlerId(),
+ isActive: m.isOver({ shallow: true }) && m.canDrop()
+ })
+ }));
drop(ref);
diff --git a/app/components/dialogs/CreateDirectoryDialog.tsx b/app/components/dialogs/CreateDirectoryDialog.tsx
index f9adc1633..e54f9065f 100644
--- a/app/components/dialogs/CreateDirectoryDialog.tsx
+++ b/app/components/dialogs/CreateDirectoryDialog.tsx
@@ -17,7 +17,7 @@
*/
import React, { useState, useEffect, useRef } from 'react';
-import { useDispatch } from 'react-redux';
+import { useDispatch, useSelector } from 'react-redux';
import Button from '@mui/material/Button';
import TextField from '@mui/material/TextField';
import DialogActions from '@mui/material/DialogActions';
@@ -26,7 +26,11 @@ import DialogTitle from '@mui/material/DialogTitle';
import FormControl from '@mui/material/FormControl';
import FormHelperText from '@mui/material/FormHelperText';
import Dialog from '@mui/material/Dialog';
-import { actions as AppActions, AppDispatch } from '-/reducers/app';
+import {
+ actions as AppActions,
+ AppDispatch,
+ getDirectoryPath
+} from '-/reducers/app';
import { joinPaths } from '@tagspaces/tagspaces-common/paths';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import PlatformIO from '-/services/platform-facade';
@@ -35,7 +39,7 @@ import { useTranslation } from 'react-i18next';
interface Props {
open: boolean;
onClose: () => void;
- selectedDirectoryPath: string;
+ selectedDirectoryPath?: string;
callback?: (newDirPath: string) => void;
reflect?: boolean;
}
@@ -47,7 +51,8 @@ function CreateDirectoryDialog(props: Props) {
const isFirstRun = useRef(true);
const [disableConfirmButton, setDisableConfirmButton] = useState(true);
const [name, setName] = useState('');
- const { open, onClose, reflect } = props;
+ const currentDirectoryPath = useSelector(getDirectoryPath);
+ const { open, onClose, selectedDirectoryPath, reflect } = props;
useEffect(() => {
if (isFirstRun.current) {
@@ -73,7 +78,9 @@ function CreateDirectoryDialog(props: Props) {
if (!disableConfirmButton && name) {
const dirPath = joinPaths(
PlatformIO.getDirSeparator(),
- props.selectedDirectoryPath,
+ selectedDirectoryPath !== undefined
+ ? selectedDirectoryPath
+ : currentDirectoryPath,
name
);
dispatch(
diff --git a/app/components/dialogs/EditEntryTagDialog.tsx b/app/components/dialogs/EditEntryTagDialog.tsx
index c967bd854..7ae586868 100644
--- a/app/components/dialogs/EditEntryTagDialog.tsx
+++ b/app/components/dialogs/EditEntryTagDialog.tsx
@@ -42,7 +42,7 @@ import TaggingActions from '-/reducers/tagging-actions';
import { isDateTimeTag } from '-/utils/dates';
import { TS } from '-/tagspaces.namespace';
import useValidation from '-/utils/useValidation';
-import { getMapTileServer, getCurrentLanguage } from '-/reducers/settings';
+import { getMapTileServer } from '-/reducers/settings';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
@@ -64,7 +64,6 @@ const StyledDialog = styled(Dialog)(() => ({
interface Props {
classes: any;
- language: string;
open: boolean;
onClose: () => void;
editTagForEntry: (path: string, tag: TS.Tag, title: string) => void;
@@ -105,7 +104,7 @@ function EditEntryTagDialog(props: Props) {
isShowDatePeriodEditor
);
const { setError, haveError } = useValidation();
- const { onClose, open, language } = props;
+ const { onClose, open } = props;
useEffect(() => {
if (titleRef && titleRef.current) {
@@ -185,7 +184,6 @@ function EditEntryTagDialog(props: Props) {
</FormControl>
{showGeoEditor && (
<GeoTagEditor
- language={language}
geoTag={title}
onChange={setTitle}
// zoom={title === defaultTagLocation ? 2 : undefined} TODO defaultTagLocation can be in MGRS format
diff --git a/app/components/dialogs/FilePreviewDialog.tsx b/app/components/dialogs/FilePreviewDialog.tsx
index adf7b2b2b..eb5e95814 100644
--- a/app/components/dialogs/FilePreviewDialog.tsx
+++ b/app/components/dialogs/FilePreviewDialog.tsx
@@ -31,11 +31,7 @@ import {
} from '-/reducers/app';
import { TS } from '-/tagspaces.namespace';
import { findExtensionsForEntry } from '-/services/utils-io';
-import {
- getCurrentLanguage,
- getCurrentTheme,
- getSupportedFileTypes
-} from '-/reducers/settings';
+import { getCurrentTheme, getSupportedFileTypes } from '-/reducers/settings';
import { useSelector, useDispatch } from 'react-redux';
import FileView from '-/components/FileView';
import useEventListener from '-/utils/useEventListener';
@@ -52,7 +48,6 @@ interface Props {
function FilePreviewDialog(props: Props) {
const { open = false, onClose, fsEntry } = props;
const dispatch: AppDispatch = useDispatch();
- const language = useSelector(getCurrentLanguage);
const supportedFileTypes = useSelector(getSupportedFileTypes);
const currentTheme = useSelector(getCurrentTheme);
const fileViewer: MutableRefObject<HTMLIFrameElement> = useRef<
diff --git a/app/components/dialogs/MoveOrCopyFilesDialog.tsx b/app/components/dialogs/MoveOrCopyFilesDialog.tsx
index 84b1a6c36..2a7a07a35 100644
--- a/app/components/dialogs/MoveOrCopyFilesDialog.tsx
+++ b/app/components/dialogs/MoveOrCopyFilesDialog.tsx
@@ -27,7 +27,7 @@ import Paper from '@mui/material/Paper';
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import ListItemIcon from '@mui/material/ListItemIcon';
-import ListSubheader from '@mui/material/ListSubheader';
+import PlatformIO from '-/services/platform-facade';
import FileIcon from '@mui/icons-material/InsertDriveFileOutlined';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
@@ -40,13 +40,17 @@ import DraggablePaper from '-/components/DraggablePaper';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import AppConfig from '-/AppConfig';
import { useTranslation } from 'react-i18next';
+import {
+ actions as AppActions,
+ AppDispatch,
+ getDirectoryPath
+} from '-/reducers/app';
+import { useDispatch, useSelector } from 'react-redux';
interface Props {
open: boolean;
onClose: (clearSelection?: boolean) => void;
selectedFiles: Array<File>;
- handleMoveFiles: (files: Array<File>) => void;
- handleCopyFiles: (files: Array<File>) => void;
}
function MoveOrCopyFilesDialog(props: Props) {
@@ -54,7 +58,46 @@ function MoveOrCopyFilesDialog(props: Props) {
const { t } = useTranslation();
const theme = useTheme();
+ const dispatch: AppDispatch = useDispatch();
const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
+ const directoryPath = useSelector(getDirectoryPath);
+
+ const handleMoveCopyFiles = (files: Array<File>, move = false) => {
+ const promises = [];
+ for (const file of files) {
+ if (move) {
+ promises.push(
+ PlatformIO.renameFilePromise(
+ file.path,
+ directoryPath + AppConfig.dirSeparator + file.name
+ )
+ .then(() => true)
+ .catch(error => {
+ console.log('renameFilePromise', error);
+ })
+ );
+ } else {
+ promises.push(
+ PlatformIO.copyFilePromise(
+ file.path,
+ directoryPath + AppConfig.dirSeparator + file.name
+ )
+ .then(() => true)
+ .catch(error => {
+ console.log('copyFilePromise', error);
+ })
+ );
+ }
+ }
+ Promise.all(promises)
+ .then(() =>
+ dispatch(AppActions.loadDirectoryContent(directoryPath, true, true))
+ )
+ .catch(error => {
+ console.log('promises', error);
+ });
+ };
+
return (
<Dialog
open={open}
@@ -104,7 +147,10 @@ function MoveOrCopyFilesDialog(props: Props) {
{t('core:cancel')}
</Button>
<Button
- onClick={() => props.handleMoveFiles(props.selectedFiles)}
+ onClick={() => {
+ handleMoveCopyFiles(props.selectedFiles, true);
+ props.onClose();
+ }}
data-tid="confirmMoveFilesTID"
color="primary"
variant="contained"
@@ -112,7 +158,10 @@ function MoveOrCopyFilesDialog(props: Props) {
{t('core:moveEntriesButton')}
</Button>
<Button
- onClick={() => props.handleCopyFiles(props.selectedFiles)}
+ onClick={() => {
+ handleMoveCopyFiles(props.selectedFiles);
+ props.onClose();
+ }}
data-tid="confirmCopyFilesTID"
color="primary"
variant="contained"
diff --git a/app/components/dialogs/RenameEntryDialog.tsx b/app/components/dialogs/RenameEntryDialog.tsx
index fed2dc37e..ea24d5aed 100644
--- a/app/components/dialogs/RenameEntryDialog.tsx
+++ b/app/components/dialogs/RenameEntryDialog.tsx
@@ -36,6 +36,7 @@ import AppConfig from '-/AppConfig';
import {
actions as AppActions,
AppDispatch,
+ getDirectoryPath,
getLastSelectedEntry
} from '-/reducers/app';
import PlatformIO from '-/services/platform-facade';
@@ -45,13 +46,13 @@ import { useTranslation } from 'react-i18next';
interface Props {
open: boolean;
- currentDirectoryPath?: string;
onClose: () => void;
}
function RenameEntryDialog(props: Props) {
- const { open, onClose, currentDirectoryPath } = props;
+ const { open, onClose } = props;
const { t } = useTranslation();
+ const currentDirectoryPath = useSelector(getDirectoryPath);
const [inputError, setInputError] = useState<boolean>(false);
const disableConfirmButton = useRef<boolean>(true);
const lastSelectedEntry = useSelector(getLastSelectedEntry);
diff --git a/app/components/dialogs/settings/SettingsDialog.tsx b/app/components/dialogs/settings/SettingsDialog.tsx
index b618c57f6..422b37fab 100644
--- a/app/components/dialogs/settings/SettingsDialog.tsx
+++ b/app/components/dialogs/settings/SettingsDialog.tsx
@@ -33,7 +33,6 @@ import ConfirmDialog from '../ConfirmDialog';
import SettingsGeneral from '../settings/SettingsGeneral';
import SettingsKeyBindings from '../settings/SettingsKeyBindings';
import SettingsFileTypes from '../settings/SettingsFileTypes';
-import { getCurrentLanguage } from '-/reducers/settings';
import { clearAllURLParams } from '-/utils/dom';
import SettingsAdvanced from '-/components/dialogs/settings/SettingsAdvanced';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
@@ -62,7 +61,6 @@ interface Props {
function SettingsDialog(props: Props) {
const { t } = useTranslation();
- const language = useSelector(getCurrentLanguage);
const [currentTab, setCurrentTab] = useState<number>(0);
const [
isResetSettingsDialogOpened,
diff --git a/app/components/dialogs/settings/SettingsGeneral.tsx b/app/components/dialogs/settings/SettingsGeneral.tsx
index 7c0eac8b4..fefbf961a 100644
--- a/app/components/dialogs/settings/SettingsGeneral.tsx
+++ b/app/components/dialogs/settings/SettingsGeneral.tsx
@@ -37,7 +37,7 @@ import AppConfig from '-/AppConfig';
import {
actions as SettingsActions,
getPersistTagsInSidecarFile,
- getCurrentLanguage,
+ //getCurrentLanguage,
getSettings
} from '-/reducers/settings';
import ColorPickerDialog from '-/components/dialogs/ColorPickerDialog';
@@ -77,14 +77,13 @@ const Root = styled('div')(({ theme }) => ({
}));
function SettingsGeneral() {
- const { t } = useTranslation();
+ const { i18n, t } = useTranslation();
const [displayColorPicker, setDisplayColorPicker] = useState<boolean>(false);
const [displayTextColorPicker, setDisplayTextColorPicker] = useState<boolean>(
false
);
const dispatch: AppDispatch = useDispatch();
const settings = useSelector(getSettings);
- const language = useSelector(getCurrentLanguage);
const persistTagsInSidecarFile = useSelector(getPersistTagsInSidecarFile);
const toggleDefaultTagBackgroundColorPicker = () => {
@@ -126,8 +125,11 @@ function SettingsGeneral() {
data-tid="settingsSetLanguage"
value={settings.interfaceLanguage}
onChange={(event: any) => {
- dispatch(SettingsActions.setLanguage(event.target.value));
- PlatformIO.setLanguage(event.target.value);
+ return i18n.changeLanguage(event.target.value).then(() => {
+ dispatch(SettingsActions.setLanguage(event.target.value));
+ PlatformIO.setLanguage(event.target.value);
+ return true;
+ });
}}
input={<Input id="languageSelector" />}
>
@@ -196,7 +198,6 @@ function SettingsGeneral() {
<ListItem className={classes.listItem}>
<ListItemText primary={t('createLocationDefaultPerspective')} />
<PerspectiveSelector
- language={language}
onChange={changePerspective}
defaultValue={defaultPerspective}
testId="changePerspectiveInSettingsTID"
diff --git a/app/components/menus/DirectoryMenu.tsx b/app/components/menus/DirectoryMenu.tsx
index d961b23a0..c992b0ed4 100644
--- a/app/components/menus/DirectoryMenu.tsx
+++ b/app/components/menus/DirectoryMenu.tsx
@@ -47,7 +47,7 @@ import { getRelativeEntryPath } from '-/services/utils-io';
import { PerspectiveIDs } from '-/perspectives';
import PlatformFacade from '-/services/platform-facade';
import { getDirectoryMenuItems } from '-/perspectives/common/DirectoryMenuItems';
-import { getLocations } from '-/reducers/locations';
+import { getCurrentLocation, getLocations } from '-/reducers/locations';
import { useTranslation } from 'react-i18next';
interface Props {
@@ -56,12 +56,6 @@ interface Props {
onClose: (param?: any) => void;
anchorEl: Element;
directoryPath: string;
- loadDirectoryContent: (
- path: string,
- generateThumbnails: boolean,
- loadDirMeta?: boolean
- ) => void;
- openDirectory: (path: string) => void;
openAddRemoveTagsDialog?: () => void;
reflectCreateEntry?: (path: string, isFile: boolean) => void;
switchPerspective?: (perspectiveId: string) => void;
@@ -70,7 +64,6 @@ interface Props {
openMoveCopyFilesDialog: () => void;
mouseX?: number;
mouseY?: number;
- currentLocation?: TS.Location;
}
function DirectoryMenu(props: Props) {
@@ -83,13 +76,12 @@ function DirectoryMenu(props: Props) {
mouseX,
mouseY,
directoryPath,
- currentLocation,
openAddRemoveTagsDialog,
openMoveCopyFilesDialog,
openRenameDirectoryDialog,
switchPerspective
} = props;
-
+ const currentLocation: TS.Location = useSelector(getCurrentLocation);
const selectedEntries: Array<TS.FileSystemEntry> = useSelector(
getSelectedEntries
);
@@ -100,7 +92,7 @@ function DirectoryMenu(props: Props) {
const dispatch: AppDispatch = useDispatch();
const loadDirectoryContent = (path, generateThumbnails, loadDirMeta) => {
- dispatch(
+ return dispatch(
AppActions.loadDirectoryContent(path, generateThumbnails, loadDirMeta)
);
};
@@ -179,11 +171,11 @@ function DirectoryMenu(props: Props) {
] = useState(false);*/
function reloadDirectory() {
- loadDirectoryContent(directoryPath, true, true);
+ return loadDirectoryContent(directoryPath, true, true);
}
function openDirectory() {
- loadDirectoryContent(directoryPath, true, true);
+ return loadDirectoryContent(directoryPath, true, true);
}
function showProperties() {
diff --git a/app/components/menus/EntryTagMenu.tsx b/app/components/menus/EntryTagMenu.tsx
index ee52d7cc1..c3fe73616 100644
--- a/app/components/menus/EntryTagMenu.tsx
+++ b/app/components/menus/EntryTagMenu.tsx
@@ -36,6 +36,7 @@ import {
} from '-/reducers/app';
import { TS } from '-/tagspaces.namespace';
import { useTranslation } from 'react-i18next';
+import TaggingActions from '-/reducers/tagging-actions';
interface Props {
open: boolean;
@@ -43,7 +44,7 @@ interface Props {
anchorEl: Element | null;
selectedTag: TS.Tag | null;
currentEntryPath: string;
- removeTags: (paths: Array<string>, tags: Array<TS.Tag>) => void;
+ removeTags?: (paths: Array<string>, tags: Array<TS.Tag>) => void;
setIsAddTagDialogOpened?: (tag: TS.Tag) => void;
}
@@ -104,8 +105,13 @@ function EntryTagMenu(props: Props) {
}
function confirmRemoveTag() {
- removeTags([currentEntryPath], [selectedTag]);
- handleCloseDialogs();
+ if (removeTags) {
+ removeTags([currentEntryPath], [selectedTag]);
+ } else {
+ dispatch(
+ TaggingActions.removeTags([currentEntryPath], [selectedTag])
+ ).then(() => handleCloseDialogs());
+ }
}
const menuItems = [
diff --git a/app/components/menus/FileMenu.tsx b/app/components/menus/FileMenu.tsx
index 45ea4ad48..936c5f241 100644
--- a/app/components/menus/FileMenu.tsx
+++ b/app/components/menus/FileMenu.tsx
@@ -65,7 +65,7 @@ import {
DeleteIcon,
LinkIcon
} from '-/components/CommonIcons';
-import { getLocations } from '-/reducers/locations';
+import { getCurrentLocation, getLocations } from '-/reducers/locations';
import PropertiesIcon from '@mui/icons-material/Info';
import { useTranslation } from 'react-i18next';
@@ -80,16 +80,9 @@ interface Props {
openMoveCopyFilesDialog: () => void;
openShareFilesDialog?: () => void;
openAddRemoveTagsDialog: () => void;
- loadDirectoryContent: (
- path: string,
- generateThumbnails: boolean,
- loadDirMeta?: boolean
- ) => void;
openFileNatively: (path: string) => void;
- showInFileManager: (path: string) => void;
selectedFilePath?: string;
selectedEntries: Array<any>;
- currentLocation: TS.Location;
reorderTop?: () => void;
reorderBottom?: () => void;
onDuplicateFile?: (fileDirPath: string) => void;
@@ -102,12 +95,9 @@ function FileMenu(props: Props) {
openMoveCopyFilesDialog,
openShareFilesDialog,
openAddRemoveTagsDialog,
- showInFileManager,
onDuplicateFile,
- loadDirectoryContent,
selectedEntries,
openFileNatively,
- currentLocation,
reorderTop,
reorderBottom,
anchorEl,
@@ -120,6 +110,7 @@ function FileMenu(props: Props) {
const { t } = useTranslation();
const dispatch: AppDispatch = useDispatch();
+ const currentLocation: TS.Location = useSelector(getCurrentLocation);
const locations: Array<TS.Location> = useSelector(getLocations);
const readOnlyMode = useSelector(isReadOnlyMode);
const prefixTagContainer = useSelector(getPrefixTagContainer);
@@ -271,7 +262,7 @@ function FileMenu(props: Props) {
if (onDuplicateFile) {
onDuplicateFile(dirPath);
} else {
- loadDirectoryContent(dirPath, true, true);
+ dispatch(AppActions.loadDirectoryContent(dirPath, true, true));
}
return true;
})
@@ -291,7 +282,9 @@ function FileMenu(props: Props) {
PlatformIO.getDirSeparator()
);
dispatch(AppActions.exitSearchMode());
- loadDirectoryContent(parentFolder, false, true);
+ return dispatch(
+ AppActions.loadDirectoryContent(parentFolder, false, true)
+ );
}
}
@@ -389,7 +382,7 @@ function FileMenu(props: Props) {
onClick={() => {
onClose();
if (selectedFilePath) {
- showInFileManager(selectedFilePath);
+ dispatch(AppActions.showInFileManager(selectedFilePath));
}
}}
>
diff --git a/app/containers/MainPage.tsx b/app/containers/MainPage.tsx
index 4dc146552..cfb499938 100644
--- a/app/containers/MainPage.tsx
+++ b/app/containers/MainPage.tsx
@@ -19,7 +19,7 @@
import React, { useEffect, useReducer, useRef, useState } from 'react';
import clsx from 'clsx';
import { bindActionCreators } from 'redux';
-import { connect } from 'react-redux';
+import { connect, useSelector } from 'react-redux';
//import { translate } from 'react-i18next';
//import { initReactI18next } from 'react-i18next';
import SwipeableDrawer from '@mui/material/SwipeableDrawer';
@@ -52,7 +52,6 @@ import {
isLicenseDialogOpened,
isThirdPartyLibsDialogOpened,
isEntryInFullWidth,
- getDirectoryPath,
isLocationManagerPanelOpened,
isTagLibraryPanelOpened,
isSearchPanelOpened,
@@ -206,7 +205,6 @@ interface Props {
isTagLibraryPanelOpened: boolean;
isSearchPanelOpened: boolean;
isHelpFeedbackPanelOpened: boolean;
- directoryPath: string;
showNotification: (
text: string,
notificationType?: string,
@@ -469,92 +467,6 @@ function MainPage(props: Props) {
setDrawerOpened(prevOpen => !prevOpen);
};
- const handleMoveCopyFiles = (files: Array<File>, move = false) => {
- const promises = [];
- for (const file of files) {
- if (move) {
- promises.push(
- PlatformIO.renameFilePromise(
- file.path,
- props.directoryPath + AppConfig.dirSeparator + file.name
- )
- .then(() => true)
- .catch(error => {
- console.log('renameFilePromise', error);
- })
- );
- } else {
- promises.push(
- PlatformIO.copyFilePromise(
- file.path,
- props.directoryPath + AppConfig.dirSeparator + file.name
- )
- .then(() => true)
- .catch(error => {
- console.log('copyFilePromise', error);
- })
- );
- }
- }
- Promise.all(promises)
- .then(() => loadDirectoryContent(props.directoryPath, true, true))
- .catch(error => {
- console.log('promises', error);
- });
- };
- /* const handleMoveFiles = (files: Array<File>) => {
- handleCopyFiles(files)
- .then(success => {
- if (AppConfig.isElectron && success) {
- for (const file of files) {
- PlatformIO.deleteFilePromise(file.path)
- .then(() => true)
- .catch(error => {
- console.log('deleteFilePromise', error);
- });
- }
- }
- return true;
- })
- .catch(error => {
- console.log('handleCopyFiles', error);
- });
- }; */
-
- const handleCopyFiles = files => {
- if (props.isReadOnlyMode) {
- props.showNotification(t('core:dndDisabledReadOnlyMode'), 'error', true);
- return Promise.reject(t('core:dndDisabledReadOnlyMode'));
- }
- if (files) {
- console.log('Dropped files: ' + JSON.stringify(files));
- if (!props.directoryPath) {
- props.showNotification(
- 'Importing files failed, because no folder is opened in TagSpaces!',
- 'error',
- true
- );
- return Promise.reject(
- new Error(
- 'Importing files failed, because no folder is opened in TagSpaces!'
- )
- );
- }
- props.resetProgress();
- props.toggleUploadDialog();
- return props
- .uploadFilesAPI(files, props.directoryPath, props.onUploadProgress)
- .then(fsEntries => {
- props.reflectCreateEntries(fsEntries);
- return true;
- })
- .catch(error => {
- console.log('uploadFiles', error);
- });
- }
- return Promise.reject(new Error('on files'));
- };
-
const keyBindingHandlers = {
openParentDirectory: props.loadParentDirectoryContent,
toggleShowHiddenEntries: props.toggleShowUnixHiddenEntries,
@@ -602,7 +514,6 @@ function MainPage(props: Props) {
toggleProTeaser,
setFirstRun,
loadDirectoryContent,
- directoryPath,
mainSplitSize,
openedFiles,
openLink
@@ -655,13 +566,10 @@ function MainPage(props: Props) {
setPercent={setPercent}
>
<FolderContainer
- windowHeight={dimensions.height}
- windowWidth={dimensions.width}
toggleDrawer={toggleDrawer}
toggleProTeaser={toggleProTeaser}
drawerOpened={drawerOpened}
openedFiles={openedFiles}
- currentDirectoryPath={directoryPath}
goBack={goBack}
goForward={goForward}
openMoveCopyFilesDialog={() =>
@@ -673,7 +581,6 @@ function MainPage(props: Props) {
key="EntryContainerID"
loadDirectoryContent={loadDirectoryContent}
openedFiles={openedFiles}
- currentDirectoryPath={directoryPath}
/>
)}
</Split>
@@ -693,14 +600,6 @@ function MainPage(props: Props) {
setMoveCopyDialogOpened(undefined);
}}
selectedFiles={moveCopyDialogOpened}
- handleMoveFiles={files => {
- handleMoveCopyFiles(files, true);
- setMoveCopyDialogOpened(undefined);
- }}
- handleCopyFiles={files => {
- handleMoveCopyFiles(files, false);
- setMoveCopyDialogOpened(undefined);
- }}
/>
{props.isLocationDialogOpened && (
<CreateEditLocationDialogAsync
@@ -788,12 +687,7 @@ function MainPage(props: Props) {
<CreateDirectoryDialog
open={true}
onClose={toggleCreateDirectoryDialog}
- selectedDirectoryPath={
- props.isCreateDirectoryOpened &&
- props.isCreateDirectoryOpened.rootDirPath
- ? props.isCreateDirectoryOpened.rootDirPath
- : directoryPath
- }
+ selectedDirectoryPath={props.isCreateDirectoryOpened?.rootDirPath}
callback={props.isCreateDirectoryOpened?.callback}
reflect={props.isCreateDirectoryOpened?.reflect}
/>
@@ -854,12 +748,15 @@ function MainPage(props: Props) {
<PageNotification />
<div
style={{
- // backgroundColor: theme.palette.background.default,
+ backgroundColor: theme.palette.background.default,
height: '100%'
}}
>
<style>
{`
+ body { background-color: ${
+ theme.palette.background.default
+ } !important;}
.default-splitter {
--default-splitter-line-margin: 2px !important;
--default-splitter-line-size: 1px !important;
@@ -888,17 +785,7 @@ function MainPage(props: Props) {
{props.isDesktopMode || (AppConfig.isAmplify && !props.user) ? (
<TargetFileBox
accepts={[FILE]}
- onDrop={(item: any) => {
- if (
- AppConfig.isElectron &&
- !PlatformIO.haveObjectStoreSupport() &&
- !PlatformIO.haveWebDavSupport()
- ) {
- setMoveCopyDialogOpened(item.files);
- } else {
- handleCopyFiles(item.files);
- }
- }}
+ setMoveCopyDialogOpened={setMoveCopyDialogOpened}
>
<CustomDragLayer />
<Drawer variant="persistent" anchor="left" open={drawerOpened}>
@@ -964,7 +851,6 @@ function mapStateToProps(state) {
isTagLibraryPanelOpened: isTagLibraryPanelOpened(state),
isSearchPanelOpened: isSearchPanelOpened(state),
isHelpFeedbackPanelOpened: isHelpFeedbackPanelOpened(state),
- directoryPath: getDirectoryPath(state),
isDeleteMultipleEntriesDialogOpened: isDeleteMultipleEntriesDialogOpened(
state
),
@@ -1036,7 +922,6 @@ 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 &&
JSON.stringify(nextProp.isCreateDirectoryOpened) ===
JSON.stringify(prevProp.isCreateDirectoryOpened) &&
diff --git a/app/perspectives/grid-perspective/components/GridPagination.tsx b/app/perspectives/grid-perspective/components/GridPagination.tsx
index 32d678ca3..12136354c 100644
--- a/app/perspectives/grid-perspective/components/GridPagination.tsx
+++ b/app/perspectives/grid-perspective/components/GridPagination.tsx
@@ -17,7 +17,7 @@
*/
import React, { useEffect, useReducer, useRef } from 'react';
-import { connect } from 'react-redux';
+import { connect, useSelector } from 'react-redux';
import { useTheme } from '@mui/material/styles';
import Typography from '@mui/material/Typography';
import Tooltip from '-/components/Tooltip';
@@ -39,7 +39,6 @@ import {
getCurrentDirectoryColor,
getIsMetaLoaded,
getCurrentDirectoryTags,
- isLoading,
getCurrentDirectoryDescription,
getLastBackgroundImageChange,
getLastThumbnailImageChange,
@@ -60,6 +59,7 @@ import PlatformIO from '-/services/platform-facade';
import { MilkdownEditor } from '@tagspaces/tagspaces-md';
import { renderCell } from '-/perspectives/common/main-container';
import { useTranslation } from 'react-i18next';
+import { getCurrentLocation } from '-/reducers/locations';
interface Props {
isMetaLoaded: boolean;
@@ -90,10 +90,8 @@ interface Props {
) => void;
currentDirectoryColor: string;
currentDirectoryTags: Array<TS.Tag>;
- isAppLoading: boolean;
currentPage: number;
gridPageLimit: number;
- currentLocationPath: string;
currentDirectoryPath: string;
onContextMenu: (event: React.MouseEvent<HTMLDivElement>) => void;
openRenameEntryDialog: () => void;
@@ -108,7 +106,6 @@ interface Props {
lastThumbnailImageChange: any;
setSelectedEntries: (selectedEntries: Array<TS.FileSystemEntry>) => void;
singleClickAction: string;
- currentLocation: TS.Location;
lastSelectedEntryPath: string;
directoryContent: Array<TS.FileSystemEntry>;
openEntry: (entryPath?: string) => void;
@@ -141,10 +138,8 @@ function GridPagination(props: Props) {
showTags,
singleClickAction,
getCellContent,
- isAppLoading,
isReadOnlyMode,
desktopMode,
- currentLocation,
currentDirectoryColor,
currentDirectoryTags,
currentDirectoryDescription,
@@ -168,6 +163,7 @@ function GridPagination(props: Props) {
clearSelection,
files
} = props;
+ const currentLocation: TS.Location = useSelector(getCurrentLocation);
if (!showDirectories) {
directories = [];
}
@@ -246,7 +242,7 @@ function GridPagination(props: Props) {
containerEl.current.scrollTop = 0;
}
}, [
- props.currentLocationPath,
+ //props.currentLocationPath,
props.currentDirectoryPath,
props.lastSearchTimestamp
]);
@@ -621,7 +617,7 @@ function GridPagination(props: Props) {
index === dArray.length - 1
)
)}
- {!isAppLoading && pageFiles.length < 1 && directories.length < 1 && (
+ {pageFiles.length < 1 && directories.length < 1 && (
<div style={{ textAlign: 'center' }}>
{!showDescription && currentDirectoryDescription && (
<div style={{ position: 'relative', marginBottom: 150 }}>
@@ -640,35 +636,32 @@ function GridPagination(props: Props) {
)}
</div>
)}
- {!isAppLoading &&
- pageFiles.length < 1 &&
- directories.length >= 1 &&
- !showDirectories && (
- <div style={{ textAlign: 'center' }}>
- {!showDescription && currentDirectoryDescription && (
- <div style={{ position: 'relative', marginBottom: 150 }}>
- <EntryIcon isFile={false} />
- </div>
- )}
- <Typography
- style={{ padding: 15, color: theme.palette.text.secondary }}
- >
- {t('core:noFileButFoldersFound')}
+ {pageFiles.length < 1 && directories.length >= 1 && !showDirectories && (
+ <div style={{ textAlign: 'center' }}>
+ {!showDescription && currentDirectoryDescription && (
+ <div style={{ position: 'relative', marginBottom: 150 }}>
+ <EntryIcon isFile={false} />
+ </div>
+ )}
+ <Typography
+ style={{ padding: 15, color: theme.palette.text.secondary }}
+ >
+ {t('core:noFileButFoldersFound')}
+ </Typography>
+ {!AppConfig.isCordova && (
+ <Typography style={{ color: theme.palette.text.secondary }}>
+ {t('core:dragAndDropToImport')}
</Typography>
- {!AppConfig.isCordova && (
- <Typography style={{ color: theme.palette.text.secondary }}>
- {t('core:dragAndDropToImport')}
- </Typography>
- )}
- </div>
- )}
+ )}
+ </div>
+ )}
</div>
{showPagination && (
<Tooltip title={folderSummary}>
<Pagination
style={{
left: 15,
- bottom: 65,
+ bottom: 15,
zIndex: 1100,
position: 'absolute',
backgroundColor: theme.palette.background.default,
@@ -704,7 +697,6 @@ function GridPagination(props: Props) {
function mapStateToProps(state) {
return {
- isAppLoading: isLoading(state),
currentDirectoryColor: getCurrentDirectoryColor(state),
lastSearchTimestamp: getLastSearchTimestamp(state),
// searchResultCount: getSearchResultCount(state),
@@ -723,7 +715,9 @@ function mapActionCreatorsToProps(dispatch) {
{
// setMetaForCurrentDir: AppActions.setMetaForCurrentDir,
updateCurrentDirEntries: AppActions.updateCurrentDirEntries,
- setIsMetaLoaded: AppActions.setIsMetaLoaded
+ setIsMetaLoaded: AppActions.setIsMetaLoaded,
+ loadDirectoryContent: AppActions.loadDirectoryContent,
+ openEntry: AppActions.openEntry
},
dispatch
);
diff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsx
index 6787b04d2..eab0743ae 100644
--- a/app/perspectives/grid-perspective/components/MainContainer.tsx
+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx
@@ -32,8 +32,10 @@ import IOActions from '-/reducers/io-actions';
import {
actions as AppActions,
AppDispatch,
+ getDirectoryContent,
getDirectoryMeta,
getEditedEntryPaths,
+ getLastSearchTimestamp,
getLastSelectedEntryPath,
getSearchFilter,
getSelectedEntries,
@@ -43,7 +45,6 @@ import CellContent from './CellContent';
import MainToolbar from './MainToolbar';
import SortingMenu from './SortingMenu';
import GridOptionsMenu from './GridOptionsMenu';
-import { getCurrentLocation } from '-/reducers/locations';
import PlatformIO from '-/services/platform-facade';
import GridPagination from '-/perspectives/grid-perspective/components/GridPagination';
import GridSettingsDialog from '-/perspectives/grid-perspective/components/GridSettingsDialog';
@@ -60,19 +61,7 @@ import { openURLExternally } from '-/services/utils-io';
interface Props {
currentDirectoryPath: string;
- openEntry: (entryPath?: string) => void;
openRenameEntryDialog: () => void;
- loadDirectoryContent: (
- path: string,
- generateThumbnails: boolean,
- loadDirMeta?: boolean
- ) => void;
- openDirectory: (path: string) => void;
- showInFileManager: (path: string) => void;
- loadParentDirectoryContent: () => void;
- removeTags: (paths: Array<string>, tags: Array<TS.Tag>) => void;
- directoryContent: Array<TS.FileSystemEntry>;
- lastSearchTimestamp: number;
}
function getSettings(directoryMeta: TS.FileSystemEntryMeta): TS.FolderSettings {
@@ -90,35 +79,26 @@ function getSettings(directoryMeta: TS.FileSystemEntryMeta): TS.FolderSettings {
}
function GridPerspective(props: Props) {
- const {
- loadParentDirectoryContent,
- currentDirectoryPath,
- openRenameEntryDialog,
- directoryContent,
- lastSearchTimestamp,
- openEntry,
- loadDirectoryContent,
- removeTags,
- showInFileManager,
- openDirectory
- } = props;
+ const { currentDirectoryPath, openRenameEntryDialog } = props;
+ const dispatch: AppDispatch = useDispatch();
+ const directoryContent: Array<TS.FileSystemEntry> = useSelector(
+ getDirectoryContent
+ );
const directoryMeta: TS.FileSystemEntryMeta = useSelector(getDirectoryMeta);
const readOnlyMode = useSelector(isReadOnlyMode);
+ const lastSearchTimestamp = useSelector(getLastSearchTimestamp);
const desktopMode = useSelector(getDesktopMode);
const selectedEntries: Array<TS.FileSystemEntry> = useSelector(
getSelectedEntries
);
const lastSelectedEntryPath = useSelector(getLastSelectedEntryPath);
const keyBindings = useSelector(getKeyBindingObject);
- const currentLocation: TS.Location = useSelector(getCurrentLocation);
const searchFilter: string = useSelector(getSearchFilter);
const editedEntryPaths: Array<TS.EditedEntryPath> = useSelector(
getEditedEntryPaths
);
- const dispatch: AppDispatch = useDispatch();
-
// Create functions that dispatch actions
const handleMoveFiles = (files: Array<string>, destination: string) =>
dispatch(IOActions.moveFiles(files, destination));
@@ -475,10 +455,10 @@ function GridPerspective(props: Props) {
}
};
- const handleLayoutSwitch = (type: string) => {
+ /*const handleLayoutSwitch = (type: string) => {
layoutType.current = type;
// forceUpdate();
- };
+ };*/
const handleGridPageLimit = (limit: number) => {
gridPageLimit.current = limit;
@@ -515,10 +495,8 @@ function GridPerspective(props: Props) {
selectedEntryPath.current = undefined;
};
- const someFileSelected = selectedEntries.length > 1;
-
const toggleSelectAllFiles = () => {
- if (someFileSelected) {
+ if (selectedEntries.length > 1) {
clearSelection();
} else {
if (!lastSearchTimestamp) {
@@ -666,7 +644,7 @@ function GridPerspective(props: Props) {
},
openEntry: e => {
e.preventDefault();
- openEntry();
+ dispatch(AppActions.openEntry());
},
openFileExternally: () => {
handleOpenFileNatively();
@@ -677,9 +655,9 @@ function GridPerspective(props: Props) {
entry => !entry.isFile
);
const sortedFiles = sortedDirContent.current.filter(entry => entry.isFile);
- const locationPath = currentLocation
+ /*const locationPath = currentLocation
? PlatformIO.getLocationPath(currentLocation)
- : '';
+ : '';*/
let entryWidth = 200;
if (entrySize.current === 'small') {
entryWidth = 150;
@@ -756,26 +734,18 @@ function GridPerspective(props: Props) {
return (
<div
style={{
- height: 'calc(100% - 48px)'
+ height: '100%' //'calc(100% - 48px)'
}}
data-tid={defaultSettings.testID}
>
<MainToolbar
prefixDataTID={'grid'}
- layoutType={layoutType.current}
- selectedEntries={selectedEntries}
- loadParentDirectoryContent={loadParentDirectoryContent}
toggleSelectAllFiles={toggleSelectAllFiles}
- someFileSelected={someFileSelected}
- handleLayoutSwitch={handleLayoutSwitch}
openAddRemoveTagsDialog={openAddRemoveTagsDialog}
- fileOperationsEnabled={fileOperationsEnabled(selectedEntries)}
openMoveCopyFilesDialog={openMoveCopyFilesDialog}
- openDeleteFileDialog={openDeleteFileDialog}
handleSortingMenu={handleSortingMenu}
handleExportCsvMenu={handleExportCsvMenu}
openSettings={openSettings}
- directoryPath={currentDirectoryPath}
openShareFilesDialog={
PlatformIO.haveObjectStoreSupport() ? openShareFilesDialog : undefined
}
@@ -792,7 +762,7 @@ function GridPerspective(props: Props) {
display: 'grid',
gridGap: '5px 5px',
padding: 5,
- paddingBottom: 10,
+ paddingBottom: 70,
gridTemplateColumns:
'repeat(auto-fit,minmax(' + entryWidth + 'px,1fr))'
}}
@@ -810,7 +780,6 @@ function GridPerspective(props: Props) {
files={sortedFiles}
getCellContent={getCellContent}
currentPage={1}
- currentLocationPath={locationPath}
currentDirectoryPath={currentDirectoryPath}
onClick={onClick}
onContextMenu={onContextMenu}
@@ -818,15 +787,12 @@ function GridPerspective(props: Props) {
selectedEntries={selectedEntries}
setSelectedEntries={handleSetSelectedEntries}
singleClickAction={singleClickAction.current}
- currentLocation={currentLocation}
directoryContent={
lastSearchTimestamp
? GlobalSearch.getInstance().getResults()
: directoryContent
}
- openEntry={openEntry}
openFileNatively={handleOpenFileNatively}
- loadDirectoryContent={loadDirectoryContent}
setFileContextMenuAnchorEl={setFileContextMenuAnchorEl}
setDirContextMenuAnchorEl={setDirContextMenuAnchorEl}
showNotification={handleShowNotification}
@@ -918,11 +884,8 @@ function GridPerspective(props: Props) {
}
openAddRemoveTagsDialog={openAddRemoveTagsDialog}
openFileNatively={handleOpenFileNatively}
- loadDirectoryContent={loadDirectoryContent}
- showInFileManager={showInFileManager}
selectedFilePath={lastSelectedEntryPath}
selectedEntries={selectedEntries}
- currentLocation={currentLocation}
/>
)}
{/* {Boolean(dirContextMenuAnchorEl) && ( // todo move dialogs from DirectoryMenu */}
@@ -933,12 +896,9 @@ function GridPerspective(props: Props) {
mouseX={mouseX}
mouseY={mouseY}
directoryPath={lastSelectedEntryPath}
- loadDirectoryContent={loadDirectoryContent}
openRenameDirectoryDialog={openRenameEntryDialog}
openMoveCopyFilesDialog={openMoveCopyFilesDialog}
- openDirectory={openDirectory}
perspectiveMode={lastSelectedEntryPath !== currentDirectoryPath}
- currentLocation={currentLocation}
openAddRemoveTagsDialog={openAddRemoveTagsDialog}
/>
{/* {Boolean(tagContextMenuAnchorEl) && ( // TODO EntryTagMenu is used in TagSelect we cannot move confirm dialog from menu */}
@@ -948,8 +908,7 @@ function GridPerspective(props: Props) {
onClose={() => setTagContextMenuAnchorEl(null)}
setIsAddTagDialogOpened={setIsAddTagDialogOpened}
selectedTag={selectedTag.current}
- currentEntryPath={selectedEntryPath.current} // getSelEntryPath()}
- removeTags={removeTags}
+ currentEntryPath={selectedEntryPath.current}
/>
{Boolean(sortingContextMenuAnchorEl) && (
<SortingMenu
@@ -984,5 +943,4 @@ function GridPerspective(props: Props) {
</div>
);
}
-
export default GridPerspective;
diff --git a/app/perspectives/grid-perspective/components/MainToolbar.tsx b/app/perspectives/grid-perspective/components/MainToolbar.tsx
index dd1d8f3ac..8e1d74039 100644
--- a/app/perspectives/grid-perspective/components/MainToolbar.tsx
+++ b/app/perspectives/grid-perspective/components/MainToolbar.tsx
@@ -33,8 +33,6 @@ import {
FolderPropertiesIcon,
PerspectiveSettingsIcon
} from '-/components/CommonIcons';
-import { connect } from 'react-redux';
-import { bindActionCreators } from 'redux';
import AppConfig from '-/AppConfig';
import { Pro } from '-/pro';
import { ProTooltip } from '-/components/HelperComponents';
@@ -47,6 +45,8 @@ import { TS } from '-/tagspaces.namespace';
import {
actions as AppActions,
AppDispatch,
+ getDirectoryPath,
+ getSelectedEntries,
isReadOnlyMode
} from '-/reducers/app';
import {
@@ -57,52 +57,39 @@ import { useTranslation } from 'react-i18next';
interface Props {
prefixDataTID?: string;
- selectedEntries: Array<TS.FileSystemEntry>;
- loadParentDirectoryContent: () => void;
toggleSelectAllFiles: (event: any) => void;
- someFileSelected: boolean;
- handleLayoutSwitch: (event: Object) => void;
openAddRemoveTagsDialog: () => void;
- fileOperationsEnabled: boolean;
openMoveCopyFilesDialog: () => void;
- openDeleteFileDialog: () => void;
handleSortingMenu: (event: Object) => void;
handleExportCsvMenu: () => void;
- layoutType: string;
openSettings: () => void;
- searchQuery: TS.SearchQuery;
- setSearchQuery: (searchQuery: TS.SearchQuery) => void;
- openCurrentDirectory: () => void;
openShareFilesDialog?: () => void;
- directoryPath: string;
- keyBindings: Array<any>;
}
function MainToolbar(props: Props) {
const {
prefixDataTID,
- selectedEntries,
toggleSelectAllFiles,
- someFileSelected,
- loadParentDirectoryContent,
- layoutType,
- handleLayoutSwitch,
openAddRemoveTagsDialog,
openMoveCopyFilesDialog,
- openDeleteFileDialog,
- fileOperationsEnabled,
handleSortingMenu,
+ handleExportCsvMenu,
openSettings,
- keyBindings,
openShareFilesDialog
} = props;
const { t } = useTranslation();
+ const selectedEntries: Array<TS.FileSystemEntry> = useSelector(
+ getSelectedEntries
+ );
+ const searchQuery: TS.SearchQuery = useSelector(getSearchQuery);
+ const keyBindings = useSelector(getKeyBindingObject);
const dispatch: AppDispatch = useDispatch();
const readOnlyMode = useSelector(isReadOnlyMode);
+ const directoryPath = useSelector(getDirectoryPath);
function showProperties() {
- return dispatch(AppActions.openEntry(props.directoryPath));
+ return dispatch(AppActions.openEntry(directoryPath));
}
return (
@@ -123,14 +110,11 @@ function MainToolbar(props: Props) {
aria-label={t('core:navigateToParentDirectory')}
data-tid={prefixDataTID + 'PerspectiveOnBackButton'}
onClick={() => {
- if (
- props.searchQuery &&
- Object.keys(props.searchQuery).length > 0
- ) {
- props.setSearchQuery({});
- props.openCurrentDirectory();
+ if (searchQuery && Object.keys(searchQuery).length > 0) {
+ dispatch(LocationIndexActions.setSearchQuery({}));
+ dispatch(AppActions.openCurrentDirectory());
} else {
- loadParentDirectoryContent();
+ dispatch(AppActions.loadParentDirectoryContent());
}
}}
size="large"
@@ -151,7 +135,7 @@ function MainToolbar(props: Props) {
onClick={toggleSelectAllFiles}
size="large"
>
- {someFileSelected ? <SelectedIcon /> : <UnSelectedIcon />}
+ {selectedEntries.length > 1 ? <SelectedIcon /> : <UnSelectedIcon />}
</IconButton>
</Tooltip>
<Tooltip title={t('core:directoryPropertiesTitle')}>
@@ -214,7 +198,9 @@ function MainToolbar(props: Props) {
<IconButton
aria-label={t('core:deleteSelectedEntries')}
data-tid={prefixDataTID + 'PerspectiveDeleteMultipleFiles'}
- onClick={openDeleteFileDialog}
+ onClick={() =>
+ dispatch(AppActions.toggleDeleteMultipleEntriesDialog())
+ }
disabled={selectedEntries.length < 1}
size="large"
>
@@ -256,7 +242,7 @@ function MainToolbar(props: Props) {
<Tooltip title={t('core:exportCsv')}>
<IconButton
data-tid={prefixDataTID + 'PerspectiveExportCsvMenuTID'}
- onClick={props.handleExportCsvMenu}
+ onClick={handleExportCsvMenu}
style={{ transform: 'scale(-1, 1)' }}
size="large"
>
@@ -278,20 +264,4 @@ function MainToolbar(props: Props) {
);
}
-function mapStateToProps(state) {
- return {
- searchQuery: getSearchQuery(state),
- keyBindings: getKeyBindingObject(state)
- };
-}
-function mapDispatchToProps(dispatch) {
- return bindActionCreators(
- {
- setSearchQuery: LocationIndexActions.setSearchQuery,
- openCurrentDirectory: AppActions.openCurrentDirectory
- },
- dispatch
- );
-}
-
-export default connect(mapStateToProps, mapDispatchToProps)(MainToolbar);
+export default MainToolbar;
diff --git a/app/perspectives/list/components/MainContainer.tsx b/app/perspectives/list/components/MainContainer.tsx
index 127e38bdc..04449edca 100644
--- a/app/perspectives/list/components/MainContainer.tsx
+++ b/app/perspectives/list/components/MainContainer.tsx
@@ -32,8 +32,10 @@ import IOActions from '-/reducers/io-actions';
import {
actions as AppActions,
AppDispatch,
+ getDirectoryContent,
getDirectoryMeta,
getEditedEntryPaths,
+ getLastSearchTimestamp,
getLastSelectedEntryPath,
getSearchFilter,
getSelectedEntries,
@@ -43,7 +45,6 @@ import CellContent from '-/perspectives/grid-perspective/components/CellContent'
import MainToolbar from '-/perspectives/grid-perspective/components/MainToolbar';
import SortingMenu from '-/perspectives/grid-perspective/components/SortingMenu';
import GridOptionsMenu from '-/perspectives/grid-perspective/components/GridOptionsMenu';
-import { getCurrentLocation } from '-/reducers/locations';
import PlatformIO from '-/services/platform-facade';
import GridPagination from '-/perspectives/grid-perspective/components/GridPagination';
import GridSettingsDialog from '-/perspectives/grid-perspective/components/GridSettingsDialog';
@@ -60,19 +61,7 @@ import { openURLExternally } from '-/services/utils-io';
interface Props {
currentDirectoryPath: string;
- openEntry: (entryPath?: string) => void;
openRenameEntryDialog: () => void;
- loadDirectoryContent: (
- path: string,
- generateThumbnails: boolean,
- loadDirMeta?: boolean
- ) => void;
- openDirectory: (path: string) => void;
- showInFileManager: (path: string) => void;
- loadParentDirectoryContent: () => void;
- removeTags: (paths: Array<string>, tags: Array<TS.Tag>) => void;
- directoryContent: Array<TS.FileSystemEntry>;
- lastSearchTimestamp: number;
}
function getSettings(directoryMeta: TS.FileSystemEntryMeta): TS.FolderSettings {
@@ -90,35 +79,26 @@ function getSettings(directoryMeta: TS.FileSystemEntryMeta): TS.FolderSettings {
}
function ListPerspective(props: Props) {
- const {
- loadParentDirectoryContent,
- currentDirectoryPath,
- openRenameEntryDialog,
- directoryContent,
- lastSearchTimestamp,
- openEntry,
- loadDirectoryContent,
- removeTags,
- showInFileManager,
- openDirectory
- } = props;
+ const { currentDirectoryPath, openRenameEntryDialog } = props;
+ const dispatch: AppDispatch = useDispatch();
+ const directoryContent: Array<TS.FileSystemEntry> = useSelector(
+ getDirectoryContent
+ );
const directoryMeta: TS.FileSystemEntryMeta = useSelector(getDirectoryMeta);
const readOnlyMode = useSelector(isReadOnlyMode);
+ const lastSearchTimestamp = useSelector(getLastSearchTimestamp);
const desktopMode = useSelector(getDesktopMode);
const selectedEntries: Array<TS.FileSystemEntry> = useSelector(
getSelectedEntries
);
const lastSelectedEntryPath = useSelector(getLastSelectedEntryPath);
const keyBindings = useSelector(getKeyBindingObject);
- const currentLocation: TS.Location = useSelector(getCurrentLocation);
const searchFilter: string = useSelector(getSearchFilter);
const editedEntryPaths: Array<TS.EditedEntryPath> = useSelector(
getEditedEntryPaths
);
- const dispatch: AppDispatch = useDispatch();
-
// Create functions that dispatch actions
const handleMoveFiles = (files: Array<string>, destination: string) =>
dispatch(IOActions.moveFiles(files, destination));
@@ -475,10 +455,10 @@ function ListPerspective(props: Props) {
}
};
- const handleLayoutSwitch = (type: string) => {
+ /*const handleLayoutSwitch = (type: string) => {
layoutType.current = type;
// forceUpdate();
- };
+ };*/
const handleGridPageLimit = (limit: number) => {
gridPageLimit.current = limit;
@@ -515,10 +495,8 @@ function ListPerspective(props: Props) {
selectedEntryPath.current = undefined;
};
- const someFileSelected = selectedEntries.length > 1;
-
const toggleSelectAllFiles = () => {
- if (someFileSelected) {
+ if (selectedEntries.length > 1) {
clearSelection();
} else {
if (!lastSearchTimestamp) {
@@ -666,7 +644,7 @@ function ListPerspective(props: Props) {
},
openEntry: e => {
e.preventDefault();
- openEntry();
+ dispatch(AppActions.openEntry());
},
openFileExternally: () => {
handleOpenFileNatively();
@@ -677,9 +655,9 @@ function ListPerspective(props: Props) {
entry => !entry.isFile
);
const sortedFiles = sortedDirContent.current.filter(entry => entry.isFile);
- const locationPath = currentLocation
+ /*const locationPath = currentLocation
? PlatformIO.getLocationPath(currentLocation)
- : '';
+ : '';*/
let entryWidth = 200;
if (entrySize.current === 'small') {
entryWidth = 150;
@@ -756,26 +734,18 @@ function ListPerspective(props: Props) {
return (
<div
style={{
- height: 'calc(100% - 48px)'
+ height: '100%' //'calc(100% - 48px)'
}}
data-tid={defaultSettings.testID}
>
<MainToolbar
prefixDataTID={'list'}
- layoutType={layoutType.current}
- selectedEntries={selectedEntries}
- loadParentDirectoryContent={loadParentDirectoryContent}
toggleSelectAllFiles={toggleSelectAllFiles}
- someFileSelected={someFileSelected}
- handleLayoutSwitch={handleLayoutSwitch}
openAddRemoveTagsDialog={openAddRemoveTagsDialog}
- fileOperationsEnabled={fileOperationsEnabled(selectedEntries)}
openMoveCopyFilesDialog={openMoveCopyFilesDialog}
- openDeleteFileDialog={openDeleteFileDialog}
handleSortingMenu={handleSortingMenu}
handleExportCsvMenu={handleExportCsvMenu}
openSettings={openSettings}
- directoryPath={currentDirectoryPath}
openShareFilesDialog={
PlatformIO.haveObjectStoreSupport() ? openShareFilesDialog : undefined
}
@@ -789,6 +759,7 @@ function ListPerspective(props: Props) {
gridPageLimit={gridPageLimit.current}
style={{
marginTop: 5,
+ marginBottom: 70,
paddingRight: 4,
paddingLeft: 4,
gridTemplateColumns: 'none'
@@ -807,7 +778,6 @@ function ListPerspective(props: Props) {
files={sortedFiles}
getCellContent={getCellContent}
currentPage={1}
- currentLocationPath={locationPath}
currentDirectoryPath={currentDirectoryPath}
onClick={onClick}
onContextMenu={onContextMenu}
@@ -815,15 +785,12 @@ function ListPerspective(props: Props) {
selectedEntries={selectedEntries}
setSelectedEntries={handleSetSelectedEntries}
singleClickAction={singleClickAction.current}
- currentLocation={currentLocation}
directoryContent={
lastSearchTimestamp
? GlobalSearch.getInstance().getResults()
: directoryContent
}
- openEntry={openEntry}
openFileNatively={handleOpenFileNatively}
- loadDirectoryContent={loadDirectoryContent}
setFileContextMenuAnchorEl={setFileContextMenuAnchorEl}
setDirContextMenuAnchorEl={setDirContextMenuAnchorEl}
showNotification={handleShowNotification}
@@ -915,11 +882,8 @@ function ListPerspective(props: Props) {
}
openAddRemoveTagsDialog={openAddRemoveTagsDialog}
openFileNatively={handleOpenFileNatively}
- loadDirectoryContent={loadDirectoryContent}
- showInFileManager={showInFileManager}
selectedFilePath={lastSelectedEntryPath}
selectedEntries={selectedEntries}
- currentLocation={currentLocation}
/>
)}
{/* {Boolean(dirContextMenuAnchorEl) && ( // todo move dialogs from DirectoryMenu */}
@@ -930,12 +894,9 @@ function ListPerspective(props: Props) {
mouseX={mouseX}
mouseY={mouseY}
directoryPath={lastSelectedEntryPath}
- loadDirectoryContent={loadDirectoryContent}
openRenameDirectoryDialog={openRenameEntryDialog}
openMoveCopyFilesDialog={openMoveCopyFilesDialog}
- openDirectory={openDirectory}
perspectiveMode={lastSelectedEntryPath !== currentDirectoryPath}
- currentLocation={currentLocation}
openAddRemoveTagsDialog={openAddRemoveTagsDialog}
/>
{/* {Boolean(tagContextMenuAnchorEl) && ( // TODO EntryTagMenu is used in TagSelect we cannot move confirm dialog from menu */}
@@ -945,8 +906,7 @@ function ListPerspective(props: Props) {
onClose={() => setTagContextMenuAnchorEl(null)}
setIsAddTagDialogOpened={setIsAddTagDialogOpened}
selectedTag={selectedTag.current}
- currentEntryPath={selectedEntryPath.current} // getSelEntryPath()}
- removeTags={removeTags}
+ currentEntryPath={selectedEntryPath.current}
/>
{Boolean(sortingContextMenuAnchorEl) && (
<SortingMenu
diff --git a/app/reducers/app.ts b/app/reducers/app.ts
index c5f6edbf5..3847e2cc6 100644
--- a/app/reducers/app.ts
+++ b/app/reducers/app.ts
@@ -165,7 +165,7 @@ export const types = {
UPDATE_CURRENTDIR_ENTRY: 'APP/UPDATE_CURRENTDIR_ENTRY',
UPDATE_CURRENTDIR_ENTRIES: 'APP/UPDATE_CURRENTDIR_ENTRIES',
REFLECT_EDITED_ENTRY_PATHS: 'APP/REFLECT_EDITED_ENTRY_PATHS',
- SET_ISLOADING: 'APP/SET_ISLOADING',
+ // SET_ISLOADING: 'APP/SET_ISLOADING',
ADD_EXTENSIONS: 'APP/ADD_EXTENSIONS',
REMOVE_EXTENSIONS: 'APP/REMOVE_EXTENSIONS',
UPDATE_EXTENSION: 'APP/UPDATE_EXTENSION'
@@ -227,7 +227,7 @@ if (window.ExtDefaultVerticalPanel === 'none') {
export const initialState = {
extensions: extensionsFound,
- isLoading: false,
+ //isLoading: false,
error: null,
loggedIn: false,
isOnline: false,
@@ -344,7 +344,10 @@ export default (state: any = initialState, action: any) => {
return { ...state, progress: [] };
}
case types.SET_READONLYMODE: {
- return { ...state, isReadOnlyMode: action.isReadOnlyMode };
+ if (action.isReadOnlyMode !== state.isReadOnlyMode) {
+ return { ...state, isReadOnlyMode: action.isReadOnlyMode };
+ }
+ return state;
}
case types.SET_NEW_VERSION_AVAILABLE: {
return {
@@ -405,8 +408,8 @@ export default (state: any = initialState, action: any) => {
/**
* used for reorder dirs in KanBan
*/
- currentDirectoryDirs: currentDirectoryDirs,
- isLoading: action.showIsLoading || false
+ currentDirectoryDirs: currentDirectoryDirs
+ // isLoading: action.showIsLoading || false
};
}
case types.CLEAR_DIRECTORY_CONTENT: {
@@ -426,7 +429,13 @@ export default (state: any = initialState, action: any) => {
return { ...state, lastSelectedEntry: action.entryPath };
} */
case types.SET_SELECTED_ENTRIES: {
- return { ...state, selectedEntries: action.selectedEntries };
+ if (
+ JSON.stringify(action.selectedEntries) !==
+ JSON.stringify(state.selectedEntries)
+ ) {
+ return { ...state, selectedEntries: action.selectedEntries };
+ }
+ return state;
}
case types.SET_TAG_LIBRARY_CHANGED: {
return { ...state, tagLibraryChanged: !state.tagLibraryChanged };
@@ -586,7 +595,7 @@ export default (state: any = initialState, action: any) => {
return {
...state,
lastSearchTimestamp: new Date().getTime(),
- isLoading: false,
+ //isLoading: false,
selectedEntries: []
};
}
@@ -597,7 +606,7 @@ export default (state: any = initialState, action: any) => {
searchMode: false,
lastSearchTimestamp: undefined,
searchFilter: undefined,
- isLoading: false,
+ //isLoading: false,
selectedEntries: []
};
}
@@ -606,8 +615,8 @@ export default (state: any = initialState, action: any) => {
return {
...state,
searchMode: true,
- searchFilter: undefined,
- isLoading: false
+ searchFilter: undefined
+ //isLoading: false
};
}
case types.APPEND_SEARCH_RESULTS: {
@@ -625,9 +634,9 @@ export default (state: any = initialState, action: any) => {
}
return {
...state,
- lastSearchTimestamp: new Date().getTime(),
+ lastSearchTimestamp: new Date().getTime()
// currentDirectoryEntries: newDirEntries,
- isLoading: false
+ //isLoading: false
};
}
case types.SET_SEARCH_FILTER: {
@@ -648,12 +657,12 @@ export default (state: any = initialState, action: any) => {
}
};
}
- case types.SET_ISLOADING: {
+ /*case types.SET_ISLOADING: {
return {
...state,
isLoading: action.isLoading
};
- }
+ }*/
case types.SET_GENERATING_THUMBNAILS: {
return {
...state,
@@ -1166,7 +1175,11 @@ export const actions = {
langURLParam.length > 1 &&
/^[a-zA-Z\-_]+$/.test('langURLParam')
) {
- dispatch(SettingsActions.setLanguage(langURLParam));
+ i18n.changeLanguage(langURLParam).then(() => {
+ dispatch(SettingsActions.setLanguage(langURLParam));
+ PlatformIO.setLanguage(langURLParam);
+ return true;
+ });
}
let openDefaultLocation = true;
@@ -1324,10 +1337,10 @@ export const actions = {
openSearchPanel: () => ({ type: types.OPEN_SEARCH_PANEL }),
openHelpFeedbackPanel: () => ({ type: types.OPEN_HELPFEEDBACK_PANEL }),
//closeAllVerticalPanels: () => ({ type: types.CLOSE_ALLVERTICAL_PANELS }),
- setIsLoading: (isLoading: boolean) => ({
+ /*setIsLoading: (isLoading: boolean) => ({
type: types.SET_ISLOADING,
isLoading
- }),
+ }),*/
/* setMetaForCurrentDir: (metaFiles: Array<any>) => (
dispatch: (action: any) => void,
getState: () => any
@@ -1378,7 +1391,7 @@ export const actions = {
const { currentDirectoryPath } = state.app;
const currentLocationPath = normalizePath(getCurrentLocationPath(state));
- dispatch(actions.setIsLoading(true));
+ // dispatch(actions.setIsLoading(true));
if (currentDirectoryPath) {
const parentDirectory = extractParentDirectoryPath(
@@ -1396,7 +1409,7 @@ export const actions = {
true
)
);
- dispatch(actions.setIsLoading(false));
+ // dispatch(actions.setIsLoading(false));
}
} else {
dispatch(
@@ -1406,7 +1419,7 @@ export const actions = {
true
)
);
- dispatch(actions.setIsLoading(false));
+ // dispatch(actions.setIsLoading(false));
}
},
updateCurrentDirectoryPerspective: (perspective: string) => (
@@ -1508,7 +1521,7 @@ export const actions = {
// console.debug('loadDirectoryContent:' + directoryPath);
window.walkCanceled = false;
- dispatch(actions.setIsLoading(true));
+ // dispatch(actions.setIsLoading(true));
const state = getState();
const { selectedEntries } = state.app;
@@ -3120,7 +3133,7 @@ export const getSearchResultCount = (state: any) =>
*/
export const getCurrentLocationId = (state: any) => state.app.currentLocationId;
export const isEntryInFullWidth = (state: any) => state.app.isEntryInFullWidth;
-export const isLoading = (state: any) => state.app.isLoading;
+//export const isLoading = (state: any) => state.app.isLoading;
export const isLocationManagerPanelOpened = (state: any) =>
state.app.locationManagerPanelOpened;
export const isTagLibraryPanelOpened = (state: any) =>
diff --git a/app/reducers/settings-default.ts b/app/reducers/settings-default.ts
index f02fe636e..1fb4ad586 100644
--- a/app/reducers/settings-default.ts
+++ b/app/reducers/settings-default.ts
@@ -34,7 +34,7 @@ if (window.ExtCheckForUpdatesOnStartup !== undefined) {
}
export default {
- isLoading: false,
+ //isLoading: false,
error: null,
userId: null,
loggedIn: false,
diff --git a/app/reducers/settings.ts b/app/reducers/settings.ts
index 827e2ef4d..818d0743b 100644
--- a/app/reducers/settings.ts
+++ b/app/reducers/settings.ts
@@ -254,7 +254,7 @@ export default (state: any = defaultSettings, action: any) => {
case types.SET_EMAIL: {
return {
...state,
- isLoading: true,
+ //isLoading: true,
email: action.email
};
}
@@ -594,12 +594,12 @@ export const actions = {
type: types.SET_REORDER_TAGS,
reorderTags
}),
- setLanguage: (language: string) => (dispatch: (action) => void) => {
+ /*setLanguage: (language: string) => (dispatch: (action) => void) => {
return i18n.changeLanguage(language).then(() => {
dispatch(actions.setLanguageInt(language));
});
- },
- setLanguageInt: (language: string) => ({
+ },*/
+ setLanguage: (language: string) => ({
type: types.SET_LANGUAGE,
language
}),
diff --git a/app/services/utils-io.ts b/app/services/utils-io.ts
index d0fb2f250..1bff6f4d9 100644
--- a/app/services/utils-io.ts
+++ b/app/services/utils-io.ts
@@ -903,7 +903,7 @@ export async function loadSubFolders(path: string, loadHidden = false) {
export function generateFileName(
fileName: string,
- tags: Array<string>,
+ tags: string[],
tagDelimiter: string,
prefixTagContainer = AppConfig.prefixTagContainer
) {