Fix macOS titlebar corner: brand next to traffic lights
The always-visible sidebar toggle sat between the macOS traffic lights and the brand, pushing "T3 Code" ~130px right against the sidebar's right edge. Move the toggle to the right edge of the sidebar header while expanded, and only show the fixed titlebar toggle when the sidebar is collapsed, so the brand sits directly after the traffic lights. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
2a33a18716
commit
2ff16b4891
3 files changed
+39
-24
No files matched your search
@@ -3,12 +3,12 @@ import { useEffect, useState, type CSSProperties, type ReactNode } from "react";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
|
||||
import { isElectron } from "../env";
|
||||
import { resolveShortcutCommand, shortcutLabelForCommand } from "../keybindings";
|
||||
import { resolveShortcutCommand } from "../keybindings";
|
||||
import { isMacPlatform } from "../lib/utils";
|
||||
import { primaryServerKeybindingsAtom } from "../state/server";
|
||||
import ThreadSidebar from "./Sidebar";
|
||||
import { Sidebar, SidebarProvider, SidebarRail, SidebarTrigger, useSidebar } from "./ui/sidebar";
|
||||
import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
|
||||
import { MainSidebarToggle } from "./SidebarToggle";
|
||||
import { Sidebar, SidebarProvider, SidebarRail, useSidebar } from "./ui/sidebar";
|
||||
|
||||
const THREAD_SIDEBAR_WIDTH_STORAGE_KEY = "chat_thread_sidebar_width";
|
||||
const THREAD_SIDEBAR_MIN_WIDTH = 13 * 16;
|
||||
@@ -18,7 +18,6 @@ const MACOS_TRAFFIC_LIGHTS_LEFT_INSET = "90px";
|
||||
function SidebarControl() {
|
||||
const keybindings = useAtomValue(primaryServerKeybindingsAtom);
|
||||
const { toggleSidebar } = useSidebar();
|
||||
const shortcutLabel = shortcutLabelForCommand(keybindings, "sidebar.toggle");
|
||||
|
||||
useEffect(() => {
|
||||
const onKeyDown = (event: KeyboardEvent) => {
|
||||
@@ -34,21 +33,14 @@ function SidebarControl() {
|
||||
return () => window.removeEventListener("keydown", onKeyDown);
|
||||
}, [keybindings, toggleSidebar]);
|
||||
|
||||
// Only visible while the sidebar is collapsed: when expanded, the toggle
|
||||
// lives at the right edge of the sidebar header instead.
|
||||
return (
|
||||
<div
|
||||
className="pointer-events-none fixed left-[var(--workspace-controls-left)] top-[var(--workspace-controls-top)] z-50 flex h-[var(--workspace-topbar-height)] items-center"
|
||||
className="pointer-events-none fixed left-[var(--workspace-controls-left)] top-[var(--workspace-controls-top)] z-50 flex h-[var(--workspace-topbar-height)] items-center [[data-sidebar-state=expanded]_&]:hidden"
|
||||
data-sidebar-control=""
|
||||
>
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<SidebarTrigger className="pointer-events-auto" aria-label="Toggle main sidebar" />
|
||||
}
|
||||
/>
|
||||
<TooltipPopup side="bottom">
|
||||
Toggle main sidebar{shortcutLabel ? ` (${shortcutLabel})` : ""}
|
||||
</TooltipPopup>
|
||||
</Tooltip>
|
||||
<MainSidebarToggle className="pointer-events-auto" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ import { isElectron } from "../env";
|
||||
import { APP_STAGE_LABEL } from "../branding";
|
||||
import { useOpenPrLink } from "../lib/openPullRequestLink";
|
||||
import { isTerminalFocused } from "../lib/terminalFocus";
|
||||
import { isMacPlatform } from "../lib/utils";
|
||||
import { cn, isMacPlatform } from "../lib/utils";
|
||||
import {
|
||||
readThreadShell,
|
||||
useProject,
|
||||
@@ -126,6 +126,7 @@ import {
|
||||
import { stackedThreadToast, toastManager } from "./ui/toast";
|
||||
import { formatRelativeTimeLabel } from "../timestampFormat";
|
||||
import { SettingsSidebarNav } from "./settings/SettingsSidebarNav";
|
||||
import { MainSidebarToggle } from "./SidebarToggle";
|
||||
import { Kbd } from "./ui/kbd";
|
||||
import {
|
||||
getArm64IntelBuildWarningDescription,
|
||||
@@ -2744,15 +2745,16 @@ const SidebarChromeHeader = memo(function SidebarChromeHeader({
|
||||
}: {
|
||||
isElectron: boolean;
|
||||
}) {
|
||||
return isElectron ? (
|
||||
<SidebarHeader className="@container/sidebar-header drag-region h-[var(--workspace-topbar-height)] shrink-0 flex-row items-center px-3 py-0 md:px-0">
|
||||
<SidebarTrigger className="md:hidden" />
|
||||
<SidebarBrand />
|
||||
</SidebarHeader>
|
||||
) : (
|
||||
<SidebarHeader className="@container/sidebar-header h-[var(--workspace-topbar-height)] shrink-0 flex-row items-center px-3 py-0 md:px-0">
|
||||
return (
|
||||
<SidebarHeader
|
||||
className={cn(
|
||||
"@container/sidebar-header h-[var(--workspace-topbar-height)] shrink-0 flex-row items-center px-3 py-0 md:px-0",
|
||||
isElectron && "drag-region",
|
||||
)}
|
||||
>
|
||||
<SidebarTrigger className="md:hidden" />
|
||||
<SidebarBrand />
|
||||
<MainSidebarToggle className="ml-auto max-md:hidden md:mr-2" />
|
||||
</SidebarHeader>
|
||||
);
|
||||
});
|
||||
@@ -2763,7 +2765,7 @@ function SidebarBrand() {
|
||||
return (
|
||||
<Link
|
||||
aria-label="Go to threads"
|
||||
className="sidebar-brand ml-[var(--workspace-titlebar-content-left)] h-7 w-fit min-w-0 shrink-0 items-center gap-1 overflow-hidden rounded-md text-foreground outline-hidden ring-ring focus-visible:ring-2"
|
||||
className="sidebar-brand ml-[var(--workspace-controls-left)] h-7 w-fit min-w-0 items-center gap-1 overflow-hidden rounded-md text-foreground outline-hidden ring-ring focus-visible:ring-2 max-md:ml-0"
|
||||
to="/"
|
||||
>
|
||||
<T3Wordmark />
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { useAtomValue } from "@effect/atom-react";
|
||||
import type { ComponentProps } from "react";
|
||||
|
||||
import { shortcutLabelForCommand } from "../keybindings";
|
||||
import { primaryServerKeybindingsAtom } from "../state/server";
|
||||
import { SidebarTrigger } from "./ui/sidebar";
|
||||
import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
|
||||
|
||||
export function MainSidebarToggle(props: ComponentProps<typeof SidebarTrigger>) {
|
||||
const keybindings = useAtomValue(primaryServerKeybindingsAtom);
|
||||
const shortcutLabel = shortcutLabelForCommand(keybindings, "sidebar.toggle");
|
||||
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger render={<SidebarTrigger aria-label="Toggle main sidebar" {...props} />} />
|
||||
<TooltipPopup side="bottom">
|
||||
Toggle main sidebar{shortcutLabel ? ` (${shortcutLabel})` : ""}
|
||||
</TooltipPopup>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user