Skip to content

The VS Code of video editing, built for agents.

TypeScript

Refactor dashboard components for improved Windows support and search functionality

konstantin-paulus790477402321
diff --git a/apps/web/src/agent-chat/chat-panel.tsx b/apps/web/src/agent-chat/chat-panel.tsx
index b5618870..e848eeaa 100644
--- a/apps/web/src/agent-chat/chat-panel.tsx
+++ b/apps/web/src/agent-chat/chat-panel.tsx
@@ -137,7 +137,7 @@ export function ChatPanel() {
return (
<div class="flex flex-1 min-h-0 flex-col">
- <div class="flex h-12 shrink-0 items-center border-y border-border px-4">
+ <div class="flex h-12 shrink-0 items-center border-y border-border px-4 [[data-platform=win32]_&]:border-t-0">
<SidebarTabs />
<HeaderActions
projectId={project.id()}
diff --git a/apps/web/src/components/dashboard/billing-view.tsx b/apps/web/src/components/dashboard/billing-view.tsx
index 6f5d9d10..8bffb8ec 100644
--- a/apps/web/src/components/dashboard/billing-view.tsx
+++ b/apps/web/src/components/dashboard/billing-view.tsx
@@ -42,8 +42,9 @@ export function DashboardBillingView() {
return (
<div class="min-h-0 flex-1 overflow-y-auto">
<div class="flex min-h-full flex-col">
- <div class="sticky top-0 z-10 flex h-12 items-center border-b border-border bg-background px-4">
- <div class="flex items-center gap-6">
+ {/* Level with the native window controls on Windows, like the search bar. */}
+ <div class="sticky top-0 z-10 flex h-12 items-center border-b border-border bg-background px-4 [[data-platform=win32]_&]:h-10 [[data-platform=win32]_&]:[-webkit-app-region:drag]">
+ <div class="flex items-center gap-6 [-webkit-app-region:no-drag]">
<DashboardBillingTabButton
label="Plans"
active={activeTab() === "plans"}
diff --git a/apps/web/src/components/dashboard/projects-view.tsx b/apps/web/src/components/dashboard/projects-view.tsx
index f36ca673..8841cf78 100644
--- a/apps/web/src/components/dashboard/projects-view.tsx
+++ b/apps/web/src/components/dashboard/projects-view.tsx
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { toast } from "somoto";
-import { For, createMemo, createResource, createSignal, type Accessor } from "solid-js";
+import { For, createMemo, createResource, createSignal } from "solid-js";
import { useNavigate } from "@solidjs/router";
import {
@@ -31,7 +31,6 @@ import { projectRoute, useReturnHere } from "@/hooks/use-project-route";
import { Icon } from "../ui/icon";
import { track } from "@/lib/analytics";
import {
- isWindowsDesktop,
listProjects,
projectKey,
projectsRevision,
@@ -40,14 +39,10 @@ import {
import type { ProjectSortOption } from "./types";
-type DashboardProjectsViewProps = {
- search: Accessor<string>;
- onSearchChange: (value: string) => void;
-};
-
-export function DashboardProjectsView(props: DashboardProjectsViewProps) {
+export function DashboardProjectsView() {
const navigate = useNavigate();
const returnHere = useReturnHere();
+ const [search, setSearch] = createSignal("");
const [sort, setSort] = createSignal<ProjectSortOption>("last-viewed");
const [projects, { refetch: refetchProjects }] = createResource(projectsRevision, () => listProjects());
const [selectedProject, setSelectedProject] = createSignal<string | null>(null);
@@ -57,7 +52,7 @@ export function DashboardProjectsView(props: DashboardProjectsViewProps) {
const selectedSortOption = () =>
SORT_OPTIONS.find((option) => option.id === sort()) ?? SORT_OPTIONS[0];
- const normalizedSearch = createMemo(() => props.search().trim().toLowerCase());
+ const normalizedSearch = createMemo(() => search().trim().toLowerCase());
const filteredProjects = createMemo(() => {
const query = normalizedSearch();
@@ -118,10 +113,9 @@ export function DashboardProjectsView(props: DashboardProjectsViewProps) {
return (
<DashboardSearchPanel
- value={props.search}
- onChange={props.onSearchChange}
+ value={search}
+ onChange={setSearch}
placeholder="Search in projects"
- showBar={!isWindowsDesktop()}
>
<DashboardViewSection
class="pb-4"
diff --git a/apps/web/src/components/dashboard/search-bar.tsx b/apps/web/src/components/dashboard/search-bar.tsx
index 6b8fee5a..de6b5375 100644
--- a/apps/web/src/components/dashboard/search-bar.tsx
+++ b/apps/web/src/components/dashboard/search-bar.tsx
@@ -2,32 +2,28 @@
* 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, type Accessor, type JSX } from "solid-js";
+import { type Accessor, type JSX } from "solid-js";
import { Icon } from "@/components/ui/icon";
import { TextField } from "@/components/ui/text-field";
-import { cx } from "@/lib/cva";
type DashboardSearchBarProps = {
value: Accessor<string>;
onChange: (value: string) => void;
placeholder: string;
- class?: string;
};
type DashboardSearchPanelProps = {
value: Accessor<string>;
onChange: (value: string) => void;
placeholder: string;
- /** False where the search field lives elsewhere (the Windows title bar). */
- showBar?: boolean;
children: JSX.Element;
};
export function DashboardSearchBar(props: DashboardSearchBarProps) {
return (
- <div class={cx("flex h-12 shrink-0 items-center border-b border-border px-4", props.class)}>
- <TextField class="relative flex h-7 w-full items-center gap-0" style="-webkit-app-region: no-drag;">
+ <div class="flex h-12 shrink-0 items-center border-b border-border pl-4 pr-[calc(1rem+var(--titlebar-controls-width))] [[data-platform=win32]_&]:h-10 [[data-platform=win32]_&]:[-webkit-app-region:drag]">
+ <TextField class="relative flex h-7 w-full items-center gap-0 [-webkit-app-region:no-drag]">
<div class="grid size-7 place-items-center overflow-clip text-muted-foreground">
<Icon name="search" class="size-6" />
</div>
@@ -53,13 +49,11 @@ export function DashboardSearchBar(props: DashboardSearchBarProps) {
export function DashboardSearchPanel(props: DashboardSearchPanelProps) {
return (
<div class="flex min-h-0 flex-1 flex-col">
- <Show when={props.showBar ?? true}>
- <DashboardSearchBar
- value={props.value}
- onChange={props.onChange}
- placeholder={props.placeholder}
- />
- </Show>
+ <DashboardSearchBar
+ value={props.value}
+ onChange={props.onChange}
+ placeholder={props.placeholder}
+ />
{props.children}
</div>
);
diff --git a/apps/web/src/components/dashboard/sidebar.tsx b/apps/web/src/components/dashboard/sidebar.tsx
index 0a600ea5..a48046b6 100644
--- a/apps/web/src/components/dashboard/sidebar.tsx
+++ b/apps/web/src/components/dashboard/sidebar.tsx
@@ -66,6 +66,20 @@ export function DashboardSidebarHeader() {
);
}
+/**
+ * The header on the Windows desktop build: one row at the height of the native
+ * window controls, which reads as the left end of the title bar.
+ */
+export function DashboardSidebarTitleBar() {
+ return (
+ <div class="flex h-10 shrink-0 items-center gap-2 pl-3 pr-4">
+ <Icon name="diffusion-logo" class="size-6 shrink-0 text-muted-foreground" />
+ <p class="min-w-0 flex-1 truncate text-xs font-450 text-muted-foreground">Diffusion Studio</p>
+ <p class="shrink-0 text-xxs text-muted-foreground">v{APP_VERSION}</p>
+ </div>
+ );
+}
+
/**
* Stands in for the header when the sidebar has none. On the macOS desktop
* build it clears the traffic lights (hiddenInset title bar), except in
diff --git a/apps/web/src/components/sidebar-left/assets.tsx b/apps/web/src/components/sidebar-left/assets.tsx
index 18a1cb16..e29a95f5 100644
--- a/apps/web/src/components/sidebar-left/assets.tsx
+++ b/apps/web/src/components/sidebar-left/assets.tsx
@@ -310,7 +310,7 @@ export function Assets() {
ref={root}
onKeyDown={handleKeyDown}
>
- <div class="h-12 shrink-0 flex items-center gap-2 px-4 border-y border-border">
+ <div class="h-12 shrink-0 flex items-center gap-2 px-4 border-y border-border [[data-platform=win32]_&]:border-t-0">
<div class="flex-1 min-w-0 flex items-center">
<SidebarTabs />
</div>
diff --git a/apps/web/src/components/ui/windows-title-bar.tsx b/apps/web/src/components/ui/windows-title-bar.tsx
index 8f6037da..21103264 100644
--- a/apps/web/src/components/ui/windows-title-bar.tsx
+++ b/apps/web/src/components/ui/windows-title-bar.tsx
@@ -22,13 +22,17 @@ type WindowsTitleBarProps = {
* The title bar of the Windows desktop build: a fixed row under the native
* minimize/maximize/close overlay. The whole row drags the window, so anything
* interactive inside it has to opt out with `-webkit-app-region: no-drag`.
- * Renders nothing on other platforms; pages clear it with `--titlebar-height`.
+ * Its bottom border runs the full width, so the first row of the left sidebar
+ * drops its own top border on Windows.
+ * Renders nothing on other platforms; the editor clears it with
+ * `--titlebar-height`. The dashboard has no such row: its sidebar header and
+ * view headers line up with the controls instead.
*/
export function WindowsTitleBar(props: WindowsTitleBarProps) {
return (
<Show when={isWindowsDesktop()}>
<div
- class="fixed inset-x-0 top-0 z-20 flex h-(--titlebar-height) bg-sidebar"
+ class="fixed inset-x-0 top-0 z-20 flex h-(--titlebar-height) border-b border-border bg-sidebar"
style="-webkit-app-region: drag;"
>
<div
diff --git a/apps/web/src/index.css b/apps/web/src/index.css
index a54fa381..a3250234 100644
--- a/apps/web/src/index.css
+++ b/apps/web/src/index.css
@@ -233,9 +233,8 @@
--titlebar-height: 0px;
}
-/* Windows desktop: the dashboard and the editor draw their own title bar
- (`WindowsTitleBar`) as a fixed row under the native controls, and pad their
- root by this height. It matches `WINDOWS_OVERLAY_HEIGHT` in the main process. */
+/* Windows desktop: the editor draws its own title bar (`WindowsTitleBar`) as a
+ fixed row under the native controls, and pads its root by this height. It matches `WINDOWS_OVERLAY_HEIGHT` in the main process. */
[data-platform="win32"] {
--titlebar-height: 40px;
}
diff --git a/apps/web/src/pages/dashboard.tsx b/apps/web/src/pages/dashboard.tsx
index 7ee8be58..04d023e0 100644
--- a/apps/web/src/pages/dashboard.tsx
+++ b/apps/web/src/pages/dashboard.tsx
@@ -14,7 +14,6 @@ import { DashboardHelpView } from "@/components/dashboard/help-view";
import { DashboardHomeView } from "@/components/dashboard/home-view";
import { DashboardMcpView } from "@/components/dashboard/mcp-view";
import { DashboardProjectsView } from "@/components/dashboard/projects-view";
-import { DashboardSearchBar } from "@/components/dashboard/search-bar";
import { DashboardSettingsView } from "@/components/dashboard/settings-view";
import {
DashboardSidebarConnectCard,
@@ -22,12 +21,11 @@ import {
DashboardSidebarItem,
DashboardSidebarNav,
DashboardSidebarSection,
+ DashboardSidebarTitleBar,
DashboardSidebarTopSpacer,
DashboardSidebarUser,
} from "@/components/dashboard/sidebar";
-import { Icon } from "@/components/ui/icon";
import { Separator } from "@/components/ui/separator";
-import { WindowsTitleBar } from "@/components/ui/windows-title-bar";
import { useFullscreenState } from "@/hooks/use-fullscreen-state";
import { connectedAgents, fetchMcpStatus } from "@/lib/mcp";
import { isDesktop, isWindowsDesktop, openProjectFolder, pickProjectFolder } from "@/projects";
@@ -58,11 +56,6 @@ const SETTINGS_VIEWS: readonly DashboardView[] = [
"help",
];
-// The title bar's left cell spans the sidebar (`w-69`) plus its 1px separator,
-// so both borders fall on the same line.
-const TITLE_BAR_SIDEBAR_WIDTH = 277;
-const TITLE_BAR_CONTROLS_WIDTH = 283;
-
function parseView(value: string | string[] | undefined): DashboardView {
const raw = Array.isArray(value) ? value[0] : value;
return DASHBOARD_VIEWS.find((v) => v === raw) ?? "home";
@@ -133,44 +126,16 @@ export function DashboardPage() {
if (isSettingsView(view())) setView("home");
};
- // The project search lives here rather than in the projects view because
- // on Windows its field sits in the title bar. Leaving the projects view
- // drops the query.
- const [projectSearch, setProjectSearch] = createSignal("");
-
- createEffect(() => {
- if (view() !== "projects") setProjectSearch("");
- });
-
return (
- <div class="flex h-screen w-full min-h-0 flex-row overflow-hidden bg-sidebar pt-(--titlebar-height)">
- <WindowsTitleBar
- leftWidth={TITLE_BAR_SIDEBAR_WIDTH}
- controlsWidth={TITLE_BAR_CONTROLS_WIDTH}
- left={
- <>
- <Icon name="diffusion-logo" class="size-6 shrink-0 text-muted-foreground" />
- <p class="min-w-0 flex-1 truncate text-xs font-450 text-muted-foreground">Diffusion Studio</p>
- <p class="shrink-0 text-xxs text-muted-foreground">v{APP_VERSION}</p>
- </>
- }
- >
- <Show when={view() === "projects"}>
- <DashboardSearchBar
- class="h-full"
- value={projectSearch}
- onChange={setProjectSearch}
- placeholder="Search in projects"
- />
- </Show>
- </WindowsTitleBar>
+ <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={isDesktop() && !isWindowsDesktop() && !isFullscreen()}>
+ <Show when={!!window.desktop && !isFullscreen()}>
<div class="absolute inset-x-0 top-0 h-10 z-20" style="-webkit-app-region: drag;" />
</Show>
- {/* The Windows title bar already carries the logo, name and version. */}
- <Show when={!settingsNavOpen() && !isWindowsDesktop()} fallback={<DashboardSidebarTopSpacer />}>
- <DashboardSidebarHeader />
+ <Show when={!isWindowsDesktop()} fallback={<DashboardSidebarTitleBar />}>
+ <Show when={!settingsNavOpen()} fallback={<DashboardSidebarTopSpacer />}>
+ <DashboardSidebarHeader />
+ </Show>
</Show>
<DashboardSidebarNav
footer={
@@ -214,7 +179,7 @@ export function DashboardPage() {
<DashboardHomeView />
</Match>
<Match when={view() === "projects"}>
- <DashboardProjectsView search={projectSearch} onSearchChange={setProjectSearch} />
+ <DashboardProjectsView />
</Match>
<Match when={view() === "ai-credits"}>
<DashboardAiCreditsView />