From 219e4b3b0e8336442d7e401cfd4c1605d4e9fb9a Mon Sep 17 00:00:00 2001 From: Shane Israel Date: Fri, 10 Apr 2026 21:46:42 -0600 Subject: [PATCH 1/2] update card paddings --- app/client/src/components/cards/ImageCards.js | 230 +++++++++--------- app/client/src/components/cards/VideoCards.js | 10 +- .../src/components/game/GameVideosHeader.js | 2 +- app/client/src/views/Dashboard.js | 7 +- app/client/src/views/Feed.js | 166 ------------- app/client/src/views/GameVideos.js | 19 +- app/client/src/views/Games.js | 9 +- app/client/src/views/ImageFeed.js | 15 +- 8 files changed, 163 insertions(+), 295 deletions(-) delete mode 100644 app/client/src/views/Feed.js diff --git a/app/client/src/components/cards/ImageCards.js b/app/client/src/components/cards/ImageCards.js index 445c34a2..0df3b787 100644 --- a/app/client/src/components/cards/ImageCards.js +++ b/app/client/src/components/cards/ImageCards.js @@ -107,126 +107,128 @@ const LazyImageCard = ({ ) } -const ImageCards = React.memo(({ - images, - loadingIcon = null, - feedView = false, - authenticated, - size, - onImageOpen, - editMode = false, - selectedImages, - onImageSelect, -}) => { - const [imgs, setImages] = React.useState(images || []) - const [alert, setAlert] = React.useState({ open: false }) - const [columnCount, setColumnCount] = React.useState(3) - const containerRef = React.useRef() - - React.useEffect(() => { - setImages(images || []) - }, [images]) - - React.useEffect(() => { - if (!imgs || imgs.length === 0) { - setColumnCount(3) - return - } - - const el = containerRef.current - if (!el) return - - const observer = new ResizeObserver(([entry]) => { - const width = entry?.contentRect?.width || 0 - if (!width) return - const colWidth = size || 300 - const cols = Math.max(1, Math.floor((width + 16) / (colWidth + 16))) - setColumnCount(cols) - }) - - observer.observe(el) - return () => observer.disconnect() - }, [size, imgs]) +const ImageCards = React.memo( + ({ + images, + loadingIcon = null, + feedView = false, + authenticated, + size, + onImageOpen, + editMode = false, + selectedImages, + onImageSelect, + }) => { + const [imgs, setImages] = React.useState(images || []) + const [alert, setAlert] = React.useState({ open: false }) + const [columnCount, setColumnCount] = React.useState(3) + const containerRef = React.useRef() + + React.useEffect(() => { + setImages(images || []) + }, [images]) + + React.useEffect(() => { + if (!imgs || imgs.length === 0) { + setColumnCount(3) + return + } + + const el = containerRef.current + if (!el) return + + const observer = new ResizeObserver(([entry]) => { + const width = entry?.contentRect?.width || 0 + if (!width) return + const colWidth = size || 300 + const cols = Math.max(1, Math.floor((width + 16) / (colWidth + 16))) + setColumnCount(cols) + }) - const memoizedHandleAlert = useCallback((a) => setAlert(a), []) + observer.observe(el) + return () => observer.disconnect() + }, [size, imgs]) - const handleDelete = (id) => { - setImages((prev) => prev.filter((img) => img.image_id !== id)) - } + const memoizedHandleAlert = useCallback((a) => setAlert(a), []) - const openImage = (img) => { - if (onImageOpen) onImageOpen(img) - } + const handleDelete = (id) => { + setImages((prev) => prev.filter((img) => img.image_id !== id)) + } - const EMPTY_STATE = () => ( - - {!loadingIcon && ( - <> - - - No images found - {!feedView && ( - - Upload images or scan your image library - - )} - - - )} - {loadingIcon} - - ) + const openImage = (img) => { + if (onImageOpen) onImageOpen(img) + } - return ( - - setAlert({ ...alert, open })} + const EMPTY_STATE = () => ( + - {alert.message} - - - {imgs.length === 0 && EMPTY_STATE()} - {imgs.length > 0 && ( - + + + No images found + {!feedView && ( + + Upload images or scan your image library + + )} + + + )} + {loadingIcon} + + ) + + return ( + + setAlert({ ...alert, open })} > - {imgs.map((img) => ( - (editMode ? onImageSelect?.(img.image_id) : openImage(img))} - alertHandler={memoizedHandleAlert} - authenticated={authenticated} - onRemoveFromView={handleDelete} - editMode={editMode} - selected={selectedImages?.has(img.image_id)} - onSelect={onImageSelect} - /> - ))} - - )} - - ) -}) + {alert.message} + + + {imgs.length === 0 && EMPTY_STATE()} + {imgs.length > 0 && ( + + {imgs.map((img) => ( + (editMode ? onImageSelect?.(img.image_id) : openImage(img))} + alertHandler={memoizedHandleAlert} + authenticated={authenticated} + onRemoveFromView={handleDelete} + editMode={editMode} + selected={selectedImages?.has(img.image_id)} + onSelect={onImageSelect} + /> + ))} + + )} + + ) + }, +) export default ImageCards diff --git a/app/client/src/components/cards/VideoCards.js b/app/client/src/components/cards/VideoCards.js index b9a9a730..28663137 100644 --- a/app/client/src/components/cards/VideoCards.js +++ b/app/client/src/components/cards/VideoCards.js @@ -131,13 +131,9 @@ const VideoCards = ({ <> - - No videos found - + No videos found {!feedView && ( - - Scan your library to discover videos - + Scan your library to discover videos )} {!feedView && ( @@ -200,7 +196,7 @@ const VideoCards = ({ width: isSingleColumn ? 'calc(100% + 48px)' : '100%', mx: isSingleColumn ? '-24px' : 0, gridTemplateColumns: `repeat(auto-fill, minmax(min(100%, ${size}px), 1fr))`, - gap: '24px', + gap: 2, }} > {vids.slice(0, visibleCount).map((v, index) => ( diff --git a/app/client/src/components/game/GameVideosHeader.js b/app/client/src/components/game/GameVideosHeader.js index fe6ff4c2..cbc5ba79 100644 --- a/app/client/src/components/game/GameVideosHeader.js +++ b/app/client/src/components/game/GameVideosHeader.js @@ -17,7 +17,7 @@ const GameVideosHeader = ({ game, height = 200, editMode, onEditAssets }) => { width: '100%', height, overflow: 'hidden', - mb: 3, + mb: 2, }} > {bgUrl && ( diff --git a/app/client/src/views/Dashboard.js b/app/client/src/views/Dashboard.js index bcc6dc69..6f9a01d4 100644 --- a/app/client/src/views/Dashboard.js +++ b/app/client/src/views/Dashboard.js @@ -475,7 +475,12 @@ const Dashboard = ({ height: 38, flexShrink: 1, minWidth: 0, - '& .MuiButton-root': { whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', px: { xs: 1, sm: 2 } }, + '& .MuiButton-root': { + whiteSpace: 'nowrap', + overflow: 'hidden', + textOverflow: 'ellipsis', + px: { xs: 1, sm: 2 }, + }, }} >