Skip to content

Commit 90662e2

Browse files
committed
[verified] fix(web): keep empty workspace draggable on desktop
1 parent 0a7c662 commit 90662e2

3 files changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { renderToStaticMarkup } from "react-dom/server";
2+
import { describe, expect, it } from "vite-plus/test";
3+
4+
import { DesktopTitlebarSpacer } from "./DesktopTitlebarSpacer";
5+
6+
describe("DesktopTitlebarSpacer", () => {
7+
it("renders a full workspace drag region in Electron", () => {
8+
const markup = renderToStaticMarkup(<DesktopTitlebarSpacer enabled />);
9+
10+
expect(markup).toContain('aria-hidden="true"');
11+
expect(markup).toContain("workspace-topbar");
12+
expect(markup).toContain("drag-region");
13+
});
14+
15+
it("does not reserve titlebar space in the browser", () => {
16+
expect(renderToStaticMarkup(<DesktopTitlebarSpacer enabled={false} />)).toBe("");
17+
});
18+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { isElectron } from "../env";
2+
3+
interface DesktopTitlebarSpacerProps {
4+
readonly enabled?: boolean;
5+
}
6+
7+
/** Keeps an otherwise empty Electron workspace draggable when the sidebar is closed. */
8+
export function DesktopTitlebarSpacer({ enabled = isElectron }: DesktopTitlebarSpacerProps) {
9+
if (!enabled) return null;
10+
11+
return <div aria-hidden="true" className="workspace-topbar drag-region" />;
12+
}

‎apps/web/src/routes/_chat.index.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { LinkIcon, PlusIcon, RotateCcwIcon } from "lucide-react";
44
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
55

66
import { openCommandPalette } from "../commandPaletteBus";
7+
import { DesktopTitlebarSpacer } from "../components/DesktopTitlebarSpacer";
78
import { sortScopedProjectsForSidebar } from "../components/Sidebar.logic";
89
import { Button } from "../components/ui/button";
910
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "../components/ui/empty";
@@ -110,6 +111,7 @@ function NoProjectsHero() {
110111
return (
111112
<SidebarInset className="h-dvh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground">
112113
<div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-background">
114+
<DesktopTitlebarSpacer />
113115
<Empty className="flex-1">
114116
<div className="w-full max-w-lg px-8 py-12">
115117
<EmptyHeader className="max-w-none">

0 commit comments

Comments
 (0)