The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
feat(create): gallery as a right side-panel, matched 1:1 with the web app
purple1cd63349d09c
diff --git a/src/components/create/experimental/CreateExperimental.tsx b/src/components/create/experimental/CreateExperimental.tsxindex 0b4c0785..bd2bffb4 100644--- a/src/components/create/experimental/CreateExperimental.tsx+++ b/src/components/create/experimental/CreateExperimental.tsx@@ -6,7 +6,7 @@ import { CreateExpProvider, useCreateExp } from './CreateContext'import { IntentBar } from './IntentBar'import { Stage } from './Stage'import { Composer } from './Composer'-import { GalleryStrip } from './GalleryStrip'+import { CreatePanel } from './CreatePanel'import { Lightbox } from './Lightbox'import { AdvancedDrawer } from './AdvancedDrawer'import { MaskEditor } from './MaskEditor'@@ -35,6 +35,7 @@ function CreateExperimentalInner() {const [advancedOpen, setAdvancedOpen] = useState(false)const [maskOpen, setMaskOpen] = useState(false)const [lightbox, setLightbox] = useState<GalleryItem | null>(null)+ const [panelOpen, setPanelOpen] = useState(false)// When a fresh generation lands on top, drop any pinned selection so the// newest result shows.@@ -120,19 +121,23 @@ function CreateExperimentalInner() {</div>)}- {/* Stage + Composer + right Advanced drawer share one relative container */}- <div className="flex-1 min-h-0 relative flex flex-col">- <Stage- displayed={displayed}- onOpenMaskEditor={() => setMaskOpen(true)}- onEditResult={(it) => { void editResultWithMask(it) }}- onFullscreen={(it) => setLightbox(it)}- />- <GalleryStrip activeId={pinnedId} onSelect={openGalleryItem} />- <Composer onOpenAdvanced={() => setAdvancedOpen(true)} />+ {/* Stage+Composer on the left, the Gallery bubble as a right rail —+ matched 1:1 with the web companion (the old bottom strip is gone). */}+ <div className="flex-1 min-h-0 flex overflow-hidden">+ <div className="flex-1 min-w-0 relative flex flex-col">+ <Stage+ displayed={displayed}+ onOpenMaskEditor={() => setMaskOpen(true)}+ onEditResult={(it) => { void editResultWithMask(it) }}+ onFullscreen={(it) => setLightbox(it)}+ />+ <Composer onOpenAdvanced={() => setAdvancedOpen(true)} />- <AdvancedDrawer open={advancedOpen} onClose={() => setAdvancedOpen(false)} />- <MaskEditor open={maskOpen} onClose={() => setMaskOpen(false)} />+ <AdvancedDrawer open={advancedOpen} onClose={() => setAdvancedOpen(false)} />+ <MaskEditor open={maskOpen} onClose={() => setMaskOpen(false)} />+ </div>++ <CreatePanel open={panelOpen} onOpenChange={setPanelOpen} activeId={pinnedId} onSelect={openGalleryItem} /></div><Lightbox item={lightbox} onClose={() => setLightbox(null)} />diff --git a/src/components/create/experimental/CreatePanel.tsx b/src/components/create/experimental/CreatePanel.tsxnew file mode 100644index 00000000..725fde06--- /dev/null+++ b/src/components/create/experimental/CreatePanel.tsx@@ -0,0 +1,139 @@+import { motion, AnimatePresence } from 'framer-motion'+import { Images, Play, PanelRightClose, PanelRightOpen, Trash2, Download, MonitorOff } from 'lucide-react'+import { downloadMediaUrl } from '../../../lib/download-media'+import { useCreateStore } from '../../../stores/createStore'+import { galleryItemUrl, markGalleryItemAvailable, recoverGalleryUrl } from './galleryUrl'+import { cn } from '../ui/cn'++interface Props {+ open: boolean+ onOpenChange: (open: boolean) => void+ activeId: string | null+ onSelect: (id: string) => void+}++/**+ * The right-hand Gallery panel — matched 1:1 with the web companion: a floating+ * bubble that collapses to a slim icon rail (default) and expands into a+ * vertical thumbnail grid, replacing the old bottom strip. Keeps the desktop's+ * local-availability affordances (recover/mark, the "unavailable" overlay).+ */+export function CreatePanel({ open, onOpenChange, activeId, onSelect }: Props) {+ const gallery = useCreateStore((s) => s.gallery)+ const removeFromGallery = useCreateStore((s) => s.removeFromGallery)+ const count = gallery.length++ const bubble =+ 'my-2 mr-2 rounded-xl bg-gray-50 dark:bg-[#1e1e1e] ring-1 ring-black/[0.04] dark:ring-white/[0.05] flex flex-col overflow-hidden shrink-0'++ return (+ <AnimatePresence mode="wait" initial={false}>+ {!open ? (+ /* Collapsed: slim icon rail (default). */+ <motion.aside+ key="rail"+ className={cn(bubble, 'items-center py-2 gap-1')}+ initial={{ width: 0, opacity: 0 }}+ animate={{ width: 52, opacity: 1 }}+ exit={{ width: 0, opacity: 0 }}+ transition={{ duration: 0.15 }}+ style={{ width: 52 }}+ >+ <button onClick={() => onOpenChange(true)} title="Expand gallery" aria-label="Expand gallery" className="flex items-center justify-center w-9 h-9 rounded-md text-gray-500 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-white/5 transition-all">+ <PanelRightOpen size={16} />+ </button>+ <div className="w-6 h-px bg-gray-200 dark:bg-white/10 my-1" />+ <button+ onClick={() => onOpenChange(true)}+ title="Gallery" aria-label="Gallery"+ className="relative flex items-center justify-center w-9 h-9 rounded-md text-gray-500 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-white/5 transition-all"+ >+ <Images size={16} />+ {count > 0 && (+ <span className="absolute -top-0.5 -right-0.5 min-w-[14px] h-[14px] px-0.5 flex items-center justify-center rounded-full text-[0.5rem] font-bold bg-gray-300 dark:bg-white/20 text-gray-700 dark:text-gray-200">+ {count}+ </span>+ )}+ </button>+ </motion.aside>+ ) : (+ /* Expanded: vertical thumbnail grid. */+ <motion.aside+ key="full"+ className={bubble}+ initial={{ width: 0, opacity: 0 }}+ animate={{ width: 260, opacity: 1 }}+ exit={{ width: 0, opacity: 0 }}+ transition={{ duration: 0.15 }}+ style={{ width: 260 }}+ >+ {/* Header */}+ <div className="flex items-center gap-2 px-3 py-2 border-b border-gray-200 dark:border-white/[0.05] shrink-0">+ <button+ onClick={() => onOpenChange(false)}+ title="Collapse gallery" aria-label="Collapse gallery"+ className="flex items-center justify-center w-6 h-6 rounded text-gray-500 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-white/5 transition-all"+ >+ <PanelRightClose size={14} />+ </button>+ <Images size={13} className="text-gray-500" />+ <span className="t-label text-gray-400">Gallery</span>+ {count > 0 && <span className="t-mono text-gray-600">{count}</span>}+ </div>++ <div className="flex-1 min-h-0 overflow-y-auto scrollbar-thin p-3">+ {count === 0 ? (+ <p className="t-body text-gray-500 py-2">Nothing generated yet.</p>+ ) : (+ <div className="grid grid-cols-2 gap-2">+ {gallery.map((g) => (+ <div key={g.id} className="relative group">+ <button+ onClick={() => onSelect(g.id)}+ className={cn(+ 'w-full aspect-square rounded-lg overflow-hidden border-2 transition-colors relative',+ (activeId ?? gallery[0]?.id) === g.id ? 'border-white/60' : 'border-transparent hover:border-white/20',+ g.intent === 'removebg' && 'lu-checker',+ )}+ >+ {g.type === 'video' ? (+ <>+ <video src={galleryItemUrl(g)} muted playsInline onError={() => recoverGalleryUrl(g)} onLoadedData={() => markGalleryItemAvailable(g)} className="w-full h-full object-cover" />+ <span className="absolute inset-0 flex items-center justify-center bg-black/20"><Play size={16} className="text-white/90" /></span>+ </>+ ) : (+ <img src={galleryItemUrl(g)} alt="" onError={() => recoverGalleryUrl(g)} onLoad={() => markGalleryItemAvailable(g)} className="w-full h-full object-cover" />+ )}+ {g.unavailable && (+ <span+ className="absolute inset-0 flex items-center justify-center bg-black/50 text-gray-500"+ title="Local render — the local engine isn't reachable"+ >+ <MonitorOff size={16} />+ </span>+ )}+ </button>+ <button+ onClick={() => removeFromGallery(g.id)}+ className="absolute -top-1.5 -right-1.5 w-6 h-6 rounded-full bg-red-600/90 hover:bg-red-600 text-gray-100 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center shadow-sm"+ title="Delete"+ >+ <Trash2 size={12} />+ </button>+ <button+ onClick={() => { void downloadMediaUrl(galleryItemUrl(g), g.filename || undefined) }}+ className="absolute bottom-1 right-1 w-6 h-6 rounded-md bg-black/55 hover:bg-black/70 text-gray-100 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center shadow-sm"+ title="Download"+ >+ <Download size={12} />+ </button>+ </div>+ ))}+ </div>+ )}+ </div>+ </motion.aside>+ )}+ </AnimatePresence>+ )+}diff --git a/src/components/create/experimental/GalleryStrip.tsx b/src/components/create/experimental/GalleryStrip.tsxdeleted file mode 100644index 7cda479e..00000000--- a/src/components/create/experimental/GalleryStrip.tsx+++ /dev/null@@ -1,68 +0,0 @@-import { motion } from 'framer-motion'-import { Trash2, Play, MonitorOff } from 'lucide-react'-import { useCreateStore } from '../../../stores/createStore'-import { galleryItemUrl, markGalleryItemAvailable, recoverGalleryUrl } from './galleryUrl'-import { cn } from '../ui/cn'--interface Props {- activeId: string | null- onSelect: (id: string) => void-}--export function GalleryStrip({ activeId, onSelect }: Props) {- const gallery = useCreateStore((s) => s.gallery)- const removeFromGallery = useCreateStore((s) => s.removeFromGallery)- if (gallery.length === 0) return null-- return (- <div className="shrink-0 border-t border-white/[0.05] px-4 py-2.5">- <div className="flex items-center gap-2 mb-1.5">- <span className="t-label text-gray-600">Gallery</span>- <span className="t-mono text-gray-700">{gallery.length}</span>- </div>- <div className="flex gap-2 overflow-x-auto scrollbar-thin pb-1">- {gallery.map((g) => (- <motion.div- key={g.id}- initial={{ opacity: 0, scale: 0.9 }}- animate={{ opacity: 1, scale: 1 }}- className="relative group shrink-0"- >- <button- onClick={() => onSelect(g.id)}- className={cn(- 'w-14 h-14 rounded-lg overflow-hidden border-2 transition-colors relative',- (activeId ?? gallery[0]?.id) === g.id ? 'border-white/60' : 'border-transparent hover:border-white/20',- g.intent === 'removebg' && 'lu-checker',- )}- >- {g.type === 'video' ? (- <>- <video src={galleryItemUrl(g)} muted playsInline onError={() => recoverGalleryUrl(g)} onLoadedData={() => markGalleryItemAvailable(g)} className="w-full h-full object-cover" />- <span className="absolute inset-0 flex items-center justify-center bg-black/20"><Play size={14} className="text-white/90" /></span>- </>- ) : (- <img src={galleryItemUrl(g)} alt="" onError={() => recoverGalleryUrl(g)} onLoad={() => markGalleryItemAvailable(g)} className="w-full h-full object-cover" />- )}- {g.unavailable && (- <span- className="absolute inset-0 flex items-center justify-center bg-black/50 text-gray-500"- title="Local render — the local engine isn't reachable"- >- <MonitorOff size={14} />- </span>- )}- </button>- <button- onClick={() => removeFromGallery(g.id)}- className="absolute -top-1 -right-1 w-4 h-4 rounded-full bg-black/70 text-gray-300 hover:text-white opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center"- title="Delete"- >- <Trash2 size={9} />- </button>- </motion.div>- ))}- </div>- </div>- )-}diff --git a/src/lib/download-media.ts b/src/lib/download-media.tsnew file mode 100644index 00000000..0b908284--- /dev/null+++ b/src/lib/download-media.ts@@ -0,0 +1,46 @@+// Save a displayed image/video to disk regardless of where it lives — ported+// from the web companion so the Create gallery downloads identically. A plain+// `<a download>` only works for same-origin/data URLs; cloud renders (signed+// Supabase URLs) are fetched into a Blob first. Last resort (fetch blocked):+// hand the URL to the system browser so the user can save manually.++import { openExternal } from '../api/backend'++export function mediaFilenameFromUrl(url: string, fallback = 'lu-render'): string {+ try {+ const path = new URL(url, typeof location !== 'undefined' ? location.origin : 'http://localhost').pathname+ const last = decodeURIComponent(path.split('/').pop() || '')+ if (last && /\.[a-z0-9]{2,5}$/i.test(last)) return last+ } catch { /* fall through */ }+ return fallback+}++function clickAnchor(href: string, filename: string): void {+ const a = document.createElement('a')+ a.href = href+ a.download = filename+ document.body.appendChild(a)+ a.click()+ document.body.removeChild(a)+}++export async function downloadMediaUrl(url: string, filename?: string): Promise<void> {+ const name = filename && filename.length > 0 ? filename : mediaFilenameFromUrl(url)+ if (url.startsWith('data:') || url.startsWith('blob:')) {+ clickAnchor(url, name)+ return+ }+ try {+ const res = await fetch(url)+ if (!res.ok) throw new Error(`download failed: ${res.status}`)+ const blob = await res.blob()+ const obj = URL.createObjectURL(blob)+ const finalName = filename && filename.length > 0+ ? filename+ : (res.url && res.url !== url ? mediaFilenameFromUrl(res.url, name) : name)+ clickAnchor(obj, finalName)+ setTimeout(() => URL.revokeObjectURL(obj), 30_000)+ } catch {+ void openExternal(url)+ }+}