Skip to content

The VS Code of video editing, built for agents.

TypeScript

Add desktop app promotion components and download functionality

konstantin-paulus9dbc4096b366
diff --git a/apps/web/src/assets/icons/download.svg b/apps/web/src/assets/icons/download.svg
new file mode 100644
index 00000000..1b9c2426
--- /dev/null
+++ b/apps/web/src/assets/icons/download.svg
@@ -0,0 +1,3 @@
+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M7.49995 16.5H16.4999C16.6249 16.4998 16.7454 16.5463 16.8377 16.6305C16.9301 16.7147 16.9875 16.8304 16.9988 16.9548C17.0101 17.0793 16.9744 17.2034 16.8987 17.3028C16.823 17.4023 16.7129 17.4697 16.5899 17.492L16.4999 17.5H7.49995C7.375 17.5002 7.25449 17.4537 7.16216 17.3695C7.06983 17.2853 7.01236 17.1696 7.00107 17.0452C6.98978 16.9207 7.02549 16.7966 7.10116 16.6972C7.17684 16.5977 7.287 16.5303 7.40995 16.508L7.49995 16.5ZM11.9099 6.508L11.9999 6.5C12.117 6.49996 12.2303 6.54097 12.3202 6.61589C12.4101 6.69081 12.4709 6.79489 12.4919 6.91L12.4999 7V13.792L14.1819 12.111C14.2647 12.0282 14.3738 11.977 14.4904 11.9664C14.607 11.9558 14.7236 11.9864 14.8199 12.053L14.8899 12.111C14.9726 12.1939 15.0236 12.3031 15.034 12.4197C15.0444 12.5363 15.0136 12.6528 14.9469 12.749L14.8889 12.818L12.3539 15.354C12.2711 15.4367 12.1619 15.4877 12.0453 15.4981C11.9287 15.5085 11.8121 15.4777 11.7159 15.411L11.6459 15.354L9.11095 12.818C9.02236 12.7298 8.97002 12.6116 8.96424 12.4868C8.95846 12.3619 8.99966 12.2394 9.07972 12.1434C9.15978 12.0474 9.27289 11.9849 9.39676 11.9682C9.52063 11.9514 9.64628 11.9817 9.74895 12.053L9.81795 12.111L11.4999 13.792V7C11.4999 6.88297 11.5409 6.76964 11.6158 6.67974C11.6908 6.58984 11.7948 6.52906 11.9099 6.508Z" fill="currentColor"/>
+</svg>
diff --git a/apps/web/src/components/canvas/desktop-app-banner.tsx b/apps/web/src/components/canvas/desktop-app-banner.tsx
index 8ce92acd..2923e4f3 100644
--- a/apps/web/src/components/canvas/desktop-app-banner.tsx
+++ b/apps/web/src/components/canvas/desktop-app-banner.tsx
@@ -7,30 +7,15 @@ import { Button } from "@/components/ui/button";
import { Icon } from "@/components/ui/icon";
import { useEditorApi } from "@/context/editor-api";
import { createStoredSignal } from "@/lib/store";
+import { downloadDesktopApp } from "@/lib/desktop-app";
import { track } from "@/lib/analytics";
import { store } from "@/init";
const BANNER_IMAGE = new URL("@/assets/images/desktop-app-banner.png", import.meta.url).href;
-/**
- * Electron Forge only makes darwin artifacts, so releases are macOS-only, and
- * the DMG name is version-independent (see `MakerDMG` in `forge.config.ts`) —
- * which is what lets GitHub's `/releases/latest/download/` alias resolve to the
- * newest build. The asset is served with `Content-Disposition: attachment`, so
- * hitting it downloads instead of navigating away from the editor.
- */
-const DOWNLOAD_URL =
- "https://github.com/diffusionstudio/editor/releases/latest/download/Diffusion-Studio-arm64.dmg";
-
-function isMacOS() {
- const uaData = (navigator as { userAgentData?: { platform?: string } }).userAgentData;
- return /mac/i.test(uaData?.platform ?? navigator.platform);
-}
-
/**
* Dismissible promo for the desktop app, pinned to the bottom left of the
- * canvas. Only shown in the browser build on macOS — the desktop app is the
- * thing being advertised, and it only ships for macOS.
+ * canvas. Hidden in the desktop build, which is the thing being advertised.
*/
export function DesktopAppBanner() {
const { isDesktop } = useEditorApi();
@@ -39,23 +24,14 @@ export function DesktopAppBanner() {
);
const handleDismiss = () => {
- track("desktop_app_banner_dismissed");
+ track("desktop_app_banner_dismissed", { source: "canvas_banner" });
setDismissed(true);
};
- const handleDownload = () => {
- track("desktop_app_banner_download");
-
- const a = document.createElement("a");
- a.href = DOWNLOAD_URL;
- a.download = "";
- document.body.appendChild(a);
- a.click();
- a.remove();
- };
+ const handleDownload = () => downloadDesktopApp("canvas_banner");
return (
- <Show when={!dismissed() && !isDesktop && isMacOS()}>
+ <Show when={!dismissed() && !isDesktop}>
<div class="absolute bottom-4 left-4 z-10 flex w-[220px] flex-col gap-1 rounded-md border border-border bg-background pb-3 shadow-[0px_0px_1px_2px_rgba(0,0,0,0.12),0px_4px_12px_8px_rgba(0,0,0,0.12)]">
<div class="relative aspect-[220/122] w-full overflow-hidden rounded-t-md">
<img src={BANNER_IMAGE} alt="" class="pointer-events-none size-full object-cover" />
diff --git a/apps/web/src/components/dashboard/dashboard.tsx b/apps/web/src/components/dashboard/dashboard.tsx
index 996405c1..8813b172 100644
--- a/apps/web/src/components/dashboard/dashboard.tsx
+++ b/apps/web/src/components/dashboard/dashboard.tsx
@@ -10,6 +10,7 @@ import { Dialog, DialogContent, DialogPortal } from "@/components/ui/dialog";
import { DashboardAccountView } from "./account-view";
import { DashboardAiCreditsView } from "./ai-credits-view";
import { DashboardBillingView } from "./billing-view";
+import { DashboardGetDesktopApp } from "./get-desktop-app";
import { DashboardHelpView } from "./help-view";
import { DashboardProjectsView } from "./projects-view";
import { DashboardSettingsView } from "./settings-view";
@@ -93,6 +94,7 @@ export function Dashboard() {
<DashboardHelpView />
</Match>
</Switch>
+ <DashboardGetDesktopApp />
</section>
</div>
</DialogContent>
diff --git a/apps/web/src/components/dashboard/get-desktop-app.tsx b/apps/web/src/components/dashboard/get-desktop-app.tsx
new file mode 100644
index 00000000..0671eece
--- /dev/null
+++ b/apps/web/src/components/dashboard/get-desktop-app.tsx
@@ -0,0 +1,67 @@
+/* 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 { Button } from "@/components/ui/button";
+import {
+ ContextMenu,
+ ContextMenuContent,
+ ContextMenuItem,
+ ContextMenuPortal,
+ ContextMenuTrigger,
+} from "@/components/ui/context-menu";
+import { useEditorApi } from "@/context/editor-api";
+import { downloadDesktopApp } from "@/lib/desktop-app";
+import { createStoredSignal } from "@/lib/store";
+import { track } from "@/lib/analytics";
+import { store } from "@/init";
+
+/**
+ * Promo bar pinned below the dashboard content. Like the canvas banner, it is
+ * hidden in the desktop build, which is the thing it advertises.
+ *
+ * The design has no dismiss affordance, so hiding it lives in a right-click
+ * context menu on the bar itself.
+ */
+export function DashboardGetDesktopApp() {
+ const { isDesktop } = useEditorApi();
+ const [hidden, setHidden] = createStoredSignal(
+ store.define("dashboard.desktop-app-promo-hidden", false),
+ );
+
+ const handleHide = () => {
+ track("desktop_app_banner_dismissed", { source: "dashboard_footer" });
+ setHidden(true);
+ };
+
+ return (
+ <Show when={!isDesktop && !hidden()}>
+ <ContextMenu>
+ <ContextMenuTrigger
+ as="div"
+ class="flex shrink-0 items-center gap-4 border-t border-border bg-background px-6 py-4"
+ >
+ <div class="flex min-w-0 flex-1 items-center gap-3">
+ <img src="/mark-macos-small.png" alt="" class="size-8 shrink-0" />
+ <div class="flex min-w-0 flex-1 flex-col gap-0.5">
+ <p class="text-xs font-450 leading-4 text-foreground">Get desktop app</p>
+ <p class="text-xxs leading-3.5 text-muted-foreground">
+ The Mac app lets Claude Code, Codex, and any coding agents work with your footage
+ and project.
+ </p>
+ </div>
+ </div>
+ <Button variant="secondary" onClick={() => downloadDesktopApp("dashboard_footer")}>
+ Download for macOS
+ </Button>
+ </ContextMenuTrigger>
+ <ContextMenuPortal>
+ <ContextMenuContent class="w-45 gap-0">
+ <ContextMenuItem onSelect={handleHide}>Don&apos;t show again</ContextMenuItem>
+ </ContextMenuContent>
+ </ContextMenuPortal>
+ </ContextMenu>
+ </Show>
+ );
+}
diff --git a/apps/web/src/components/sidebar-left/project-menu/index.tsx b/apps/web/src/components/sidebar-left/project-menu/index.tsx
index 96c36551..d3c32af8 100644
--- a/apps/web/src/components/sidebar-left/project-menu/index.tsx
+++ b/apps/web/src/components/sidebar-left/project-menu/index.tsx
@@ -16,6 +16,9 @@ import {
DropdownMenuGroup,
} from "@/components/ui/dropdown-menu";
import { useSearchParams } from "@solidjs/router";
+import { Show } from "solid-js";
+import { useEditorApi } from "@/context/editor-api";
+import { downloadDesktopApp } from "@/lib/desktop-app";
import { FileMenu } from "./file-menu";
import { EditMenu } from "./edit-menu";
import { ViewMenu } from "./view-menu";
@@ -25,6 +28,7 @@ import { HelpMenu } from "./help-menu";
export function ProjectMenu() {
const [, setParams] = useSearchParams();
+ const { isDesktop } = useEditorApi();
const handleOpenDashboard = () => {
(document.activeElement as HTMLElement)?.blur?.();
@@ -50,7 +54,7 @@ export function ProjectMenu() {
</div>
</DropdownMenuTrigger>
<DropdownMenuPortal>
- <DropdownMenuContent class="w-[188px]">
+ <DropdownMenuContent class="w-[196px]">
<DropdownMenuGroup>
<DropdownMenuItem onSelect={handleOpenDashboard}>
Go to dashboard
@@ -120,6 +124,22 @@ export function ProjectMenu() {
<DropdownMenuItem onSelect={handleOpenAccount}>Account</DropdownMenuItem>
</DropdownMenuGroup>
+
+ <Show when={!isDesktop}>
+ <DropdownMenuSeparator />
+
+ <DropdownMenuGroup>
+ <DropdownMenuItem
+ class="gap-1 pl-0 pr-2"
+ onSelect={() => downloadDesktopApp("main_menu")}
+ >
+ <span class="grid h-7 w-6 shrink-0 place-items-center overflow-clip">
+ <Icon name="download" class="size-6" />
+ </span>
+ Get desktop app (macOS)
+ </DropdownMenuItem>
+ </DropdownMenuGroup>
+ </Show>
</DropdownMenuContent>
</DropdownMenuPortal>
</DropdownMenu>
diff --git a/apps/web/src/lib/desktop-app.ts b/apps/web/src/lib/desktop-app.ts
new file mode 100644
index 00000000..160e4e49
--- /dev/null
+++ b/apps/web/src/lib/desktop-app.ts
@@ -0,0 +1,51 @@
+/* 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 { toast } from "somoto";
+
+import { track } from "@/lib/analytics";
+
+/**
+ * Electron Forge only makes darwin artifacts, so releases are macOS-only, and
+ * the DMG name is version-independent (see `MakerDMG` in `forge.config.ts`) —
+ * which is what lets GitHub's `/releases/latest/download/` alias resolve to the
+ * newest build.
+ */
+const DOWNLOAD_URL =
+ "https://github.com/diffusionstudio/editor/releases/latest/download/Diffusion-Studio-arm64.dmg";
+
+/** Where a download was started from, so the promos can be compared. */
+export type DesktopAppDownloadSource = "canvas_banner" | "dashboard_footer" | "main_menu";
+
+function isMacOS() {
+ const uaData = (navigator as { userAgentData?: { platform?: string } }).userAgentData;
+ return /mac/i.test(uaData?.platform ?? navigator.platform);
+}
+
+/**
+ * Pulls the latest DMG. GitHub serves the asset with `Content-Disposition:
+ * attachment`, so this starts a download rather than navigating away.
+ *
+ * The promos run on every platform to gauge interest, but there is only a
+ * macOS build to hand out — everywhere else this explains that instead.
+ */
+export function downloadDesktopApp(source: DesktopAppDownloadSource) {
+ const supported = isMacOS();
+ track("desktop_app_download", { source, supported });
+
+ if (!supported) {
+ toast("Available for macOS only", {
+ description:
+ "The desktop app currently ships as a macOS build. Open Diffusion Studio on a Mac to install it.",
+ });
+ return;
+ }
+
+ const a = document.createElement("a");
+ a.href = DOWNLOAD_URL;
+ a.download = "";
+ document.body.appendChild(a);
+ a.click();
+ a.remove();
+}