Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(sidebar): put Pinned above the Inbox in the Work panel (MUL-9607) (#11110)

Jiayuan Zhang2ba739e4ae88
diff --git a/apps/docs/content/docs/inbox.fr.mdx b/apps/docs/content/docs/inbox.fr.mdx
index 3204c68b02..29388fedc9 100644
--- a/apps/docs/content/docs/inbox.fr.mdx
+++ b/apps/docs/content/docs/inbox.fr.mdx
@@ -10,7 +10,7 @@ La boîte de réception rassemble l'activité de travail qui vous concerne et si
## Où la trouver
-La boîte de réception est la première section du panneau **Travail**, au-dessus des épingles, des vues et des projets. Le nombre de non-lus s'affiche à côté du titre de la section et en badge sur **Travail** dans la barre d'applications ; un clic droit sur **Travail** propose **Tout marquer comme lu**.
+La boîte de réception est une section du panneau **Travail**, sous les épingles et au-dessus des vues et des projets ; sans épingle, c'est la première section. Le nombre de non-lus s'affiche à côté du titre de la section et en badge sur **Travail** dans la barre d'applications ; un clic droit sur **Travail** propose **Tout marquer comme lu**.
La section affiche une ligne par tâche, de la plus récente à la plus ancienne, lues et non lues confondues. Une ligne montre le statut de la tâche, son titre et l'heure, et qui a fait quoi ; un point signale une ligne non lue. Survolez une ligne pour ouvrir une carte avec le titre complet, le commentaire, et **Ouvrir**, **Marquer comme lu** et **Archiver**.
diff --git a/apps/docs/content/docs/inbox.ja.mdx b/apps/docs/content/docs/inbox.ja.mdx
index 4b70301c24..bc2d3bcb51 100644
--- a/apps/docs/content/docs/inbox.ja.mdx
+++ b/apps/docs/content/docs/inbox.ja.mdx
@@ -10,7 +10,7 @@ import { InboxDemo } from "@/components/demos/inbox-demo";
## インボックスの場所
-インボックスは **作業** パネルの最初のセクションで、ピン留め済み、ビュー、プロジェクトの上にあります。未読数はセクション名の横と、アプリレールの **作業** のバッジに表示されます。**作業** を右クリックすると **すべて既読にする** を使えます。
+インボックスは **作業** パネルのセクションで、ピン留め済みの下、ビューとプロジェクトの上にあります。ピン留めがないときは最初のセクションになります。未読数はセクション名の横と、アプリレールの **作業** のバッジに表示されます。**作業** を右クリックすると **すべて既読にする** を使えます。
セクションにはタスクごとに 1 行ずつ、新しい順に、既読・未読を問わず並びます。行にはタスクのステータス、タイトルと時刻、誰が何をしたかが表示され、未読の行にはドットが付きます。行にカーソルを合わせると、タイトル全文とコメントを表示するカードが開き、**開く**、**既読にする**、**アーカイブ** を使えます。
diff --git a/apps/docs/content/docs/inbox.ko.mdx b/apps/docs/content/docs/inbox.ko.mdx
index f95ba1f503..3ee208a4b7 100644
--- a/apps/docs/content/docs/inbox.ko.mdx
+++ b/apps/docs/content/docs/inbox.ko.mdx
@@ -10,7 +10,7 @@ import { InboxDemo } from "@/components/demos/inbox-demo";
## 인박스 위치
-인박스는 **작업** 패널의 첫 번째 섹션이며, 고정됨, 뷰, 프로젝트보다 위에 있습니다. 읽지 않은 수는 섹션 제목 옆과 앱 레일의 **작업** 배지에 표시됩니다. **작업**을 오른쪽 클릭하면 **모두 읽음으로 표시**를 쓸 수 있습니다.
+인박스는 **작업** 패널의 섹션으로, 고정됨 아래, 뷰와 프로젝트 위에 있습니다. 고정한 항목이 없으면 첫 번째 섹션이 됩니다. 읽지 않은 수는 섹션 제목 옆과 앱 레일의 **작업** 배지에 표시됩니다. **작업**을 오른쪽 클릭하면 **모두 읽음으로 표시**를 쓸 수 있습니다.
섹션에는 태스크마다 한 행씩, 최신순으로, 읽음 여부와 관계없이 표시됩니다. 행에는 태스크 상태, 제목과 시간, 누가 무엇을 했는지가 보이고, 읽지 않은 행에는 점이 붙습니다. 행 위에 마우스를 올리면 전체 제목과 댓글이 담긴 카드가 열리고, **열기**, **읽음으로 표시**, **보관**을 쓸 수 있습니다.
diff --git a/apps/docs/content/docs/inbox.mdx b/apps/docs/content/docs/inbox.mdx
index 9cb75afa04..61a95ec041 100644
--- a/apps/docs/content/docs/inbox.mdx
+++ b/apps/docs/content/docs/inbox.mdx
@@ -10,7 +10,7 @@ The inbox collects the work activity that concerns you and flags where something
## Where to find it
-The inbox is the first section of the **Work** panel, above Pinned, Views, and Projects. The unread count shows next to the section title and as a badge on **Work** in the app rail; right-click **Work** for **Mark all as read**.
+The inbox is a section of the **Work** panel, below Pinned and above Views and Projects; with nothing pinned, it is the first section. The unread count shows next to the section title and as a badge on **Work** in the app rail; right-click **Work** for **Mark all as read**.
The section lists one row per issue, newest first, read and unread alike. A row shows the issue's status, its title and time, and who did what; a dot marks it unread. Hover a row for a card with the full title, the comment, and **Open**, **Mark as read**, and **Archive**.
diff --git a/apps/docs/content/docs/inbox.zh-Hant.mdx b/apps/docs/content/docs/inbox.zh-Hant.mdx
index d12e81088c..a3dcd8e5bd 100644
--- a/apps/docs/content/docs/inbox.zh-Hant.mdx
+++ b/apps/docs/content/docs/inbox.zh-Hant.mdx
@@ -10,7 +10,7 @@ import { InboxDemo } from "@/components/demos/inbox-demo";
## 在哪裡找到收件箱
-收件箱是**工作**面板的第一個分區,排在固定、檢視和專案之前。未讀數顯示在分區標題旁,也會以角標顯示在應用側欄的**工作**上;右鍵點選**工作**可以**全部標為已讀**。
+收件箱是**工作**面板裡的一個分區,排在固定之後、檢視和專案之前;沒有固定項時,它就是第一個分區。未讀數顯示在分區標題旁,也會以角標顯示在應用側欄的**工作**上;右鍵點選**工作**可以**全部標為已讀**。
這個分區每個任務佔一列,最新的在前,已讀和未讀都在。每列顯示任務狀態、標題和時間,以及誰做了什麼;未讀的列帶一個圓點。滑鼠懸停在某列上會彈出卡片,顯示完整標題和評論內容,並提供**開啟**、**標為已讀**和**歸檔**。
diff --git a/apps/docs/content/docs/inbox.zh.mdx b/apps/docs/content/docs/inbox.zh.mdx
index fc73dcf4b8..41d594e6d2 100644
--- a/apps/docs/content/docs/inbox.zh.mdx
+++ b/apps/docs/content/docs/inbox.zh.mdx
@@ -10,7 +10,7 @@ import { InboxDemo } from "@/components/demos/inbox-demo";
## 在哪里找到收件箱
-收件箱是**工作**面板的第一个分区,排在固定、视图和项目之前。未读数显示在分区标题旁,也会以角标显示在应用侧栏的**工作**上;右键点击**工作**可以**全部标为已读**。
+收件箱是**工作**面板里的一个分区,排在固定之后、视图和项目之前;没有固定项时,它就是第一个分区。未读数显示在分区标题旁,也会以角标显示在应用侧栏的**工作**上;右键点击**工作**可以**全部标为已读**。
这个分区每个任务占一行,最新的在前,已读和未读都在。每行显示任务状态、标题和时间,以及谁做了什么;未读的行带一个圆点。鼠标悬停在某行上会弹出卡片,显示完整标题和评论内容,并提供**打开**、**标为已读**和**归档**。
diff --git a/apps/docs/content/docs/shortcuts.fr.mdx b/apps/docs/content/docs/shortcuts.fr.mdx
index c17f8f7dee..05cb99df30 100644
--- a/apps/docs/content/docs/shortcuts.fr.mdx
+++ b/apps/docs/content/docs/shortcuts.fr.mdx
@@ -45,7 +45,7 @@ Choisir un résultat l'ouvre. Maintenez `⌘` (`Ctrl` sous Windows et Linux) en
Les raccourcis à une seule touche (`C`, `E`, `H`) et Revenir en arrière / Avancer ne réagissent pas pendant que vous tapez dans un champ.
-Le groupe **Navigation** propose aussi d'aller à la boîte de réception, aux discussions, à Mes tâches, aux tâches, aux projets, aux automatisations, aux agents, aux squads, aux statistiques, aux runtimes, aux skills et aux paramètres. Aucune de ces actions n'a de touche par défaut : attribuez-en à celles que vous utilisez. Aller à la boîte de réception ouvre la page Boîte de réception ; la liste des notifications elle-même est la première section du panneau Travail. Aller à Mes tâches ouvre la page Mes tâches, qui n'est pas la vue **Mon travail** du panneau Travail.
+Le groupe **Navigation** propose aussi d'aller à la boîte de réception, aux discussions, à Mes tâches, aux tâches, aux projets, aux automatisations, aux agents, aux squads, aux statistiques, aux runtimes, aux skills et aux paramètres. Aucune de ces actions n'a de touche par défaut : attribuez-en à celles que vous utilisez. Aller à la boîte de réception ouvre la page Boîte de réception ; la liste des notifications elle-même est une section du panneau Travail, juste sous les épingles. Aller à Mes tâches ouvre la page Mes tâches, qui n'est pas la vue **Mon travail** du panneau Travail.
### Raccourcis système fixes
diff --git a/apps/docs/content/docs/shortcuts.ja.mdx b/apps/docs/content/docs/shortcuts.ja.mdx
index 5f196db349..a7a897953b 100644
--- a/apps/docs/content/docs/shortcuts.ja.mdx
+++ b/apps/docs/content/docs/shortcuts.ja.mdx
@@ -45,7 +45,7 @@ import { Step, Steps } from "fumadocs-ui/components/steps";
1 キーだけのショートカット(`C`、`E`、`H`)と「戻る」「進む」は、入力欄で文字を打っている間は反応しません。
-**ナビゲーション**には、インボックス、チャット、自分のタスク、タスク、プロジェクト、自動化、エージェント、Squads、使用量、ランタイム、Skills、設定へ移動する操作もあります。どれも既定ではキーが割り当てられていないので、よく使うものに設定してください。インボックスへの移動で開くのはインボックスページで、通知のリスト自体は作業パネルの最初のセクションにあります。自分のタスクへの移動で開くのはマイタスクのページで、作業パネルの **自分の作業** ビューとは別のものです。
+**ナビゲーション**には、インボックス、チャット、自分のタスク、タスク、プロジェクト、自動化、エージェント、Squads、使用量、ランタイム、Skills、設定へ移動する操作もあります。どれも既定ではキーが割り当てられていないので、よく使うものに設定してください。インボックスへの移動で開くのはインボックスページで、通知のリスト自体は作業パネルの、ピン留め済みのすぐ下のセクションにあります。自分のタスクへの移動で開くのはマイタスクのページで、作業パネルの **自分の作業** ビューとは別のものです。
### 固定のシステムショートカット
diff --git a/apps/docs/content/docs/shortcuts.ko.mdx b/apps/docs/content/docs/shortcuts.ko.mdx
index 8528ee1bf8..f2c62fa1ec 100644
--- a/apps/docs/content/docs/shortcuts.ko.mdx
+++ b/apps/docs/content/docs/shortcuts.ko.mdx
@@ -45,7 +45,7 @@ import { Step, Steps } from "fumadocs-ui/components/steps";
키 하나짜리 단축키(`C`, `E`, `H`)와 뒤로 가기·앞으로 가기는 입력란에서 글을 쓰는 동안에는 동작하지 않습니다.
-**탐색** 그룹에는 인박스, 채팅, 내 태스크, 태스크, 프로젝트, 자동화, 에이전트, 스쿼드, 사용량, 런타임, Skills, 설정으로 이동하는 동작도 있습니다. 모두 기본 키가 없으니 자주 쓰는 것에 직접 지정하세요. 인박스로 이동하면 인박스 페이지가 열리며, 알림 목록 자체는 작업 패널의 첫 번째 섹션에 있습니다. 내 태스크로 이동하면 내 태스크 페이지가 열리며, 작업 패널의 **내 작업** 뷰와는 다릅니다.
+**탐색** 그룹에는 인박스, 채팅, 내 태스크, 태스크, 프로젝트, 자동화, 에이전트, 스쿼드, 사용량, 런타임, Skills, 설정으로 이동하는 동작도 있습니다. 모두 기본 키가 없으니 자주 쓰는 것에 직접 지정하세요. 인박스로 이동하면 인박스 페이지가 열리며, 알림 목록 자체는 작업 패널에서 고정됨 바로 아래 섹션에 있습니다. 내 태스크로 이동하면 내 태스크 페이지가 열리며, 작업 패널의 **내 작업** 뷰와는 다릅니다.
### 고정 시스템 단축키
diff --git a/apps/docs/content/docs/shortcuts.mdx b/apps/docs/content/docs/shortcuts.mdx
index 124a38ec15..ec749cd2b4 100644
--- a/apps/docs/content/docs/shortcuts.mdx
+++ b/apps/docs/content/docs/shortcuts.mdx
@@ -45,7 +45,7 @@ Selecting a result opens it. Hold `⌘` (`Ctrl` on Windows and Linux) while clic
Single-key shortcuts (`C`, `E`, `H`) and Go back / Go forward don't fire while you're typing in an input.
-The **Navigation** group also has Go to Inbox, Chat, My Issues, Issues, Projects, Autopilot, Agents, Squads, Usage, Runtimes, Skills, and Settings. None of them has a key by default; bind the ones you use. Go to Inbox opens the Inbox page; the notification list itself is the first section of the Work panel. Go to My Issues opens the My Issues page, which is not the same as the **My work** view in the Work panel.
+The **Navigation** group also has Go to Inbox, Chat, My Issues, Issues, Projects, Autopilot, Agents, Squads, Usage, Runtimes, Skills, and Settings. None of them has a key by default; bind the ones you use. Go to Inbox opens the Inbox page; the notification list itself is a section of the Work panel, right below Pinned. Go to My Issues opens the My Issues page, which is not the same as the **My work** view in the Work panel.
### Fixed system shortcuts
diff --git a/apps/docs/content/docs/shortcuts.zh-Hant.mdx b/apps/docs/content/docs/shortcuts.zh-Hant.mdx
index 62a3d9d857..9862eba122 100644
--- a/apps/docs/content/docs/shortcuts.zh-Hant.mdx
+++ b/apps/docs/content/docs/shortcuts.zh-Hant.mdx
@@ -45,7 +45,7 @@ import { Step, Steps } from "fumadocs-ui/components/steps";
單鍵快捷鍵(`C`、`E`、`H`)和後退、前進在輸入框裡不起作用,避免打字時誤觸。
-**導航**類操作還有前往收件箱、聊天、我的任務、任務、專案、自動化、AI 代理、小隊、統計、執行時、Skills 和設定,預設都沒有設定按鍵,需要時自己繫結。前往收件箱開啟的是收件箱頁面,通知列表本身是工作面板的第一個分區。前往我的任務開啟的是"我的任務"頁面,和工作面板裡的**我的工作**檢視不是一回事。
+**導航**類操作還有前往收件箱、聊天、我的任務、任務、專案、自動化、AI 代理、小隊、統計、執行時、Skills 和設定,預設都沒有設定按鍵,需要時自己繫結。前往收件箱開啟的是收件箱頁面,通知列表本身是工作面板裡的一個分區,就在固定下面。前往我的任務開啟的是"我的任務"頁面,和工作面板裡的**我的工作**檢視不是一回事。
### 固定的系統快捷鍵
diff --git a/apps/docs/content/docs/shortcuts.zh.mdx b/apps/docs/content/docs/shortcuts.zh.mdx
index 526cdbac9f..54ece0d43a 100644
--- a/apps/docs/content/docs/shortcuts.zh.mdx
+++ b/apps/docs/content/docs/shortcuts.zh.mdx
@@ -45,7 +45,7 @@ import { Step, Steps } from "fumadocs-ui/components/steps";
单键快捷键(`C`、`E`、`H`)和后退、前进在输入框里不起作用,避免打字时误触。
-**导航**类操作还有前往收件箱、聊天、我的任务、任务、项目、自动化、智能体、小队、统计、运行时、Skills 和设置,默认都没有设置按键,需要时自己绑定。前往收件箱打开的是收件箱页面,通知列表本身是工作面板的第一个分区。前往我的任务打开的是"我的任务"页面,和工作面板里的**我的工作**视图不是一回事。
+**导航**类操作还有前往收件箱、聊天、我的任务、任务、项目、自动化、智能体、小队、统计、运行时、Skills 和设置,默认都没有设置按键,需要时自己绑定。前往收件箱打开的是收件箱页面,通知列表本身是工作面板里的一个分区,就在固定下面。前往我的任务打开的是"我的任务"页面,和工作面板里的**我的工作**视图不是一回事。
### 固定的系统快捷键
diff --git a/packages/views/layout/panel-nav.tsx b/packages/views/layout/panel-nav.tsx
index 1a8c145a14..e0b54d09ed 100644
--- a/packages/views/layout/panel-nav.tsx
+++ b/packages/views/layout/panel-nav.tsx
@@ -108,7 +108,8 @@ export function PanelSection({
collapsed,
onCollapsedChange,
children,
-}: {
+ ...props
+}: Omit<React.ComponentProps<"section">, "children" | "className"> & {
label: string;
/** Rendered at the end of the label row (e.g. a create button). */
action?: React.ReactNode;
@@ -121,7 +122,7 @@ export function PanelSection({
const contentId = useId();
const collapsible = !!onCollapsedChange;
return (
- <section data-mc="panel-section" aria-labelledby={id} className="mt-5">
+ <section {...props} data-mc="panel-section" aria-labelledby={id} className="mt-5">
<div className="group/section flex h-7 items-center gap-1 pl-3 pr-1">
<h3 id={id} className="min-w-0 flex-1 truncate text-caption font-medium text-muted-foreground">
{collapsible ? (
diff --git a/packages/views/layout/panels/inbox-section.test.tsx b/packages/views/layout/panels/inbox-section.test.tsx
index 73c4609dfd..c60ab14d00 100644
--- a/packages/views/layout/panels/inbox-section.test.tsx
+++ b/packages/views/layout/panels/inbox-section.test.tsx
@@ -1,4 +1,4 @@
-import type { ReactNode } from "react";
+import { useState, type ReactNode } from "react";
import { act, fireEvent, screen, waitFor, within } from "@testing-library/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
@@ -658,7 +658,7 @@ describe("InboxSection with every row shown", () => {
};
}
- function renderInPanel(count: number, activeIssueId: string | null = null) {
+ function renderInPanel(count: number, activeIssueId: string | null = null, above: ReactNode = null) {
const items = Array.from({ length: count }, (_, i) =>
item({
id: `n${i}`,
@@ -676,6 +676,7 @@ describe("InboxSection with every row shown", () => {
<QueryClientProvider client={client}>
<NavigationProvider value={adapter("/acme/issues")}>
<PanelBody>
+ {above}
<Harness activeIssueId={activeIssueId} pathname="/acme/issues" openKey={activeIssueId} />
</PanelBody>
</NavigationProvider>
@@ -712,6 +713,68 @@ describe("InboxSection with every row shown", () => {
}
});
+ it("follows a section above it that mounts or changes height", async () => {
+ const restore = installLayout();
+ const rect = Element.prototype.getBoundingClientRect;
+ // Where the list starts below the panel's top, as the section above it sets.
+ let listTop = 0;
+ Element.prototype.getBoundingClientRect = function (this: Element) {
+ const top = this.matches("[data-sidebar-list]") ? listTop : 0;
+ return { width: 280, height: ROW_HEIGHT, top, left: 0, right: 280, bottom: top + ROW_HEIGHT, x: 0, y: top, toJSON: () => ({}) } as DOMRect;
+ };
+ const observers: { callback: ResizeObserverCallback; targets: Set<Element> }[] = [];
+ vi.stubGlobal(
+ "ResizeObserver",
+ class {
+ private entry: { callback: ResizeObserverCallback; targets: Set<Element> };
+ constructor(callback: ResizeObserverCallback) {
+ this.entry = { callback, targets: new Set() };
+ observers.push(this.entry);
+ }
+ observe(target: Element) {
+ this.entry.targets.add(target);
+ }
+ unobserve(target: Element) {
+ this.entry.targets.delete(target);
+ }
+ disconnect() {
+ this.entry.targets.clear();
+ }
+ },
+ );
+ const resize = (target: Element) => {
+ for (const { callback, targets } of observers) {
+ if (targets.has(target)) callback([], {} as ResizeObserver);
+ }
+ };
+ const showAbove: { set?: (shown: boolean) => void } = {};
+ function Above() {
+ const [shown, setShown] = useState(false);
+ showAbove.set = setShown;
+ return shown ? <section data-testid="above" /> : null;
+ }
+ try {
+ renderInPanel(300, null, <Above />);
+ fireEvent.click(screen.getByRole("button", { name: /^Show \d+ more/ }));
+ await waitFor(() => expect(rows().length).toBeGreaterThan(0));
+ const atTop = rows().length;
+
+ // A section mounts above the list and pushes it most of a viewport down.
+ listTop = 500;
+ act(() => showAbove.set!(true));
+ await waitFor(() => expect(rows().length).toBeLessThan(atTop));
+
+ // It collapses: the panel keeps its size, the section above shrinks.
+ listTop = 0;
+ act(() => resize(screen.getByTestId("above")));
+ await waitFor(() => expect(rows()).toHaveLength(atTop));
+ } finally {
+ vi.unstubAllGlobals();
+ Element.prototype.getBoundingClientRect = rect;
+ restore();
+ }
+ });
+
it("keeps a short list fully mounted", () => {
useSidebarTreeStore.setState({ inboxSettings: { ...DEFAULT_SIDEBAR_INBOX_SETTINGS, limit: 5 } });
renderInPanel(30);
diff --git a/packages/views/layout/panels/inbox-section.tsx b/packages/views/layout/panels/inbox-section.tsx
index f2ec8bf1de..509b36c202 100644
--- a/packages/views/layout/panels/inbox-section.tsx
+++ b/packages/views/layout/panels/inbox-section.tsx
@@ -364,17 +364,31 @@ function VirtualInboxList({
}) {
const scrollRef = usePanelScrollRef()!;
const [list, setList] = useState<HTMLUListElement | null>(null);
- // Where the list starts within the scroll container's content.
+ // Where the list starts within the scroll container's content. The sections
+ // above it (Pinned) move it as they collapse, expand, mount or unmount.
const [scrollMargin, setScrollMargin] = useState(0);
useLayoutEffect(() => {
const scroller = scrollRef.current;
if (!list || !scroller) return;
const measure = () =>
setScrollMargin(list.getBoundingClientRect().top - scroller.getBoundingClientRect().top + scroller.scrollTop);
- measure();
- const observer = new ResizeObserver(measure);
- observer.observe(scroller);
- return () => observer.disconnect();
+ const resize = new ResizeObserver(measure);
+ const observe = () => {
+ resize.disconnect();
+ resize.observe(scroller);
+ for (const child of scroller.children) {
+ if (child.contains(list)) break;
+ resize.observe(child);
+ }
+ measure();
+ };
+ observe();
+ const mutations = new MutationObserver(observe);
+ mutations.observe(scroller, { childList: true });
+ return () => {
+ mutations.disconnect();
+ resize.disconnect();
+ };
}, [list, scrollRef]);
const virtualizer = useVirtualizer({
diff --git a/packages/views/layout/panels/pinned-section.tsx b/packages/views/layout/panels/pinned-section.tsx
index 22b0d0ad34..2da50f39cf 100644
--- a/packages/views/layout/panels/pinned-section.tsx
+++ b/packages/views/layout/panels/pinned-section.tsx
@@ -160,6 +160,7 @@ export function PinnedSection({ pins, wsId }: { pins: PanelPins; wsId: string })
return (
<PanelSection
+ data-pinned-section
label={t(($) => $.sidebar.pinned_label)}
collapsed={collapsed}
onCollapsedChange={setCollapsed}
diff --git a/packages/views/layout/panels/work-panel.test.tsx b/packages/views/layout/panels/work-panel.test.tsx
index 38d13cc720..bc28d375d2 100644
--- a/packages/views/layout/panels/work-panel.test.tsx
+++ b/packages/views/layout/panels/work-panel.test.tsx
@@ -1,6 +1,6 @@
import { useState, type ReactNode } from "react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import { act, fireEvent, screen, waitFor, within } from "@testing-library/react";
+import { act, cleanup, fireEvent, screen, waitFor, within } from "@testing-library/react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { agentTaskSnapshotOptions } from "@multica/core/agents";
import { EMPTY_ISSUE_VIEW_PREFERENCE } from "@multica/core/api/schemas";
@@ -300,10 +300,23 @@ function inboxItem(issue: Issue): InboxItem {
}
describe("WorkPanel sections", () => {
- it("orders Inbox, Pinned, Views, Projects", () => {
+ const sections = () => Array.from(document.querySelectorAll<HTMLElement>("[data-mc='panel-section']"));
+ const labels = () => sections().map((section) => section.querySelector("h3")?.textContent);
+
+ it("orders Pinned, Inbox, Views, Projects", () => {
renderPanel("/acme/my-issues", [PIN], [PROJECT]);
- const labels = Array.from(document.querySelectorAll("[data-mc='panel-section'] h3"), (h) => h.textContent);
- expect(labels).toEqual(["Inbox", "Pinned", "Views", "Projects"]);
+ expect(labels()).toEqual(["Pinned", "Inbox", "Views", "Projects"]);
+ });
+
+ // The panel body drops the top margin of a section that is its first child.
+ it("starts the panel with its first section, with or without pins", () => {
+ renderPanel("/acme/my-issues", [PIN], [PROJECT]);
+ expect(sections()[0]!.parentElement!.firstElementChild).toBe(sections()[0]);
+ cleanup();
+
+ renderPanel("/acme/my-issues", [], [PROJECT]);
+ expect(labels()[0]).toBe("Inbox");
+ expect(sections()[0]!.parentElement!.firstElementChild).toBe(sections()[0]);
});
});
diff --git a/packages/views/layout/panels/work-panel.tsx b/packages/views/layout/panels/work-panel.tsx
index f6957377fb..664f9bff33 100644
--- a/packages/views/layout/panels/work-panel.tsx
+++ b/packages/views/layout/panels/work-panel.tsx
@@ -236,6 +236,8 @@ export function WorkPanel() {
through the React tree, and must not reach rememberClickedIssue. */}
<IssueContextMenuProvider variant="sidebar">
<PanelBody onClickCapture={rememberClickedIssue} onAuxClickCapture={rememberClickedIssue}>
+ {wsId && <PinnedSection pins={pins} wsId={wsId} />}
+
{wsId && (
<InboxSection
wsId={wsId}
@@ -245,12 +247,6 @@ export function WorkPanel() {
/>
)}
- {wsId && (
- <div data-pinned-section className="contents">
- <PinnedSection pins={pins} wsId={wsId} />
- </div>
- )}
-
{wsId && (
<ViewsSection
wsId={wsId}