SurfSense/surfsense_web/components/layout/ui/sidebar/SidebarHeader.tsx
Anish Sarkar a8c1fb660d feat(rename): complete searchSpace to workspace transition across frontend and backend
- Introduced a comprehensive specification for renaming `searchSpace` to `workspace` in `surfsense_web` and `surfsense_desktop`, ensuring all TypeScript identifiers, React props, and local data structures are updated.
- Implemented migration shims for persisted local state to prevent data loss during the transition.
- Updated observability metrics and IPC channels to reflect the new naming convention.
- Removed legacy `active-search-space` module and replaced it with `active-workspace` to maintain consistency.
- Ensured no behavioral changes or data loss for users during the renaming process.
2026-07-06 15:12:40 +05:30

60 lines
1.6 KiB
TypeScript

"use client";
import { ChevronsUpDown, Settings, UserPen } from "lucide-react";
import { useTranslations } from "next-intl";
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { cn } from "@/lib/utils";
import type { Workspace } from "../../types/layout.types";
interface SidebarHeaderProps {
workspace: Workspace | null;
isCollapsed?: boolean;
onSettings?: () => void;
onManageMembers?: () => void;
className?: string;
}
export function SidebarHeader({
workspace,
isCollapsed,
onSettings,
onManageMembers,
className,
}: SidebarHeaderProps) {
const t = useTranslations("sidebar");
return (
<div className={cn("flex min-w-0 flex-1 items-center", className)}>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
variant="ghost"
className={cn(
"flex h-8 w-full items-center justify-between gap-1 overflow-hidden px-2 py-0.5 font-semibold",
isCollapsed && "w-10"
)}
>
<span className="truncate text-sm">{workspace?.name ?? t("select_workspace")}</span>
<ChevronsUpDown className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="start" className="w-48">
<DropdownMenuItem onClick={onManageMembers}>
<UserPen className="h-4 w-4" />
{t("manage_members")}
</DropdownMenuItem>
<DropdownMenuItem onClick={onSettings}>
<Settings className="h-4 w-4" />
{t("workspace_settings")}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
);
}