Skip to content

Image Pipeline Playground

feat(frontend): mount PreviewGrid as Results side tab

Mohammad Rajaei8939a314733c
diff --git a/frontend/src/app/App.tsx b/frontend/src/app/App.tsx
index c3a5c70..e1044bf 100644
--- a/frontend/src/app/App.tsx
+++ b/frontend/src/app/App.tsx
@@ -1,10 +1,11 @@
-import { Box } from '@mui/material'
+import { Box, Tab, Tabs } from '@mui/material'
import { useEffect, useRef, useState } from 'react'
import { PipelineCanvas } from '../features/canvas/PipelineCanvas'
import { NodePalette } from '../features/palette/NodePalette'
import { NodeInspector } from '../features/inspector/NodeInspector'
import { CodePanel } from '../features/code/CodePanel'
import { ExecutionLogPanel } from '../features/execution/ExecutionLogPanel'
+import { PreviewGrid } from '../features/preview/PreviewGrid'
import { TemplateGallery } from '../features/templates/TemplateGallery'
import { useGraphStore } from '../store/graphStore'
import {
@@ -27,6 +28,7 @@ export default function App() {
const { run, cancel } = useExecutionSocket()
const fileInputRef = useRef<HTMLInputElement>(null)
const [templatesOpen, setTemplatesOpen] = useState(false)
+ const [sideTab, setSideTab] = useState(0)
useEffect(() => bindExecutionRunner(run), [run])
@@ -162,15 +164,46 @@ export default function App() {
borderLeft: '1px solid rgba(255,255,255,0.08)',
bgcolor: '#141414',
display: 'grid',
- gridTemplateRows: '1fr 220px',
+ gridTemplateRows: '1fr 260px',
minHeight: 0,
}}
>
<Box sx={{ minHeight: 0, overflow: 'auto' }}>
<NodeInspector />
</Box>
- <Box sx={{ borderTop: '1px solid rgba(255,255,255,0.08)', minHeight: 0 }}>
- <CodePanel />
+ <Box
+ sx={{
+ borderTop: '1px solid rgba(255,255,255,0.08)',
+ minHeight: 0,
+ display: 'flex',
+ flexDirection: 'column',
+ }}
+ >
+ <Tabs
+ value={sideTab}
+ onChange={(_, value: number) => setSideTab(value)}
+ sx={{
+ minHeight: 36,
+ px: 1,
+ borderBottom: '1px solid rgba(255,255,255,0.06)',
+ '& .MuiTab-root': {
+ minHeight: 36,
+ py: 0.5,
+ textTransform: 'none',
+ fontWeight: 650,
+ fontSize: 12,
+ color: 'rgba(244,241,234,0.45)',
+ },
+ '& .Mui-selected': { color: '#7dcea0' },
+ '& .MuiTabs-indicator': { bgcolor: '#7dcea0', height: 2 },
+ }}
+ >
+ <Tab label="Code" />
+ <Tab label="Results" />
+ </Tabs>
+ <Box sx={{ flex: 1, minHeight: 0 }}>
+ {sideTab === 0 ? <CodePanel /> : <PreviewGrid />}
+ </Box>
</Box>
</Box>
</Box>
diff --git a/frontend/src/features/preview/PreviewGrid.tsx b/frontend/src/features/preview/PreviewGrid.tsx
index 60a9e71..36164d4 100644
--- a/frontend/src/features/preview/PreviewGrid.tsx
+++ b/frontend/src/features/preview/PreviewGrid.tsx
@@ -5,32 +5,37 @@ 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
+ <Box sx={{ height: '100%', display: 'flex', flexDirection: 'column', minHeight: 0 }}>
+ <Typography
+ variant="subtitle1"
+ sx={{ fontFamily: '"Fraunces", Georgia, serif', fontWeight: 700, px: 2, pt: 1.5, pb: 0.5 }}
+ >
+ Run Results
</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.portId ? `${preview.nodeId}:${preview.portId}` : preview.nodeId}
- subtitle={`sample ${preview.sampleIndex}${preview.cacheHit ? ' · cache' : ''}`}
- />
- </ImageListItem>
- ))}
- </ImageList>
- )}
+ <Box sx={{ flex: 1, minHeight: 0, overflow: 'auto', px: 2, pb: 2 }}>
+ {previews.length === 0 ? (
+ <Typography sx={{ color: 'rgba(244,241,234,0.55)', fontSize: 13, lineHeight: 1.5 }}>
+ Execute a pipeline to collect intermediate and final images here.
+ </Typography>
+ ) : (
+ <ImageList cols={2} 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.portId ? `${preview.nodeId}:${preview.portId}` : preview.nodeId}
+ subtitle={`sample ${preview.sampleIndex}${preview.cacheHit ? ' · cache' : ''}`}
+ />
+ </ImageListItem>
+ ))}
+ </ImageList>
+ )}
+ </Box>
</Box>
)
}