TagSpaces is an offline, open source, document manager with tagging support
chore: improving grid perspective
Ilian Sapundshievd35585cd6ff0
diff --git a/src/renderer/components/TagContainer.tsx b/src/renderer/components/TagContainer.tsxindex 18294d347..5ff7f0846 100644--- a/src/renderer/components/TagContainer.tsx+++ b/src/renderer/components/TagContainer.tsx@@ -195,6 +195,7 @@ function TagContainer(props: Props) {opacity: isDragging ? 0.5 : 1,fontSize: 13,textTransform: 'none',+ textWrap: 'nowrap',color: textColor,backgroundColor,minHeight: 0,diff --git a/src/renderer/perspectives/grid-perspective/components/GridCell.tsx b/src/renderer/perspectives/grid-perspective/components/GridCell.tsxindex 122791eaf..4bbba5c51 100644--- a/src/renderer/perspectives/grid-perspective/components/GridCell.tsx+++ b/src/renderer/perspectives/grid-perspective/components/GridCell.tsx@@ -286,7 +286,8 @@ function GridCell(props: Props) {];const entryPath = fSystemEntry.path;- const isSmall = entrySize === EntrySizes.tiny; // || entrySize === EntrySizes.small;+ const isSmall =+ entrySize === EntrySizes.tiny || entrySize === EntrySizes.small;const renderTags = useMemo(() => {let sideCarLength = 0;@@ -398,6 +399,9 @@ function GridCell(props: Props) {backgroundColor: fileSystemEntryColor,textShadow: '1px 1px #8f8f8f',textOverflow: 'unset',+ height: 18,+ marginTop: 4,+ marginBottom: 4,maxWidth: fSystemEntry.isFile ? 50 : 100,}}noWrap={true}@@ -407,12 +411,25 @@ function GridCell(props: Props) {selectEntry(fSystemEntry);}}>- {fSystemEntry.isFile ? fSystemEntry.extension : <FolderOpenIcon />}+ {fSystemEntry.isFile ? (+ fSystemEntry.extension+ ) : (+ <FolderOpenIcon style={{}} />+ )}</Typography></Tooltip>);}+ const tmbImgSrc =+ fSystemEntry.thumbPath ++ (lastThumbnailImageChange &&+ lastThumbnailImageChange.thumbPath === fSystemEntry.thumbPath &&+ !PlatformIO.haveObjectStoreSupport() &&+ !PlatformIO.haveWebDavSupport()+ ? urlGetDelim(fSystemEntry.thumbPath) + lastThumbnailImageChange.dt+ : '');+return (<GridPaperdata-entry-id={fSystemEntry.uuid}@@ -427,6 +444,8 @@ function GridCell(props: Props) {maxHeight: maxHeight,marginBottom: isLast ? 40 : 'auto',background: fileSystemEntryBgColor && theme.palette.background.default,+ display: 'flex',+ flexDirection: 'column',}}onContextMenu={(event) => handleGridContextMenu(event, fSystemEntry)}onDoubleClick={(event) => {@@ -442,6 +461,54 @@ function GridCell(props: Props) {handleGridCellClick(event, fSystemEntry);}}>+ <Box style={{ height: maxHeight - 70, position: 'relative' }}>+ <Box style={{ position: 'absolute' }}>+ {showTags && entryTags ? (+ renderTags+ ) : (+ <TagsPreview tags={entryTags} />+ )}+ </Box>+ {fSystemEntry.thumbPath ? (+ <CardMedia+ component="img"+ loading="lazy"+ // @ts-ignore+ onError={(i) => (i.target.style.display = 'none')}+ alt="green iguana"+ height="auto"+ src={tmbImgSrc}+ />+ ) : (+ <Box style={{ width: '50%', height: 'auto', margin: '0 auto' }}>+ <EntryIcon+ isFile={fSystemEntry.isFile}+ fileExtension={fSystemEntry.extension}+ />+ </Box>+ )}+ </Box>++ <CardContent sx={{ padding: '5px', flexGrow: 1 }}>+ {/* <img+ alt="thumbnail"+ style={{+ backgroundRepeat: 'no-repeat',+ backgroundPosition: 'center',+ objectFit: thumbnailMode,+ width: '100%',+ height: '100%',+ }}+ src={tmbDataURL}+ // @ts-ignore+ onError={(i) => (i.target.style.display = 'none')}+ loading="lazy"+ /> */}+ <Box style={{ textWrap: isSmall ? 'nowrap' : 'unset' }}>+ {entryTitle}+ </Box>+ {/* <Box>{generateCardHeader()}</Box> */}+ </CardContent><CardHeaderstyle={{ padding: 5 }}sx={{@@ -452,63 +519,20 @@ function GridCell(props: Props) {'.MuiCardHeader-subheader': {fontSize: 12,},- // '.MuiCardHeader-header': {- // fontSize: 12,- // },}}- title={entryTitle}- subheader={generateCardHeader()}action={<IconButtonaria-label="entry context menu"size="small"+ style={{ marginRight: 5 }}onClick={(event) => handleGridContextMenu(event, fSystemEntry)}><MoreMenuIcon /></IconButton>}+ subheader={generateCardHeader()}avatar={generateAvatar()}></CardHeader>-- <CardContent sx={{ width: 'auto', padding: 0, height: maxHeight - 30 }}>- {fSystemEntry.thumbPath ? (- <img- alt="thumbnail"- style={{- backgroundRepeat: 'no-repeat',- backgroundPosition: 'center',- objectFit: thumbnailMode,- width: '100%',- height: '100%',- }}- src={- fSystemEntry.thumbPath +- (lastThumbnailImageChange &&- lastThumbnailImageChange.thumbPath === fSystemEntry.thumbPath &&- !PlatformIO.haveObjectStoreSupport() &&- !PlatformIO.haveWebDavSupport()- ? urlGetDelim(fSystemEntry.thumbPath) +- lastThumbnailImageChange.dt- : '')- }- // @ts-ignore- onError={(i) => (i.target.style.display = 'none')}- loading="lazy"- />- ) : (- <Box style={{ width: '50%', margin: '0 auto' }}>- <EntryIcon- isFile={fSystemEntry.isFile}- fileExtension={fSystemEntry.extension}- />- </Box>- )}- {showTags && entryTags && !isSmall ? (- renderTags- ) : (- <TagsPreview tags={entryTags} />- )}- </CardContent></GridPaper>);}diff --git a/src/renderer/perspectives/grid-perspective/components/GridPagination.tsx b/src/renderer/perspectives/grid-perspective/components/GridPagination.tsxindex 20b3c21aa..04a3a78da 100644--- a/src/renderer/perspectives/grid-perspective/components/GridPagination.tsx+++ b/src/renderer/perspectives/grid-perspective/components/GridPagination.tsx@@ -267,14 +267,12 @@ function GridPagination(props: Props) {</Tooltip>{showTags ? (<span style={{ paddingLeft: 5 }}>- {directoryMeta &&- directoryMeta.tags &&- directoryMeta.tags.map((tag: TS.Tag) => {- return <TagContainer tag={tag} tagMode="display" />;- })}+ {directoryMeta?.tags?.map((tag: TS.Tag) => {+ return <TagContainer tag={tag} tagMode="display" />;+ })}</span>) : (- <TagsPreview tags={directoryMeta.tags} />+ <TagsPreview tags={directoryMeta?.tags} />)}</Box>)}