dd4cb2c3ee
* fix(web): align office topbar border with sidebar header (h-10) The OfficeTopbar was h-12 (48px) while the AppSidebar header is h-10 (40px), so the office top bar's bottom border sat ~8px below the sidebar's under-workspace-picker border, breaking the continuous seam where the sidebar meets the page content. Drop the topbar to h-10 to match the sidebar header and the PageTopbar/dockview top bars used elsewhere. Add data-testid hooks to both bordered sections and a Playwright regression asserting they resolve to the same height and bottom y-position. * test(web): force expanded sidebar in topbar alignment check Addresses review feedback (Greptile/Claude): the alignment assertion only holds for the expanded sidebar header (its border sits under the workspace picker, and that layout carries data-testid="app-sidebar-header"). Set the appSidebar.collapsed flag off via addInitScript before load so leftover collapsed state can't turn the check into a confusing timeout instead of a real assertion.
93 lines
3.1 KiB
TypeScript
93 lines
3.1 KiB
TypeScript
"use client";
|
|
|
|
import Link from "next/link";
|
|
import { IconChevronsLeft, IconChevronsRight } from "@tabler/icons-react";
|
|
import { Button } from "@kandev/ui/button";
|
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@kandev/ui/tooltip";
|
|
import { cn } from "@/lib/utils";
|
|
import { AppSidebarWorkspacePicker } from "./app-sidebar-workspace-picker";
|
|
|
|
type AppSidebarHeaderProps = {
|
|
collapsed: boolean;
|
|
onToggleCollapse: () => void;
|
|
};
|
|
|
|
const COLLAPSE_BUTTON_CLASS = "h-7 w-7 shrink-0 cursor-pointer";
|
|
|
|
export function AppSidebarHeader({ collapsed, onToggleCollapse }: AppSidebarHeaderProps) {
|
|
if (collapsed) {
|
|
// Minimal rail: brand home + expand. The workspace switcher lives only in
|
|
// the expanded header — a lone workspace glyph here read as noise.
|
|
return (
|
|
<div className="flex flex-col items-center gap-1 px-1 py-1.5 border-b border-border shrink-0">
|
|
<Tooltip>
|
|
<TooltipTrigger asChild>
|
|
<Link
|
|
href="/"
|
|
aria-label="Kandev home"
|
|
className="flex h-7 w-7 items-center justify-center rounded-md text-foreground/80 hover:bg-muted/60 cursor-pointer"
|
|
>
|
|
<span className="text-base font-bold tracking-tight">K</span>
|
|
</Link>
|
|
</TooltipTrigger>
|
|
<TooltipContent side="right">Kandev</TooltipContent>
|
|
</Tooltip>
|
|
<Tooltip>
|
|
<TooltipTrigger asChild>
|
|
<Button
|
|
variant="ghost"
|
|
size="icon"
|
|
className={COLLAPSE_BUTTON_CLASS}
|
|
onClick={onToggleCollapse}
|
|
aria-label="Expand sidebar"
|
|
>
|
|
<IconChevronsRight className="h-4 w-4" />
|
|
</Button>
|
|
</TooltipTrigger>
|
|
<TooltipContent side="right">Expand sidebar</TooltipContent>
|
|
</Tooltip>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
// Single h-10 row — brand · workspace picker · collapse — so the sidebar's
|
|
// top section lines up with the page/dockview top bar (also h-10). Brand and
|
|
// workspace share the same text size so they sit on a common baseline; the
|
|
// brand carries weight/colour, the workspace stays muted and secondary.
|
|
return (
|
|
<div
|
|
data-testid="app-sidebar-header"
|
|
className="flex items-center gap-1.5 h-10 px-3 shrink-0 border-b border-border"
|
|
>
|
|
<Link
|
|
href="/"
|
|
aria-label="Kandev home"
|
|
className={cn(
|
|
"shrink-0 cursor-pointer text-sm font-semibold tracking-tight",
|
|
"text-foreground hover:text-foreground/80 transition-colors",
|
|
)}
|
|
>
|
|
Kandev
|
|
</Link>
|
|
<span aria-hidden className="shrink-0 select-none text-muted-foreground/30">
|
|
/
|
|
</span>
|
|
<AppSidebarWorkspacePicker />
|
|
<Tooltip>
|
|
<TooltipTrigger asChild>
|
|
<Button
|
|
variant="ghost"
|
|
size="icon"
|
|
className={COLLAPSE_BUTTON_CLASS}
|
|
onClick={onToggleCollapse}
|
|
aria-label="Collapse sidebar"
|
|
>
|
|
<IconChevronsLeft className="h-4 w-4" />
|
|
</Button>
|
|
</TooltipTrigger>
|
|
<TooltipContent side="top">Collapse sidebar</TooltipContent>
|
|
</Tooltip>
|
|
</div>
|
|
);
|
|
}
|