TagSpaces is an offline, open source, document manager with tagging support
improving show hide tags feature
Ilian Sapundshiev412d8316013d
diff --git a/app/locales/en/core.json b/app/locales/en/core.jsonindex 1d26e0ccb..0d0462be0 100644--- a/app/locales/en/core.json+++ b/app/locales/en/core.json@@ -326,7 +326,7 @@"tagSelectedEntries": "Tag selected entries","copyMoveSelectedEntries": "Copy or move selected entries","deleteSelectedEntries": "Delete selected entries",- "showHideDirectories": "Show directories",+ "showHideDirectories": "Show folders","showTags": "Show tags","sort": "Sort","thirdPartyLibs": "Third Party Libraries",diff --git a/app/perspectives/grid-perspective/components/CellContent.js b/app/perspectives/grid-perspective/components/CellContent.jsindex 6499fee8d..8cdac8f9a 100644--- a/app/perspectives/grid-perspective/components/CellContent.js+++ b/app/perspectives/grid-perspective/components/CellContent.js@@ -24,6 +24,7 @@ import removeMd from 'remove-markdown';import classNames from 'classnames';import Grid from '@material-ui/core/Grid';import Typography from '@material-ui/core/Typography';+import IconButton from '@material-ui/core/IconButton';import Paper from '@material-ui/core/Paper';import FolderIcon from '@material-ui/icons/FolderOpen';import TagIcon from '@material-ui/icons/LocalOffer';@@ -50,6 +51,7 @@ type Props = {supportedFileTypes: Array<Object>,thumbnailMode: any,addTags: () => void,+ openFile: (path: string, isFile: boolean) => void,selectedEntries: Array<Object>,isReadOnlyMode: boolean,showTags: boolean,@@ -77,7 +79,8 @@ const CellContent = (props: Props) => {handleGridContextMenu,handleGridCellDblClick,handleGridCellClick,- showTags+ showTags,+ openFile} = props;const fsEntryBackgroundColor = fsEntry.color ? fsEntry.color : 'transparent';@@ -92,19 +95,28 @@ const CellContent = (props: Props) => {supportedFileTypes);- let thumbPathUrl = fsEntry.thumbPath- ? 'url("' + fsEntry.thumbPath + '")'- : '';- if (AppConfig.isWin) {- thumbPathUrl = thumbPathUrl.split('\\').join('\\\\');- }+ // let thumbPathUrl = fsEntry.thumbPath+ // ? 'url("' + fsEntry.thumbPath + '")'+ // : '';+ // if (AppConfig.isWin) {+ // thumbPathUrl = thumbPathUrl.split('\\').join('\\\\');+ // }let tagTitles = '';fsEntry.tags.map(tag => {tagTitles += tag.title + ', ';+ return true;});+ tagTitles = tagTitles.substring(0, tagTitles.length - 2);const tagPlaceholder =- tagTitles.length > 0 ? <TagIcon title={tagTitles} /> : null;+ tagTitles.length > 0 ? (+ <IconButton+ title={tagTitles}+ onClick={() => openFile(fsEntry.path, fsEntry.isFile)}+ >+ <TagIcon />+ </IconButton>+ ) : null;function renderGridCell() {return (@@ -130,7 +142,6 @@ const CellContent = (props: Props) => {style={{objectFit: thumbnailMode,position: 'absolute',- margin: 1,width: '100%',height: 150}}@@ -250,8 +261,13 @@ const CellContent = (props: Props) => {<Grid item xs zeroMinWidth><Typography style={{ wordBreak: 'break-all' }}>{extractTitle(fsEntry.name, !fsEntry.isFile)}+ {entrySize === 'small' && tagPlaceholder}</Typography>- {fsEntry.tags.map(tag => renderTag(tag))}+ {entrySize !== 'small'+ ? showTags+ ? fsEntry.tags.map(tag => renderTag(tag))+ : tagPlaceholder+ : null}{entrySize !== 'small' && (<Typographystyle={{@@ -292,7 +308,6 @@ const CellContent = (props: Props) => {loading="lazy"style={{objectFit: thumbnailMode,- margin: 1,height: tmbSize,width: tmbSize}}diff --git a/app/perspectives/grid-perspective/components/styles.css.js b/app/perspectives/grid-perspective/components/styles.css.jsindex 48539c231..0a3c6e9a5 100644--- a/app/perspectives/grid-perspective/components/styles.css.js+++ b/app/perspectives/grid-perspective/components/styles.css.js@@ -18,13 +18,13 @@*/import AppConfig from '../../../config';-export default (theme) => ({+export default theme => ({gridContainer: {display: 'grid',gridGap: '2px 2px',padding: 2,paddingRight: 10,- paddingBottom: 200,+ paddingBottom: 200},rowContainer: {display: 'grid',@@ -32,14 +32,14 @@ export default (theme) => ({padding: 0,paddingRight: 10,margin: 0,- paddingBottom: 200,+ paddingBottom: 200},gridCell: {// backgroundColor: theme.palette.background.paper,border: '2px solid transparent',margin: 2,marginBottom: 3,- marginRight: 3,+ marginRight: 3// maxWidth: 500},rowCell: {@@ -51,7 +51,7 @@ export default (theme) => ({borderBottom: '1px solid ' + theme.palette.divider,margin: 0,marginTop: 0,- marginBottom: 0,+ marginBottom: 0},selectedGridCell: {border: '2px solid' + theme.palette.primary.main,@@ -72,7 +72,6 @@ export default (theme) => ({},gridCellTags: {padding: 0,- paddingTop: 5,zIndex: 100,maxHeight: 100,overflowY: 'auto',@@ -90,11 +89,11 @@ export default (theme) => ({gridFileExtension: {flex: 1,padding: 5,+ lineHeight: '20px',marginRight: 5,maxWidth: 50,minWidth: 40,- minHeight: 16,- borderWidth: 1,+ height: 20,color: 'white',// color: theme.palette.getContrastText(),textAlign: 'center'@@ -133,13 +132,13 @@ export default (theme) => ({marginRight: 5,marginTop: 5,minHeight: 10,- height: 20,+ height: 20},gridFolder: {color: 'white',padding: 5,minHeight: 15,- height: 20,+ height: 20},topToolbar: {paddingLeft: 5,