TagSpaces is an offline, open source, document manager with tagging support
chore: updating design row and grid cells
Ilian Sapundshiev259d6c3dfb6b
diff --git a/src/renderer/components/CommonIcons.tsx b/src/renderer/components/CommonIcons.tsxindex 36673ef78..6dfcc26ca 100644--- a/src/renderer/components/CommonIcons.tsx+++ b/src/renderer/components/CommonIcons.tsx@@ -28,7 +28,9 @@ export const NavigateToFolderIcon = (props) => <KeyboardReturnIcon />;export { default as InfoTooltipIcon } from '@mui/icons-material/InfoOutlined';-export { default as FolderIcon } from '@mui/icons-material/Folder'; // FolderOpen+export { default as FolderIcon } from '@mui/icons-material/Folder';++export { default as FolderOutlineIcon } from '@mui/icons-material/FolderOpen';export { default as FileIcon } from '@mui/icons-material/InsertDriveFile';diff --git a/src/renderer/perspectives/grid-perspective/components/GridCell.tsx b/src/renderer/perspectives/grid-perspective/components/GridCell.tsxindex 15543be08..30557a25e 100644--- a/src/renderer/perspectives/grid-perspective/components/GridCell.tsx+++ b/src/renderer/perspectives/grid-perspective/components/GridCell.tsx@@ -30,7 +30,7 @@ import CardMedia from '@mui/material/CardMedia';import CardContent from '@mui/material/CardContent';import CardActions from '@mui/material/CardActions';import Tooltip from '-/components/Tooltip';-import FolderOpenIcon from '@mui/icons-material/FolderOpen';+import { FolderOutlineIcon } from '-/components/CommonIcons';import IconButton from '@mui/material/IconButton';import {SelectedIcon,@@ -281,7 +281,7 @@ function GridCell(props: Props) {);}- function generateAvatar() {+ function generateExtension() {return selectionMode ? (<IconButtonstyle={{@@ -290,14 +290,14 @@ function GridCell(props: Props) {paddingBottom: 2,}}size="small"- onMouseLeave={(e) => {- //@ts-ignore- e.target.style.opacity = selected ? 1 : 0.5;- }}- onMouseOver={(e) => {- //@ts-ignore- e.target.style.opacity = 1;- }}+ // onMouseLeave={(e) => {+ // //@ts-ignore+ // e.target.style.opacity = selected ? 1 : 0.5;+ // }}+ // onMouseOver={(e) => {+ // //@ts-ignore+ // e.target.style.opacity = 1;+ // }}onClick={(e) => {e.stopPropagation();if (selected) {@@ -310,17 +310,15 @@ function GridCell(props: Props) {{selected ? (<SelectedIconstyle={{- opacity: 1,borderRadius: 15,- backgroundColor: '#d7d7d7',+ // backgroundColor: '#d7d7d7',}}/>) : (<UnSelectedIconstyle={{- opacity: 0.7,borderRadius: 15,- backgroundColor: 'd7d7d7',+ // backgroundColor: 'd7d7d7',}}/>)}@@ -352,7 +350,7 @@ function GridCell(props: Props) {selectEntry(fSystemEntry);}}>- {fSystemEntry.isFile ? fSystemEntry.extension : <FolderOpenIcon />}+ {fSystemEntry.isFile ? fSystemEntry.extension : <FolderOutlineIcon />}</Typography></Tooltip>);@@ -377,7 +375,6 @@ function GridCell(props: Props) {minHeight: maxHeight,maxHeight: maxHeight,marginBottom: isLast ? 40 : 'auto',- background: fileSystemEntryBgColor && theme.palette.background.default,border:'2px solid ' +(selected ? theme.palette.primary.main : 'transparent'),@@ -398,7 +395,13 @@ function GridCell(props: Props) {handleGridCellClick(event, fSystemEntry);}}>- <Box style={{ height: maxHeight - 70, position: 'relative' }}>+ <Box+ style={{+ height: maxHeight - 70,+ position: 'relative',+ backgroundColor: fileSystemEntryBgColor || 'transparent',+ }}+ ><Box style={{ position: 'absolute' }}>{showTags && entryTags ? (renderTags@@ -415,10 +418,18 @@ function GridCell(props: Props) {alt="green iguana"height="auto"src={tmbImgSrc}- style={{ height: maxHeight - 70 }}+ style={{+ height: maxHeight - 70,+ }}/>) : (- <Box style={{ width: '50%', height: 'auto', margin: '0 auto' }}>+ <Box+ style={{+ width: '50%',+ height: 'auto',+ margin: '0 auto',+ }}+ ><EntryIconisFile={fSystemEntry.isFile}fileExtension={fSystemEntry.extension}@@ -427,30 +438,33 @@ function GridCell(props: Props) {)}</Box>- <CardContent sx={{ padding: '5px', flexGrow: 1 }}>- <Tooltip title={entryTitle}>- <Typography- style={{- paddingRight: 4,- overflowX: 'clip',- textWrap: 'nowrap', // isSmall ? 'nowrap' : 'unset',- // display: '-webkit-box',- // WebkitLineClamp: 2,- // WebkitBoxOrient: 'vertical',- // textOverflow: 'ellipsis',- // overflow: 'hidden',- }}- >- {entryTitle}- </Typography>- </Tooltip>+ <CardContent sx={{ padding: '1px 5px 0px 5px', flexGrow: 1 }}><Typography+ title={fSystemEntry.name}+ style={{+ paddingRight: 4,+ overflowX: 'clip',+ textWrap: 'nowrap', // isSmall ? 'nowrap' : 'unset',+ // display: '-webkit-box',+ // WebkitLineClamp: 2,+ // WebkitBoxOrient: 'vertical',+ // textOverflow: 'ellipsis',+ // overflow: 'hidden',+ }}+ >+ {entryTitle}+ </Typography>+ <Typography+ title={description}+ variant="caption"+ display="block"+ gutterBottomstyle={{- fontSize: 12,lineHeight: '12px',paddingRight: 4,overflowX: 'clip',textWrap: 'nowrap',+ color: 'gray',// wordBreak: 'break-word',}}>@@ -480,7 +494,7 @@ function GridCell(props: Props) {</IconButton>}subheader={generateCardHeader()}- avatar={generateAvatar()}+ avatar={generateExtension()}></CardHeader></Card>);diff --git a/src/renderer/perspectives/list/components/MainContainer.tsx b/src/renderer/perspectives/list/components/MainContainer.tsxindex f6e24c83d..52bdc4a36 100644--- a/src/renderer/perspectives/list/components/MainContainer.tsx+++ b/src/renderer/perspectives/list/components/MainContainer.tsx@@ -586,6 +586,9 @@ function ListPerspective(props: Props) {);handleSetSelectedEntries(newSelection);};++ const selectionMode = selectedEntries.length > 0;+return (<TagDropContainerentryPath={fsEntry.path} // TODO remove entryPath it is already included in selectedEntries@@ -599,6 +602,7 @@ function ListPerspective(props: Props) {showEntriesDescription={showEntriesDescription.current}entrySize={entrySize.current}isLast={isLast}+ selectionMode={selectionMode}thumbnailMode={thumbnailMode.current}selectEntry={selectEntry}deselectEntry={deselectEntry}diff --git a/src/renderer/perspectives/list/components/RowCell.tsx b/src/renderer/perspectives/list/components/RowCell.tsxindex 0d324d3d5..2bcfd7ced 100644--- a/src/renderer/perspectives/list/components/RowCell.tsx+++ b/src/renderer/perspectives/list/components/RowCell.tsx@@ -24,7 +24,12 @@ import Grid from '@mui/material/Grid';import Typography from '@mui/material/Typography';import Paper from '@mui/material/Paper';import Tooltip from '-/components/Tooltip';-import { SelectedIcon, UnSelectedIcon } from '-/components/CommonIcons';+import IconButton from '@mui/material/IconButton';+import {+ SelectedIcon,+ UnSelectedIcon,+ FolderOutlineIcon,+} from '-/components/CommonIcons';import {formatFileSize,formatDateTime,@@ -49,7 +54,6 @@ import {AppDispatch,getLastThumbnailImageChange,} from '-/reducers/app';-import { FolderIcon } from '-/components/CommonIcons';import { EntrySizes } from '-/components/ZoomComponent';import { getSupportedFileTypes, isReorderTags } from '-/reducers/settings';import { defaultSettings } from '../index';@@ -95,7 +99,7 @@ interface Props {thumbnailMode: any;selectEntry: (fsEntry: TS.FileSystemEntry) => void;deselectEntry: (fsEntry: TS.FileSystemEntry) => void;- // selectionMode: boolean;+ selectionMode: boolean;showTags: boolean;handleTagMenu: (event: Object, tag: TS.Tag, entryPath: string) => void;handleGridContextMenu: (event: Object, fsEntry: TS.FileSystemEntry) => void;@@ -134,6 +138,7 @@ function RowCell(props: Props) {showTags,selectEntry,deselectEntry,+ selectionMode,isLast,} = props;@@ -270,6 +275,129 @@ function RowCell(props: Props) {});}, [entryTags, readOnlyMode, reorderTags, entryPath]);+ function generateExtension() {+ // <div+ // data-tid="rowCellTID"+ // style={{+ // display: 'flex',+ // flexDirection: isSmall ? 'row' : 'column',+ // flex: 1,+ // padding: 4,+ // borderWidth: 1,+ // color: 'white',+ // textTransform: 'uppercase',+ // fontSize: 12,+ // fontWeight: 'bold',+ // borderRadius: 4,+ // textAlign: 'center',+ // overflow: 'hidden',+ // textOverflow: 'ellipsis',+ // backgroundColor: fileSystemEntryColor,+ // alignItems: 'center',+ // }}+ // role="button"+ // onClick={(e) => {+ // e.stopPropagation();+ // if (selected) {+ // deselectEntry(fSystemEntry);+ // } else {+ // selectEntry(fSystemEntry);+ // }+ // }}+ // >+ // {selected ? <SelectedIcon /> : <UnSelectedIcon />}+ // {fSystemEntry.isFile ? (+ // <span+ // style={{+ // width: '100%',+ // marginTop: isSmall ? 0 : 10,+ // textShadow: '1px 1px #8f8f8f',+ // overflowWrap: 'anywhere',+ // }}+ // >+ // {fSystemEntry.extension}+ // </span>+ // ) : (+ // <FolderOutlineIcon style={{ margin: '0 auto' }} />+ // )}+ // </div>++ return selectionMode ? (+ <IconButton+ style={{+ minWidth: 35,+ height: 40,+ padding: 4,+ paddingBottom: 2,+ }}+ size="small"+ // onMouseLeave={(e) => {+ // //@ts-ignore+ // e.target.style.opacity = selected ? 1 : 0.5;+ // }}+ // onMouseOver={(e) => {+ // //@ts-ignore+ // e.target.style.opacity = 1;+ // }}+ onClick={(e) => {+ e.stopPropagation();+ if (selected) {+ deselectEntry(fSystemEntry);+ } else {+ selectEntry(fSystemEntry);+ }+ }}+ >+ {selected ? (+ <SelectedIcon+ style={{+ borderRadius: 15,+ backgroundColor: '#d7d7d7',+ }}+ />+ ) : (+ <UnSelectedIcon+ style={{+ borderRadius: 15,+ backgroundColor: 'd7d7d7',+ }}+ />+ )}+ </IconButton>+ ) : (+ <Tooltip title={fSystemEntry.path}>+ <Typography+ style={{+ paddingTop: 1,+ paddingBottom: 9,+ paddingLeft: 3,+ paddingRight: 3,+ fontSize: 13,+ minWidth: 35,+ color: 'white',+ borderRadius: 3,+ textAlign: 'center',+ display: 'inline',+ backgroundColor: fileSystemEntryColor,+ textShadow: '1px 1px #8f8f8f',+ textOverflow: 'unset',+ height: 15,+ maxWidth: fSystemEntry.isFile ? 50 : 100,+ alignSelf: 'center',+ }}+ noWrap={true}+ variant="button"+ onClick={(e) => {+ e.stopPropagation();+ selectEntry(fSystemEntry);+ }}+ >+ {fSystemEntry.isFile ? fSystemEntry.extension : <FolderOutlineIcon />}+ </Typography>+ </Tooltip>+ );+ }+const entryHeight = calculateEntryHeight(entrySize);const isSmall =entrySize === EntrySizes.tiny || entrySize === EntrySizes.small;@@ -309,64 +437,21 @@ function RowCell(props: Props) {containerwrap="nowrap"className={classes.rowHover}- sx={{ backgroundColor }}+ sx={{ backgroundColor, borderRadius: '4px' }}><Griditemstyle={{minHeight: entryHeight,- width: isSmall ? 80 : 60,+ width: 45,+ height: 30,padding: 3,marginRight: 5,textAlign: 'left',display: 'flex',}}>- <div- data-tid="rowCellTID"- style={{- display: 'flex',- flexDirection: isSmall ? 'row' : 'column',- flex: 1,- padding: 4,- borderWidth: 1,- color: 'white',- textTransform: 'uppercase',- fontSize: 12,- fontWeight: 'bold',- borderRadius: 4,- textAlign: 'center',- overflow: 'hidden',- textOverflow: 'ellipsis',- backgroundColor: fileSystemEntryColor,- alignItems: 'center',- }}- role="button"- onClick={(e) => {- e.stopPropagation();- if (selected) {- deselectEntry(fSystemEntry);- } else {- selectEntry(fSystemEntry);- }- }}- >- {selected ? <SelectedIcon /> : <UnSelectedIcon />}- {fSystemEntry.isFile ? (- <span- style={{- width: '100%',- marginTop: isSmall ? 0 : 10,- textShadow: '1px 1px #8f8f8f',- overflowWrap: 'anywhere',- }}- >- {fSystemEntry.extension}- </span>- ) : (- <FolderIcon style={{ margin: '0 auto' }} />- )}- </div>+ {generateExtension()}</Grid>{isSmall ? (<Grid@@ -377,22 +462,29 @@ function RowCell(props: Props) {display: 'flex',}}>- <Typography style={{ wordBreak: 'break-all', alignSelf: 'center' }}>- <Tooltip title={fSystemEntry.path}>- <>{entryTitle}</>- </Tooltip>+ <Typography+ variant="body2"+ style={{+ overflowX: 'clip',+ textWrap: 'nowrap',+ alignSelf: 'center',+ }}+ title={fSystemEntry.name}+ >+ <>{entryTitle}</> {showTags && entryTags ? renderTags : tagPlaceholder}</Typography></Grid>) : (- <Grid item xs zeroMinWidth>- <Tooltip title={fSystemEntry.path}>- <Typography style={{ wordBreak: 'break-all' }}>- {entryTitle}- </Typography>- </Tooltip>- {showTags && entryTags ? renderTags : tagPlaceholder}+ <Grid item xs zeroMinWidth style={{ alignSelf: 'center' }}>+ <Typography+ variant="body1"+ title={fSystemEntry.name}+ style={{ wordBreak: 'break-all' }}+ >+ {entryTitle}+ </Typography><Typographystyle={{color: 'gray',@@ -413,6 +505,7 @@ function RowCell(props: Props) {</Tooltip><span>{description}</span></Typography>+ {showTags && entryTags ? renderTags : tagPlaceholder}</Grid>)}{fSystemEntry.thumbPath && (