mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-19 20:10:39 +09:00
## Thinking Path > - Paperclip is the control plane for autonomous AI companies. > - The board UI needs a clear persistent way to move between company workspaces. > - The previous layout kept company switching in a separate left rail, which made the sidebar feel split between workspace selection and navigation. > - The workspace switcher belongs in the sidebar header so navigation and workspace context stay together. > - This pull request removes the separate company rail from the layout and turns the sidebar company menu into the primary workspace switcher. > - The benefit is a cleaner sidebar structure that keeps workspace identity, switching, company actions, and navigation in one place. ## What Changed - Removed the standalone `CompanyRail` from the main layout. - Added the company/workspace switcher to the default, company settings, and instance settings sidebars. - Expanded `SidebarCompanyMenu` to list active workspaces, indicate the current workspace, navigate out of instance settings when switching, and expose add-company onboarding. - Updated focused component tests for the new workspace-switcher behavior. ## Verification - `pnpm --filter @paperclipai/ui exec vitest run src/components/SidebarCompanyMenu.test.tsx src/components/CompanySettingsSidebar.test.tsx` - `pnpm --filter @paperclipai/ui typecheck` - `git diff --check` - Visual smoke attempted against the managed dev server at `http://127.0.0.1:57385`; a fresh browser context reached the authenticated sign-in screen, so I could not capture an authenticated sidebar screenshot from this heartbeat. ## Risks - Low-to-medium UI risk: this changes the primary sidebar structure and workspace-switching entry point. - The instance-settings switch behavior now routes back to the selected company dashboard when a workspace is selected. - No migrations, API contracts, or lockfile changes. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - OpenAI Codex, GPT-5 coding agent, tool-enabled, medium reasoning mode. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [ ] If this change affects the UI, I have included before/after screenshots - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] I will address all Greptile and reviewer comments before requesting merge Co-authored-by: Paperclip <noreply@paperclip.ing>
79 lines
2.9 KiB
TypeScript
79 lines
2.9 KiB
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import { ChevronLeft, MailPlus, MonitorCog, Settings, Shield, SlidersHorizontal } from "lucide-react";
|
|
import { sidebarBadgesApi } from "@/api/sidebarBadges";
|
|
import { ApiError } from "@/api/client";
|
|
import { Link } from "@/lib/router";
|
|
import { queryKeys } from "@/lib/queryKeys";
|
|
import { useCompany } from "@/context/CompanyContext";
|
|
import { useSidebar } from "@/context/SidebarContext";
|
|
import { SidebarNavItem } from "./SidebarNavItem";
|
|
import { SidebarCompanyMenu } from "./SidebarCompanyMenu";
|
|
|
|
export function CompanySettingsSidebar() {
|
|
const { selectedCompany, selectedCompanyId } = useCompany();
|
|
const { isMobile, setSidebarOpen } = useSidebar();
|
|
const { data: badges } = useQuery({
|
|
queryKey: selectedCompanyId
|
|
? queryKeys.sidebarBadges(selectedCompanyId)
|
|
: ["sidebar-badges", "__disabled__"] as const,
|
|
queryFn: async () => {
|
|
try {
|
|
return await sidebarBadgesApi.get(selectedCompanyId!);
|
|
} catch (error) {
|
|
if (error instanceof ApiError && (error.status === 401 || error.status === 403)) {
|
|
return null;
|
|
}
|
|
throw error;
|
|
}
|
|
},
|
|
enabled: !!selectedCompanyId,
|
|
retry: false,
|
|
refetchInterval: 15_000,
|
|
});
|
|
|
|
return (
|
|
<aside className="w-60 h-full min-h-0 border-r border-border bg-background flex flex-col">
|
|
<div className="flex items-center gap-1 px-3 h-12 shrink-0">
|
|
<SidebarCompanyMenu />
|
|
</div>
|
|
<div className="flex flex-col gap-1 px-3 pb-3 shrink-0">
|
|
<Link
|
|
to="/dashboard"
|
|
onClick={() => {
|
|
if (isMobile) setSidebarOpen(false);
|
|
}}
|
|
className="flex items-center gap-1.5 rounded-md px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground"
|
|
>
|
|
<ChevronLeft className="h-3.5 w-3.5 shrink-0" />
|
|
<span className="truncate">{selectedCompany?.name ?? "Company"}</span>
|
|
</Link>
|
|
<div className="flex items-center gap-2 px-2 py-1">
|
|
<Settings className="h-4 w-4 text-muted-foreground shrink-0" />
|
|
<span className="flex-1 truncate text-sm font-bold text-foreground">
|
|
Company Settings
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<nav className="flex-1 min-h-0 overflow-y-auto scrollbar-auto-hide px-3 py-2">
|
|
<div className="flex flex-col gap-0.5">
|
|
<SidebarNavItem to="/company/settings" label="General" icon={SlidersHorizontal} end />
|
|
<SidebarNavItem
|
|
to="/company/settings/environments"
|
|
label="Environments"
|
|
icon={MonitorCog}
|
|
end
|
|
/>
|
|
<SidebarNavItem
|
|
to="/company/settings/access"
|
|
label="Access"
|
|
icon={Shield}
|
|
badge={badges?.joinRequests ?? 0}
|
|
end
|
|
/>
|
|
<SidebarNavItem to="/company/settings/invites" label="Invites" icon={MailPlus} end />
|
|
</div>
|
|
</nav>
|
|
</aside>
|
|
);
|
|
}
|