Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(issues): split the issue sidebar into an action card and one property card (MUL-9592) (#10928)
Jiayuan Zhange18fe48271f1
diff --git a/packages/views/issues/components/issue-sidebar-settings.test.tsx b/packages/views/issues/components/issue-sidebar-settings.test.tsxindex 8ac30b92f1..23ffe2484d 100644--- a/packages/views/issues/components/issue-sidebar-settings.test.tsx+++ b/packages/views/issues/components/issue-sidebar-settings.test.tsx@@ -30,6 +30,7 @@ function renderSections(revealed?: IssueSidebarSection[]) {const renderedOrder = () => screen.getAllByText(/^body:/).map((el) => el.textContent!.slice("body:".length));const cardOf = (text: string) => screen.getByText(text).closest("[data-slot=issue-sidebar-card]");+const groupOf = (text: string) => screen.getByText(text).closest("[data-slot=issue-sidebar-group]");async function openSettings() {fireEvent.click(screen.getByRole("button", { name: "Customize sidebar" }));@@ -39,19 +40,22 @@ async function openSettings() {describe("IssueSidebarSections", () => {beforeEach(() => useIssueSidebarSectionsStore.getState().reset());- it("puts the overview first, then groups related sections into cards", () => {+ it("puts the overview on its own card, then every other section on one card in related groups", () => {renderSections();expect(renderedOrder()).toEqual(available.filter((id) => id !== "apps"));const cards = document.querySelectorAll("[data-slot=issue-sidebar-card]");+ expect(cards).toHaveLength(2);expect(cards[0]).toHaveTextContent("overview");- expect(cardOf("body:pull_requests")).toBe(cardOf("body:environments"));- expect(cardOf("body:parent")).toBe(cardOf("body:duplicates"));- expect(cardOf("body:pull_requests")).not.toBe(cardOf("body:parent"));+ expect(cardOf("body:properties")).toBe(cards[1]);+ expect(cardOf("body:wakeups")).toBe(cards[1]);+ expect(groupOf("body:pull_requests")).toBe(groupOf("body:environments"));+ expect(groupOf("body:parent")).toBe(groupOf("body:duplicates"));+ expect(groupOf("body:pull_requests")).not.toBe(groupOf("body:parent"));// Creator and timestamps are small print under the cards, not a card.expect(cardOf("body:details")).toBeNull();});- it("leaves hidden sections out, and drops a card once all of its sections are hidden", () => {+ it("leaves hidden sections out, and drops a group once all of its sections are hidden", () => {act(() => {useIssueSidebarSectionsStore.getState().setHidden("execution_log", true);useIssueSidebarSectionsStore.getState().setHidden("metadata", true);@@ -60,10 +64,11 @@ describe("IssueSidebarSections", () => {expect(screen.queryByText("body:execution_log")).toBeNull();expect(container.querySelector('[data-issue-sidebar-section="execution_log"]')).toBeNull();+ expect(container.querySelectorAll("[data-slot=issue-sidebar-group]")).toHaveLength(4);expect(screen.getByRole("button", { name: /2 sections hidden/ })).toBeInTheDocument();});- it("collapses the Output card while it has nothing to show, offering its actions from the strip's + menu", async () => {+ it("collapses the Output group while it has nothing to show, offering its actions from the strip's + menu", async () => {function EmptyOutput({ id, label }: { id: string; label: string }) {useIssueSidebarAddEntry(id, { order: 0, items: <DropdownMenuItem>{label}</DropdownMenuItem> });return null;@@ -82,9 +87,10 @@ describe("IssueSidebarSections", () => {/></I18nProvider>,);- const outputCard = document.querySelector('[data-issue-sidebar-section="pull_requests"]')!.parentElement!;- // The card hides itself once every section slot in it is empty.- expect([...outputCard.children].every((slot) => slot.childNodes.length === 0)).toBe(true);+ const outputGroup = document.querySelector('[data-issue-sidebar-section="pull_requests"]')!.parentElement!;+ expect(outputGroup).toHaveAttribute("data-slot", "issue-sidebar-group");+ // The group hides itself once every section slot in it is empty.+ expect([...outputGroup.children].every((slot) => slot.childNodes.length === 0)).toBe(true);fireEvent.click(screen.getByRole("button", { name: "Add" }));expect(await screen.findByRole("menuitem", { name: "Link pull request" })).toBeInTheDocument();expect(screen.getByRole("menuitem", { name: "Start an environment" })).toBeInTheDocument();diff --git a/packages/views/issues/components/issue-sidebar-settings.tsx b/packages/views/issues/components/issue-sidebar-settings.tsxindex 7391491a11..61ae693625 100644--- a/packages/views/issues/components/issue-sidebar-settings.tsx+++ b/packages/views/issues/components/issue-sidebar-settings.tsx@@ -42,9 +42,11 @@ export function useIssueSidebarSectionLabels(): Record<IssueSidebarSection, stri/*** The issue sidebar: a strip level with the page header holding the "+" menu- * and settings, then the overview card and one card per group of related- * sections, minus the sections the reader hid. Each section sits in its own slot, which collapses while the- * section renders nothing; a card whose slots all collapse goes with them.+ * and settings, the overview card for what the issue needs next, then one card+ * for everything else, its groups of related sections split by hairlines,+ * minus the sections the reader hid. Each section sits in its own slot, which+ * collapses while the section renders nothing; a group whose slots all+ * collapse goes with them.*/export function IssueSidebarSections({sections,@@ -109,14 +111,24 @@ export function IssueSidebarSections({</div><div className="flex flex-col gap-2 p-2">{overview && <IssueSidebarCard>{overview}</IssueSidebarCard>}- {CARD_GROUPS.map((group) => {- const shown = slots(group);- return shown.length > 0 && (- <IssueSidebarCard key={group[0]} className="[&:not(:has(>:not(:empty)))]:hidden">- {shown}- </IssueSidebarCard>- );- })}+ {/* Each group draws the hairline above it; the card clips the+ first visible group's, wherever the groups before it collapsed. */}+ <IssueSidebarCard className="gap-0 overflow-clip py-0">+ <div className="-mt-px">+ {CARD_GROUPS.map((group) => {+ const shown = slots(group);+ return shown.length > 0 && (+ <div+ key={group[0]}+ data-slot="issue-sidebar-group"+ className="flex flex-col gap-3 border-t py-1.5 [&>*]:flow-root [&:not(:has(>:not(:empty)))]:hidden"+ >+ {shown}+ </div>+ );+ })}+ </div>+ </IssueSidebarCard><div className="flex flex-col gap-2 pt-1 [&>*]:flow-root">{slots(FOOTER_GROUP)}</div>{hiddenCount > 0 && (<IssueSidebarSettings