Skip to content

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

Selection-and-tagging-with-show-folders-settings (#1977)

Stanimir05a5d9a5ac03
diff --git a/app/perspectives/grid-perspective/components/GridPagination.tsx b/app/perspectives/grid-perspective/components/GridPagination.tsx
index 9b7ae28be..f2acba65c 100644
--- a/app/perspectives/grid-perspective/components/GridPagination.tsx
+++ b/app/perspectives/grid-perspective/components/GridPagination.tsx
@@ -131,9 +131,9 @@ interface Props {
}
function GridPagination(props: Props) {
+ let { directories } = props;
const {
style,
- directories,
showDirectories,
showDetails,
showDescription,
@@ -167,6 +167,9 @@ function GridPagination(props: Props) {
clearSelection,
files
} = props;
+ if (!showDirectories) {
+ directories = [];
+ }
const theme = useTheme();
const allFilesCount = files.length;
const showPagination = gridPageLimit && files.length > gridPageLimit;
@@ -389,7 +392,9 @@ function GridPagination(props: Props) {
const dirColor = currentDirectoryColor || 'transparent';
let folderSummary =
- directories.length + ' folder(s) and ' + allFilesCount + ' file(s) found';
+ (directories.length > 0 ? directories.length + ' folder(s) and ' : '') +
+ allFilesCount +
+ ' file(s) found';
if (selectedEntries && selectedEntries.length > 0) {
folderSummary = selectedEntries.length + ' entries selected';
}
diff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsx
index 6571a09cc..2712ab807 100644
--- a/app/perspectives/grid-perspective/components/MainContainer.tsx
+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx
@@ -125,7 +125,10 @@ function GridPerspective(props: Props) {
dispatch(IOActions.moveFiles(files, destination));
const handleSetSelectedEntries = (entries: Array<TS.FileSystemEntry>) => {
- dispatch(AppActions.setSelectedEntries(entries));
+ const selected = showDirectories.current
+ ? entries
+ : entries.filter(entry => entry.isFile);
+ dispatch(AppActions.setSelectedEntries(selected));
};
const handleShowNotification = (
diff --git a/app/perspectives/list/components/MainContainer.tsx b/app/perspectives/list/components/MainContainer.tsx
index 28c13daa6..f0ae9abaa 100644
--- a/app/perspectives/list/components/MainContainer.tsx
+++ b/app/perspectives/list/components/MainContainer.tsx
@@ -125,7 +125,10 @@ function ListPerspective(props: Props) {
dispatch(IOActions.moveFiles(files, destination));
const handleSetSelectedEntries = (entries: Array<TS.FileSystemEntry>) => {
- dispatch(AppActions.setSelectedEntries(entries));
+ const selected = showDirectories.current
+ ? entries
+ : entries.filter(entry => entry.isFile);
+ dispatch(AppActions.setSelectedEntries(selected));
};
const handleShowNotification = (