Skip to content

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

Allow changing the folder thumbnail and background from the list grid… (#2261)

Stanimir2d6aa04c31c8
diff --git a/package-lock.json b/package-lock.json
index 975f3ac94..b8ebce5e0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -206,7 +206,7 @@
"yarn": "please-use-npm"
},
"optionalDependencies": {
- "@tagspacespro/tagspacespro": "5.0.122"
+ "@tagspacespro/tagspacespro": "5.0.123"
}
},
"node_modules/@adobe/css-tools": {
@@ -19826,9 +19826,9 @@
}
},
"node_modules/@tagspacespro/tagspacespro": {
- "version": "5.0.122",
- "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.122/83c3d654ba0b7de889f9a3de7fbad2efe6c431a7",
- "integrity": "sha512-7VUnPOPJsU/rlA0Wp9mEEJcxaoZU6Zc9THAurpVpfqSuWLiktquCQ9dCUby30oMs71AkIEhtPKnwj1cFcDGdFQ==",
+ "version": "5.0.123",
+ "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.123/fdcbb92c380c4cdb4d4922fecf540f9d5498e651",
+ "integrity": "sha512-2DC7+AAPHPFpTS/CPlkhFIa/A+vz7FnydSelXtU6cZELYYcVTGD0coXC9v4/+Jwwf2mwxdnnqfHVTiCN4O1lgw==",
"license": "Proprietary",
"optional": true
},
diff --git a/package.json b/package.json
index 99cf2b282..87befab4a 100644
--- a/package.json
+++ b/package.json
@@ -245,7 +245,7 @@
"zod-to-json-schema": "^3.24.1"
},
"optionalDependencies": {
- "@tagspacespro/tagspacespro": "5.0.122"
+ "@tagspacespro/tagspacespro": "5.0.123"
},
"devDependencies": {
"@electron/notarize": "^2.5.0",
diff --git a/src/renderer/components/CommonIcons.tsx b/src/renderer/components/CommonIcons.tsx
index 4b193ce0a..dae833349 100644
--- a/src/renderer/components/CommonIcons.tsx
+++ b/src/renderer/components/CommonIcons.tsx
@@ -96,6 +96,10 @@ export { default as DateIcon } from '@mui/icons-material/DateRange';
export { default as PictureIcon } from '@mui/icons-material/PanoramaOutlined';
+export { default as CopyPictureIcon } from '@mui/icons-material/CollectionsOutlined';
+
+export { default as ChangeBackgroundIcon } from '@mui/icons-material/ImagesearchRollerOutlined';
+
export { default as DocumentIcon } from '@mui/icons-material/PictureAsPdfOutlined';
export { default as NoteIcon } from '@mui/icons-material/NoteOutlined';
diff --git a/src/renderer/components/EntryContainer.tsx b/src/renderer/components/EntryContainer.tsx
index 99a0aac57..03a8d4971 100644
--- a/src/renderer/components/EntryContainer.tsx
+++ b/src/renderer/components/EntryContainer.tsx
@@ -18,7 +18,7 @@
import AppConfig from '-/AppConfig';
import { CancelIcon, CloseEditIcon, SaveIcon } from '-/components/CommonIcons';
-import { extractContainingDirectoryPath } from '@tagspaces/tagspaces-common/paths';
+import EditFileButton from '-/components/EditFileButton';
import EntryContainerNav from '-/components/EntryContainerNav';
import EntryContainerTabs from '-/components/EntryContainerTabs';
import EntryContainerTitle from '-/components/EntryContainerTitle';
@@ -31,6 +31,7 @@ import { useResolveConflictContext } from '-/components/dialogs/hooks/useResolve
import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
import { useEntryPropsTabsContext } from '-/hooks/useEntryPropsTabsContext';
import { useFilePropertiesContext } from '-/hooks/useFilePropertiesContext';
+import { useFullScreenContext } from '-/hooks/useFullScreenContext';
import { useIOActionsContext } from '-/hooks/useIOActionsContext';
import { useNotificationContext } from '-/hooks/useNotificationContext';
import { useOpenedEntryContext } from '-/hooks/useOpenedEntryContext';
@@ -48,6 +49,7 @@ import { Switch, useMediaQuery } from '@mui/material';
import Box from '@mui/material/Box';
import ButtonGroup from '@mui/material/ButtonGroup';
import { useTheme } from '@mui/material/styles';
+import { extractContainingDirectoryPath } from '@tagspaces/tagspaces-common/paths';
import React, {
MutableRefObject,
useCallback,
@@ -59,8 +61,6 @@ import React, {
import { GlobalHotKeys } from 'react-hotkeys';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
-import EditFileButton from '-/components/EditFileButton';
-import { useFullScreenContext } from '-/hooks/useFullScreenContext';
function EntryContainer() {
const { t } = useTranslation();
@@ -732,7 +732,7 @@ function EntryContainer() {
<Box
style={{
paddingLeft: 0,
- paddingRight: 50,
+ paddingRight: 55,
paddingTop: 0,
minHeight: 48,
display: 'flex',
diff --git a/src/renderer/components/EntryProperties.tsx b/src/renderer/components/EntryProperties.tsx
index d15019295..92a1e0c26 100644
--- a/src/renderer/components/EntryProperties.tsx
+++ b/src/renderer/components/EntryProperties.tsx
@@ -87,6 +87,7 @@ import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
import L from 'leaflet';
import React, {
ChangeEvent,
+ useContext,
useEffect,
useReducer,
useRef,
@@ -110,12 +111,12 @@ const ThumbnailTextField = styled(TsTextField)(({ theme }) => ({
},
}));
-const ThumbnailChooserDialog =
- Pro && Pro.UI ? Pro.UI.ThumbnailChooserDialog : false;
+/*const ThumbnailChooserDialog =
+ Pro && Pro.UI ? Pro.UI.ThumbnailChooserDialog : false;*/
const CustomBackgroundDialog =
Pro && Pro.UI ? Pro.UI.CustomBackgroundDialog : false;
-const BgndImgChooserDialog =
- Pro && Pro.UI ? Pro.UI.BgndImgChooserDialog : false;
+/*const BgndImgChooserDialog =
+ Pro && Pro.UI ? Pro.UI.BgndImgChooserDialog : false;*/
interface Props {
tileServer: TS.MapTileServer;
@@ -173,6 +174,16 @@ function EntryProperties(props: Props) {
const { addTagsToFsEntry, removeTagsFromEntry } = useTaggingActionsContext();
const { findLocation, readOnlyMode } = useCurrentLocationContext();
const { showNotification } = useNotificationContext();
+ const thumbDialogContext = Pro?.contextProviders?.ThumbDialogContext
+ ? useContext<TS.ThumbDialogContextData>(
+ Pro.contextProviders.ThumbDialogContext,
+ )
+ : undefined;
+ const bgndDialogContext = Pro?.contextProviders?.BgndDialogContext
+ ? useContext<TS.BgndDialogContextData>(
+ Pro.contextProviders.BgndDialogContext,
+ )
+ : undefined;
const dirProps = useRef<TS.DirProp>(undefined);
const fileNameRef = useRef<HTMLInputElement>(null);
@@ -192,12 +203,12 @@ function EntryProperties(props: Props) {
useState<boolean>(false);
const [isConfirmResetColorDialogOpened, setConfirmResetColorDialogOpened] =
useState<boolean>(false);
- const [isFileThumbChooseDialogOpened, setFileThumbChooseDialogOpened] =
- useState<boolean>(false);
+ /* const [isFileThumbChooseDialogOpened, setFileThumbChooseDialogOpened] =
+ useState<boolean>(false);*/
const [showSharingLinkDialog, setShowSharingLinkDialog] =
useState<boolean>(false);
- const [isBgndImgChooseDialogOpened, setBgndImgChooseDialogOpened] =
- useState<boolean>(false);
+ /* const [isBgndImgChooseDialogOpened, setBgndImgChooseDialogOpened] =
+ useState<boolean>(false);*/
const [displayColorPicker, setDisplayColorPicker] = useState<boolean>(false);
const backgroundImage = useRef<string>('none');
@@ -259,7 +270,9 @@ function EntryProperties(props: Props) {
openedEntry.meta?.lastUpdated,
)
.then((thumbPath) => {
- const thbImage = thumbPath ? 'url("' + thumbPath + '")' : 'none';
+ const thbImage = thumbPath
+ ? 'url("' + thumbPath.replace(/#/g, '%23') + '")'
+ : 'none';
if (thbImage !== thumbImage.current) {
thumbImage.current = thbImage;
forceUpdate();
@@ -324,23 +337,23 @@ function EntryProperties(props: Props) {
setMoveCopyFilesDialogOpened(!isMoveCopyFilesDialogOpened);
};
- const toggleThumbFilesDialog = () => {
+ const openThumbFilesDialog = () => {
if (!Pro) {
showNotification(t('core:thisFunctionalityIsAvailableInPro'));
return true;
}
- if (!isEditMode && editName === undefined) {
- setFileThumbChooseDialogOpened(!isFileThumbChooseDialogOpened);
+ if (!isEditMode && editName === undefined && thumbDialogContext) {
+ thumbDialogContext.openThumbsDialog(openedEntry);
}
};
- const toggleBgndImgDialog = () => {
+ const openBgndImgDialog = () => {
if (!Pro) {
showNotification(t('core:thisFunctionalityIsAvailableInPro'));
return true;
}
if (!isEditMode && editName === undefined) {
- setBgndImgChooseDialogOpened(!isBgndImgChooseDialogOpened);
+ bgndDialogContext.openBgndDialog(openedEntry);
}
};
@@ -996,7 +1009,7 @@ function EntryProperties(props: Props) {
data-tid="changeThumbnailTID"
fullWidth
variant="text"
- onClick={toggleThumbFilesDialog}
+ onClick={openThumbFilesDialog}
>
{t('core:change')}
</TsButton>
@@ -1015,7 +1028,7 @@ function EntryProperties(props: Props) {
minWidth: 150,
marginBottom: 5,
}}
- onClick={toggleThumbFilesDialog}
+ onClick={openThumbFilesDialog}
/>
</Stack>
</InputAdornment>
@@ -1052,7 +1065,7 @@ function EntryProperties(props: Props) {
data-tid="changeBackgroundImageTID"
fullWidth
variant="text"
- onClick={toggleBgndImgDialog}
+ onClick={openBgndImgDialog}
>
{t('core:change')}
</TsButton>
@@ -1072,7 +1085,7 @@ function EntryProperties(props: Props) {
minWidth: 150,
marginBottom: 5,
}}
- onClick={toggleBgndImgDialog}
+ onClick={openBgndImgDialog}
/>
</Stack>
</InputAdornment>
@@ -1163,26 +1176,26 @@ function EntryProperties(props: Props) {
]}
/>
)}
- {ThumbnailChooserDialog && (
+ {/*{ThumbnailChooserDialog && (
<ThumbnailChooserDialog
open={isFileThumbChooseDialogOpened}
onClose={toggleThumbFilesDialog}
entry={openedEntry as TS.FileSystemEntry}
/>
- )}
+ )}*/}
{showSharingLinkDialog && (
<LinkGeneratorDialog
open={showSharingLinkDialog}
onClose={() => setShowSharingLinkDialog(false)}
/>
)}
- {BgndImgChooserDialog && (
+ {/*{BgndImgChooserDialog && (
<BgndImgChooserDialog
open={isBgndImgChooseDialogOpened}
onClose={toggleBgndImgDialog}
entry={openedEntry as TS.FileSystemEntry}
/>
- )}
+ )}*/}
{CustomBackgroundDialog && (
<CustomBackgroundDialog
color={openedEntry.meta?.color}
diff --git a/src/renderer/components/HowToStart.tsx b/src/renderer/components/HowToStart.tsx
index cd9f226b7..36dff76e8 100644
--- a/src/renderer/components/HowToStart.tsx
+++ b/src/renderer/components/HowToStart.tsx
@@ -1,16 +1,16 @@
-import * as React from 'react';
+import { ProSign } from '-/components/HelperComponents';
import TsButton from '-/components/TsButton';
+import { openURLExternally } from '-/services/utils-io';
import Box from '@mui/material/Box';
-import Stepper from '@mui/material/Stepper';
+import Paper from '@mui/material/Paper';
import Step from '@mui/material/Step';
-import StepLabel from '@mui/material/StepLabel';
import StepContent from '@mui/material/StepContent';
-import Paper from '@mui/material/Paper';
+import StepLabel from '@mui/material/StepLabel';
+import Stepper from '@mui/material/Stepper';
import Typography from '@mui/material/Typography';
-import Links from 'assets/links';
-import { ProSign } from '-/components/HelperComponents';
-import { openURLExternally } from '-/services/utils-io';
import { useTheme } from '@mui/material/styles';
+import Links from 'assets/links';
+import * as React from 'react';
import { useTranslation } from 'react-i18next';
/*export const styles: any = (theme: any) => ({
@@ -349,6 +349,13 @@ function HowToStart() {
</Typography>
<Box sx={{ mb: 2 }}>
<div>
+ <TsButton
+ disabled={index === 0}
+ onClick={handleBack}
+ sx={{ mt: 1, mr: 1 }}
+ >
+ {t('core:goback')}
+ </TsButton>
<TsButton
// variant="contained"
onClick={handleNext}
@@ -358,13 +365,6 @@ function HowToStart() {
? t('core:finish')
: t('core:goforward')}
</TsButton>
- <TsButton
- disabled={index === 0}
- onClick={handleBack}
- sx={{ mt: 1, mr: 1 }}
- >
- {t('core:goback')}
- </TsButton>
</div>
</Box>
</StepContent>
diff --git a/src/renderer/components/MobileNavigation.tsx b/src/renderer/components/MobileNavigation.tsx
index 42c409462..f5382bb6c 100644
--- a/src/renderer/components/MobileNavigation.tsx
+++ b/src/renderer/components/MobileNavigation.tsx
@@ -489,6 +489,7 @@ function MobileNavigation(props: Props) {
display: 'flex',
flexDirection: 'row',
alignSelf: 'anchor-center',
+ backgroundColor: theme.palette.background.default,
}}
>
<TsToolbarButton
diff --git a/src/renderer/components/PathBreadcrumbs.tsx b/src/renderer/components/PathBreadcrumbs.tsx
index e73633cfc..ceb2038d4 100644
--- a/src/renderer/components/PathBreadcrumbs.tsx
+++ b/src/renderer/components/PathBreadcrumbs.tsx
@@ -242,6 +242,7 @@ function PathBreadcrumbs(props: Props) {
onClose={closeDirectoryMenu}
anchorEl={directoryContextMenuAnchorEl}
perspectiveMode={false}
+ switchPerspectives={true}
directoryPath={currentDirectoryPath}
openRenameDirectoryDialog={openRenameDirectoryDialog}
/>
diff --git a/src/renderer/components/TagsPreview.tsx b/src/renderer/components/TagsPreview.tsx
index 579c8f86d..e34bdfa31 100644
--- a/src/renderer/components/TagsPreview.tsx
+++ b/src/renderer/components/TagsPreview.tsx
@@ -16,10 +16,9 @@
*
*/
-import React, { useRef } from 'react';
-import { useSelector } from 'react-redux';
import Tooltip from '-/components/Tooltip';
import { TS } from '-/tagspaces.namespace';
+import { useSelector } from 'react-redux';
import { getTagColor, getTagTextColor } from '-/reducers/settings';
import { getTagColors } from '-/services/taglibrary-utils';
@@ -82,7 +81,8 @@ function TagsPreview(props: Props) {
minWidth: 15,
width: 18,
height: 15,
- marginLeft: 5,
+ marginLeft: 4,
+ marginRight: 4,
borderRadius: 7,
borderRight: moreThanOne ? 'white 1px solid' : 'initial',
boxShadow: moreThanOne ? '4px 0px 0px 0px ' + secondTagColor : 'none',
diff --git a/src/renderer/components/Tooltip.tsx b/src/renderer/components/Tooltip.tsx
index 49afa35f8..566acb7dc 100644
--- a/src/renderer/components/Tooltip.tsx
+++ b/src/renderer/components/Tooltip.tsx
@@ -16,9 +16,8 @@
*
*/
-import React from 'react';
-import Tooltip from '@mui/material/Tooltip';
import { adjustKeyBinding } from '-/components/dialogs/KeyboardDialog';
+import Tooltip from '@mui/material/Tooltip';
interface Props {
title: any;
@@ -41,7 +40,7 @@ interface Props {
}
function TooltipTS(props: Props) {
- const { title, placement, keyBinding, children } = props;
+ const { title, placement = 'top', keyBinding, children } = props;
let tooltipText = title;
if (keyBinding) {
tooltipText = title + ' (' + adjustKeyBinding(keyBinding) + ')';
@@ -52,7 +51,7 @@ function TooltipTS(props: Props) {
arrow
title={tooltipText}
disableInteractive
- placement="top"
+ placement={placement}
/>
);
}
diff --git a/src/renderer/components/dialogs/SettingsDialog.tsx b/src/renderer/components/dialogs/SettingsDialog.tsx
index 8bfbdd2ea..e6035919e 100644
--- a/src/renderer/components/dialogs/SettingsDialog.tsx
+++ b/src/renderer/components/dialogs/SettingsDialog.tsx
@@ -92,6 +92,7 @@ function SettingsDialog(props: Props) {
overflowX: 'hidden',
display: smallScreen ? 'block' : 'flex',
flexGrow: 1,
+ padding: smallScreen ? 0 : '0 20px',
}}
>
<Tabs
diff --git a/src/renderer/components/dialogs/components/SettingsFileTypes.tsx b/src/renderer/components/dialogs/components/SettingsFileTypes.tsx
index 5693b46aa..a9def591d 100644
--- a/src/renderer/components/dialogs/components/SettingsFileTypes.tsx
+++ b/src/renderer/components/dialogs/components/SettingsFileTypes.tsx
@@ -46,7 +46,6 @@ import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableRow from '@mui/material/TableRow';
-import { styled } from '@mui/material/styles';
import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
import React, { useEffect, useReducer, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -57,16 +56,6 @@ import {
TableVirtuosoHandle,
} from 'react-virtuoso';
-const PREFIX = 'SettingsFileTypes';
-
-const classes = {
- fileExtRemove: `${PREFIX}-fileExtRemove`,
-};
-
-const Root = styled('div')(({ theme: any }) => ({
- [`& .${classes.fileExtRemove}`]: {},
-}));
-
function SettingsFileTypes() {
const { t } = useTranslation();
const { extensions } = useExtensionsContext();
@@ -231,17 +220,17 @@ function SettingsFileTypes() {
const columns: ColumnData[] = [
{
- width: '160px',
+ width: '130px',
label: t('core:fileExtension'),
dataKey: 'type',
},
{
- width: '45%',
+ width: '170px',
label: t('core:fileOpener'),
dataKey: 'viewer',
},
{
- width: '45%',
+ width: '170px',
label: t('core:fileEditor'),
dataKey: 'editor',
},
@@ -314,7 +303,10 @@ function SettingsFileTypes() {
function rowContent(_index: number, item: TS.FileTypes) {
return (
<React.Fragment>
- <TableCell align={'left'} sx={{ padding: '0 5px 0px 5px' }}>
+ <TableCell
+ align={'left'}
+ sx={{ maxWidth: 160, padding: '0 5px 0px 5px' }}
+ >
<FormControl
error={
(isValidationInProgress.current && item.type === '') ||
@@ -382,7 +374,7 @@ function SettingsFileTypes() {
</TableCell>
<TableCell
align={'center'}
- sx={{ minWith: 180, padding: '0 5px 0px 0' }}
+ sx={{ minWith: 150, padding: '0 5px 0px 0' }}
>
<FormControl
error={isValidationInProgress.current && item.viewer === ''}
@@ -391,7 +383,7 @@ function SettingsFileTypes() {
data-tid={'viewerTID' + item.type}
error={isValidationInProgress.current && item.viewer === ''}
value={item.viewer}
- style={{ minWidth: 150, maxWidth: 190, marginTop: 0 }}
+ style={{ minWidth: 150, marginTop: 0 }}
onChange={(event) => {
const extension: TS.Extension = extensions.find(
(ext) => ext.extensionId === event.target.value,
@@ -435,7 +427,7 @@ function SettingsFileTypes() {
<TableCell align={'center'} sx={{ padding: '0 5px 0px 0' }}>
<TsSelect
value={item.editor}
- style={{ minWidth: 150, maxWidth: 190, marginTop: 0 }}
+ style={{ minWidth: 150, marginTop: 0 }}
onChange={(event) =>
updateItems(item, 'editor', event.target.value)
}
@@ -520,8 +512,9 @@ function SettingsFileTypes() {
)}
<TableVirtuoso
style={{
- overflowX: 'hidden',
+ overflowX: 'auto',
height: 'calc(100% - 50px)',
+ minWidth: 350,
overflowY: 'auto',
background: 'transparent',
}}
diff --git a/src/renderer/components/menus/DirectoryMenu.tsx b/src/renderer/components/menus/DirectoryMenu.tsx
index f189eb40a..cdac06cd6 100644
--- a/src/renderer/components/menus/DirectoryMenu.tsx
+++ b/src/renderer/components/menus/DirectoryMenu.tsx
@@ -16,7 +16,7 @@
*
*/
-import React from 'react';
+import React, { useContext } from 'react';
import { Menu } from '@mui/material';
import { formatDateTime4Tag } from '@tagspaces/tagspaces-common/misc';
import AppConfig from '-/AppConfig';
@@ -69,6 +69,7 @@ interface Props {
openAddRemoveTagsDialog?: () => void;
switchPerspective?: (perspectiveId: string) => void;
perspectiveMode?: boolean;
+ switchPerspectives?: boolean;
openRenameDirectoryDialog?: () => void;
openMoveCopyFilesDialog?: () => void;
mouseX?: number;
@@ -94,6 +95,7 @@ function DirectoryMenu(props: Props) {
currentDirectoryEntries,
setManualDirectoryPerspective,
openCurrentDirectory,
+ getAllPropertiesPromise,
} = useDirectoryContentContext();
const { generateThumbnails } = useThumbGenerationContext();
const { copyFilePromise, renameFilePromise } = usePlatformFacadeContext();
@@ -102,6 +104,18 @@ function DirectoryMenu(props: Props) {
const { openProTeaserDialog } = useProTeaserDialogContext();
const { openDeleteMultipleEntriesDialog } =
useDeleteMultipleEntriesDialogContext();
+
+ const thumbDialogContext = Pro?.contextProviders?.ThumbDialogContext
+ ? useContext<TS.ThumbDialogContextData>(
+ Pro.contextProviders.ThumbDialogContext,
+ )
+ : undefined;
+ const bgndDialogContext = Pro?.contextProviders?.BgndDialogContext
+ ? useContext<TS.BgndDialogContextData>(
+ Pro.contextProviders.BgndDialogContext,
+ )
+ : undefined;
+
const {
open,
onClose,
@@ -114,6 +128,7 @@ function DirectoryMenu(props: Props) {
openRenameDirectoryDialog,
switchPerspective,
perspectiveMode,
+ switchPerspectives,
} = props;
const currentLocation = findLocation();
const directoryPath = props.directoryPath || currentDirectoryPath;
@@ -414,6 +429,26 @@ Do you want to continue?`)
return openCurrentDirectory();
}
}
+ function changeFolderThumbnail() {
+ if (selectedEntries.length === 1) {
+ thumbDialogContext.openThumbsDialog(selectedEntries[0]);
+ } else {
+ getAllPropertiesPromise(currentDirectoryPath).then(
+ (fsEntry: TS.FileSystemEntry) =>
+ thumbDialogContext.openThumbsDialog(fsEntry),
+ );
+ }
+ }
+ function changeFolderBackground() {
+ if (selectedEntries.length === 1) {
+ bgndDialogContext.openBgndDialog(selectedEntries[0]);
+ } else {
+ getAllPropertiesPromise(currentDirectoryPath).then(
+ (fsEntry: TS.FileSystemEntry) =>
+ bgndDialogContext.openBgndDialog(fsEntry),
+ );
+ }
+ }
const menuItems = items
? items
@@ -437,11 +472,13 @@ Do you want to continue?`)
setFolderThumbnail,
copySharingLink,
importMacTags,
- perspectiveSwitch,
+ switchPerspectives ? perspectiveSwitch : undefined,
showProperties,
cameraTakePicture,
openAddRemoveTagsDialog,
openInNewWindow,
+ changeFolderThumbnail,
+ changeFolderBackground,
);
return (
diff --git a/src/renderer/containers/Root.tsx b/src/renderer/containers/Root.tsx
index 5278df902..d50cdb718 100644
--- a/src/renderer/containers/Root.tsx
+++ b/src/renderer/containers/Root.tsx
@@ -106,9 +106,13 @@ export default function Root({ store, persistor }: RootType) {
<Pro.contextProviders.BookmarksContextProvider>
<Pro.contextProviders.HistoryContextProvider>
<Pro.contextProviders.KanBanImportDialogContextProvider>
- <DialogsRoot>
- <MainPage />
- </DialogsRoot>
+ <Pro.contextProviders.ThumbDialogContextProvider>
+ <Pro.contextProviders.BgndDialogContextProvider>
+ <DialogsRoot>
+ <MainPage />
+ </DialogsRoot>
+ </Pro.contextProviders.BgndDialogContextProvider>
+ </Pro.contextProviders.ThumbDialogContextProvider>
</Pro.contextProviders.KanBanImportDialogContextProvider>
</Pro.contextProviders.HistoryContextProvider>
</Pro.contextProviders.BookmarksContextProvider>
diff --git a/src/renderer/perspectives/common/DirectoryMenuItems.tsx b/src/renderer/perspectives/common/DirectoryMenuItems.tsx
index 61da42951..90b4dcedf 100644
--- a/src/renderer/perspectives/common/DirectoryMenuItems.tsx
+++ b/src/renderer/perspectives/common/DirectoryMenuItems.tsx
@@ -2,7 +2,9 @@ import AppConfig from '-/AppConfig';
import {
AddExistingFileIcon,
AudioRecordIcon,
+ ChangeBackgroundIcon,
CopyMoveIcon,
+ CopyPictureIcon,
DeleteIcon,
EntryPropertiesIcon,
HTMLFileIcon,
@@ -59,6 +61,8 @@ export function getDirectoryMenuItems(
cameraTakePicture?: () => void,
showAddRemoveTagsDialog?: () => void,
openInNewWindow?: () => void,
+ changeFolderThumbnail?: () => void,
+ changeFolderBackground?: () => void,
) {
const keyBindings = useSelector(getKeyBindingObject);
const menuItems = [];
@@ -335,28 +339,58 @@ export function getDirectoryMenuItems(
);
}
}
- if (
- Pro &&
- !isReadOnlyMode &&
- perspectiveMode &&
- selectedEntriesLength < 2 &&
- setFolderThumbnail
- ) {
- menuItems.push(
- <MenuItem
- key="setAsThumb"
- data-tid="setAsThumbTID"
- onClick={() => {
- onClose();
- setFolderThumbnail();
- }}
- >
- <ListItemIcon>
- <PictureIcon />
- </ListItemIcon>
- <ListItemText primary={t('core:setAsParentFolderThumbnail')} />
- </MenuItem>,
- );
+ if (Pro && !isReadOnlyMode && selectedEntriesLength < 2) {
+ if (setFolderThumbnail && perspectiveMode) {
+ menuItems.push(
+ <MenuItem
+ key="setAsThumb"
+ data-tid="setAsThumbTID"
+ onClick={() => {
+ onClose();
+ setFolderThumbnail();
+ }}
+ >
+ <ListItemIcon>
+ <CopyPictureIcon />
+ </ListItemIcon>
+ <ListItemText primary={t('core:setAsParentFolderThumbnail')} />
+ </MenuItem>,
+ );
+ }
+ if (changeFolderThumbnail) {
+ menuItems.push(
+ <MenuItem
+ key="changeThumb"
+ data-tid="changeThumbTID"
+ onClick={() => {
+ onClose();
+ changeFolderThumbnail();
+ }}
+ >
+ <ListItemIcon>
+ <PictureIcon />
+ </ListItemIcon>
+ <ListItemText primary={t('core:changeThumbnail')} />
+ </MenuItem>,
+ );
+ }
+ if (changeFolderBackground) {
+ menuItems.push(
+ <MenuItem
+ key="changeBackground"
+ data-tid="changeBackgroundTID"
+ onClick={() => {
+ onClose();
+ changeFolderBackground();
+ }}
+ >
+ <ListItemIcon>
+ <ChangeBackgroundIcon />
+ </ListItemIcon>
+ <ListItemText primary={t('core:changeBackgroundColor')} />
+ </MenuItem>,
+ );
+ }
}
if (selectedEntriesLength === 1 && copySharingLink) {
menuItems.push(
diff --git a/src/renderer/perspectives/grid/components/GridPagination.tsx b/src/renderer/perspectives/grid/components/GridPagination.tsx
index fa33580c6..a900e4fd4 100644
--- a/src/renderer/perspectives/grid/components/GridPagination.tsx
+++ b/src/renderer/perspectives/grid/components/GridPagination.tsx
@@ -20,7 +20,7 @@ import AppConfig from '-/AppConfig';
import EntryIcon from '-/components/EntryIcon';
import TagContainer from '-/components/TagContainer';
import TagsPreview from '-/components/TagsPreview';
-import { default as Tooltip } from '-/components/Tooltip';
+import TooltipTS from '-/components/Tooltip';
import { SelectionArea } from '-/components/drag/SelectionArea';
import SelectionDragLayer from '-/components/drag/SelectionDragLayer';
import LightMdEditor from '-/components/md/LigthMdEditor';
@@ -32,6 +32,7 @@ import { usePaginationContext } from '-/hooks/usePaginationContext';
import { usePerspectiveSettingsContext } from '-/hooks/usePerspectiveSettingsContext';
import CellView from '-/perspectives/common/CellView';
import { useSortedDirContext } from '-/perspectives/grid/hooks/useSortedDirContext';
+import { Pro } from '-/pro';
import { dataTidFormat } from '-/services/test';
import { getDescriptionPreview } from '-/services/utils-io';
import { TS } from '-/tagspaces.namespace';
@@ -43,7 +44,7 @@ import Pagination from '@mui/material/Pagination';
import Typography from '@mui/material/Typography';
import { useTheme } from '@mui/material/styles';
import { extractDirectoryName } from '@tagspaces/tagspaces-common/paths';
-import React, { useEffect, useReducer, useRef } from 'react';
+import React, { useContext, useEffect, useReducer, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import GridCellsContainer from './GridCellsContainer';
@@ -89,10 +90,16 @@ function GridPagination(props: Props) {
gridPageLimit,
} = usePerspectiveSettingsContext();
const { findLocation } = useCurrentLocationContext();
- const { directoryMeta } = useDirectoryContentContext();
+ const { directoryMeta, getAllPropertiesPromise } =
+ useDirectoryContentContext();
const { sortedDirContent } = useSortedDirContext();
const { page, pageFiles, setCurrentPage } = usePaginationContext();
const { openEntry } = useOpenedEntryContext();
+ const thumbDialogContext = Pro?.contextProviders?.ThumbDialogContext
+ ? useContext<TS.ThumbDialogContextData>(
+ Pro.contextProviders.ThumbDialogContext,
+ )
+ : undefined;
const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);
const currentLocation = findLocation();
@@ -262,7 +269,7 @@ function GridPagination(props: Props) {
color: theme.palette.text.primary,
}}
>
- <Tooltip title={t('core:renameDirectory')}>
+ <TooltipTS title={t('core:renameDirectory')}>
<ButtonBase
data-tid={'currentDir_' + dataTidFormat(folderName)}
style={{
@@ -276,7 +283,7 @@ function GridPagination(props: Props) {
>
{folderName}
</ButtonBase>
- </Tooltip>
+ </TooltipTS>
{showTags ? (
<span style={{ paddingLeft: 5 }}>
{directoryMeta?.tags?.map((tag: TS.Tag) => {
@@ -324,21 +331,37 @@ function GridPagination(props: Props) {
</Typography>
)}
</Box>
- <div
- data-tid="folderThumbTID"
- style={{
- borderRadius: 10,
- height: 100,
- width: 140,
- backgroundImage: thumbImage.current,
- backgroundSize: 'cover', // cover contain
- backgroundRepeat: 'no-repeat',
- backgroundPosition: 'center center',
- position: 'absolute',
- top: 0,
- right: 0,
- }}
- />
+ <TooltipTS title={t('core:changeThumbnail')} placement="bottom">
+ <Box
+ sx={{
+ ':hover': {
+ border: '1px dashed gray',
+ },
+ }}
+ data-tid="folderThumbTID"
+ style={{
+ borderRadius: AppConfig.defaultCSSRadius,
+ height: 100,
+ width: 140,
+ backgroundImage: thumbImage.current,
+ backgroundSize: 'cover', // cover contain
+ backgroundRepeat: 'no-repeat',
+ backgroundPosition: 'center center',
+ position: 'absolute',
+ top: 0,
+ right: 0,
+ cursor: 'pointer',
+ }}
+ onClick={() => {
+ if (Pro) {
+ getAllPropertiesPromise(currentDirectoryPath).then(
+ (fsEntry: TS.FileSystemEntry) =>
+ thumbDialogContext.openThumbsDialog(fsEntry),
+ );
+ }
+ }}
+ />
+ </TooltipTS>
</div>
</Grid>
)}
@@ -377,7 +400,7 @@ function GridPagination(props: Props) {
.gridPagination .milkdown .ProseMirror h1 {
margin-top: 10px;
}
- .gridPagination .milkdown {
+ .gridPagination .milkdown {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
@@ -473,7 +496,7 @@ function GridPagination(props: Props) {
)}
</GridCellsContainer>
{showPagination && (
- <Tooltip title={folderSummary}>
+ <TooltipTS title={folderSummary}>
<Pagination
style={{
left: 15,
@@ -490,7 +513,7 @@ function GridPagination(props: Props) {
page={page}
onChange={handleChange}
/>
- </Tooltip>
+ </TooltipTS>
)}
{!showDetails && !showPagination && pageFiles.length > 0 && (
<div style={{ padding: 15, bottom: 10 }}>
diff --git a/src/renderer/tagspaces.namespace.d.ts b/src/renderer/tagspaces.namespace.d.ts
index 760869071..dbc55a58b 100644
--- a/src/renderer/tagspaces.namespace.d.ts
+++ b/src/renderer/tagspaces.namespace.d.ts
@@ -309,6 +309,16 @@ export namespace TS {
closeKanBanImportDialog: () => void;
};
+ type ThumbDialogContextData = {
+ openThumbsDialog: (fsEntry: TS.FileSystemEntry) => void;
+ closeThumbsDialog: () => void;
+ };
+
+ type BgndDialogContextData = {
+ openBgndDialog: (fsEntry: TS.FileSystemEntry) => void;
+ closeBgndDialog: () => void;
+ };
+
interface EditedEntryPath {
action: EditedEntryAction;
path: string;