Skip to content

Image Pipeline Playground

feat(frontend/inspector): add bare/zip packaging and folder picker

Mohammad Rajaei38cc74cf3c77
diff --git a/frontend/src/features/inspector/SaveImageParams.tsx b/frontend/src/features/inspector/SaveImageParams.tsx
index d8c0e38..436de5d 100644
--- a/frontend/src/features/inspector/SaveImageParams.tsx
+++ b/frontend/src/features/inspector/SaveImageParams.tsx
@@ -1,4 +1,4 @@
-import { Box, Button, TextField, Typography } from '@mui/material'
+import { Box, Button, MenuItem, TextField, Typography } from '@mui/material'
import { getDesktop, isDesktopApp } from '../../api/assets'
import { notifyError } from '../../notify'
@@ -8,20 +8,32 @@ const SAVE_PATH_TEMPLATES = [
{ token: '{index}', hint: 'sample index' },
] as const
+const PACKAGING_OPTIONS = [
+ { value: 'bare', label: 'Bare files' },
+ { value: 'zip', label: 'ZIP archive' },
+] as const
+
+export type SavePackaging = 'bare' | 'zip'
+
type SaveImageParamsProps = {
filename: string
outputDir: string
+ packaging: SavePackaging
onFilenameChange: (filename: string) => void
onOutputDirChange: (outputDir: string) => void
+ onPackagingChange: (packaging: SavePackaging) => void
}
export function SaveImageParams({
filename,
outputDir,
+ packaging,
onFilenameChange,
onOutputDirChange,
+ onPackagingChange,
}: SaveImageParamsProps) {
const desktop = isDesktopApp()
+ const hasFolder = Boolean(outputDir.trim())
const insertTemplate = (token: string) => {
onFilenameChange(`${filename}${token}`)
@@ -29,7 +41,10 @@ export function SaveImageParams({
const pickFolder = async () => {
const bridge = getDesktop()
- if (!bridge) return
+ if (!bridge) {
+ notifyError('Folder selection requires the desktop app')
+ return
+ }
try {
const result = await bridge.pickFolder()
if (result.canceled || !result.path) return
@@ -42,28 +57,95 @@ export function SaveImageParams({
return (
<Box sx={{ display: 'grid', gap: 1.5 }}>
<Typography sx={{ fontSize: 13, color: 'rgba(244,241,234,0.55)', lineHeight: 1.45 }}>
- {desktop
- ? 'Pick an output folder to write images after Run. Leave empty to fall back to a ZIP download.'
- : 'After Run, images are packed into a ZIP and downloaded. Set an output folder when running on desktop.'}
+ Choose bare files or a ZIP, then optionally pick a destination folder. Default is the
+ workflow output folder.
</Typography>
+ <TextField
+ select
+ size="small"
+ label="Packaging"
+ value={packaging}
+ onChange={(event) => {
+ const next = event.target.value === 'zip' ? 'zip' : 'bare'
+ onPackagingChange(next)
+ }}
+ helperText={
+ packaging === 'zip'
+ ? 'Images are packed into one ZIP under the destination folder'
+ : 'Each image is written as a separate file'
+ }
+ >
+ {PACKAGING_OPTIONS.map((option) => (
+ <MenuItem key={option.value} value={option.value}>
+ {option.label}
+ </MenuItem>
+ ))}
+ </TextField>
+
<Box sx={{ display: 'grid', gap: 1 }}>
- <TextField
- size="small"
- label="Output folder"
- value={outputDir}
- onChange={(event) => onOutputDirChange(event.target.value)}
- helperText={desktop ? 'Required for direct disk writes' : 'Optional on desktop builds'}
- />
- {desktop && (
+ <Typography
+ sx={{
+ fontSize: 10,
+ fontWeight: 700,
+ letterSpacing: '0.06em',
+ textTransform: 'uppercase',
+ color: 'rgba(244,241,234,0.4)',
+ }}
+ >
+ Output folder
+ </Typography>
+ <Box
+ title={hasFolder ? outputDir : 'output'}
+ sx={{
+ px: 1.25,
+ py: 1,
+ borderRadius: 1.25,
+ bgcolor: '#0f0f0f',
+ border: '1px solid rgba(255,255,255,0.1)',
+ minHeight: 40,
+ display: 'flex',
+ alignItems: 'center',
+ }}
+ >
+ <Typography
+ sx={{
+ color: hasFolder ? '#f0ebe3' : 'rgba(244,241,234,0.45)',
+ fontSize: 12,
+ fontWeight: 600,
+ lineHeight: 1.4,
+ wordBreak: 'break-all',
+ fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace',
+ }}
+ >
+ {hasFolder ? outputDir : 'output (default)'}
+ </Typography>
+ </Box>
+ <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
<Button
size="small"
variant="outlined"
onClick={() => void pickFolder()}
- sx={{ textTransform: 'none', justifySelf: 'start' }}
+ sx={{ textTransform: 'none' }}
>
- Choose folder
+ {hasFolder ? 'Change folder' : 'Choose folder'}
</Button>
+ {hasFolder && (
+ <Button
+ size="small"
+ variant="text"
+ onClick={() => onOutputDirChange('')}
+ sx={{ textTransform: 'none', color: 'rgba(244,241,234,0.55)' }}
+ >
+ Use default
+ </Button>
+ )}
+ </Box>
+ {!desktop && (
+ <Typography sx={{ fontSize: 12, color: 'rgba(244,241,234,0.4)', lineHeight: 1.4 }}>
+ Folder selection needs the desktop app. Without it, saves use the default output
+ folder.
+ </Typography>
)}
</Box>