feat(ui): company-prefix routes, archive company, hide archived from sidebar

Support optional company-prefix in URL paths (e.g. /PAP/issues/PAP-1).
Filter archived companies from sidebar rail, switcher, and auto-select.
Add archive button to company settings with confirmation dialog.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Forgotten
2026-03-02 10:31:54 -06:00
parent ce3b31d2c3
commit 410164a632
5 changed files with 134 additions and 50 deletions

View File

@@ -67,19 +67,24 @@ export function CompanyProvider({ children }: { children: ReactNode }) {
},
retry: false,
});
const sidebarCompanies = useMemo(
() => companies.filter((company) => company.status !== "archived"),
[companies],
);
// Auto-select first company when list loads
useEffect(() => {
if (companies.length === 0) return;
const selectableCompanies = sidebarCompanies.length > 0 ? sidebarCompanies : companies;
const stored = localStorage.getItem(STORAGE_KEY);
if (stored && companies.some((c) => c.id === stored)) return;
if (selectedCompanyId && companies.some((c) => c.id === selectedCompanyId)) return;
if (stored && selectableCompanies.some((c) => c.id === stored)) return;
if (selectedCompanyId && selectableCompanies.some((c) => c.id === selectedCompanyId)) return;
const next = companies[0]!.id;
const next = selectableCompanies[0]!.id;
setSelectedCompanyIdState(next);
localStorage.setItem(STORAGE_KEY, next);
}, [companies, selectedCompanyId]);
}, [companies, selectedCompanyId, sidebarCompanies]);
const setSelectedCompanyId = useCallback((companyId: string) => {
setSelectedCompanyIdState(companyId);