Skip to content

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

chore: introducing new FileExtBadge component

Ilian Sapundshiev006a8532302b
diff --git a/package-lock.json b/package-lock.json
index 14b733869..37dfb172f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -20,10 +20,10 @@
"@mui/material": "^7.1.2",
"@mui/x-data-grid": "^8.9.1",
"@mui/x-date-pickers": "^8.6.0",
- "@tagspaces/tagspaces-common": "4.5.101",
- "@tagspaces/tagspaces-common-aws3": "4.5.101",
- "@tagspaces/tagspaces-common-cordova": "4.5.101",
- "@tagspaces/tagspaces-indexer": "4.5.101",
+ "@tagspaces/tagspaces-common": "4.5.102",
+ "@tagspaces/tagspaces-common-aws3": "4.5.102",
+ "@tagspaces/tagspaces-common-cordova": "4.5.102",
+ "@tagspaces/tagspaces-indexer": "4.5.102",
"aws-amplify": "^4.3.8",
"coordinate-parser": "1.0.7",
"crypto-js": "4.2.0",
@@ -19123,9 +19123,9 @@
}
},
"node_modules/@tagspaces/tagspaces-common": {
- "version": "4.5.101",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.101.tgz",
- "integrity": "sha512-y/lF2Iv18bMHkVz+W+55ny10H6f/KxgRe4dCfP6MU+MvhQQbmSL1Z4s8/jMiBb10LciSNMld4agYVNtvhCSNdw==",
+ "version": "4.5.102",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.102.tgz",
+ "integrity": "sha512-igkqJ29MJv8ftuNfk8cb73H7xCI2wdNdXPi46G89dKPMbj7YQezKZHnJ68vPYSrJ1cnyqmIorwFIhLVtPM+Tnw==",
"license": "MIT",
"dependencies": {
"dompurify": "^3.2.3",
@@ -19137,25 +19137,25 @@
}
},
"node_modules/@tagspaces/tagspaces-common-aws3": {
- "version": "4.5.101",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-aws3/-/tagspaces-common-aws3-4.5.101.tgz",
- "integrity": "sha512-HznctbH3ybiwaUERyYHoq39ttKsk/Ior8XL4W31QauaEkjKm1aWViuorie4o8iFfJH86+pJ6V+SxR6yWY9glTg==",
+ "version": "4.5.102",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-aws3/-/tagspaces-common-aws3-4.5.102.tgz",
+ "integrity": "sha512-FrhQYikkEIgSKxV+YWmjvcOlSGgUpb/KLAihpr2gVE3TqaS5AafJyqf3J9psoChYGyL+CMAjWxiPBmTyYOqgNg==",
"license": "MIT",
"dependencies": {
"@aws-sdk/client-s3": "^3.665.0",
"@aws-sdk/lib-storage": "^3.665.0",
"@aws-sdk/s3-request-presigner": "^3.665.0",
- "@tagspaces/tagspaces-common": "^4.5.101",
+ "@tagspaces/tagspaces-common": "^4.5.102",
"crypto-js": "^4.2.0"
}
},
"node_modules/@tagspaces/tagspaces-common-cordova": {
- "version": "4.5.101",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-cordova/-/tagspaces-common-cordova-4.5.101.tgz",
- "integrity": "sha512-iAvmTRH0B9UXFaeNW3Z+bKnMP7xaJBJ5wGs0cpz2apwOLTMWFoi8CjF/6eIRuKLpgslEKZJ5h03rvhZa5UCA+A==",
+ "version": "4.5.102",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-cordova/-/tagspaces-common-cordova-4.5.102.tgz",
+ "integrity": "sha512-Y5gfde6ss3/Hyrwo0h5fNwq9ghblsVhhrWRAPfUeLeUtpFw6Xkooha4kScdoKJFPtTC70Vn9nEX9BieeFb7Jng==",
"license": "MIT",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.5.101"
+ "@tagspaces/tagspaces-common": "^4.5.102"
}
},
"node_modules/@tagspaces/tagspaces-common/node_modules/cssstyle": {
@@ -19362,12 +19362,12 @@
}
},
"node_modules/@tagspaces/tagspaces-indexer": {
- "version": "4.5.101",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.5.101.tgz",
- "integrity": "sha512-rS5VaTkdnu7C+ElJ9IFmnTPWJwBMBTzoi0swk5kGbOoX4v0L+z6cCMCQVxFitMupjuCG3z5V4NAHF3YlTyE1Lg==",
+ "version": "4.5.102",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.5.102.tgz",
+ "integrity": "sha512-l9PJyivGyYz4FnSLqSNyMs8KZNcnsRKdX0g60/RugNWEXcnaHL80OJdCRbZJ0oFvjzKabiImUmbVJMSnm5yVoQ==",
"license": "MIT",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.5.101"
+ "@tagspaces/tagspaces-common": "^4.5.102"
}
},
"node_modules/@tagspacespro/tagspacespro": {
diff --git a/release/app/package-lock.json b/release/app/package-lock.json
index b7a699e2d..7d1915960 100644
--- a/release/app/package-lock.json
+++ b/release/app/package-lock.json
@@ -12,8 +12,8 @@
"dependencies": {
"@elife/pm2": "3.6.1",
"@tagspaces/extensions": "1.0.202",
- "@tagspaces/tagspaces-common-node": "4.5.101",
- "@tagspaces/tagspaces-ws": "4.5.101",
+ "@tagspaces/tagspaces-common-node": "4.5.102",
+ "@tagspaces/tagspaces-ws": "4.5.102",
"sharp": "0.32.6",
"ws": "8.18.1"
},
@@ -160,9 +160,9 @@
}
},
"node_modules/@tagspaces/tagspaces-common": {
- "version": "4.5.101",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.101.tgz",
- "integrity": "sha512-y/lF2Iv18bMHkVz+W+55ny10H6f/KxgRe4dCfP6MU+MvhQQbmSL1Z4s8/jMiBb10LciSNMld4agYVNtvhCSNdw==",
+ "version": "4.5.102",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.102.tgz",
+ "integrity": "sha512-igkqJ29MJv8ftuNfk8cb73H7xCI2wdNdXPi46G89dKPMbj7YQezKZHnJ68vPYSrJ1cnyqmIorwFIhLVtPM+Tnw==",
"dependencies": {
"dompurify": "^3.2.3",
"dotenv": "^16.0.2",
@@ -173,22 +173,22 @@
}
},
"node_modules/@tagspaces/tagspaces-common-node": {
- "version": "4.5.101",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.5.101.tgz",
- "integrity": "sha512-QKp6We86MT7LNKE5KZOx1syjesiOtftoVFM24SzPAQtlApkarfpvnvKDw0o7kw6+RdbmcTHld7BDYg/P3s2oQQ==",
+ "version": "4.5.102",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.5.102.tgz",
+ "integrity": "sha512-o6667tLJRbOqfLJKIW1Fv5OhpbWj/GYRLXPLyOSaRNO5g9Y+/RmU145end6uJ0Zi/OZtEgI5TfGLs0moBuf6+w==",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.5.101",
+ "@tagspaces/tagspaces-common": "^4.5.102",
"adm-zip": "0.5.10",
"fs-extra": "^10.0.0",
"klaw": "^4.1.0"
}
},
"node_modules/@tagspaces/tagspaces-indexer": {
- "version": "4.5.101",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.5.101.tgz",
- "integrity": "sha512-rS5VaTkdnu7C+ElJ9IFmnTPWJwBMBTzoi0swk5kGbOoX4v0L+z6cCMCQVxFitMupjuCG3z5V4NAHF3YlTyE1Lg==",
+ "version": "4.5.102",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.5.102.tgz",
+ "integrity": "sha512-l9PJyivGyYz4FnSLqSNyMs8KZNcnsRKdX0g60/RugNWEXcnaHL80OJdCRbZJ0oFvjzKabiImUmbVJMSnm5yVoQ==",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.5.101"
+ "@tagspaces/tagspaces-common": "^4.5.102"
}
},
"node_modules/@tagspaces/tagspaces-pdf-extraction": {
@@ -209,25 +209,25 @@
}
},
"node_modules/@tagspaces/tagspaces-workers": {
- "version": "4.5.101",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.5.101.tgz",
- "integrity": "sha512-lSdH8cWqNR0PlobwQI1OH7UHPqAblAEzGsp+IQgi2Kjbb+3kJacETi1PCSfbq0+QSBUaRViuFrO0P1AJUNTfTw==",
+ "version": "4.5.102",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.5.102.tgz",
+ "integrity": "sha512-kyeQ+mJb5Y12xKSsE0SpUJGmbNGHh+Ze8DF/XHCd/B6KHvvvonLJNQ1+NYgsX/sjSisolSu43o4xZ4ukMfBJgg==",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.5.101",
- "@tagspaces/tagspaces-common-node": "^4.5.101",
+ "@tagspaces/tagspaces-common": "^4.5.102",
+ "@tagspaces/tagspaces-common-node": "^4.5.102",
"@tagspaces/tagspaces-pdf-extraction": "^4.5.53",
"@tagspaces/tagspaces-thumbgen-image": "^4.5.60",
"fswin": "^3.24.829"
}
},
"node_modules/@tagspaces/tagspaces-ws": {
- "version": "4.5.101",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.5.101.tgz",
- "integrity": "sha512-X08mhQvQ6qQ52oD30Z7+mzecrx54vshzERB7+JepYfLSg1hqGmswKNz2dyUlEtDxWxeRGbn9kGF19IbxHj5aZA==",
+ "version": "4.5.102",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.5.102.tgz",
+ "integrity": "sha512-IJ5BXMFENjSep697BBOgK5qohY5OQcmA/EMiL3iNPbM2YawfBC9KEEtXetHd8mIKsvwy3RXARUpiDtvplDcFrg==",
"dependencies": {
- "@tagspaces/tagspaces-indexer": "^4.5.101",
+ "@tagspaces/tagspaces-indexer": "^4.5.102",
"@tagspaces/tagspaces-pdf-extraction": "^4.5.53",
- "@tagspaces/tagspaces-workers": "^4.5.101",
+ "@tagspaces/tagspaces-workers": "^4.5.102",
"find-free-ports": "^3.1.1",
"jsonwebtoken": "^9.0.2",
"ws": "^8.18.3"
@@ -1891,9 +1891,9 @@
}
},
"@tagspaces/tagspaces-common": {
- "version": "4.5.101",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.101.tgz",
- "integrity": "sha512-y/lF2Iv18bMHkVz+W+55ny10H6f/KxgRe4dCfP6MU+MvhQQbmSL1Z4s8/jMiBb10LciSNMld4agYVNtvhCSNdw==",
+ "version": "4.5.102",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.102.tgz",
+ "integrity": "sha512-igkqJ29MJv8ftuNfk8cb73H7xCI2wdNdXPi46G89dKPMbj7YQezKZHnJ68vPYSrJ1cnyqmIorwFIhLVtPM+Tnw==",
"requires": {
"dompurify": "^3.2.3",
"dotenv": "^16.0.2",
@@ -1904,22 +1904,22 @@
}
},
"@tagspaces/tagspaces-common-node": {
- "version": "4.5.101",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.5.101.tgz",
- "integrity": "sha512-QKp6We86MT7LNKE5KZOx1syjesiOtftoVFM24SzPAQtlApkarfpvnvKDw0o7kw6+RdbmcTHld7BDYg/P3s2oQQ==",
+ "version": "4.5.102",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.5.102.tgz",
+ "integrity": "sha512-o6667tLJRbOqfLJKIW1Fv5OhpbWj/GYRLXPLyOSaRNO5g9Y+/RmU145end6uJ0Zi/OZtEgI5TfGLs0moBuf6+w==",
"requires": {
- "@tagspaces/tagspaces-common": "^4.5.101",
+ "@tagspaces/tagspaces-common": "^4.5.102",
"adm-zip": "0.5.10",
"fs-extra": "^10.0.0",
"klaw": "^4.1.0"
}
},
"@tagspaces/tagspaces-indexer": {
- "version": "4.5.101",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.5.101.tgz",
- "integrity": "sha512-rS5VaTkdnu7C+ElJ9IFmnTPWJwBMBTzoi0swk5kGbOoX4v0L+z6cCMCQVxFitMupjuCG3z5V4NAHF3YlTyE1Lg==",
+ "version": "4.5.102",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.5.102.tgz",
+ "integrity": "sha512-l9PJyivGyYz4FnSLqSNyMs8KZNcnsRKdX0g60/RugNWEXcnaHL80OJdCRbZJ0oFvjzKabiImUmbVJMSnm5yVoQ==",
"requires": {
- "@tagspaces/tagspaces-common": "^4.5.101"
+ "@tagspaces/tagspaces-common": "^4.5.102"
}
},
"@tagspaces/tagspaces-pdf-extraction": {
@@ -1940,25 +1940,25 @@
}
},
"@tagspaces/tagspaces-workers": {
- "version": "4.5.101",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.5.101.tgz",
- "integrity": "sha512-lSdH8cWqNR0PlobwQI1OH7UHPqAblAEzGsp+IQgi2Kjbb+3kJacETi1PCSfbq0+QSBUaRViuFrO0P1AJUNTfTw==",
+ "version": "4.5.102",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.5.102.tgz",
+ "integrity": "sha512-kyeQ+mJb5Y12xKSsE0SpUJGmbNGHh+Ze8DF/XHCd/B6KHvvvonLJNQ1+NYgsX/sjSisolSu43o4xZ4ukMfBJgg==",
"requires": {
- "@tagspaces/tagspaces-common": "^4.5.101",
- "@tagspaces/tagspaces-common-node": "^4.5.101",
+ "@tagspaces/tagspaces-common": "^4.5.102",
+ "@tagspaces/tagspaces-common-node": "^4.5.102",
"@tagspaces/tagspaces-pdf-extraction": "^4.5.53",
"@tagspaces/tagspaces-thumbgen-image": "^4.5.60",
"fswin": "^3.24.829"
}
},
"@tagspaces/tagspaces-ws": {
- "version": "4.5.101",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.5.101.tgz",
- "integrity": "sha512-X08mhQvQ6qQ52oD30Z7+mzecrx54vshzERB7+JepYfLSg1hqGmswKNz2dyUlEtDxWxeRGbn9kGF19IbxHj5aZA==",
+ "version": "4.5.102",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.5.102.tgz",
+ "integrity": "sha512-IJ5BXMFENjSep697BBOgK5qohY5OQcmA/EMiL3iNPbM2YawfBC9KEEtXetHd8mIKsvwy3RXARUpiDtvplDcFrg==",
"requires": {
- "@tagspaces/tagspaces-indexer": "^4.5.101",
+ "@tagspaces/tagspaces-indexer": "^4.5.102",
"@tagspaces/tagspaces-pdf-extraction": "^4.5.53",
- "@tagspaces/tagspaces-workers": "^4.5.101",
+ "@tagspaces/tagspaces-workers": "^4.5.102",
"find-free-ports": "^3.1.1",
"jsonwebtoken": "^9.0.2",
"ws": "^8.18.3"
diff --git a/src/renderer/components/EntryContainerTitle.tsx b/src/renderer/components/EntryContainerTitle.tsx
index c118bb407..d7c7f5e06 100644
--- a/src/renderer/components/EntryContainerTitle.tsx
+++ b/src/renderer/components/EntryContainerTitle.tsx
@@ -26,6 +26,7 @@ import {
MoreMenuIcon,
} from '-/components/CommonIcons';
import EntryContainerMenu from '-/components/EntryContainerMenu';
+import FileExtBadge from '-/components/FileExtBadge';
import { ProTooltip } from '-/components/HelperComponents';
import TagsPreview from '-/components/TagsPreview';
import Tooltip from '-/components/Tooltip';
@@ -39,7 +40,7 @@ import { dataTidFormat } from '-/services/test';
import { findColorForEntry, getAllTags } from '-/services/utils-io';
import { TS } from '-/tagspaces.namespace';
import Box from '@mui/material/Box';
-import { styled, useTheme } from '@mui/material/styles';
+import { useTheme } from '@mui/material/styles';
import {
extractDirectoryName,
extractFileExtension,
@@ -50,16 +51,6 @@ import React, { useContext, useReducer } from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
-const FileBadge = styled('span')(({ theme }) => ({
- color: 'white',
- backgroundColor: AppConfig.defaultFileColor,
- padding: 3,
- textShadow: '1px 1px #8f8f8f',
- fontSize: 13,
- marginLeft: 3,
- borderRadius: 3,
-}));
-
interface Props {
reloadDocument: () => void;
startClosingEntry: (event) => void;
@@ -195,7 +186,7 @@ function EntryContainerTitle(props: Props) {
) : (
''
)}
- <FileBadge
+ <FileExtBadge
title={t('core:toggleEntryProperties')}
data-tid="propsActionsMenuTID"
aria-controls={Boolean(anchorEl) ? 'basic-menu' : undefined}
@@ -207,9 +198,6 @@ function EntryContainerTitle(props: Props) {
style={
{
backgroundColor: fileSystemEntryColor,
- display: 'flex',
- alignItems: 'center',
- textTransform: 'uppercase',
paddingLeft: 10,
WebkitAppRegion: 'no-drag',
} as React.CSSProperties & { WebkitAppRegion?: string }
@@ -223,10 +211,10 @@ function EntryContainerTitle(props: Props) {
)
}
<MoreMenuIcon sx={{ fontSize: '20px' }} />
- </FileBadge>
+ </FileExtBadge>
</>
) : (
- <FileBadge
+ <FileExtBadge
title={t('core:toggleEntryProperties')}
data-tid="propsActionsMenuTID"
aria-controls={Boolean(anchorEl) ? 'basic-menu' : undefined}
@@ -238,8 +226,6 @@ function EntryContainerTitle(props: Props) {
style={
{
backgroundColor: AppConfig.defaultFolderColor,
- display: 'flex',
- alignItems: 'center',
paddingLeft: 10,
WebkitAppRegion: 'no-drag',
} as React.CSSProperties & { WebkitAppRegion?: string }
@@ -247,7 +233,7 @@ function EntryContainerTitle(props: Props) {
>
<FolderIcon sx={{ fontSize: '20px' }} />
<MoreMenuIcon sx={{ fontSize: '20px' }} />
- </FileBadge>
+ </FileExtBadge>
)}
<Tooltip title={openedEntry.isFile && fileName}>
<Box
diff --git a/src/renderer/components/FileExtBadge.tsx b/src/renderer/components/FileExtBadge.tsx
new file mode 100644
index 000000000..1625a80ea
--- /dev/null
+++ b/src/renderer/components/FileExtBadge.tsx
@@ -0,0 +1,38 @@
+/**
+ * TagSpaces - universal file and folder organizer
+ * Copyright (C) 2025-present TagSpaces GmbH
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License (version 3) as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+import AppConfig from '-/AppConfig';
+import { Typography } from '@mui/material';
+import { styled } from '@mui/material/styles';
+
+const FileExtBadge = styled(Typography)(({ theme }) => ({
+ fontSize: '12px',
+ minWidth: 40,
+ color: 'white',
+ borderRadius: AppConfig.defaultCSSRadius,
+ textAlign: 'center',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ textShadow: '1px 1px #8f8f8f',
+ height: 28,
+ alignSelf: 'center',
+ textTransform: 'uppercase',
+}));
+
+export default FileExtBadge;
diff --git a/src/renderer/perspectives/grid/components/GridCell.tsx b/src/renderer/perspectives/grid/components/GridCell.tsx
index 12bc33186..f1c130c8e 100644
--- a/src/renderer/perspectives/grid/components/GridCell.tsx
+++ b/src/renderer/perspectives/grid/components/GridCell.tsx
@@ -17,13 +17,6 @@
*/
import AppConfig from '-/AppConfig';
-import {
- extractTagsAsObjects,
- extractTitle,
- getThumbFileLocationForFile,
- cleanTrailingDirSeparator,
- cleanFrontDirSeparator,
-} from '@tagspaces/tagspaces-common/paths';
import {
FolderOutlineIcon,
MoreMenuIcon,
@@ -31,6 +24,7 @@ import {
UnSelectedIcon,
} from '-/components/CommonIcons';
import EntryIcon from '-/components/EntryIcon';
+import FileExtBadge from '-/components/FileExtBadge';
import TagContainer from '-/components/TagContainer';
import TagContainerDnd from '-/components/TagContainerDnd';
import TagsPreview from '-/components/TagsPreview';
@@ -67,6 +61,13 @@ import {
formatDateTime,
formatFileSize,
} from '@tagspaces/tagspaces-common/misc';
+import {
+ cleanFrontDirSeparator,
+ cleanTrailingDirSeparator,
+ extractTagsAsObjects,
+ extractTitle,
+ getThumbFileLocationForFile,
+} from '@tagspaces/tagspaces-common/paths';
import { useEffect, useReducer, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
@@ -344,52 +345,39 @@ function GridCell(props: Props) {
};
function generateExtension() {
- return selectionMode ? (
- <TsIconButton
- style={{
- minWidth: 35,
- }}
- size="small"
- onClick={(e) => {
- e.stopPropagation();
- if (selected) {
- selectEntry(fsEntry, false);
- } else {
- selectEntry(fsEntry);
- }
- }}
- >
- {selected ? <SelectedIcon /> : <UnSelectedIcon />}
- </TsIconButton>
- ) : (
- <Tooltip title={i18n.t('clickToSelect') + ' ' + fsEntry.path}>
- <Typography
+ return (
+ <Tooltip title={i18n.t('clickToSelect') + ': ' + fsEntry.name}>
+ <FileExtBadge
style={{
- paddingTop: 1,
- paddingBottom: 9,
- paddingLeft: 3,
- paddingRight: 3,
- fontSize: 13,
- minWidth: 35,
- color: 'white',
- borderRadius: 5,
- textAlign: 'center',
- display: 'inline',
backgroundColor: fileSystemEntryColor,
- textShadow: '1px 1px #8f8f8f',
- textOverflow: 'unset',
- height: 15,
- maxWidth: fsEntry.isFile ? 50 : 100,
}}
noWrap={true}
variant="button"
onClick={(e) => {
e.stopPropagation();
- selectEntry(fsEntry);
+ if (selectionMode) {
+ if (selected) {
+ selectEntry(fsEntry, false);
+ } else {
+ selectEntry(fsEntry);
+ }
+ } else {
+ selectEntry(fsEntry);
+ }
}}
>
- {fsEntry.isFile ? fsEntry.extension : <FolderOutlineIcon />}
- </Typography>
+ {selectionMode ? (
+ selected ? (
+ <SelectedIcon />
+ ) : (
+ <UnSelectedIcon />
+ )
+ ) : fsEntry.isFile ? (
+ fsEntry.extension
+ ) : (
+ <FolderOutlineIcon />
+ )}
+ </FileExtBadge>
</Tooltip>
);
}
diff --git a/src/renderer/perspectives/list/components/RowCell.tsx b/src/renderer/perspectives/list/components/RowCell.tsx
index 8a0a45105..be22dfcba 100644
--- a/src/renderer/perspectives/list/components/RowCell.tsx
+++ b/src/renderer/perspectives/list/components/RowCell.tsx
@@ -23,6 +23,7 @@ import {
SelectedIcon,
UnSelectedIcon,
} from '-/components/CommonIcons';
+import FileExtBadge from '-/components/FileExtBadge';
import TagContainer from '-/components/TagContainer';
import TagContainerDnd from '-/components/TagContainerDnd';
import TagsPreview from '-/components/TagsPreview';
@@ -231,58 +232,6 @@ function RowCell(props: Props) {
});
}, [entryTags, currentLocation?.isReadOnly, reorderTags, entryPath]);
- function generateExtension() {
- return selectionMode ? (
- <TsIconButton
- style={{
- width: 40,
- height: 35,
- alignSelf: 'center',
- }}
- onClick={(e) => {
- e.stopPropagation();
- if (selected) {
- selectEntry(fsEntry, false);
- } else {
- selectEntry(fsEntry);
- }
- }}
- >
- {selected ? <SelectedIcon /> : <UnSelectedIcon />}
- </TsIconButton>
- ) : (
- <Tooltip title={i18n.t('clickToSelect') + ' ' + fsEntry.path}>
- <Typography
- style={{
- paddingTop: 1,
- paddingBottom: 9,
- paddingLeft: 3,
- paddingRight: 3,
- fontSize: 13,
- minWidth: 40,
- color: 'white',
- borderRadius: 3,
- textAlign: 'center',
- display: 'inline',
- backgroundColor: fileSystemEntryColor,
- textShadow: '1px 1px #8f8f8f',
- textOverflow: 'unset',
- height: 15,
- alignSelf: 'center',
- }}
- noWrap={true}
- variant="button"
- onClick={(e) => {
- e.stopPropagation();
- selectEntry(fsEntry);
- }}
- >
- {fsEntry.isFile ? fsEntry.extension : <FolderOutlineIcon />}
- </Typography>
- </Tooltip>
- );
- }
-
const entryHeight = calculateEntryHeight(entrySize);
const isSmall = entrySize === 'tiny'; // || entrySize === 'small';
@@ -348,7 +297,39 @@ function RowCell(props: Props) {
alignSelf: 'center',
}}
>
- {generateExtension()}
+ <Tooltip title={i18n.t('clickToSelect') + ': ' + fsEntry.name}>
+ <FileExtBadge
+ style={{
+ backgroundColor: fileSystemEntryColor,
+ }}
+ noWrap={true}
+ variant="button"
+ onClick={(e) => {
+ e.stopPropagation();
+ if (selectionMode) {
+ if (selected) {
+ selectEntry(fsEntry, false);
+ } else {
+ selectEntry(fsEntry);
+ }
+ } else {
+ selectEntry(fsEntry);
+ }
+ }}
+ >
+ {selectionMode ? (
+ selected ? (
+ <SelectedIcon />
+ ) : (
+ <UnSelectedIcon />
+ )
+ ) : fsEntry.isFile ? (
+ fsEntry.extension
+ ) : (
+ <FolderOutlineIcon />
+ )}
+ </FileExtBadge>
+ </Tooltip>
</Grid>
{isSmall ? (
<Grid
@@ -382,7 +363,7 @@ function RowCell(props: Props) {
<Grid sx={{ alignSelf: 'center', width: '100%', marginLeft: 5 }}>
<Typography
variant="body1"
- title={fsEntry.name}
+ title={fsEntry.path}
sx={{ wordBreak: 'break-all' }}
>
{entryTitle}