diff --git a/.gitignore b/.gitignore index 9653177..c29cb4c 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,7 @@ # Playwright .playwright-mcp/ +solvway-admin-portal/.impeccable/ + # Build output target/ diff --git a/docs/superpowers/specs/2026-12-01-visual-foundation-design.md b/docs/superpowers/specs/2026-12-01-visual-foundation-design.md new file mode 100644 index 0000000..a137eb5 --- /dev/null +++ b/docs/superpowers/specs/2026-12-01-visual-foundation-design.md @@ -0,0 +1,43 @@ +# Co-Lite visual foundation — design + +Date: 2026-12-01. Status: direction chosen by the owner; design awaiting approval. + +## Why + +The admin portal still wears the inherited babyboo look: brown primary, DM Sans headings, 16px soft corners, a gradient wordmark, and native selects whose option lists cannot be styled (the owner asked why the company picker's options are not rounded). The owner wants a complete revamp before go-live (2027-01-15), and the invitations screens (tasks 5.1–5.3 of `add-event-invitations`) wait on it. + +## Direction + +The owner looked at nine directions on a decision page and chose **the category standard**: a clean SaaS admin, done well, with no brand gimmick. The quality bar is Stripe Dashboard, Linear and Vercel (my call; the owner did not name products). Reference sketch: `solvway-admin-portal/.impeccable/mocks/decision/canon.html` (local only). + +- **Colour:** white ground and white sidebar with a 1px slate border; slate text (#0F172A, muted #64748B); slate-50 surfaces (#F1F5F9); one blue accent (#2563EB) for primary buttons, links, focus rings and the active nav item. Status pills are pastel tints with dark text (green, amber, red, blue, slate). +- **Type:** Inter for everything; DM Sans is dropped. Tabular figures for numbers. +- **Shape:** 8px card radius, 6px controls, one soft shadow on cards, 1px borders. +- **Wordmark:** a small blue square mark plus "Co-Lite" in solid text. The gradient text goes. +- **Selects:** every native ` setForm((f) => ({ ...f, status: e.target.value as AdminCompany["status"] }))} - disabled={saving} - className="h-9 w-full rounded-md border border-input bg-transparent px-3 text-sm" - > - - - + )} diff --git a/solvway-admin-portal/app/companyScope.forms.test.tsx b/solvway-admin-portal/app/companyScope.forms.test.tsx index fc5f1b2..35ab904 100644 --- a/solvway-admin-portal/app/companyScope.forms.test.tsx +++ b/solvway-admin-portal/app/companyScope.forms.test.tsx @@ -49,7 +49,7 @@ describe("UserForm company", () => { const user = userEvent.setup(); render(); const company = await screen.findByRole("combobox", { name: "Company" }); - expect(company).toHaveValue("2"); + expect(company).toHaveTextContent("CV"); await fillUser(user); await user.click(screen.getByLabelText("HQ")); await user.click(screen.getByRole("button", { name: /create|save/i })); @@ -60,7 +60,8 @@ describe("UserForm company", () => { const onSubmit = vi.fn().mockResolvedValue(undefined); const user = userEvent.setup(); render(); - await user.selectOptions(await screen.findByRole("combobox", { name: "Company" }), "super"); + await user.click(await screen.findByRole("combobox", { name: "Company" })); + await user.click(await screen.findByRole("option", { name: "Super admin (no company)" })); await fillUser(user); await user.click(screen.getByLabelText("HQ")); await user.click(screen.getByRole("button", { name: /create|save/i })); @@ -106,6 +107,13 @@ describe("UserForm company", () => { await user.click(screen.getByRole("button", { name: /create|save/i })); expect(await screen.findByText("Choose a company.")).toBeInTheDocument(); }); + it("lists only the company codes and Super admin in the Company menu, with no blank option", async () => { + mocks.useCompanyScope.mockReturnValue(scope(undefined)); + const user = userEvent.setup(); + render(); + await user.click(await screen.findByRole("combobox", { name: "Company" })); + expect((await screen.findAllByRole("option")).map((o) => o.textContent)).toEqual(["INS", "CV", "Super admin (no company)"]); + }); }); describe("EventForm company", () => { @@ -113,7 +121,7 @@ describe("EventForm company", () => { const onSubmit = vi.fn().mockResolvedValue(undefined); const user = userEvent.setup(); render(); - expect(await screen.findByRole("combobox", { name: "Company" })).toHaveValue("2"); + expect(await screen.findByRole("combobox", { name: "Company" })).toHaveTextContent("CV"); await user.type(screen.getByLabelText("Name"), "Expo"); await user.type(screen.getByLabelText("Location"), "KL"); pickDate("Start date", "2026-12-01"); @@ -133,7 +141,8 @@ describe("EventForm company", () => { const user = userEvent.setup(); const { unmount } = render(); await waitFor(() => expect(mocks.listSalespersonOptions).toHaveBeenLastCalledWith(2)); - await user.selectOptions(screen.getByRole("combobox", { name: "Company" }), "1"); + await user.click(screen.getByRole("combobox", { name: "Company" })); + await user.click(await screen.findByRole("option", { name: "INS" })); await waitFor(() => expect(mocks.listSalespersonOptions).toHaveBeenLastCalledWith(1)); unmount(); mocks.useCompanyScope.mockReturnValue(scope(1)); @@ -161,4 +170,38 @@ describe("EventForm company required", () => { expect(onSubmit).not.toHaveBeenCalled(); expect(await screen.findByText("Choose a company.")).toBeInTheDocument(); }); + + it("lists only the company codes in the Company menu, with no blank option", async () => { + mocks.useCompanyScope.mockReturnValue(scope(undefined)); + const user = userEvent.setup(); + render(); + await user.click(await screen.findByRole("combobox", { name: "Company" })); + expect((await screen.findAllByRole("option")).map((o) => o.textContent)).toEqual(["INS", "CV"]); + }); +}); + +describe("company picker placeholder and team hint", () => { + it("shows a placeholder in the empty company picker on the user form", async () => { + mocks.useCompanyScope.mockReturnValue(scope(undefined)); + render(); + expect(await screen.findByRole("combobox", { name: "Company" })).toHaveTextContent("Select a company"); + }); + + it("shows a placeholder in the empty company picker on the event form", async () => { + mocks.useCompanyScope.mockReturnValue(scope(undefined)); + render(); + expect(await screen.findByRole("combobox", { name: "Company" })).toHaveTextContent("Select a company"); + }); + + it("hints to choose a company before the team can be listed, then lists it", async () => { + mocks.useCompanyScope.mockReturnValue(scope(undefined)); + const user = userEvent.setup(); + render(); + expect(await screen.findByText("Choose a company to list its team")).toBeInTheDocument(); + expect(screen.queryByRole("checkbox", { name: /Alice/ })).not.toBeInTheDocument(); + await user.click(screen.getByRole("combobox", { name: "Company" })); + await user.click(await screen.findByRole("option", { name: "CV" })); + expect(await screen.findByRole("checkbox", { name: /Alice/ })).toBeInTheDocument(); + expect(screen.queryByText("Choose a company to list its team")).not.toBeInTheDocument(); + }); }); diff --git a/solvway-admin-portal/app/components/app/CompanyPicker.tsx b/solvway-admin-portal/app/components/app/CompanyPicker.tsx index 96ac7a5..23290e7 100644 --- a/solvway-admin-portal/app/components/app/CompanyPicker.tsx +++ b/solvway-admin-portal/app/components/app/CompanyPicker.tsx @@ -3,6 +3,10 @@ import { useAdminAuth } from "@/app/lib/AdminAuthContext"; import { useCompanyScope } from "@/app/lib/CompanyScope"; import { useT } from "@/app/lib/i18n/MessagesProvider"; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/app/components/ui/select"; + +// Radix Select rejects "" as an item value, so "All companies" is this sentinel, mapped to undefined. +const ALL = "all"; // Header company filter; super admins only (staff are always scoped by the server). export default function CompanyPicker() { @@ -11,16 +15,16 @@ export default function CompanyPicker() { const t = useT(); if (!isSuper) return null; return ( - + ); } diff --git a/solvway-admin-portal/app/components/app/Header.tsx b/solvway-admin-portal/app/components/app/Header.tsx index 706f3f9..5a580ec 100644 --- a/solvway-admin-portal/app/components/app/Header.tsx +++ b/solvway-admin-portal/app/components/app/Header.tsx @@ -55,7 +55,7 @@ export default function Header() { const initial = (name ?? "?").slice(0, 1).toUpperCase(); return ( -
+