diff --git a/plugins/stewards/app.test.tsx b/plugins/stewards/app.test.tsx index 20e0ff82..9424020e 100644 --- a/plugins/stewards/app.test.tsx +++ b/plugins/stewards/app.test.tsx @@ -283,7 +283,7 @@ describe("the sidebar-footer toggle (BB-45)", () => { }); }); -// BB-46: the sidebar's count badge and "Needs you" block, fed by the +// BB-46: the sidebar's "Needs you" block, fed by the // `stewardsSidebar` call and refreshed over the realtime channel. const sidebarProjects = [ { id: "p1", name: "Acme", isPersonal: false, href: "/projects/p1", settingsHref: "/projects/p1/settings" }, @@ -340,22 +340,33 @@ describe("the stewards sidebar's needs you block (BB-46)", () => { } as never); }; - it("shows the summed count badge beside the picker only when non-zero", async () => { - const slot = await renderSidebar({ stewardsSidebar: () => sidebarData({ count: 2, items: [questionItem()] }, { count: 0, items: [] }) }); + it("does not render a summed count badge beside the picker", async () => { + const slot = await renderSidebar({ stewardsSidebar: () => sidebarData({ count: 2, items: [questionItem()] }) }); await waitFor(() => expect(slot.getByLabelText("Project")).toBeTruthy()); - await waitFor(() => expect(slot.getByLabelText("2 waiting on you")).toBeTruthy()); - expect(slot.queryByLabelText("0 waiting on you")).toBeNull(); + await waitFor(() => expect(slot.getByRole("option", { name: "Acme (2)" })).toBeTruthy()); + expect(slot.queryByLabelText("2 waiting on you")).toBeNull(); + expect(slot.getByRole("option", { name: "Beta" })).toBeTruthy(); slot.lifecycle.unmount(); }); - it.each([false, true])("sums the count beside the picker and shows per-project counts in its options (compact=%s)", async (isCompactViewport) => { + it.each([false, true])("shows per-project counts in its options and no summed badge (compact=%s)", async (isCompactViewport) => { const slot = await renderSidebar( { stewardsSidebar: () => sidebarData({ count: 2, items: [questionItem(), needItem()] }, { count: 1, items: [needItem({ id: "need_2" })] }) }, { isCompactViewport }, ); - await waitFor(() => expect(slot.getByLabelText("3 waiting on you")).toBeTruthy()); - expect(slot.getByRole("option", { name: "Acme (2)" })).toBeTruthy(); + await waitFor(() => expect(slot.getByRole("option", { name: "Acme (2)" })).toBeTruthy()); expect(slot.getByRole("option", { name: "Beta (1)" })).toBeTruthy(); + expect(slot.queryByLabelText("3 waiting on you")).toBeNull(); + slot.lifecycle.unmount(); + }); + + it("sizes the picker and the New thread button as h-8 controls", async () => { + const slot = await renderSidebar({ stewardsSidebar: () => sidebarData({ count: 2, items: [questionItem()] }) }); + const select = await waitFor(() => slot.getByLabelText("Project")); + expect(select.className).toContain("h-8"); + const button = slot.getByRole("button", { name: "New thread" }); + expect(button.className).toContain("size-8"); + expect(button.className).toContain("shrink-0"); slot.lifecycle.unmount(); }); diff --git a/plugins/stewards/app.tsx b/plugins/stewards/app.tsx index 47eb3aa0..28bf90b7 100644 --- a/plugins/stewards/app.tsx +++ b/plugins/stewards/app.tsx @@ -131,15 +131,6 @@ function Badge({ children, tone = "muted" }: { children: ReactNode; tone?: "mute return {children}; } -/** The count of everything waiting on the user for one project; rendered only when non-zero. */ -function NeedsBadge({ count }: { count: number }) { - return ( - - {count} - - ); -} - function EntityLink({ entityKey, url }: { entityKey: string; url: string | null }) { const navigate = useBbNavigate(); if (url === null) return {entityKey}; @@ -993,18 +984,17 @@ function SidebarCollapsible({ title, count, children }: { title: string; count: } /** - * The project dropdown, always a native ``: the per-project needs count - * in each option and the summed `NeedsBadge` beside it. The plus button opens - * the composer on the dropdown's project — the host's own New thread button - * cannot be retargeted from a thread list — then closes the mobile drawer. + * The project dropdown, always a native ``, with the per-project needs + * count in each option. The plus button opens the composer on the dropdown's + * project — the host's own New thread button cannot be retargeted from a thread + * list — then closes the mobile drawer. */ function ProjectTabs({ tabs, counts, activeId, onPick, onNewThread }: { tabs: Array<{ projectId: string; name: string }>; counts: ReadonlyMap; activeId: string | null; onPick: (projectId: string) => void; onNewThread: () => void }) { - const total = [...counts.values()].reduce((sum, n) => sum + n, 0); return ( - + onPick(e.target.value)} > @@ -1017,13 +1007,12 @@ function ProjectTabs({ tabs, counts, activeId, onPick, onNewThread }: { tabs: Ar ); })} - {total > 0 ? : null} {tabs.length > 0 ? (