Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Composer polish: open-only tools, clip lists, phone sheets, fileToList

Claude044f21ab7b6a
diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsx
index a62e2576..f4366817 100644
--- a/src/components/studio/composer.tsx
+++ b/src/components/studio/composer.tsx
@@ -208,7 +208,9 @@ export function Composer({ docked }: { docked: boolean }) {
if (blocker || create.isPending) {
if (blocker) {
toast(blocker.message);
- if (blocker.slot) pulseSlot(root.current, blocker.slot);
+ // Point at the tile to fill: the missing slot, or the clip list of a tool that only takes clips.
+ const target = blocker.slot ?? (config.multiRef && config.hidePrompt && draft.refs.length < 2 ? "refs" : undefined);
+ if (target) pulseSlot(root.current, target);
}
return;
}
@@ -262,7 +264,9 @@ export function Composer({ docked }: { docked: boolean }) {
// Attachments: only when something is attached or a required slot is still empty (U8).
const kinds = [...attach.kinds];
const hasAttachment = slots.some((s) => draft.slots[s.key]) || draft.refs.length > 0;
- const showAttachments = (slots.length > 0 || !!config.multiRef) && (hasAttachment || !!slots.find((s) => s.required && !draft.slots[s.key]));
+ // Tools whose only input is a list of clips (Join clips) keep their "Add clip" tile in view.
+ const showAttachments =
+ (slots.length > 0 || !!config.multiRef) && (hasAttachment || !!slots.find((s) => s.required && !draft.slots[s.key]) || (!!config.multiRef && !showPrompt));
const collapsed = docked && !focused;
return (
@@ -325,6 +329,7 @@ export function Composer({ docked }: { docked: boolean }) {
))}
{config.multiRef && draft.refs.length < refMax && (
<MediaSlot
+ slotKey="refs"
label={config.multiRef.label}
kind={config.multiRef.kind ?? "image"}
value={null}
diff --git a/src/components/studio/media-slot.tsx b/src/components/studio/media-slot.tsx
index 954f1529..5eb58583 100644
--- a/src/components/studio/media-slot.tsx
+++ b/src/components/studio/media-slot.tsx
@@ -1,6 +1,7 @@
"use client";
import { AudioLines, FileVideo, ImagePlus, Library, Loader2, Upload, X } from "lucide-react";
+import { nanoid } from "nanoid";
import { useRef, useState } from "react";
import { toast } from "sonner";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
@@ -72,6 +73,29 @@ export async function fileToSlot(file: File, onChange: (v: SlotValue | null) =>
}
}
+/**
+ * Upload into a list kept in React state (reference photos, a storyboard's looks): appended once
+ * with its preview, then replaced by id when the upload finishes, or dropped if it fails. A file
+ * removed from the list while it uploads stays removed.
+ */
+export function fileToList(file: File, setList: (update: (xs: SlotValue[]) => SlotValue[]) => void, kind?: MediaKind): void {
+ const id = nanoid(8);
+ let placed = false;
+ void fileToSlot(
+ file,
+ (v) => {
+ const first = !placed;
+ placed = true;
+ setList((xs) => {
+ if (first) return v ? [...xs, { ...v, id }] : xs;
+ if (!xs.some((x) => x.id === id)) return xs;
+ return v ? xs.map((x) => (x.id === id ? { ...v, id } : x)) : xs.filter((x) => x.id !== id);
+ });
+ },
+ kind,
+ );
+}
+
function KindIcon({ kind, className }: { kind: MediaKind; className?: string }) {
if (kind === "video") return <FileVideo className={className} />;
if (kind === "audio") return <AudioLines className={className} />;
diff --git a/src/components/studio/model-picker.tsx b/src/components/studio/model-picker.tsx
index 1e96c638..d9d9031a 100644
--- a/src/components/studio/model-picker.tsx
+++ b/src/components/studio/model-picker.tsx
@@ -6,6 +6,7 @@ import { useMemo, useState } from "react";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Command, CommandGroup, CommandInput, CommandItem, CommandList } from "@/components/ui/command";
+import { useIsMobile } from "@/hooks/use-mobile";
import { type Engine, type ModelDef } from "@/lib/catalog/types";
import { useEngineMode, useStatus } from "@/lib/api";
import { bestForStudio, groupModels, toggleIn } from "@/lib/composer";
@@ -134,6 +135,7 @@ export function ModelPicker({
const [q, setQ] = useState("");
const status = useStatus().data;
const mode = useEngineMode();
+ const mobile = useIsMobile();
const [recent] = useStoredList(RECENT_MODELS);
const [starred, setStarred] = useStoredList(STARRED_MODELS);
const engines = useMemo<Engine[]>(() => (mode === "both" ? ["cloud", "open"] : [mode]), [mode]);
@@ -172,7 +174,7 @@ export function ModelPicker({
<Command shouldFilter={false} loop label="Models" className="rounded-none! bg-transparent p-0">
<div className="flex items-center gap-2 p-1 sm:p-2 sm:pb-1">
<div className="min-w-0 flex-1 [&_[data-slot=command-input-wrapper]]:p-0">
- <CommandInput value={q} onValueChange={setQ} placeholder={mode === "both" ? "Search all models" : "Search models"} aria-label="Search models" autoFocus />
+ <CommandInput value={q} onValueChange={setQ} placeholder={mode === "both" ? "Search all models" : "Search models"} aria-label="Search models" autoFocus={!mobile} />
</div>
<EngineSwitch value={engine} onChange={onEngineChange} size="sm" />
</div>
diff --git a/src/components/studio/responsive-panel.tsx b/src/components/studio/responsive-panel.tsx
index e0221f6a..5dc089f7 100644
--- a/src/components/studio/responsive-panel.tsx
+++ b/src/components/studio/responsive-panel.tsx
@@ -31,6 +31,11 @@ export function ResponsivePanel({
align?: "start" | "center" | "end";
}) {
const mobile = useIsMobile();
+ // On phones the sheet itself takes focus, so the keyboard doesn't jump up over the list.
+ const focusSheet = (e: Event) => {
+ e.preventDefault();
+ (e.currentTarget as HTMLElement | null)?.focus();
+ };
const withTip = (t: React.ReactNode) =>
tooltip ? (
<Tooltip>
@@ -45,7 +50,7 @@ export function ResponsivePanel({
return (
<Sheet open={open} onOpenChange={onOpenChange}>
{withTip(<SheetTrigger asChild>{inner}</SheetTrigger>)}
- <SheetContent side="bottom" className={cn("max-h-[88svh] gap-0 rounded-t-2xl pb-[env(safe-area-inset-bottom)]", sheetClassName)}>
+ <SheetContent side="bottom" onOpenAutoFocus={focusSheet} className={cn("max-h-[88svh] gap-0 rounded-t-2xl pb-[env(safe-area-inset-bottom)] outline-none", sheetClassName)}>
<SheetHeader className="pr-12 pb-2">
<SheetTitle className="font-sans text-[15px] font-semibold">{title}</SheetTitle>
<SheetDescription className={cn(!description && "sr-only")}>{description ?? title}</SheetDescription>