The VS Code of video editing, built for agents.
TypeScript
Add APP_SHOW_IN_FOLDER channel and implement reveal functionality
konstantin-paulus6ea190134be2
diff --git a/apps/desktop/src/main-channels.ts b/apps/desktop/src/main-channels.tsindex 40ea7388..3e5fba2f 100644--- a/apps/desktop/src/main-channels.ts+++ b/apps/desktop/src/main-channels.ts@@ -28,6 +28,7 @@ export type MainWireChannel = (typeof MAIN_WIRE)[keyof typeof MAIN_WIRE];export const MAIN_CHANNELS = {// Renderer→Main requestsAPP_OPEN_EXTERNAL: "app:open-external",+ APP_SHOW_IN_FOLDER: "app:show-in-folder",AUTH_GET_PENDING_CALLBACK: "auth:get-pending-callback",CHECKOUT_GET_PENDING_CALLBACK: "checkout:get-pending-callback",WINDOW_IS_FULLSCREEN: "window:is-fullscreen",@@ -126,6 +127,8 @@ export type MainRequestMap = {request: { id: string };response: void;};+ // Reveals a file or folder in the OS file manager (Finder on macOS).+ [MAIN_CHANNELS.APP_SHOW_IN_FOLDER]: { request: { path: string }; response: void };[MAIN_CHANNELS.HEADLESS_GET_MODE]: { request: void; response: boolean };[MAIN_CHANNELS.LOGS_GET]: { request: void; response: LogEntry[] };[MAIN_CHANNELS.PROJECTS_PICK_ROOT]: { request: void; response: string | null };diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.tsindex a02c17be..353ed248 100644--- a/apps/desktop/src/main.ts+++ b/apps/desktop/src/main.ts@@ -253,6 +253,7 @@ if (app.requestSingleInstanceLock()) {});mainBridge.handle(MAIN_CHANNELS.APP_OPEN_EXTERNAL, ({ url }) => shell.openExternal(url));+ mainBridge.handle(MAIN_CHANNELS.APP_SHOW_IN_FOLDER, ({ path }) => shell.showItemInFolder(path));mainBridge.handle(MAIN_CHANNELS.AUTH_GET_PENDING_CALLBACK, () =>takePendingDeepLink(MAIN_CHANNELS.AUTH_CALLBACK),);diff --git a/apps/web/src/components/dashboard/projects-folder-bar.tsx b/apps/web/src/components/dashboard/projects-folder-bar.tsxnew file mode 100644index 00000000..648ddae0--- /dev/null+++ b/apps/web/src/components/dashboard/projects-folder-bar.tsx@@ -0,0 +1,73 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Show } from "solid-js";+import { toast } from "somoto";++import { Button } from "@/components/ui/button";+import { Icon } from "@/components/ui/icon";+import { revealPath } from "@/lib/shell";+import { isDesktop, pickProjectsRoot, projectsRoot } from "@/projects";++/**+ * Footer bar of the projects view: shows the projects root and the actions on+ * it. Desktop only — projects live on disk, so there is no root to show in the+ * browser build (see @/projects).+ */+export function DashboardProjectsFolderBar() {+ const handleChange = async () => {+ try {+ await pickProjectsRoot();+ } catch (e) {+ toast.error("Failed to choose projects folder", { description: (e as Error).message });+ }+ };++ const handleReveal = async () => {+ const root = projectsRoot();+ if (!root) return;++ try {+ await revealPath(root);+ } catch (e) {+ toast.error("Failed to reveal projects folder", { description: (e as Error).message });+ }+ };++ return (+ <Show when={isDesktop()}>+ <div class="flex shrink-0 flex-col gap-3 border-t border-border px-4 py-3">+ <div class="flex items-center gap-4">+ <div class="flex min-w-0 flex-1 items-start gap-2">+ <span class="relative size-4 shrink-0 text-muted-foreground">+ <Icon+ name="navigation.folder"+ class="absolute left-1/2 top-1/2 size-6 -translate-x-1/2 -translate-y-1/2"+ />+ </span>+ <div class="flex min-w-0 flex-1 flex-col justify-center gap-1">+ <p class="h-4 text-xs text-foreground">Project folder</p>+ <p class="min-w-0 truncate text-xs text-muted-foreground">+ {projectsRoot() ?? "No folder selected"}+ </p>+ </div>+ </div>+ <div class="flex shrink-0 items-center gap-2">+ <Button+ variant="ghost"+ class="text-muted-foreground"+ disabled={!projectsRoot()}+ onClick={handleReveal}+ >+ Reveal in finder+ </Button>+ <Button variant="secondary" onClick={handleChange}>+ Change...+ </Button>+ </div>+ </div>+ </div>+ </Show>+ );+}diff --git a/apps/web/src/components/dashboard/projects-view.tsx b/apps/web/src/components/dashboard/projects-view.tsxindex 41f57f72..e77624fc 100644--- a/apps/web/src/components/dashboard/projects-view.tsx+++ b/apps/web/src/components/dashboard/projects-view.tsx@@ -11,7 +11,6 @@ import {ContextMenuSeparator,ContextMenuTrigger,} from "@/components/ui/context-menu";-import { Button } from "@/components/ui/button";import { TextField, TextFieldInput } from "@/components/ui/text-field";import { toast } from "somoto";import { For, Show, batch, createMemo, createResource, createSignal, onCleanup } from "solid-js";@@ -32,6 +31,7 @@ import {DashboardViewSection,} from "./shared";import { DashboardSearchPanel } from "./search-bar";+import { DashboardProjectsFolderBar } from "./projects-folder-bar";import { projectRoute } from "@/hooks/use-project-id";import { Icon } from "../ui/icon";import { track } from "@/lib/analytics";@@ -220,10 +220,6 @@ export function DashboardProjectsView() {title="Recent projects"controls={<>- <Button variant="ghost" onClick={handleChooseRoot} title={projectsRoot() ?? undefined}>- <Icon name="navigation.folder" class="mr-1 size-4" />- {projectsRoot() ? folderLabel(projectsRoot()!) : "Choose projects folder"}- </Button><Select<(typeof SORT_OPTIONS)[number]>options={SORT_OPTIONS}value={selectedSortOption()}@@ -249,7 +245,7 @@ export function DashboardProjectsView() {}><DashboardCardButton onClick={handleCreateProject}>- <DashboardCardPreview class="bg-accent/50 group-hover:bg-accent group-hover:border-input">+ <DashboardCardPreview class="bg-overlay-soft group-hover:bg-overlay"><Iconname="plus-add"class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-muted-foreground"@@ -330,6 +326,7 @@ export function DashboardProjectsView() {)}</For></DashboardViewSection>+ <DashboardProjectsFolderBar /></DashboardSearchPanel>);}@@ -375,10 +372,6 @@ function folderName(name: string): string {.replace(/^[-.]+|[-.]+$/g, "") || "project";}-function folderLabel(path: string): string {- return path.split(/[\\/]/).filter(Boolean).pop() ?? path;-}-function parseTimestamp(value: string): number {const parsed = Date.parse(value);return Number.isNaN(parsed) ? 0 : parsed;diff --git a/apps/web/src/components/dashboard/search-bar.tsx b/apps/web/src/components/dashboard/search-bar.tsxindex 5a8c2967..28f98f47 100644--- a/apps/web/src/components/dashboard/search-bar.tsx+++ b/apps/web/src/components/dashboard/search-bar.tsx@@ -22,7 +22,7 @@ type DashboardSearchPanelProps = {export function DashboardSearchBar(props: DashboardSearchBarProps) {return (- <div class="flex h-11 items-center border-b border-border-strong px-4">+ <div class="flex h-12 shrink-0 items-center border-b border-border px-4"><TextField class="relative flex h-7 w-full items-center gap-0"><div class="grid size-7 place-items-center overflow-clip text-muted-foreground"><Icon name="search" class="size-6" />diff --git a/apps/web/src/components/dashboard/shared.tsx b/apps/web/src/components/dashboard/shared.tsxindex e86d3ae5..196f080c 100644--- a/apps/web/src/components/dashboard/shared.tsx+++ b/apps/web/src/components/dashboard/shared.tsx@@ -88,8 +88,8 @@ type DashboardScrollViewProps = {export function DashboardScrollView(props: DashboardScrollViewProps) {return (- <div class={cx("min-h-0 flex-1 overflow-y-auto px-6 pb-6 pt-4", props.class)}>- <div class="flex flex-col gap-6">{props.children}</div>+ <div class={cx("min-h-0 flex-1 overflow-y-auto px-6 py-12", props.class)}>+ <div class="mx-auto flex w-full max-w-3xl flex-col gap-6">{props.children}</div></div>);}@@ -417,7 +417,7 @@ export function DashboardCardButton(props: DashboardCardButtonProps) {onClick={props.onClick}onKeyDown={handleKeyDown}class={cx(- "flex w-62 shrink-0 flex-col gap-3 rounded-xl p-2 text-left outline-none transition-colors hover:bg-accent/50 focus-ring group",+ "flex w-62 shrink-0 flex-col gap-3 rounded-xl px-2 pt-2 pb-3 text-left outline-none transition-colors hover:bg-accent/50 focus-ring group",props.active && "bg-muted hover:bg-muted ring-1 ring-inset ring-ring",props.class,)}@@ -436,7 +436,7 @@ export function DashboardCardPreview(props: DashboardCardPreviewProps) {return (<divclass={cx(- "bg-canvas relative aspect-video w-full overflow-hidden rounded-md border border-border-strong",+ "bg-canvas relative aspect-video w-full overflow-hidden rounded-md border border-border",props.class,)}>@@ -478,9 +478,9 @@ type DashboardViewSectionProps = {export function DashboardViewSection(props: DashboardViewSectionProps) {return (- <div class={cx("flex min-h-0 flex-1 flex-col gap-4 pt-4", props.class)}>- <div class="flex h-10 items-end gap-6 px-6">- <h1 class="min-w-0 flex-1 text-lg leading-7 font-450 text-foreground">+ <div class={cx("flex min-h-0 flex-1 flex-col gap-3 pt-4", props.class)}>+ <div class="flex items-end gap-6 px-6">+ <h1 class="min-w-0 flex-1 text-2xl leading-6 font-450 text-foreground">{props.title}</h1>{props.controls}diff --git a/apps/web/src/components/dashboard/sidebar.tsx b/apps/web/src/components/dashboard/sidebar.tsxindex 1d327a51..f4184cd3 100644--- a/apps/web/src/components/dashboard/sidebar.tsx+++ b/apps/web/src/components/dashboard/sidebar.tsx@@ -6,7 +6,6 @@ import { Show, type JSX } from "solid-js";import { Icon } from "@/components/ui/icon";import { useAuth } from "@/context/auth";import { useAvatar } from "@/hooks/use-avatar";-import { Separator } from "@/components/ui/separator";import { cx } from "@/lib/cva";type DashboardSidebarItemProps = {@@ -22,10 +21,13 @@ export function DashboardSidebarItem(props: DashboardSidebarItemProps) {<buttontype="button"onClick={props.onClick}- class={cx("flex h-8 w-full items-center rounded-md px-0 hover:bg-accent focus-ring", props.class)}+ class={cx(+ "my-0.5 flex h-7 w-full shrink-0 items-center gap-1 rounded-md pl-0 pr-1 hover:bg-accent focus-ring",+ props.class,+ )}classList={{ "bg-accent": props.active }}>- <span class="grid size-7 place-items-center overflow-clip">+ <span class="grid size-7 shrink-0 place-items-center overflow-clip"><Showwhen={props.active}fallback={<Icon name={props.icon} class="size-6 text-muted-foreground" />}@@ -44,20 +46,20 @@ export function DashboardSidebarItem(props: DashboardSidebarItemProps) {}export function DashboardSidebarHeader() {- const auth = useAuth();-return (// Extra top padding on the macOS desktop build clears the traffic lights// (hiddenInset title bar), except in fullscreen where they are gone.- <div class="flex flex-col items-start gap-3 p-4 [[data-platform=darwin]:not([data-fullscreen=true])_&]:pt-12">+ <div class="flex flex-col items-start gap-3 p-4 [[data-platform=darwin]:not([data-fullscreen=true])_&]:pt-14"><Icon name="diffusion-logo-large" class="size-6 text-muted-foreground" />- <div class="flex h-10 w-full flex-col items-start gap-1 text-muted-foreground">- <p class="w-full text-base leading-5 font-450 text-muted-foreground">- {auth.isPro() ? "Diffusion Studio Pro" : "Diffusion Studio"}- </p>- <p class="w-full overflow-hidden text-xxs whitespace-nowrap text-ellipsis text-muted-foreground">- v{APP_VERSION}+ <div class="flex w-full flex-col items-start gap-1 text-muted-foreground">+ <p class="w-full text-2xl leading-5 font-450 text-muted-foreground">+ Diffusion Studio</p>+ <div class="flex w-full items-center py-0.5">+ <p class="w-full overflow-hidden text-xxs whitespace-nowrap text-ellipsis text-muted-foreground opacity-50">+ v{APP_VERSION}+ </p>+ </div></div></div>);@@ -65,21 +67,24 @@ export function DashboardSidebarHeader() {type DashboardSidebarNavProps = {children: JSX.Element;+ footer: JSX.Element;};export function DashboardSidebarNav(props: DashboardSidebarNavProps) {return (- <div class="flex min-h-0 flex-1 flex-col gap-2 px-4">- <Separator />- <div class="flex min-h-0 flex-1 flex-col gap-1">- <div class="flex h-8 items-center px-1">- <p class="text-xs font-450 text-muted-foreground">+ <div class="flex min-h-0 flex-1 flex-col gap-2 px-3">+ <div class="flex shrink-0 flex-col">+ <div class="flex h-8 shrink-0 items-center px-1">+ <p class="text-xs text-muted-foreground">Get Started</p></div>{props.children}</div>- <Separator />+ <div class="min-h-0 flex-1" />+ <div class="flex shrink-0 flex-col">+ {props.footer}+ </div></div>);}diff --git a/apps/web/src/context/dapi/api.tsx b/apps/web/src/context/dapi/api.tsxindex 5f6931ce..b9ea095f 100644--- a/apps/web/src/context/dapi/api.tsx+++ b/apps/web/src/context/dapi/api.tsx@@ -2,7 +2,7 @@* License, v. 2.0. If a copy of the MPL was not distributed with this* file, You can obtain one at http://mozilla.org/MPL/2.0/. */-import { createEffect, createContext, useContext, onCleanup, onMount, createResource } from "solid-js";+import { createEffect, createContext, useContext, onCleanup } from "solid-js";import { useEngine } from '@/context/engine';import { useWorld } from '@diffusionstudio/koota-solid';import { useProjectId } from '@/hooks/use-project-id';@@ -14,11 +14,11 @@ import { handleCapture } from "./capture";import { handleLogs } from "./logs";import { handleModels } from "./models";import { handleVoices } from "./voices";-import { cliBridge, mainBridge } from '@/lib/ipc';+import { cliBridge } from '@/lib/ipc';import { createRouterCaller } from '@/lib/cli-rpc';-import { MAIN_CHANNELS } from '@desktop/main-channels';import { assert } from "@/utils/common";-import { handleGetFullscreenState, handleWindowFullscreenChange, handleWindowScreenshot } from "./window";+import { handleWindowScreenshot } from "./window";+import { useFullscreenState } from "@/hooks/use-fullscreen-state";import type { JSX, Accessor } from 'solid-js';import type { User } from '@supabase/supabase-js';@@ -40,7 +40,7 @@ export function EditorApiProvider(props: EditorApiProviderProps) {const projectId = useProjectId();const engine = useEngine();const auth = useAuth();- const [isFullscreen, { mutate }] = createResource(handleGetFullscreenState, { initialValue: false });+ const isFullscreen = useFullscreenState();const requireAuth = <I, O>(fn: (data: I) => Promise<O>) => (data: I) => {assert(auth.isAuthenticated(), "Sign in required: AI generation needs a Diffusion Studio account.");@@ -56,15 +56,6 @@ export function EditorApiProvider(props: EditorApiProviderProps) {const getEngine = () => engine;const world = useWorld();- createEffect(() => {- document.documentElement.dataset.fullscreen = String(isFullscreen());- });-- onMount(() => {- if (!window.desktop) return;- onCleanup(mainBridge.handle(MAIN_CHANNELS.WINDOW_FULLSCREEN_CHANGE, handleWindowFullscreenChange(mutate)));- });-createEffect(() => {if (!window.desktop || !engine.initialized() || projectId() !== engine.world.projectId) return;diff --git a/apps/web/src/hooks/use-fullscreen-state.ts b/apps/web/src/hooks/use-fullscreen-state.tsnew file mode 100644index 00000000..8823fcbe--- /dev/null+++ b/apps/web/src/hooks/use-fullscreen-state.ts@@ -0,0 +1,40 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createEffect, createResource, onCleanup, onMount } from "solid-js";++import { handleGetFullscreenState, handleWindowFullscreenChange } from "@/context/dapi/window";+import { mainBridge } from "@/lib/ipc";+import { MAIN_CHANNELS } from "@desktop/main-channels";++/**+ * Tracks the desktop window's fullscreen state and mirrors it onto+ * `<html data-fullscreen>`, which the theme reads to decide whether the macOS+ * vibrancy background applies (it does not in fullscreen, where the window is+ * opaque and the traffic lights are gone).+ *+ * Every screen that renders against the vibrancy background needs this, so it+ * lives here rather than inside the editor-only API provider.+ */+export function useFullscreenState() {+ const [isFullscreen, { mutate }] = createResource(handleGetFullscreenState, {+ initialValue: false,+ });++ createEffect(() => {+ document.documentElement.dataset.fullscreen = String(isFullscreen());+ });++ onMount(() => {+ if (!window.desktop) return;+ onCleanup(+ mainBridge.handle(+ MAIN_CHANNELS.WINDOW_FULLSCREEN_CHANGE,+ handleWindowFullscreenChange(mutate),+ ),+ );+ });++ return isFullscreen;+}diff --git a/apps/web/src/index.css b/apps/web/src/index.cssindex 45301cb9..9a823c88 100644--- a/apps/web/src/index.css+++ b/apps/web/src/index.css@@ -158,7 +158,7 @@--ring: hsla(207, 100%, 50%, 1);--canvas: hsla(0, 0%, 91%, 1);--overlay: hsla(0, 0%, 4%, 0.8);- --overlay-soft: hsla(0, 0%, 9%, 0.4);+ --overlay-soft: hsla(0, 0%, 4%, 0.4);--overlay-strong: hsla(0, 0%, 4%, 0.93);--selection: hsla(207, 100%, 50%, 1);--selection-foreground: hsla(207, 100%, 90%, 1);@@ -212,7 +212,7 @@--ring: hsla(207, 100%, 50%, 1);--canvas: hsla(0, 0%, 9%, 1);--overlay: hsla(0, 0%, 4%, 0.8);- --overlay-soft: hsla(0, 0%, 9%, 0.4);+ --overlay-soft: hsla(0, 0%, 4%, 0.4);--overlay-strong: hsla(0, 0%, 4%, 0.95);--selection: hsla(207, 99%, 22%, 1);--selection-foreground: hsla(207, 100%, 90%, 1);diff --git a/apps/web/src/lib/shell.ts b/apps/web/src/lib/shell.tsnew file mode 100644index 00000000..65a9291c--- /dev/null+++ b/apps/web/src/lib/shell.ts@@ -0,0 +1,19 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Renderer-side wrappers for OS shell actions, which only the desktop main+// process can perform. Off the desktop build there is no shell to talk to, so+// these are no-ops rather than errors.++import { MAIN_CHANNELS } from "@desktop/main-channels";+import { mainBridge } from "@/lib/ipc";++/**+ * Reveals a file or folder in the OS file manager — Finder on macOS, Explorer+ * on Windows — selecting it inside its parent folder.+ */+export async function revealPath(path: string): Promise<void> {+ if (!window.desktop || !path) return;+ await mainBridge.call(MAIN_CHANNELS.APP_SHOW_IN_FOLDER, { path });+}diff --git a/apps/web/src/pages/dashboard.tsx b/apps/web/src/pages/dashboard.tsxindex f4bb39da..935097be 100644--- a/apps/web/src/pages/dashboard.tsx+++ b/apps/web/src/pages/dashboard.tsx@@ -14,6 +14,7 @@ import { DashboardProjectsView } from "@/components/dashboard/projects-view";import { DashboardSettingsView } from "@/components/dashboard/settings-view";import { DashboardSidebarHeader, DashboardSidebarNav, DashboardSidebarUser, DashboardSidebarItem } from "@/components/dashboard/sidebar";import { Separator } from "@/components/ui/separator";+import { useFullscreenState } from "@/hooks/use-fullscreen-state";import type { DashboardView } from "@/components/dashboard/types";@@ -35,30 +36,36 @@ function parseView(value: string | string[] | undefined): DashboardView {export function DashboardPage() {const [params, setParams] = useSearchParams();+ const isFullscreen = useFullscreenState();const view = (): DashboardView => parseView(params.dashboard);const setView = (next: DashboardView) => setParams({ dashboard: next }, { replace: true });return (- <div class="flex h-screen w-full min-h-0 flex-row overflow-hidden bg-background">- <Show when={!!window.desktop}>- <div class="fixed top-0 left-0 right-0 h-10 z-20" style="-webkit-app-region: drag;" />- </Show>- <aside class="flex min-h-0 w-66 shrink-0 flex-col bg-card">+ <div class="flex h-screen w-full min-h-0 flex-row overflow-hidden bg-sidebar">+ <aside class="relative flex min-h-0 w-69 shrink-0 flex-col">+ <Show when={!!window.desktop && !isFullscreen()}>+ <div class="absolute inset-x-0 top-0 h-10 z-20" style="-webkit-app-region: drag;" />+ </Show><DashboardSidebarHeader />- <DashboardSidebarNav>+ <DashboardSidebarNav+ footer={+ <>+ <DashboardSidebarItem active={view() === "ai-credits"} onClick={() => setView("ai-credits")} icon="ai-generate" label="AI credits" />+ <DashboardSidebarItem active={view() === "billing"} onClick={() => setView("billing")} icon="billing" label="Billing" />+ <DashboardSidebarItem active={view() === "settings"} onClick={() => setView("settings")} icon="settings" label="Settings" />+ <DashboardSidebarItem active={view() === "help"} onClick={() => setView("help")} icon="help" label="Help" />+ </>+ }+ ><DashboardSidebarItem active={view() === "projects"} onClick={() => setView("projects")} icon="diffusion-project-file" label="Projects" />- <DashboardSidebarItem active={view() === "ai-credits"} onClick={() => setView("ai-credits")} icon="ai-generate" label="AI credits" class="mt-auto" />- <DashboardSidebarItem active={view() === "billing"} onClick={() => setView("billing")} icon="billing" label="Billing" />- <DashboardSidebarItem active={view() === "settings"} onClick={() => setView("settings")} icon="settings" label="Settings" />- <DashboardSidebarItem active={view() === "help"} onClick={() => setView("help")} icon="help" label="Help" /></DashboardSidebarNav><DashboardSidebarUser active={view() === "account"} onClick={() => setView("account")} /></aside><Separator orientation="vertical" class="bg-border-strong" />- <section class="flex min-h-0 flex-1 flex-col bg-canvas">+ <section class="flex min-h-0 flex-1 flex-col bg-overlay-soft"><Switch><Match when={view() === "projects"}><DashboardProjectsView />