Skip to content

Image Pipeline Playground

feat(frontend/preview): implement image preview grid

Mohammad Rajaei726debf47b45
diff --git a/frontend/src/features/preview/PreviewGrid.tsx b/frontend/src/features/preview/PreviewGrid.tsx
new file mode 100644
index 0000000..78ad106
--- /dev/null
+++ b/frontend/src/features/preview/PreviewGrid.tsx
@@ -0,0 +1,36 @@
+import { Box, ImageList, ImageListItem, ImageListItemBar, Typography } from '@mui/material'
+import { useGraphStore } from '../../store/graphStore'
+
+export function PreviewGrid() {
+ const previews = useGraphStore((s) => s.previews)
+
+ return (
+ <Box sx={{ p: 2, height: '100%', overflow: 'auto' }}>
+ <Typography variant="subtitle1" sx={{ fontWeight: 700, mb: 1 }}>
+ Previews
+ </Typography>
+ {previews.length === 0 ? (
+ <Typography variant="body2" color="text.secondary">
+ Execute a pipeline to see intermediate and final images.
+ </Typography>
+ ) : (
+ <ImageList cols={3} gap={8}>
+ {previews.map((preview, index) => (
+ <ImageListItem key={`${preview.nodeId}-${preview.sampleIndex}-${index}`}>
+ <img
+ src={`data:image/png;base64,${preview.imageB64}`}
+ alt={`${preview.nodeId} sample ${preview.sampleIndex}`}
+ loading="lazy"
+ style={{ width: '100%', display: 'block', borderRadius: 4 }}
+ />
+ <ImageListItemBar
+ title={preview.nodeId}
+ subtitle={`sample ${preview.sampleIndex}${preview.cacheHit ? ' · cache' : ''}`}
+ />
+ </ImageListItem>
+ ))}
+ </ImageList>
+ )}
+ </Box>
+ )
+}