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.

Keys: one ⌘ / Ctrl helper everywhere

Claude21f318cb480f
diff --git a/src/components/canvas/canvas-editor.tsx b/src/components/canvas/canvas-editor.tsx
index 48b70c5f..e6943086 100644
--- a/src/components/canvas/canvas-editor.tsx
+++ b/src/components/canvas/canvas-editor.tsx
@@ -73,6 +73,7 @@ import {
} from "@/lib/catalog/canvas";
import type { Engine, MediaKind, ModelDef } from "@/lib/catalog/types";
import { formatCost } from "@/lib/format";
+import { useModKey } from "@/lib/keys";
import { cn } from "@/lib/utils";
import {
buildViews,
@@ -1022,6 +1023,7 @@ const EditorHeader = memo(function EditorHeader({
mode: EngineMode;
ui: HeaderUi;
}) {
+ const mod = useModKey();
return (
<header className="z-20 flex h-14 shrink-0 items-center gap-2 border-b bg-background px-2 sm:px-4">
<SidebarTrigger className="md:hidden" />
@@ -1069,7 +1071,7 @@ const EditorHeader = memo(function EditorHeader({
</Button>
</TooltipTrigger>
<TooltipContent>
- Run every node that changed <Kbd>⌘</Kbd>
+ Run every node that changed <Kbd>{mod}</Kbd>
<Kbd>↵</Kbd>
</TooltipContent>
</Tooltip>
diff --git a/src/components/cinema/prompt-bar.tsx b/src/components/cinema/prompt-bar.tsx
index 7d709b07..1774d423 100644
--- a/src/components/cinema/prompt-bar.tsx
+++ b/src/components/cinema/prompt-bar.tsx
@@ -62,6 +62,7 @@ import {
import { findMentions, type StudioElement } from "@/lib/catalog/elements";
import type { Engine, MediaKind } from "@/lib/catalog/types";
import { formatCost } from "@/lib/format";
+import { modKey } from "@/lib/keys";
import { cn } from "@/lib/utils";
import { MoveChips, MovePicker } from "./camera-moves";
import { CameraChip, EmotionChip, FilmSetupChip, LightingChip, PaletteChip } from "./director-panel";
@@ -208,9 +209,6 @@ function RefThumb({ r, index, startFrame, onRemove }: { r: RefItem; index: numbe
);
}
-/** "⌘" on Apple keyboards, "Ctrl" elsewhere (only rendered inside tooltips, i.e. in the browser). */
-const modKey = () => (typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform) ? "⌘" : "Ctrl");
-
const kindOf = (f: File): MediaKind => (f.type.startsWith("video/") ? "video" : f.type.startsWith("audio/") ? "audio" : "image");
/** Upload files into the reference tray (preview first, then the server URL; durations measured for clips). */
diff --git a/src/components/layers/top-bar.tsx b/src/components/layers/top-bar.tsx
index 77d6c103..d2e02ea4 100644
--- a/src/components/layers/top-bar.tsx
+++ b/src/components/layers/top-bar.tsx
@@ -22,6 +22,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip
import { EngineSwitch } from "@/components/studio/engine-switch";
import type { Engine } from "@/lib/catalog/types";
import { timeAgo } from "@/lib/format";
+import { useModKey } from "@/lib/keys";
import { docJson, exportScale, scaledSize, type LayerDoc, type LayerJob, type LayerVersion } from "@/lib/layers";
import { cn } from "@/lib/utils";
import { copyWithToast } from "@/lib/clipboard";
@@ -167,7 +168,7 @@ export function TopBar(p: {
const [historyOpen, setHistoryOpen] = useState(false);
const [restoring, setRestoring] = useState<string | null>(null);
const copyJson = () => void copyWithToast(docJson(p.doc, window.location.origin), "JSON copied");
- const mod = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform) ? "⌘" : "Ctrl";
+ const mod = useModKey();
return (
<header className="flex h-14 shrink-0 items-center gap-1.5 border-b bg-background px-2 sm:px-3">
diff --git a/src/components/studio/attach-menu.tsx b/src/components/studio/attach-menu.tsx
index d24b2411..b3da0520 100644
--- a/src/components/studio/attach-menu.tsx
+++ b/src/components/studio/attach-menu.tsx
@@ -6,6 +6,7 @@ import { toast } from "sonner";
import { Button } from "@/components/ui/button";
import { Kbd } from "@/components/ui/kbd";
import type { MediaKind } from "@/lib/catalog/types";
+import { useModKey } from "@/lib/keys";
import { ACCEPT, LibraryGrid, type SlotValue } from "./media-slot";
import { ResponsivePanel } from "./responsive-panel";
@@ -35,7 +36,7 @@ async function clipboardFiles(): Promise<File[]> {
export function AttachMenu({ kinds, onFiles, onPick }: { kinds: MediaKind[]; onFiles: (files: File[]) => void; onPick: (v: SlotValue) => void }) {
const [open, setOpen] = useState(false);
const input = useRef<HTMLInputElement>(null);
- const mac = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform);
+ const mod = useModKey();
const paste = async () => {
try {
const files = await clipboardFiles();
@@ -43,7 +44,7 @@ export function AttachMenu({ kinds, onFiles, onPick }: { kinds: MediaKind[]; onF
onFiles(files);
setOpen(false);
} catch {
- toast(`Press ${mac ? "⌘V" : "Ctrl+V"} in the prompt to paste`);
+ toast(`Press ${mod === "⌘" ? "⌘V" : "Ctrl+V"} in the prompt to paste`);
}
};
const words = kinds.map((k) => KIND_WORD[k]);
@@ -73,7 +74,7 @@ export function AttachMenu({ kinds, onFiles, onPick }: { kinds: MediaKind[]; onF
<Button variant="secondary" className="h-10 justify-start gap-2" onClick={paste}>
<ClipboardPaste /> Paste
<span className="ml-auto hidden items-center gap-0.5 sm:flex">
- <Kbd>{mac ? "⌘" : "Ctrl"}</Kbd>
+ <Kbd>{mod}</Kbd>
<Kbd>V</Kbd>
</span>
</Button>