Skip to content

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

Go

feat(inbox): eliminate layout jump and polish auto-advance transition (MUL-9865) (#11201)

Jiayuan Zhangaf0aa65b393f
diff --git a/apps/docs/content/docs/inbox.fr.mdx b/apps/docs/content/docs/inbox.fr.mdx
index cd1b8b35b9..8a0de838b5 100644
--- a/apps/docs/content/docs/inbox.fr.mdx
+++ b/apps/docs/content/docs/inbox.fr.mdx
@@ -137,7 +137,7 @@ Lire une notification ne la retire pas. Une ligne quitte la boîte de réception
- quand c'est une notification **Exécution en échec** et que sa tâche passe à un statut qui la rend à une personne : `in_review`, un statut personnalisé de la catégorie `started`, ou n'importe quel statut des catégories `done` ou `closed`. Les notifications Exécution en échec de tout le monde sur cette tâche sont alors archivées, quelle que soit la personne qui a changé le statut, et indépendamment du réglage ci-dessus. `blocked` fait exception : il rend aussi la tâche, mais le travail reste bloqué, donc les échecs précédents méritent encore d'être lus.
- quand votre boîte de réception dans l'espace de travail dépasse 2 000 notifications. Elle garde les 2 000 plus récentes et archive peu après les plus anciennes, lues ou non. Une notification revenue d'un report ou restaurée depuis l'archive compte à partir de son retour. Les notifications d'une tâche reportée ne comptent pas et restent en place.
-Les fenêtres ouvertes retirent aussitôt une ligne archivée, sauf celle que vous avez ouverte. Quand sa notification quitte la boîte de réception autrement (vous passez la tâche à `done` depuis son statut, une autre fenêtre l'archive, ou une modification la sort des filtres de la section), la ligne reste en surbrillance à sa place et la barre de la boîte de réception indique ce qui s'est passé. Quand un changement fait depuis la barre archive la notification, la barre le nomme, par exemple *Statut passé à En cours · Notification archivée*, et garde **Statut**, **Assigné à** et **Actions rapides** pour la suite. **Annuler** (ou `Z`) fait revenir la notification, et **Suivante** (ou `E`) ouvre la ligne suivante. La ligne disparaît dès que vous passez à autre chose. Si c'était la dernière notification de votre boîte de réception, la barre affiche plutôt **Boîte de réception vide** avec le nombre de tâches reportées, et propose **Aller à Mon travail** à la place de **Suivante** ; `E` ouvre la boîte de réception vide. C'est le comportement de **Après l'archivage → Rester sur la tâche**, par défaut ; avec **Ouvrir la suivante**, un changement de votre part qui archive la notification ouverte ouvre aussitôt la ligne suivante, ou la boîte de réception vide, et la confirmation propose **Annuler**.
+Les fenêtres ouvertes retirent aussitôt une ligne archivée, sauf celle que vous avez ouverte. Quand sa notification quitte la boîte de réception autrement (vous passez la tâche à `done` depuis son statut, une autre fenêtre l'archive, ou une modification la sort des filtres de la section), la ligne reste en surbrillance à sa place et la barre de la boîte de réception indique ce qui s'est passé. Quand un changement fait depuis la barre archive la notification, la barre le nomme, par exemple *Statut passé à En cours · Notification archivée*, et garde **Statut**, **Assigné à** et **Actions rapides** pour la suite. **Annuler** (ou `Z`) fait revenir la notification, et **Suivante** (ou `E`) ouvre la ligne suivante. La ligne disparaît dès que vous passez à autre chose. Si c'était la dernière notification de votre boîte de réception, la barre affiche plutôt **Boîte de réception vide** avec le nombre de tâches reportées, et propose **Aller à Mon travail** à la place de **Suivante** ; `E` ouvre la boîte de réception vide. C'est le comportement de **Après l'archivage → Rester sur la tâche**, par défaut ; avec **Ouvrir la suivante**, un changement de votre part qui archive la notification ouverte marque une courte pause d'environ 1,4 seconde avant d'ouvrir la ligne suivante, ou la boîte de réception vide, et la confirmation propose **Annuler**. Pendant cette pause, cliquez sur **Rester ici**, appuyez sur `Esc`, faites défiler la page ou cliquez en dehors de la barre pour annuler et rester sur la tâche, ou appuyez sur `E` pour ouvrir la ligne suivante tout de suite.
Quand vous retirez vous-même la ligne ouverte, depuis la barre de la boîte de réception, sa ligne, la carte de survol ou une action groupée qui l'inclut, c'est la ligne suivante qui s'ouvre. S'il n'en reste aucune, la page de la boîte de réception s'ouvre sur **Boîte de réception vide**. Elle rappelle ce que vous venez de faire, avec **Annuler** (ou `Z`) pour revenir en arrière, et indique combien de tâches sont reportées et quand la prochaine revient. Quand des filtres masquaient le reste de votre boîte de réception, elle indique plutôt combien de notifications restent et propose **Effacer les filtres et continuer**. Revenir en arrière ramène à la tâche. L'archivage et les actions groupées proposent **Annuler**, qui fait revenir les notifications sans changer le statut de la tâche. Les confirmations qui proposent **Annuler**, pour l'archivage, le report comme le désabonnement, restent 10 secondes ; tant que l'une d'elles est affichée, `Z` annule cette dernière action.
diff --git a/apps/docs/content/docs/inbox.ja.mdx b/apps/docs/content/docs/inbox.ja.mdx
index ecb8154e90..2cade350e0 100644
--- a/apps/docs/content/docs/inbox.ja.mdx
+++ b/apps/docs/content/docs/inbox.ja.mdx
@@ -137,7 +137,7 @@ multica inbox snooze <id>... --until tomorrow # RFC 3339、30m、3h、1d、1w
- 「実行失敗」の通知で、タスクが人に引き継がれるステータスになったとき。対象は `in_review`、`started` カテゴリのカスタムステータス、`done`・`closed` カテゴリのすべてのステータスです。誰がステータスを変えたかにかかわらず、そのタスクの全員分の「実行失敗」の通知がアーカイブされ、上の設定には左右されません。`blocked` は例外です。人に引き継がれはしますが作業は止まったままなので、それまでの失敗の記録はまだ確認する必要があります。
- そのワークスペースのインボックスが 2,000 件を超えたとき。新しい 2,000 件を残し、それより古い通知は既読かどうかにかかわらず、少し後に自動でアーカイブされます。スヌーズから戻った通知やアーカイブから戻した通知は、戻った時点の新しさで数えます。スヌーズ中のタスクの通知は数えず、そのまま残ります。
-アーカイブされた行は、開いているウィンドウからもすぐに消えます。ただし、いま開いている行は別です。その通知がほかの理由でインボックスから外れたとき(ステータスからタスクを `done` にした、別のウィンドウでアーカイブされた、編集でセクションのフィルターに合わなくなった)、行は元の位置でハイライトされたまま残り、インボックスバーに何が起きたかが表示されます。バーの **ステータス**、**担当者**、**クイックアクション** で変更して通知がアーカイブされたときは、「進行中 に変更 · 通知をアーカイブしました」のようにその操作が示され、これらの操作はバーに残るので続けて変更できます。**元に戻す**(または `Z`)で通知が戻り、**次へ**(または `E`)で次の行が開きます。行が消えるのは、ほかへ移ったときです。それがインボックスの最後の通知だった場合、バーには代わりに **インボックスは空です** とスヌーズ中のタスク数が表示され、**次へ** の代わりに **自分の作業へ** が出ます。`E` で空になったインボックスが開きます。これは既定の **アーカイブ後 → このタスクに留まる** の動きです。**次の通知を開く** にすると、あなたの操作で開いている通知がアーカイブされたとき、すぐ次の行(なければ空になったインボックス)が開き、確認メッセージに **元に戻す** が出ます。
+アーカイブされた行は、開いているウィンドウからもすぐに消えます。ただし、いま開いている行は別です。その通知がほかの理由でインボックスから外れたとき(ステータスからタスクを `done` にした、別のウィンドウでアーカイブされた、編集でセクションのフィルターに合わなくなった)、行は元の位置でハイライトされたまま残り、インボックスバーに何が起きたかが表示されます。バーの **ステータス**、**担当者**、**クイックアクション** で変更して通知がアーカイブされたときは、「進行中 に変更 · 通知をアーカイブしました」のようにその操作が示され、これらの操作はバーに残るので続けて変更できます。**元に戻す**(または `Z`)で通知が戻り、**次へ**(または `E`)で次の行が開きます。行が消えるのは、ほかへ移ったときです。それがインボックスの最後の通知だった場合、バーには代わりに **インボックスは空です** とスヌーズ中のタスク数が表示され、**次へ** の代わりに **自分の作業へ** が出ます。`E` で空になったインボックスが開きます。これは既定の **アーカイブ後 → このタスクに留まる** の動きです。**次の通知を開く** にすると、あなたの操作で開いている通知がアーカイブされたとき、約 1.4 秒待ってから次の行(なければ空になったインボックス)が開き、確認メッセージに **元に戻す** が出ます。待っている間に **ここに留まる** をクリックするか、`Esc`、スクロール、インボックスバー以外のクリックでキャンセルしてこのタスクに留まれ、`E` を押すとすぐに次の行を開けます。
開いている行を自分で処理したとき(インボックスバー、その行、ホバーカード、その行を含む一括操作)は、代わりに次の行が開きます。残りがなければ、インボックスのページが開き、**インボックスは空です** と表示されます。直前の操作が示されて **元に戻す**(または `Z`)で取り戻せるほか、スヌーズ中のタスク数と次に戻る時刻が表示されます。フィルターでほかの通知が隠れているだけのときは、残りの件数と **フィルターを解除して続ける** が代わりに表示されます。戻るとタスクに戻れます。アーカイブと一括操作の確認には **元に戻す** があり、通知は戻りますが、タスクのステータスはそのままです。**元に戻す** のある確認メッセージ(アーカイブ、スヌーズ、購読解除のいずれも)は 10 秒間表示され、表示中に `Z` を押すとその操作を取り消せます。
diff --git a/apps/docs/content/docs/inbox.ko.mdx b/apps/docs/content/docs/inbox.ko.mdx
index 29807f4662..5acf29e217 100644
--- a/apps/docs/content/docs/inbox.ko.mdx
+++ b/apps/docs/content/docs/inbox.ko.mdx
@@ -137,7 +137,7 @@ multica inbox snooze <id>... --until tomorrow # RFC 3339, 30m, 3h, 1d, 1w; uns
- "실행 실패함" 알림이고, 태스크가 사람에게 넘어가는 상태가 될 때. 해당 상태는 `in_review`, `started` 카테고리의 사용자 지정 상태, `done`·`closed` 카테고리의 모든 상태입니다. 누가 상태를 바꿨는지와 관계없이 그 태스크의 모든 사람의 "실행 실패함" 알림이 보관되며, 위 설정의 영향을 받지 않습니다. `blocked`는 예외입니다. 사람에게 넘어가기는 하지만 작업이 여전히 막혀 있으므로 지난 실패 기록을 계속 확인해야 합니다.
- 그 워크스페이스의 인박스가 알림 2,000개를 넘을 때. 최신 2,000개를 남기고, 그보다 오래된 알림은 읽음 여부와 관계없이 잠시 후 자동으로 보관됩니다. 미루기에서 돌아온 알림과 보관함에서 복원한 알림은 돌아온 시점을 기준으로 셉니다. 미룬 태스크의 알림은 개수에 포함되지 않으며 그대로 남습니다.
-보관된 행은 열려 있는 창에서도 바로 사라집니다. 단, 지금 열어 둔 행은 예외입니다. 그 알림이 다른 이유로 인박스에서 빠지면(상태에서 태스크를 `done`으로 바꿨거나, 다른 창에서 보관했거나, 편집으로 섹션 필터에 더 이상 맞지 않게 된 경우) 행은 제자리에서 강조된 채 남고, 인박스 바에 무슨 일이 있었는지 표시됩니다. 바의 **상태**, **담당자**, **퀵 액션**으로 바꿔서 알림이 보관되면 '상태 변경됨: 진행 중 · 알림이 보관됨'처럼 그 동작이 표시되고, 이 동작들은 바에 그대로 남아 이어서 바꿀 수 있습니다. **실행 취소**(또는 `Z`)로 알림을 되돌리고, **다음**(또는 `E`)으로 다음 행을 엽니다. 행은 다른 곳으로 이동할 때 사라집니다. 그것이 인박스의 마지막 알림이었다면 바에는 대신 **인박스가 비었습니다**와 미뤄 둔 태스크 수가 표시되고, **다음** 대신 **내 작업으로 이동**이 나옵니다. `E`를 누르면 비워진 인박스가 열립니다. 이는 기본값인 **보관한 뒤 → 이 태스크에 머무르기**의 동작입니다. **다음 알림 열기**를 고르면 내 동작으로 열어 둔 알림이 보관될 때 바로 다음 행(없으면 비워진 인박스)이 열리고, 확인 알림에 **실행 취소**가 나옵니다.
+보관된 행은 열려 있는 창에서도 바로 사라집니다. 단, 지금 열어 둔 행은 예외입니다. 그 알림이 다른 이유로 인박스에서 빠지면(상태에서 태스크를 `done`으로 바꿨거나, 다른 창에서 보관했거나, 편집으로 섹션 필터에 더 이상 맞지 않게 된 경우) 행은 제자리에서 강조된 채 남고, 인박스 바에 무슨 일이 있었는지 표시됩니다. 바의 **상태**, **담당자**, **퀵 액션**으로 바꿔서 알림이 보관되면 '상태 변경됨: 진행 중 · 알림이 보관됨'처럼 그 동작이 표시되고, 이 동작들은 바에 그대로 남아 이어서 바꿀 수 있습니다. **실행 취소**(또는 `Z`)로 알림을 되돌리고, **다음**(또는 `E`)으로 다음 행을 엽니다. 행은 다른 곳으로 이동할 때 사라집니다. 그것이 인박스의 마지막 알림이었다면 바에는 대신 **인박스가 비었습니다**와 미뤄 둔 태스크 수가 표시되고, **다음** 대신 **내 작업으로 이동**이 나옵니다. `E`를 누르면 비워진 인박스가 열립니다. 이는 기본값인 **보관한 뒤 → 이 태스크에 머무르기**의 동작입니다. **다음 알림 열기**를 고르면 내 동작으로 열어 둔 알림이 보관될 때 약 1.4초 잠시 머문 뒤 다음 행(없으면 비워진 인박스)이 열리고, 확인 알림에 **실행 취소**가 나옵니다. 대기하는 동안 **여기에 머무르기**를 누르거나 `Esc`, 스크롤, 인박스 바 바깥을 클릭하면 이동이 취소되어 현재 태스크에 머무르며, `E`를 누르면 바로 다음 행을 엽니다.
열어 둔 행을 직접 처리하면(인박스 바, 그 행, 호버 카드, 그 행을 포함한 일괄 작업) 대신 다음 행이 열립니다. 남은 행이 없으면 인박스 페이지가 열리고 **인박스가 비었습니다**가 표시됩니다. 방금 한 동작이 표시되고 **실행 취소**(또는 `Z`)로 되돌릴 수 있으며, 미뤄 둔 태스크 수와 다음으로 돌아오는 시각이 표시됩니다. 필터 때문에 나머지 알림이 가려진 경우에는 남은 알림 수와 **필터 지우고 계속하기**가 대신 표시됩니다. 뒤로 가면 태스크로 돌아갑니다. 보관과 일괄 작업의 확인에는 **실행 취소**가 있으며, 알림은 돌아오고 태스크 상태는 그대로 유지됩니다. **실행 취소**가 있는 확인 알림(보관, 미루기, 구독 해제 모두)은 10초 동안 표시되며, 표시되는 동안 `Z`를 누르면 그 동작을 취소합니다.
diff --git a/apps/docs/content/docs/inbox.mdx b/apps/docs/content/docs/inbox.mdx
index 0b927d5678..aee2254dd1 100644
--- a/apps/docs/content/docs/inbox.mdx
+++ b/apps/docs/content/docs/inbox.mdx
@@ -137,7 +137,7 @@ Reading a notification doesn't remove it. A row leaves the inbox only when:
- it's a **Run failed** notification and its issue moves to a status that hands it back to a person: `in_review`, a custom status in the `started` category, or any status in the `done` or `closed` category. This archives everyone's Run failed notifications on the issue, whoever moved it, and doesn't depend on the setting above. `blocked` is the exception: it hands the issue over too, but the work is still stuck, so the earlier failures are still worth reading.
- your inbox in the workspace goes past 2,000 notifications. It keeps the newest 2,000 and shortly afterwards archives the older ones, read or not. A notification that comes back from a snooze or that you restore from the archive counts from when it came back. Notifications on a snoozed issue don't count and are left alone.
-Open windows drop an archived row right away, except the one you have open. When its notification leaves the inbox some other way (you set the issue to `done` from its status, another window archived it, or an edit took it out of the section's filters), the row stays lit where it was and the inbox bar says what happened. When a change you make from the bar archives the notification, the bar names it, as in *Changed to In Progress · Notification archived*, and keeps **Status**, **Assignee** and **Quick actions** for the next change. **Undo** (or `Z`) brings the notification back, and **Next** (or `E`) opens the next row. The row leaves once you move on. When it was the last notification in your inbox, the bar says **Inbox cleared** instead, with how many issues are snoozed, and offers **Go to My work** in place of **Next**; `E` opens the cleared inbox. That is **After archiving → Stay on the issue**, the default; with **Open the next one**, a change you make that archives the open notification opens the next row, or the cleared inbox, right away, and the confirmation offers **Undo**.
+Open windows drop an archived row right away, except the one you have open. When its notification leaves the inbox some other way (you set the issue to `done` from its status, another window archived it, or an edit took it out of the section's filters), the row stays lit where it was and the inbox bar says what happened. When a change you make from the bar archives the notification, the bar names it, as in *Changed to In Progress · Notification archived*, and keeps **Status**, **Assignee** and **Quick actions** for the next change. **Undo** (or `Z`) brings the notification back, and **Next** (or `E`) opens the next row. The row leaves once you move on. When it was the last notification in your inbox, the bar says **Inbox cleared** instead, with how many issues are snoozed, and offers **Go to My work** in place of **Next**; `E` opens the cleared inbox. That is **After archiving → Stay on the issue**, the default; with **Open the next one**, a change you make that archives the open notification pauses for about 1.4 seconds before opening the next row (or the cleared inbox), and the confirmation offers **Undo**. During the pause, click **Stay here**, press `Esc`, scroll, or click outside the inbox bar to cancel and stay on the issue, or press `E` to open the next row right away.
When you take the open row out yourself, from the inbox bar, its row, the hover card, or a bulk action that includes it, the next row opens instead. With nothing left to open, the inbox page opens on **Inbox cleared**. It names what you just did, with **Undo** (or `Z`) to bring it back, and shows how many issues are snoozed and when the next one returns. When filters hid the rest of your inbox, it says how many notifications are left and offers **Clear filters and continue** instead. Going back returns to the issue. Archiving and the bulk actions confirm with **Undo**, which brings the notifications back and leaves the issue's status as it is. Confirmations that offer **Undo**, for archiving, snoozing and unsubscribing alike, stay for 10 seconds, and while one shows, `Z` undoes that latest action.
diff --git a/apps/docs/content/docs/inbox.zh-Hant.mdx b/apps/docs/content/docs/inbox.zh-Hant.mdx
index b627ca4105..df41ddd7a2 100644
--- a/apps/docs/content/docs/inbox.zh-Hant.mdx
+++ b/apps/docs/content/docs/inbox.zh-Hant.mdx
@@ -137,7 +137,7 @@ multica inbox snooze <id>... --until tomorrow # RFC 3339、30m、3h、1d、1w
- 它是"執行失敗"通知,且任務進入交回給人的狀態:`in_review`、`started` 分類下的自定義狀態,或 `done`、`closed` 分類下的任一狀態。這會歸檔所有人在該任務上的"執行失敗"通知,不論是誰改的狀態,也不受上面的開關影響。`blocked` 例外:它同樣交回給人,但工作還卡著,之前的失敗記錄還要看。
- 你在該工作區的收件箱超過 2,000 條通知。收件箱保留最新的 2,000 條,隨後自動歸檔更早的通知,無論是否已讀。從延後中回來或從歸檔中還原的通知,按回來的時間算作新通知。已延後任務上的通知不計入,也不會被歸檔。
-開著的視窗會立即移除已歸檔的列,但你正開著的那一列除外。它的通知因為其他原因離開收件箱時(你在狀態裡把任務改為 `done`、別的視窗歸檔了它,或修改後不再符合分區的篩選),這一列會在原位保持高亮,收件箱列會說明發生了什麼。在列裡改**狀態**、**負責人**或執行**快捷操作**後通知被歸檔時,列會寫明是哪一項,例如「已改為進行中 · 通知已歸檔」,這幾個操作也留在列裡,可以接著改。**復原**(或按 `Z`)讓通知回來,**下一條**(或按 `E`)開啟下一列。你離開之後,這一列才會移出。如果這是收件箱裡的最後一條通知,列會改為顯示**收件箱已清空**和延後中的任務數,用**前往我的工作**代替**下一條**;按 `E` 會開啟已清空的收件箱。這是**歸檔後 → 停在目前任務**(預設)的行為;選**打開下一條**時,你的操作歸檔了正開著的通知後,會直接開啟下一列(沒有下一列時開啟已清空的收件箱),提示裡可以**復原**。
+開著的視窗會立即移除已歸檔的列,但你正開著的那一列除外。它的通知因為其他原因離開收件箱時(你在狀態裡把任務改為 `done`、別的視窗歸檔了它,或修改後不再符合分區的篩選),這一列會在原位保持高亮,收件箱列會說明發生了什麼。在列裡改**狀態**、**負責人**或執行**快捷操作**後通知被歸檔時,列會寫明是哪一項,例如「已改為進行中 · 通知已歸檔」,這幾個操作也留在列裡,可以接著改。**復原**(或按 `Z`)讓通知回來,**下一條**(或按 `E`)開啟下一列。你離開之後,這一列才會移出。如果這是收件箱裡的最後一條通知,列會改為顯示**收件箱已清空**和延後中的任務數,用**前往我的工作**代替**下一條**;按 `E` 會開啟已清空的收件箱。這是**歸檔後 → 停在目前任務**(預設)的行為;選**打開下一條**時,你的操作歸檔了正開著的通知後,會短暫停留約 1.4 秒再開啟下一列(沒有下一列時開啟已清空的收件箱),提示裡可以**復原**;停留期間點**留在這裡**、按 `Esc`、捲動頁面或點擊收件箱列以外的區域都會取消跳轉並留在目前任務,按 `E` 則立即開啟下一列。
如果是你自己把正開著的這一列處理掉(在收件箱列、它所在的列、懸停卡片,或包含它的批次操作裡),會直接開啟下一列;沒有剩下的列時,會開啟收件箱頁面,顯示**收件箱已清空**:寫明你剛才的操作,可以**復原**(或按 `Z`)把它找回,並顯示延後中的任務數和下一條回來的時間。如果是篩選隱藏了收件箱裡的其餘通知,會改為說明還剩多少條,並提供**清除篩選,繼續處理**。返回上一頁可以回到任務。歸檔和批次操作的提示裡都可以**復原**:通知會回來,任務的狀態保持不變。帶**復原**的提示(歸檔、延後、取消訂閱都一樣)會停留 10 秒;提示還在時,按 `Z` 復原這次操作。
diff --git a/apps/docs/content/docs/inbox.zh.mdx b/apps/docs/content/docs/inbox.zh.mdx
index ef335f696d..b1f00fc5c3 100644
--- a/apps/docs/content/docs/inbox.zh.mdx
+++ b/apps/docs/content/docs/inbox.zh.mdx
@@ -137,7 +137,7 @@ multica inbox snooze <id>... --until tomorrow # RFC 3339、30m、3h、1d、1w
- 它是"运行失败"通知,且任务进入交回给人的状态:`in_review`、`started` 分类下的自定义状态,或 `done`、`closed` 分类下的任一状态。这会归档所有人在该任务上的"运行失败"通知,不论是谁改的状态,也不受上面的开关影响。`blocked` 例外:它同样交回给人,但工作还卡着,之前的失败记录还要看。
- 你在该工作区的收件箱超过 2,000 条通知。收件箱保留最新的 2,000 条,随后自动归档更早的通知,无论是否已读。从延后中回来或从归档中还原的通知,按回来的时间算作新通知。已延后任务上的通知不计入,也不会被归档。
-打开着的窗口会立即移除已归档的行,但你正打开的那一行除外。它的通知因为其他原因离开收件箱时(你在状态里把任务改为 `done`、别的窗口归档了它,或修改后不再符合分区的筛选),这一行会在原位保持高亮,收件箱栏会说明发生了什么。在栏里改**状态**、**负责人**或运行**快捷操作**后通知被归档时,栏会写明是哪一项,比如“已改为进行中 · 通知已归档”,这几个操作也留在栏里,可以接着改。**撤销**(或按 `Z`)让通知回来,**下一条**(或按 `E`)打开下一行。你离开之后,这一行才会移出。如果这是收件箱里的最后一条通知,栏会改为显示**收件箱已清空**和延后中的任务数,用**前往我的工作**代替**下一条**;按 `E` 会打开已清空的收件箱。这是**归档后 → 停在当前任务**(默认)的行为;选**打开下一条**时,你的操作归档了正打开的通知后,会直接打开下一行(没有下一行时打开已清空的收件箱),提示里可以**撤销**。
+打开着的窗口会立即移除已归档的行,但你正打开的那一行除外。它的通知因为其他原因离开收件箱时(你在状态里把任务改为 `done`、别的窗口归档了它,或修改后不再符合分区的筛选),这一行会在原位保持高亮,收件箱栏会说明发生了什么。在栏里改**状态**、**负责人**或运行**快捷操作**后通知被归档时,栏会写明是哪一项,比如“已改为进行中 · 通知已归档”,这几个操作也留在栏里,可以接着改。**撤销**(或按 `Z`)让通知回来,**下一条**(或按 `E`)打开下一行。你离开之后,这一行才会移出。如果这是收件箱里的最后一条通知,栏会改为显示**收件箱已清空**和延后中的任务数,用**前往我的工作**代替**下一条**;按 `E` 会打开已清空的收件箱。这是**归档后 → 停在当前任务**(默认)的行为;选**打开下一条**时,你的操作归档了正打开的通知后,会短暂停留约 1.4 秒再打开下一行(没有下一行时打开已清空的收件箱),提示里可以**撤销**;停留期间点**留在这里**、按 `Esc`、滚动页面或点击收件箱栏以外的区域都会取消跳转并留在当前任务,按 `E` 则立即打开下一行。
如果是你自己把正打开的这一行处理掉(在收件箱栏、它所在的行、悬停卡片,或包含它的批量操作里),会直接打开下一行;没有剩下的行时,会打开收件箱页面,显示**收件箱已清空**:写明你刚才的操作,可以**撤销**(或按 `Z`)把它找回,并显示延后中的任务数和下一条回来的时间。如果是筛选隐藏了收件箱里的其余通知,会改为说明还剩多少条,并提供**清除筛选,继续处理**。返回上一页可以回到任务。归档和批量操作的提示里都可以**撤销**:通知会回来,任务的状态保持不变。带**撤销**的提示(归档、延后、取消订阅都一样)会停留 10 秒;提示还在时,按 `Z` 撤销这次操作。
diff --git a/apps/storybook/.storybook/preview.tsx b/apps/storybook/.storybook/preview.tsx
index 784d8bc0ac..582ceaab7f 100644
--- a/apps/storybook/.storybook/preview.tsx
+++ b/apps/storybook/.storybook/preview.tsx
@@ -57,7 +57,7 @@ const preview: Preview = {
parameters: {
layout: "centered",
options: {
- storySort: { order: ["Kbd", ["Compare all", "Specimen wall", "Real surfaces", "Glyph anatomy", "*"], "Comment box", ["Compare all", "*"], "Voice input", ["Composer (A + C)", "Waveform", ["Compare all", "*"], "Settings", "First use", "Edge cases", "Explored", ["All directions", "*"]]] },
+ storySort: { order: ["Inbox transition", ["Compare all", "*"], "Kbd", ["Compare all", "Specimen wall", "Real surfaces", "Glyph anatomy", "*"], "Comment box", ["Compare all", "*"], "Voice input", ["Composer (A + C)", "Waveform", ["Compare all", "*"], "Settings", "First use", "Edge cases", "Explored", ["All directions", "*"]]] },
},
controls: { disable: true },
actions: { disable: true },
diff --git a/apps/storybook/src/inbox-transition/data.ts b/apps/storybook/src/inbox-transition/data.ts
new file mode 100644
index 0000000000..23604fc12e
--- /dev/null
+++ b/apps/storybook/src/inbox-transition/data.ts
@@ -0,0 +1,487 @@
+import type { Lang } from "../voice-input/copy";
+import type { MockImageKind } from "./mock-images";
+
+export type IssueStatus = "in_review" | "in_progress" | "todo" | "done";
+export type IssuePriority = "urgent" | "high" | "medium" | "low";
+
+export interface DemoActor {
+ name: string;
+ initials: string;
+ isAgent?: boolean;
+}
+
+export interface DemoCommentImage {
+ kind: MockImageKind;
+ caption: Record<Lang, string>;
+ /** Extra decode delay relative to base network latency. */
+ delayMultiplier: number;
+}
+
+export interface DemoComment {
+ id: string;
+ author: DemoActor;
+ time: Record<Lang, string>;
+ body: Record<Lang, string[]>;
+ code?: string;
+ runBadge?: Record<Lang, string>;
+ image?: DemoCommentImage;
+ isTarget?: boolean;
+}
+
+export interface DemoInboxIssue {
+ id: string;
+ identifier: string;
+ title: Record<Lang, string>;
+ project: Record<Lang, string>;
+ status: IssueStatus;
+ priority: IssuePriority;
+ assignee: DemoActor;
+ actor: DemoActor;
+ reason: Record<Lang, string>;
+ timeAgo: Record<Lang, string>;
+ unread: boolean;
+ agentRunning?: boolean;
+ /** Mirrors `INBOX_IDLE_PREFETCH_LIMIT = 3` (only first 3 unread rows are pre-warmed today). */
+ coldInCurrent: boolean;
+ labels: Record<Lang, string[]>;
+ description: Record<Lang, string[]>;
+ subIssues: { id: string; done: boolean; title: Record<Lang, string> }[];
+ comments: DemoComment[];
+}
+
+export const ACTORS = {
+ jiayuan: { name: "Jiayuan", initials: "J" },
+ bohan: { name: "Bohan", initials: "B" },
+ alex: { name: "Alex", initials: "A" },
+ emacs: { name: "Emacs", initials: "E", isAgent: true },
+ lambda: { name: "Lambda", initials: "L", isAgent: true },
+ cursor: { name: "Cursor", initials: "C", isAgent: true },
+} satisfies Record<string, DemoActor>;
+
+/**
+ * Generates realistic multi-comment history (12–16 comments per issue, ~3,000–4,500px tall)
+ * with embedded screenshots placed BOTH above and inside the target comment so scroll
+ * landing, async image CLS, and network request latency behave like real Multica issues.
+ */
+function buildLongTimeline(opts: {
+ issueTag: string;
+ agent: DemoActor;
+ reviewer: DemoActor;
+ leadBodyZh: string;
+ leadBodyEn: string;
+ targetBodyZh: string;
+ targetBodyEn: string;
+ targetTime: Record<Lang, string>;
+ targetAuthor: DemoActor;
+ followUpZh?: string;
+ followUpEn?: string;
+ images: [MockImageKind, MockImageKind, MockImageKind];
+ totalBeforeTarget: number;
+}): DemoComment[] {
+ const out: DemoComment[] = [];
+ const { issueTag, agent, reviewer, images, totalBeforeTarget } = opts;
+
+ for (let i = 1; i <= totalBeforeTarget; i++) {
+ const isAgentTurn = i % 2 === 1;
+ const author = isAgentTurn ? agent : i % 4 === 0 ? ACTORS.jiayuan : reviewer;
+ const minsAgo = (totalBeforeTarget - i + 2) * 14;
+ const time = {
+ zh: minsAgo >= 60 ? `${Math.floor(minsAgo / 60)} 小时前` : `${minsAgo} 分钟前`,
+ en: minsAgo >= 60 ? `${Math.floor(minsAgo / 60)}h ago` : `${minsAgo}m ago`,
+ };
+
+ if (i === 1) {
+ out.push({
+ id: `${issueTag}-c${i}`,
+ author: agent,
+ time,
+ runBadge: { zh: "运行 48s · 修改 5 个文件", en: "Ran 48s · 5 files" },
+ body: {
+ zh: [opts.leadBodyZh, "先贴一下本地复现的火焰图和关键指标,下面逐项拆解影响路径与边界条件。"],
+ en: [opts.leadBodyEn, "Attaching the local trace and key latency metrics below before breaking down the edge cases."],
+ },
+ image: {
+ kind: images[0],
+ caption: { zh: `图 1 · ${issueTag} 复现采集与耗时分布`, en: `Fig 1 · ${issueTag} reproduction trace` },
+ delayMultiplier: 0.9,
+ },
+ });
+ continue;
+ }
+
+ if (i === Math.floor(totalBeforeTarget * 0.45)) {
+ out.push({
+ id: `${issueTag}-c${i}`,
+ author: agent,
+ time,
+ runBadge: { zh: "运行 1m 12s · 新增 6 条单测", en: "Ran 1m 12s · 6 tests added" },
+ body: {
+ zh: [
+ "补了一轮真机对比截图,重点观察 40px InboxBar 槽位在切页间隙的变化以及长评论页里的滚动锚点表现。",
+ "同时检查了 React Query 缓存失效链路:在 `inbox:batch-archived` 到达后,旧列表引用会被重新计算一次,需要避免触发二次卸载。",
+ ],
+ en: [
+ "Captured a before/after UI comparison focused on the 40px InboxBar slot during route transitions and deep-thread scroll alignment.",
+ "Also audited the TanStack Query invalidation path after `inbox:batch-archived` to make sure cache patches never trigger a redundant unmount.",
+ ],
+ },
+ code: `// ${issueTag}: keep next + next+1 warm around openKey\nconst targets = [nextInboxRow(rows, openKey), nextInboxRow(rows, nextKey)].filter(Boolean);\nawait Promise.all(targets.map((row) => prefetchIssuePage(qc, wsId, row.issue_id)));`,
+ image: {
+ kind: images[1],
+ caption: { zh: `图 2 · ${issueTag} 切页前后布局对比截图`, en: `Fig 2 · ${issueTag} layout comparison` },
+ delayMultiplier: 1.45,
+ },
+ });
+ continue;
+ }
+
+ if (i === totalBeforeTarget - 2) {
+ out.push({
+ id: `${issueTag}-c${i}`,
+ author: agent,
+ time,
+ runBadge: { zh: "运行 34s · E2E 全绿", en: "Ran 34s · E2E green" },
+ body: {
+ zh: [
+ "在弱网(250ms / 600ms)和带 3 张大图的长讨论串上跑了 50 轮回归测试,确认没有出现主线程长任务阻塞,也没有回退到顶部的二次跳动。",
+ "附上最新一轮 Playwright 采样和网络瀑布图,方便评审确认。",
+ ],
+ en: [
+ "Ran 50 regression rounds under 250ms and 600ms throttled networks on long multi-image threads—zero main-thread stalls and zero top-scroll regressions.",
+ "Attached the latest Playwright verification output and waterfall.",
+ ],
+ },
+ image: {
+ kind: images[2],
+ caption: { zh: `图 3 · ${issueTag} 弱网与多图回归快照`, en: `Fig 3 · ${issueTag} throttled multi-image run` },
+ delayMultiplier: 1.9,
+ },
+ });
+ continue;
+ }
+
+ out.push({
+ id: `${issueTag}-c${i}`,
+ author,
+ time,
+ runBadge: isAgentTurn ? { zh: `运行 ${18 + i * 3}s`, en: `Ran ${18 + i * 3}s` } : undefined,
+ body: {
+ zh: isAgentTurn
+ ? [
+ `第 ${i} 轮排查更新:核对了 \`${issueTag}\` 在桌面端 Tab 切换、Web 端 Next.js 异步路由和侧边栏收起态下的表现。`,
+ "发现在评论区包含多张未指定宽高比的图片时,即使首帧准确滚到了目标评论,图片解码展开后仍会把视口往下推 200–500px。",
+ ]
+ : [
+ `看了第 ${i - 1} 楼的结果,方向是对的。再确认一下快速连按 E 超过预取窗口时的降级体验——不能一连按就满屏闪骨架屏。`,
+ ],
+ en: isAgentTurn
+ ? [
+ `Pass #${i} update on \`${issueTag}\`: verified desktop tabs, Next.js async navigation on web, and collapsed sidebar states.`,
+ "Confirmed that unreserved images above the target comment still push the viewport down by 200–500px once decoded, even when initial scroll landing is exact.",
+ ]
+ : [
+ `Reviewed comment #${i - 1}—looks solid. Double-check the fallback when someone mashes E faster than prefetch so it degrades calmly instead of flashing blank skeletons.`,
+ ],
+ },
+ });
+ }
+
+ // Deep notification target comment (sits ~2,800–4,200px down!)
+ out.push({
+ id: `${issueTag}-target`,
+ author: opts.targetAuthor,
+ time: opts.targetTime,
+ isTarget: true,
+ body: {
+ zh: [opts.targetBodyZh],
+ en: [opts.targetBodyEn],
+ },
+ image: {
+ kind: images[1],
+ caption: { zh: `附图 · ${issueTag} 通知目标评论内嵌截图`, en: `Attachment · ${issueTag} target comment screenshot` },
+ delayMultiplier: 1.15,
+ },
+ });
+
+ if (opts.followUpZh && opts.followUpEn) {
+ out.push({
+ id: `${issueTag}-tail`,
+ author: agent,
+ time: { zh: "1 分钟前", en: "1m ago" },
+ body: {
+ zh: [opts.followUpZh],
+ en: [opts.followUpEn],
+ },
+ });
+ }
+
+ return out;
+}
+
+export function createSeedIssues(): DemoInboxIssue[] {
+ return [
+ {
+ id: "mul-9865",
+ identifier: "MUL-9865",
+ title: {
+ zh: "优化 Inbox 处理完上一条后自动切换下一条的页面跳动交互",
+ en: "Smooth out page jump when Inbox auto-advances to the next item",
+ },
+ project: { zh: "收件箱体验", en: "Inbox Experience" },
+ status: "in_review",
+ priority: "high",
+ assignee: ACTORS.emacs,
+ actor: ACTORS.jiayuan,
+ reason: { zh: "Jiayuan 提及了你 · 14 条评论", en: "Jiayuan mentioned you · 14 comments" },
+ timeAgo: { zh: "刚刚", en: "just now" },
+ unread: true,
+ coldInCurrent: false,
+ labels: { zh: ["交互细节", "收件箱"], en: ["Interaction", "Inbox"] },
+ description: {
+ zh: [
+ "连续处理收件箱通知时,真实的任务往往包含十几条长评论、多张内嵌图片和 200–600ms 的接口请求耗时。当前实现把 40px InboxBar 塌陷、冷缓存骨架屏、侧栏闪白、顶部闪现再瞬移到评论、以及图片无占位展开导致的视口偏移全部叠在了一起。",
+ "这版 Storybook 原型为每条任务构造了 12–16 条长评论(3,500px+ 高度)和 3 张异步加载图片,并在顶部提供 0ms / 250ms / 600ms 三档真实请求延迟与实时预热状态——既可以体验正常阅读节奏下的预取命中,也可以狂按 E 冲出预取窗口看真实加载态的表现。",
+ ],
+ en: [
+ "Real Multica issues have 12–20+ long agent comments, multiple embedded screenshots, and 200–600ms network requests. Today's transition stacks a 40px InboxBar drop, cold Skeleton flash, right-sidebar blanking, top-of-page scroll teleport, and late image CLS.",
+ "This upgraded Storybook workbench gives every issue 12–16 long comments (3,500px+ tall), 3 async-loading screenshots above the target comment, and selectable 0ms / 250ms / 600ms network latency with live anchor prefetch.",
+ ],
+ },
+ subIssues: [
+ { id: "MUL-9866", done: true, title: { zh: "排查 InboxBar 40px 跳动、预取盲区与图片偏移", en: "Audit 40px InboxBar shift, prefetch gaps, and image CLS" } },
+ { id: "MUL-9867", done: false, title: { zh: "在 Storybook 还原多评论 + 图片 + 请求耗时场景", en: "Simulate long threads, images, and request latency in Storybook" } },
+ ],
+ comments: buildLongTimeline({
+ issueTag: "MUL-9865",
+ agent: ACTORS.emacs,
+ reviewer: ACTORS.bohan,
+ leadBodyZh: "已定位代码里叠在一起的 6 处跳动来源,其中在长讨论串里最扎眼的是「顶部闪一下 → 瞬移 3500px 到底部评论 → 上方图片晚 250ms 加载完又把评论顶出屏幕」。",
+ leadBodyEn: "Traced 6 stacked glitches; on long threads the worst sequence is flashing top-of-page, teleporting 3,500px down, and then having late images above push the target comment back off-screen.",
+ targetAuthor: ACTORS.jiayuan,
+ targetTime: { zh: "2 分钟前", en: "2m ago" },
+ targetBodyZh: "现在这个 Storybook 已经还原了真实长评论、异步大图和网络请求延迟:建议切到 A(现状)连按 E 感受 250ms/600ms 下的多段跳动与图片顶偏,再切到 B/C/D/E 对比稳态预取 + 宽高比占位 + 轻过渡的体感。",
+ targetBodyEn: "This workbench now simulates long threads, async images, and real request latency: try A (Current) at 250ms/600ms to feel the multi-stage jump & image push, then compare B/C/D/E.",
+ followUpZh: "提示:在 B/C/D/E 下稍微停 300ms 看顶部变成「下一条已预热」后按 E 是 0ms 秒切;如果连续狂按 E E E 超过预热速度,可以直接看到真实的加载降级态(顶栏不闪、40px Bar 锁稳、评论对齐后淡入)。",
+ followUpEn: "Tip: Wait ~300ms for the green 'Next pre-warmed' pill to feel 0ms warm switches, or mash E-E-E rapidly to outrun prefetch and test the live loading fallback.",
+ images: ["perf-chart", "ui-compare", "trace-waterfall"],
+ totalBeforeTarget: 12,
+ }),
+ },
+ {
+ id: "mul-9848",
+ identifier: "MUL-9848",
+ title: {
+ zh: "简化 Inbox Zero 空状态文案与撤销按钮样式",
+ en: "Simplify Inbox Zero empty state copy and inline Undo styling",
+ },
+ project: { zh: "收件箱体验", en: "Inbox Experience" },
+ status: "in_review",
+ priority: "medium",
+ assignee: ACTORS.lambda,
+ actor: ACTORS.lambda,
+ reason: { zh: "Lambda 运行已完成 · 13 条评论", en: "Lambda finished running · 13 comments" },
+ timeAgo: { zh: "14 分钟", en: "14m" },
+ unread: true,
+ coldInCurrent: false,
+ labels: { zh: ["UI 精修"], en: ["UI Polish"] },
+ description: {
+ zh: [
+ "清完收件箱后的空状态之前堆了过多入口按钮,本轮收敛为只保留核心状态:完成标志、「收件箱已清空」标题、单行内联撤销(支持按 Z)和延后摘要。",
+ "本条同样包含 12 条长讨论和 3 张设计对比截图,目标评论位于页面底部 ~3,400px 处。",
+ ],
+ en: [
+ "Trimmed Inbox Zero down to the core state: check tile, cleared heading, quiet inline Undo (Z), and snoozed summary.",
+ "Includes 12 long comments and 3 screenshots with the target comment ~3,400px down.",
+ ],
+ },
+ subIssues: [
+ { id: "MUL-9849", done: true, title: { zh: "移除多余的导航 CTA 和快捷键提示", en: "Remove redundant navigation CTAs and shortcut hints" } },
+ ],
+ comments: buildLongTimeline({
+ issueTag: "MUL-9848",
+ agent: ACTORS.lambda,
+ reviewer: ACTORS.alex,
+ leadBodyZh: "整理了浅色/深色模式下 Inbox Zero 的视觉重心,移除了与侧栏重复的三个快捷按钮。",
+ leadBodyEn: "Audited Inbox Zero visual hierarchy in light and dark modes and removed the three redundant navigation buttons.",
+ targetAuthor: ACTORS.lambda,
+ targetTime: { zh: "14 分钟前", en: "14m ago" },
+ targetBodyZh: "PR #11193 已合并。注意观察切到这一条时:在 A 模式下,上方 3 张截图延迟展开会把这条评论直接往下顶 480px;而在 B/C/D/E 下图片容器预留了宽高比,这条评论的位置 0px 偏移。",
+ targetBodyEn: "PR #11193 merged. Notice how in Direction A the 3 screenshots above expand late and push this comment down by 480px, while B/C/D/E hold it at 0px shift.",
+ images: ["ui-compare", "ci-matrix", "perf-chart"],
+ totalBeforeTarget: 11,
+ }),
+ },
+ {
+ id: "mul-9822",
+ identifier: "MUL-9822",
+ title: {
+ zh: "支持在 Inbox Zero 页面直接按 Z 撤销刚清空的通知",
+ en: "Allow pressing Z on Inbox Zero to undo the last cleared notification",
+ },
+ project: { zh: "收件箱体验", en: "Inbox Experience" },
+ status: "in_progress",
+ priority: "medium",
+ assignee: ACTORS.bohan,
+ actor: ACTORS.bohan,
+ reason: { zh: "Bohan 评论了 · 15 条评论", en: "Bohan commented · 15 comments" },
+ timeAgo: { zh: "38 分钟", en: "38m" },
+ unread: true,
+ agentRunning: true,
+ coldInCurrent: false,
+ labels: { zh: ["快捷键"], en: ["Shortcuts"] },
+ description: {
+ zh: [
+ "把单键快捷键保护逻辑抽成共享的 `useInboxUndoShortcut` hook,在 toast 存在时由 toast 接管 `Z`,toast 消失后无缝交给 Inbox Zero 内联撤销接管。",
+ "这条讨论串包含 15 条评论与多段代码评审,目标评论在倒数第 2 条。",
+ ],
+ en: [
+ "Unified single-key shortcut guards into `useInboxUndoShortcut` so toast owns `Z` first and Inbox Zero seamlessly takes over afterward.",
+ "15-comment engineering thread with target comment near the bottom.",
+ ],
+ },
+ subIssues: [],
+ comments: buildLongTimeline({
+ issueTag: "MUL-9822",
+ agent: ACTORS.cursor,
+ reviewer: ACTORS.bohan,
+ leadBodyZh: "核对了 E / H / Shift+E / Z 在中文 IME 组合输入、评论框、命令面板中的拦截边界。",
+ leadBodyEn: "Audited E / H / Shift+E / Z guards across IME composition, editors, and command bar.",
+ targetAuthor: ACTORS.bohan,
+ targetTime: { zh: "38 分钟前", en: "38m ago" },
+ targetBodyZh: "试着在这里点「标记完成」或「快捷发送 @Emacs 评论」:在 A 下等 250–600ms 网络回包后会突然抽走页面;在 D 下 InboxBar 立刻给 1.4s 细进度条缓冲,期间滚动一下正文就会自动停住。",
+ targetBodyEn: "Try clicking Mark Done or Send @Emacs comment here: A yanks the page after network round-trip, while D settles InboxBar with a 1.4s cancellable progress line.",
+ followUpZh: "补充:此时按 Z 撤销可以同时感受反向落回过渡与左侧行平滑展开。",
+ followUpEn: "Also try pressing Z right after to feel the reverse motion and smooth row re-expansion.",
+ images: ["trace-waterfall", "ci-matrix", "ui-compare"],
+ totalBeforeTarget: 13,
+ }),
+ },
+ {
+ id: "mul-9806",
+ identifier: "MUL-9806",
+ title: {
+ zh: "Settled InboxBar 展示触发自动归档的具体操作原因",
+ en: "Name the action that triggered auto-archive in the settled InboxBar",
+ },
+ project: { zh: "收件箱体验", en: "Inbox Experience" },
+ status: "in_review",
+ priority: "high",
+ assignee: ACTORS.alex,
+ actor: ACTORS.alex,
+ reason: { zh: "Alex 请求审查 · 第 4 条(现状冷缓存)", en: "Alex requested review · Item #4 (cold in Current)" },
+ timeAgo: { zh: "1 小时", en: "1h" },
+ unread: true,
+ coldInCurrent: true,
+ labels: { zh: ["自动归档", "冷缓存"], en: ["Auto-archive", "Cold cache"] },
+ description: {
+ zh: [
+ "这是列表第 4 条——超出线上 `INBOX_IDLE_PREFETCH_LIMIT = 3` 的预取上限!在「A · 现状」下切到这里会完整经历:`InboxBar 闪消 (-40px) → 缺 bar 骨架屏 → Issue JSON 回来 (+40px + 侧栏闪白 + 停在顶部) → Timeline 回来瞬移 3,800px → 3 张图陆续顶偏 +480px`。",
+ "在 B/C/D/E 下,当你阅读前一条时锚点预取已经在后台把这一条预热好了;即使你连按 E 冲出预热窗口,顶栏与 40px InboxBar 也会立刻用列表元数据填满不闪跳。",
+ ],
+ en: [
+ "Item #4—beyond today's 3-item unread prefetch cap! In Direction A you feel the full cascade: -40px bar drop → barless skeleton → +40px jump at scrollTop=0 → 3,800px teleport → +480px image CLS.",
+ "In B/C/D/E anchor prefetch warms this row while you read #3; even if you mash E past prefetch, top chrome + 40px InboxBar populate immediately from list metadata.",
+ ],
+ },
+ subIssues: [
+ { id: "MUL-9807", done: true, title: { zh: "记录 InboxBar 发起的状态/负责人/快捷操作", en: "Track status, assignee, and quick-action causes from InboxBar" } },
+ { id: "MUL-9808", done: true, title: { zh: "覆盖 8 个语言包的 settled 文案", en: "Add settled copy across all 8 locale bundles" } },
+ ],
+ comments: buildLongTimeline({
+ issueTag: "MUL-9806",
+ agent: ACTORS.emacs,
+ reviewer: ACTORS.alex,
+ leadBodyZh: "实现了 InboxBar 归档归因文案:区分「已改为已完成」「已改派给某人」「已运行快捷操作」三种来源。",
+ leadBodyEn: "Implemented action-specific settled copy in InboxBar for status, assignee, and quick-action causes.",
+ targetAuthor: ACTORS.alex,
+ targetTime: { zh: "1 小时前", en: "1h ago" },
+ targetBodyZh: "对比一下把网络延迟切到 600ms 后快速连按 E 到这一条:A 会连续跳 4 次,而 B/C/D/E 整个顶部框架纹丝不动,数据回来直接定位到这条评论平滑呈现。",
+ targetBodyEn: "Switch latency to 600ms and rapidly press E to reach this item: A jumps 4 times, while B/C/D/E keep the entire top frame locked and fade in aligned right on this comment.",
+ images: ["perf-chart", "trace-waterfall", "ci-matrix"],
+ totalBeforeTarget: 14,
+ }),
+ },
+ {
+ id: "mul-9790",
+ identifier: "MUL-9790",
+ title: {
+ zh: "将任务页顶部通知操作收敛到标题栏下方的统一 InboxBar",
+ en: "Consolidate notification actions into a unified 40px InboxBar under the header",
+ },
+ project: { zh: "工作区壳层", en: "Workspace Shell" },
+ status: "todo",
+ priority: "medium",
+ assignee: ACTORS.cursor,
+ actor: ACTORS.jiayuan,
+ reason: { zh: "Jiayuan 评论了(已读 · 现状不预取)", en: "Jiayuan commented (read · skipped by Current)" },
+ timeAgo: { zh: "3 小时", en: "3h" },
+ unread: false,
+ coldInCurrent: true,
+ labels: { zh: ["架构", "已读条目"], en: ["Architecture", "Read row"] },
+ description: {
+ zh: [
+ "这是一条**已读**通知——线上 `useInboxIssuePrefetch` 只预取 `read !== true` 的行,所以切到已读条目每次都会冷加载。",
+ "在 B/C/D/E 的锚点预取下,无论已读还是未读,只要它在当前条目的下一位就会被提前预热。",
+ ],
+ en: [
+ "This row is already **read**—today's `useInboxIssuePrefetch` skips read rows, causing a cold skeleton every time.",
+ "With anchor prefetch in B/C/D/E, the next row is warmed regardless of read status.",
+ ],
+ },
+ subIssues: [],
+ comments: buildLongTimeline({
+ issueTag: "MUL-9790",
+ agent: ACTORS.cursor,
+ reviewer: ACTORS.jiayuan,
+ leadBodyZh: "将分散在标题栏右侧和正文上方的通知按钮统一收敛到 40px 的 InboxBar。",
+ leadBodyEn: "Consolidated notification actions into a single 40px InboxBar under the breadcrumb header.",
+ targetAuthor: ACTORS.jiayuan,
+ targetTime: { zh: "3 小时前", en: "3h ago" },
+ targetBodyZh: "InboxBar 收拢之后整条任务页干净很多,现在最重要的是把切下一条时这 40px bar 的闪烁、冷加载骨架屏和长评论多图跳动一起治干净。",
+ targetBodyEn: "The unified InboxBar looks clean—now we just need to eliminate the 40px flicker, cold skeleton jump, and multi-image scroll shift when advancing.",
+ images: ["ui-compare", "perf-chart", "trace-waterfall"],
+ totalBeforeTarget: 11,
+ }),
+ },
+ {
+ id: "mul-9788",
+ identifier: "MUL-9788",
+ title: {
+ zh: "完成任务或触发智能体运行时默认自动归档收件箱通知",
+ en: "Default auto-archive to completing an issue or triggering an agent",
+ },
+ project: { zh: "收件箱体验", en: "Inbox Experience" },
+ status: "in_review",
+ priority: "low",
+ assignee: ACTORS.emacs,
+ actor: ACTORS.emacs,
+ reason: { zh: "Emacs 完成了运行 · 最后一条", en: "Emacs finished run · Final item" },
+ timeAgo: { zh: "5 小时", en: "5h" },
+ unread: true,
+ coldInCurrent: true,
+ labels: { zh: ["自动归档"], en: ["Auto-archive"] },
+ description: {
+ zh: [
+ "列表最后一条通知:处理完之后进入 Inbox Zero 清空状态,可以按 `Z` 撤销直接回到这条长讨论串的原评论位置。",
+ ],
+ en: [
+ "Final item in the queue: clearing it transitions to Inbox Zero, and pressing `Z` returns right back to this thread's target comment.",
+ ],
+ },
+ subIssues: [],
+ comments: buildLongTimeline({
+ issueTag: "MUL-9788",
+ agent: ACTORS.emacs,
+ reviewer: ACTORS.bohan,
+ leadBodyZh: "默认自动归档策略改为「完成任务或触发智能体运行」,纯字段整理留在收件箱。",
+ leadBodyEn: "Defaulted auto-archive to issue completion or agent trigger, keeping tidy-up edits in place.",
+ targetAuthor: ACTORS.emacs,
+ targetTime: { zh: "5 小时前", en: "5h ago" },
+ targetBodyZh: "这是最后一条通知:归档或标记完成后直接进入 Inbox Zero;按 Z 撤销可以体验从空状态返回长评论页的过渡。",
+ targetBodyEn: "Last item in the queue: archive or mark Done to reach Inbox Zero, then press Z to undo back into this long thread.",
+ images: ["ci-matrix", "ui-compare", "perf-chart"],
+ totalBeforeTarget: 10,
+ }),
+ },
+ ];
+}
diff --git a/apps/storybook/src/inbox-transition/directions.ts b/apps/storybook/src/inbox-transition/directions.ts
new file mode 100644
index 0000000000..8d74786217
--- /dev/null
+++ b/apps/storybook/src/inbox-transition/directions.ts
@@ -0,0 +1,153 @@
+import type { Lang } from "../voice-input/copy";
+
+export type DirectionId = "current" | "crossfade" | "glide" | "buffer" | "card-stack";
+
+export interface TransitionDirection {
+ id: DirectionId;
+ letter: string;
+ recommended?: boolean;
+ name: Record<Lang, string>;
+ shortName: Record<Lang, string>;
+ pitch: Record<Lang, string>;
+ bestFor: Record<Lang, string>;
+ tradeoff: Record<Lang, string>;
+ mechanics: Record<Lang, string[]>;
+}
+
+export const DIRECTIONS: TransitionDirection[] = [
+ {
+ id: "current",
+ letter: "A",
+ name: { zh: "线上现状(基准对照)", en: "Current (baseline)" },
+ shortName: { zh: "现状", en: "Current" },
+ pitch: {
+ zh: "完整还原线上 5 处跳动:InboxBar 闪消 40px、第 4 条与已读条冷加载骨架屏、侧栏闪白、先闪顶部再瞬移到评论、自动归档 380ms 后无预告抽走页面。",
+ en: "Reproduces all 5 production glitches: 40px InboxBar drop, cold Skeleton on item #4+ and read rows, right sidebar blanking, top-to-comment teleport, and unbuffered 380ms auto-archive yank.",
+ },
+ bestFor: { zh: "对照体验问题真因", en: "Baseline for comparing fixes" },
+ tradeoff: { zh: "每次切页都有多段跳动与失控感", en: "Multi-stage layout jumps and rug-pull feel" },
+ mechanics: {
+ zh: [
+ "归档前 leaveRow 同步卸载 InboxBar → 正文上跳 40px",
+ "第 4 条起(及已读条)未预取 → 闪无 InboxBar 的骨架屏",
+ "landingChromeHeld 期间右侧栏闪白,主区先渲染 scrollTop=0 再瞬移到评论",
+ "自动归档等网络回包 ~380ms 后无预告直接抽走当前页",
+ ],
+ en: [
+ "leaveRow unmounts InboxBar before navigation → 40px upward snap",
+ "Item #4+ and read rows miss prefetch → Skeleton without InboxBar",
+ "Right sidebar blanks during landingChromeHeld; body flashes scrollTop=0 then teleports",
+ "Auto-archive yanks the page ~380ms after action with zero preview",
+ ],
+ },
+ },
+ {
+ id: "crossfade",
+ letter: "B",
+ name: { zh: "稳态底座 + 纯淡入淡出", en: "Steady chrome + pure crossfade" },
+ shortName: { zh: "纯淡入淡出", en: "Crossfade" },
+ pitch: {
+ zh: "修掉所有 40px 跳动、预取盲区、侧栏闪白和滚动瞬移;内容区仅做 130ms 零位移淡入淡出。用来验证「只要足够稳,是否根本不需要滑动」。",
+ en: "Fixes every layout shift, prefetch miss, sidebar flicker, and scroll teleport; content does a 130ms zero-translation fade. Tests whether pure stability is enough without slide motion.",
+ },
+ bestFor: { zh: "追求绝对克制、零晕动、极速连按", en: "Maximum restraint, zero motion, rapid triage" },
+ tradeoff: { zh: "方向感偏弱;自动归档后仍然立刻切走", en: "Less directional cue; auto-archive still leaves right away" },
+ mechanics: {
+ zh: [
+ "锚点预取下一条 & 下下一条(含已读),锁定 40px InboxBar 与右侧栏不闪",
+ "目标评论在淡入前已精确对齐视口,彻底消灭「闪顶部 → 瞬移」",
+ "左侧列表行 160ms 平滑收拢高度;右侧正文 130ms 纯 opacity 过渡(0px 位移)",
+ "手动与自动归档均立即切换",
+ ],
+ en: [
+ "Anchor-prefetches next + next+1 (including read rows); locks 40px InboxBar and sidebar",
+ "Target comment aligns before reveal—zero top-of-page flash",
+ "Left row collapses smoothly in 160ms; body uses pure 130ms opacity fade (0px shift)",
+ "Both manual and auto-archive advance immediately",
+ ],
+ },
+ },
+ {
+ id: "glide",
+ letter: "C",
+ name: { zh: "稳态底座 + 轻方向滑入", en: "Steady chrome + directional glide" },
+ shortName: { zh: "轻方向滑入", en: "Glide" },
+ pitch: {
+ zh: "在稳态底座上叠加 12px 轻垂直滑入(160ms),与左侧列表「下一条在下方」的方向隐喻一致;按 Z 撤销时从上方反向轻落回。",
+ en: "Adds a restrained 12px vertical glide (160ms) matching the sidebar's top-to-bottom progression; pressing Z to undo glides cleanly back down from above.",
+ },
+ bestFor: { zh: "既有明确「推进到下一条」的方向感,又保持 Linear 级干脆", en: "Clear forward momentum while staying Linear-fast" },
+ tradeoff: { zh: "触发自动归档(点完成 / @Agent 评论)时仍会立刻离开当前页", en: "Auto-archive actions still leave the page immediately" },
+ mechanics: {
+ zh: [
+ "外框(BreadcrumbHeader / 40px InboxBar / 右侧栏)纹丝不动",
+ "左侧归档行 160ms 平滑收拢;右侧正文从下方 +12px 轻滑淡入(160ms)",
+ "按 Z 撤销时左侧行平滑展开,右侧正文从上方 -12px 镜像落回",
+ "连续快速按 E 立即打断,零排队拖沓",
+ ],
+ en: [
+ "Outer chrome (BreadcrumbHeader / 40px InboxBar / sidebar) stays anchored",
+ "Left row collapses in 160ms; body glides up +12px → 0 (160ms)",
+ "Undo (Z) expands the row back and glides the issue down from -12px",
+ "Rapid E presses interrupt cleanly with zero queue buildup",
+ ],
+ },
+ },
+ {
+ id: "buffer",
+ letter: "D",
+ recommended: true,
+ name: { zh: "手动快切 + 自动归档缓冲条", en: "Instant manual + auto-archive buffer" },
+ shortName: { zh: "缓冲条(推荐)", en: "Buffer (Rec)" },
+ pitch: {
+ zh: "把「手动归档 (E/H)」和「任务操作触发自动归档(完成 / @智能体)」拆开:手动 0 等待走 C;自动归档在 InboxBar 给 1.4s 细进度条缓冲,滚动或点击即停住,按 E 立刻切走。",
+ en: "Splits explicit triage (E/H) from action-triggered auto-archive (Done / @agent): manual advances immediately via C; auto-archive shows a 1.4s 2px progress line in InboxBar that pauses on any interaction or skips on E.",
+ },
+ bestFor: { zh: "兼顾 E-E-E 极速清收件箱与「确认改完状态/发出评论再走」的掌控感", en: "Fast E-E-E triage plus calm confirmation after Done or @agent comment" },
+ tradeoff: { zh: "自动归档后多停 1.4s(但随时按 E 可跳过)", en: "1.4s pause on auto-archive (skippable anytime with E)" },
+ mechanics: {
+ zh: [
+ "按 E / H 手动处理:0 等待,走 C 的稳态 + 12px 轻方向滑入",
+ "点「标记完成」、改派智能体或发 @Agent 评论:InboxBar 立刻变 settled 态并启动底部 2px 进度线(1.4s)",
+ "缓冲期间滚动正文、点进页面、聚焦输入框或点「留在这里 / Esc」自动取消切页",
+ "确认无误无需操作,1.4s 后平滑推进到下一条(或按 E 立即跳过)",
+ ],
+ en: [
+ "Manual E / H: zero wait, uses Direction C's steady 12px directional glide",
+ "Mark Done, assign agent, or send @agent comment: InboxBar settles immediately with a 1.4s 2px bottom progress bar",
+ "Scrolling, clicking the body, focusing composer, or pressing Esc cancels auto-advance",
+ "Otherwise glides smoothly to the next item after 1.4s (or press E to skip)",
+ ],
+ },
+ },
+ {
+ id: "card-stack",
+ letter: "E",
+ name: { zh: "卡片叠层翻页", en: "Card stack turnover" },
+ shortName: { zh: "卡片叠层", en: "Card stack" },
+ pitch: {
+ zh: "更强的物理卡片隐喻:旧任务整页轻微缩小上滑离场(scale 0.985 / y -18px),新任务从下方叠层推入(y +24px,220ms),类似 Superhuman / Apple Mail。",
+ en: "Stronger physical deck metaphor: outgoing issue lifts and scales subtly back (0.985 / -18px) while the next sheet rises cleanly from underneath (+24px, 220ms).",
+ },
+ bestFor: { zh: "希望每次切换都有明确「收走一张、翻出下一张」的强空间感知", en: "Unmistakable card-filed-away spatial metaphor" },
+ tradeoff: { zh: "大页面位移幅度较大,高频连续按 E 时视觉体量比 C/D 更重", en: "Larger displacement feels heavier during rapid E-E-E bursts" },
+ mechanics: {
+ zh: [
+ "外框稳态不变,阅读区双层叠加呈现离场页与入场页",
+ "旧页 190ms 轻缩上退,新页 220ms 从下方 24px 推入",
+ "按 Z 撤销时方向反转(旧页下沉退场,撤销页从上方落回)",
+ "自动归档采用同样卡片切换(可与 D 的缓冲条组合)",
+ ],
+ en: [
+ "Outer chrome stays steady while leaving and entering sheets overlap briefly",
+ "Outgoing sheet lifts -18px & scales to 0.985 (190ms); incoming rises from +24px (220ms)",
+ "Undo (Z) reverses the deck cleanly",
+ "Auto-archive uses the same card turnover (combinable with D's buffer)",
+ ],
+ },
+ },
+];
+
+export const DIRECTION_BY_ID: Record<DirectionId, TransitionDirection> = Object.fromEntries(
+ DIRECTIONS.map((d) => [d.id, d]),
+) as Record<DirectionId, TransitionDirection>;
diff --git a/apps/storybook/src/inbox-transition/inbox-transition.css b/apps/storybook/src/inbox-transition/inbox-transition.css
new file mode 100644
index 0000000000..2713d08c0f
--- /dev/null
+++ b/apps/storybook/src/inbox-transition/inbox-transition.css
@@ -0,0 +1,162 @@
+/* Motion choreography for Inbox auto-advance prototypes.
+ * `--inbox-motion-scale` is 1 at normal speed and 2.5 in slow-motion review mode. */
+
+.inbox-row-wrap {
+ display: grid;
+ grid-template-rows: 1fr;
+ opacity: 1;
+ transition:
+ grid-template-rows calc(160ms * var(--inbox-motion-scale, 1)) cubic-bezier(0.2, 0.8, 0.2, 1),
+ opacity calc(120ms * var(--inbox-motion-scale, 1)) ease;
+}
+
+.inbox-row-wrap[data-motion="instant"] {
+ transition: none;
+}
+
+.inbox-row-wrap[data-state="collapsing"] {
+ grid-template-rows: 0fr;
+ opacity: 0;
+ pointer-events: none;
+}
+
+.inbox-row-wrap[data-state="entering"] {
+ animation: inbox-row-expand calc(170ms * var(--inbox-motion-scale, 1)) cubic-bezier(0.2, 0.8, 0.2, 1) both;
+}
+
+@keyframes inbox-row-expand {
+ from {
+ grid-template-rows: 0fr;
+ opacity: 0;
+ }
+ to {
+ grid-template-rows: 1fr;
+ opacity: 1;
+ }
+}
+
+/* B · Pure crossfade (zero translation) */
+.inbox-stage-crossfade-enter {
+ animation: inbox-crossfade-in calc(130ms * var(--inbox-motion-scale, 1)) ease-out both;
+}
+
+@keyframes inbox-crossfade-in {
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
+ }
+}
+
+/* C / D · Directional vertical glide (aligned with list progression) */
+.inbox-stage-glide-next {
+ animation: inbox-glide-from-bottom calc(160ms * var(--inbox-motion-scale, 1)) cubic-bezier(0.2, 0.8, 0.2, 1) both;
+}
+
+.inbox-stage-glide-prev {
+ animation: inbox-glide-from-top calc(160ms * var(--inbox-motion-scale, 1)) cubic-bezier(0.2, 0.8, 0.2, 1) both;
+}
+
+@keyframes inbox-glide-from-bottom {
+ from {
+ opacity: 0;
+ transform: translateY(12px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+@keyframes inbox-glide-from-top {
+ from {
+ opacity: 0;
+ transform: translateY(-12px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+/* E · Card stack (leaving card lifts + scales back, next card rises cleanly underneath) */
+.inbox-card-enter-next {
+ animation: inbox-card-rise calc(220ms * var(--inbox-motion-scale, 1)) cubic-bezier(0.22, 1, 0.36, 1) both;
+}
+
+.inbox-card-enter-prev {
+ animation: inbox-card-drop calc(220ms * var(--inbox-motion-scale, 1)) cubic-bezier(0.22, 1, 0.36, 1) both;
+}
+
+.inbox-card-leave-next {
+ animation: inbox-card-lift-out calc(190ms * var(--inbox-motion-scale, 1)) cubic-bezier(0.4, 0, 0.2, 1) forwards;
+}
+
+.inbox-card-leave-prev {
+ animation: inbox-card-sink-out calc(190ms * var(--inbox-motion-scale, 1)) cubic-bezier(0.4, 0, 0.2, 1) forwards;
+}
+
+@keyframes inbox-card-rise {
+ from {
+ opacity: 0;
+ transform: translateY(24px) scale(0.992);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0) scale(1);
+ }
+}
+
+@keyframes inbox-card-drop {
+ from {
+ opacity: 0;
+ transform: translateY(-22px) scale(0.992);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0) scale(1);
+ }
+}
+
+@keyframes inbox-card-lift-out {
+ from {
+ opacity: 1;
+ transform: translateY(0) scale(1);
+ }
+ to {
+ opacity: 0;
+ transform: translateY(-18px) scale(0.985);
+ }
+}
+
+@keyframes inbox-card-sink-out {
+ from {
+ opacity: 1;
+ transform: translateY(0) scale(1);
+ }
+ to {
+ opacity: 0;
+ transform: translateY(18px) scale(0.985);
+ }
+}
+
+/* Target comment flash pulse matching Multica's deep-link landing highlight */
+.inbox-comment-flash {
+ animation: inbox-comment-pulse calc(1600ms * var(--inbox-motion-scale, 1)) ease-out;
+}
+
+@keyframes inbox-comment-pulse {
+ 0% {
+ box-shadow: 0 0 0 2px color-mix(in oklch, var(--brand) 65%, transparent);
+ background-color: color-mix(in oklch, var(--brand) 8%, var(--card));
+ }
+ 65% {
+ box-shadow: 0 0 0 1px color-mix(in oklch, var(--brand) 35%, transparent);
+ background-color: color-mix(in oklch, var(--brand) 4%, var(--card));
+ }
+ 100% {
+ box-shadow: 0 0 0 0 transparent;
+ background-color: var(--card);
+ }
+}
diff --git a/apps/storybook/src/inbox-transition/inbox-transition.stories.tsx b/apps/storybook/src/inbox-transition/inbox-transition.stories.tsx
new file mode 100644
index 0000000000..1f9b15320a
--- /dev/null
+++ b/apps/storybook/src/inbox-transition/inbox-transition.stories.tsx
@@ -0,0 +1,109 @@
+import type { Meta, StoryObj } from "@storybook/react-vite";
+import { Badge } from "@multica/ui/components/ui/badge";
+import { useStoryEnv } from "../voice-input/env";
+import { DIRECTIONS, type DirectionId } from "./directions";
+import { InboxWorkbench } from "./inbox-workbench";
+
+const meta = {
+ title: "Inbox transition",
+ id: "inbox-transition",
+ parameters: { layout: "fullscreen" },
+} satisfies Meta;
+export default meta;
+type Story = StoryObj<typeof meta>;
+
+function CompareAllPage() {
+ const { lang } = useStoryEnv();
+ return (
+ <div className="min-h-screen bg-page-canvas">
+ <div className="mx-auto max-w-[1380px] px-8 py-8">
+ <header className="max-w-3xl">
+ <h1 className="text-display-sm font-semibold">
+ {lang === "zh" ? "Inbox 自动切下一条:五种过渡方案" : "Inbox auto-advance: five transition directions"}
+ </h1>
+ <p className="mt-2 text-body text-muted-foreground">
+ {lang === "zh"
+ ? "每条任务都包含 11–15 条长评论(3,000px+ 高度)和 3 张异步加载图片,顶部可切 0ms / 250ms / 600ms 请求延迟。建议:1)切到 A 在 250ms/600ms 下连按 E,观察 40px 跳动、骨架屏、顶部闪现瞬移和图片晚加载把评论顶出视口;2)切到 B/C/D/E 体验锚点预热(0ms 秒切)以及狂按 E 冲出预热窗口时的稳态降级;3)点「标记完成」或「快捷发送 @Emacs 评论」感受自动归档节奏。"
+ : "Every issue has 11–15 long comments (3,000px+ tall) and 3 async-loading screenshots, with 0ms / 250ms / 600ms network presets. Try: (1) Direction A at 250ms/600ms to feel the 40px bar drop, skeleton flash, scroll teleport, and late-image shift; (2) B/C/D/E for warm 0ms switches and rapid E-E-E cold fallback; (3) Mark Done or @Emacs comment for auto-archive pacing."}
+ </p>
+ </header>
+
+ <div className="mt-6 overflow-hidden rounded-xl border border-surface-border shadow-sm">
+ <InboxWorkbench initialDirection="buffer" allowSwitchDirection heightClass="h-[720px]" />
+ </div>
+
+ <section className="mt-8 grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-5">
+ {DIRECTIONS.map((d) => (
+ <article
+ key={d.id}
+ className="flex flex-col rounded-xl bg-surface p-4 ring-1 ring-surface-border"
+ >
+ <div className="flex items-center justify-between gap-2">
+ <span className="text-caption font-semibold text-brand">{d.letter}</span>
+ {d.recommended && (
+ <Badge variant="secondary" className="text-micro font-medium text-brand">
+ {lang === "zh" ? "推荐" : "Recommended"}
+ </Badge>
+ )}
+ </div>
+ <h2 className="mt-1 text-body font-semibold text-foreground">{d.name[lang]}</h2>
+ <p className="mt-1.5 text-caption text-muted-foreground">{d.pitch[lang]}</p>
+ <ul className="mt-3 space-y-1.5 text-caption text-foreground/85">
+ {d.mechanics[lang].map((line) => (
+ <li key={line} className="flex gap-1.5">
+ <span className="mt-1.5 size-1 shrink-0 rounded-full bg-faint-foreground" />
+ <span>{line}</span>
+ </li>
+ ))}
+ </ul>
+ <dl className="mt-auto space-y-2 border-t border-border/60 pt-3 text-caption">
+ <div>
+ <dt className="font-medium text-foreground">{lang === "zh" ? "适合" : "Best for"}</dt>
+ <dd className="text-muted-foreground">{d.bestFor[lang]}</dd>
+ </div>
+ <div>
+ <dt className="font-medium text-foreground">{lang === "zh" ? "代价" : "Trade-off"}</dt>
+ <dd className="text-muted-foreground">{d.tradeoff[lang]}</dd>
+ </div>
+ </dl>
+ </article>
+ ))}
+ </section>
+ </div>
+ </div>
+ );
+}
+
+function SingleDirectionStory({ id }: { id: DirectionId }) {
+ return <InboxWorkbench initialDirection={id} allowSwitchDirection heightClass="h-screen" />;
+}
+
+export const CompareAll: Story = {
+ name: "Compare all",
+ render: () => <CompareAllPage />,
+};
+
+export const Current: Story = {
+ name: "A · Current (baseline)",
+ render: () => <SingleDirectionStory id="current" />,
+};
+
+export const CalmCrossfade: Story = {
+ name: "B · Calm crossfade",
+ render: () => <SingleDirectionStory id="crossfade" />,
+};
+
+export const DirectionalGlide: Story = {
+ name: "C · Directional glide",
+ render: () => <SingleDirectionStory id="glide" />,
+};
+
+export const AutoArchiveBuffer: Story = {
+ name: "D · Auto-archive buffer (Rec)",
+ render: () => <SingleDirectionStory id="buffer" />,
+};
+
+export const CardStack: Story = {
+ name: "E · Card stack",
+ render: () => <SingleDirectionStory id="card-stack" />,
+};
diff --git a/apps/storybook/src/inbox-transition/inbox-workbench.tsx b/apps/storybook/src/inbox-transition/inbox-workbench.tsx
new file mode 100644
index 0000000000..7ad7b9bc39
--- /dev/null
+++ b/apps/storybook/src/inbox-transition/inbox-workbench.tsx
@@ -0,0 +1,1599 @@
+import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
+import {
+ AlarmClock,
+ Archive,
+ ArrowDown,
+ BellOff,
+ Bot,
+ Check,
+ CheckCircle2,
+ ChevronDown,
+ Circle,
+ CircleDot,
+ Folder,
+ Gauge,
+ Inbox,
+ MoreHorizontal,
+ PanelRight,
+ Pin,
+ RotateCcw,
+ Send,
+ Sparkles,
+ Undo2,
+ X,
+} from "@multica/ui/icons";
+import { ActorAvatar } from "@multica/ui/components/common/actor-avatar";
+import { IconButton } from "@multica/ui/components/common/icon-button";
+import { MulticaBleedMark } from "@multica/ui/components/common/multica-graphics";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
+import { Badge } from "@multica/ui/components/ui/badge";
+import { Button } from "@multica/ui/components/ui/button";
+import { Kbd } from "@multica/ui/components/ui/kbd";
+import { Skeleton } from "@multica/ui/components/ui/skeleton";
+import { cn } from "@multica/ui/lib/utils";
+import type { Lang } from "../voice-input/copy";
+import { useStoryEnv } from "../voice-input/env";
+import { ACTORS, createSeedIssues, type DemoInboxIssue, type IssuePriority, type IssueStatus } from "./data";
+import { DIRECTION_BY_ID, DIRECTIONS, type DirectionId } from "./directions";
+import { DelayedCommentImage } from "./mock-images";
+import "./inbox-transition.css";
+
+type LatencyPreset = 0 | 250 | 600;
+
+const COPY = {
+ work: { zh: "工作", en: "Work" },
+ pinned: { zh: "置顶", en: "Pinned" },
+ inbox: { zh: "收件箱", en: "Inbox" },
+ projects: { zh: "项目", en: "Projects" },
+ inboxEmpty: { zh: "暂无通知", en: "No notifications" },
+ archive: { zh: "归档", en: "Archive" },
+ snooze: { zh: "延后", en: "Snooze" },
+ unsubscribe: { zh: "取消订阅并归档", en: "Unsubscribe & archive" },
+ markDone: { zh: "标记完成", en: "Mark Done" },
+ assignAgent: { zh: "指派 Emacs", en: "Assign Emacs" },
+ undo: { zh: "撤销", en: "Undo" },
+ next: { zh: "下一条", en: "Next" },
+ stayHere: { zh: "留在这里", en: "Stay here" },
+ reset: { zh: "重置", en: "Reset" },
+ slowMo: { zh: "慢动作 0.4x", en: "0.4x" },
+ latencyLabel: { zh: "请求延迟", en: "Latency" },
+ prefetchWarm: { zh: "下一条已预热", en: "Next pre-warmed" },
+ prefetchCold: { zh: "下一条未预热(会冷加载)", en: "Next cold (not prefetched)" },
+ prefetchWarming: { zh: "后台预热下一条中…", en: "Pre-warming next…" },
+ clearedTitle: { zh: "收件箱已清空", en: "Inbox cleared" },
+ clearedSub: { zh: "刚归档了", en: "Just archived" },
+ snoozedSummary: { zh: "2 条延后通知 · 最早 明天 09:00 回来", en: "2 snoozed · next returns tomorrow 9:00 AM" },
+ subIssues: { zh: "子任务", en: "Sub-issues" },
+ activity: { zh: "动态与评论", en: "Activity" },
+ targetTag: { zh: "通知定位评论", en: "Notification comment" },
+ composerPlaceholder: { zh: "留下评论,输入 @ 唤起智能体...", en: "Leave a comment, type @ to trigger an agent..." },
+ quickAgentReply: { zh: "快捷发送 @Emacs 评论(触发自动归档)", en: "Send @Emacs comment (auto-archive)" },
+ send: { zh: "发送", en: "Send" },
+ status: { zh: "状态", en: "Status" },
+ priority: { zh: "优先级", en: "Priority" },
+ assignee: { zh: "负责人", en: "Assignee" },
+ project: { zh: "项目", en: "Project" },
+ labels: { zh: "标签", en: "Labels" },
+ running: { zh: "运行中", en: "Running" },
+ bufferAdvancing: { zh: "即将打开下一条", en: "opening next" },
+ bufferPaused: { zh: "已留在当前任务", en: "staying on this issue" },
+ toastArchived: { zh: "已归档通知", en: "Notification archived" },
+ toastSnoozed: { zh: "已延后至明天 09:00", en: "Snoozed until tomorrow 9:00 AM" },
+ toastAutoArchived: { zh: "已自动归档通知", en: "Auto-archived notification" },
+ doneCause: { zh: "已改为已完成 · 通知已归档", en: "Changed to Done · Notification archived" },
+ assignCause: { zh: "已改派给 Emacs · 通知已归档", en: "Reassigned to Emacs · Notification archived" },
+ commentCause: { zh: "已发送并唤醒 Emacs · 通知已归档", en: "Sent & woke Emacs · Notification archived" },
+ loadingTimeline: { zh: "正在加载时间线与评论…", en: "Loading timeline & comments…" },
+ shortcutsHint: {
+ zh: "E 归档 · H 延后 · Z 撤销 · Esc 停住缓冲 · R 重置",
+ en: "E archive · H snooze · Z undo · Esc stay · R reset",
+ },
+};
+
+const STATUS_META: Record<IssueStatus, { label: Record<Lang, string>; color: string }> = {
+ todo: { label: { zh: "待办", en: "Todo" }, color: "text-muted-foreground" },
+ in_progress: { label: { zh: "进行中", en: "In Progress" }, color: "text-amber-500" },
+ in_review: { label: { zh: "待审核", en: "In Review" }, color: "text-blue-500" },
+ done: { label: { zh: "已完成", en: "Done" }, color: "text-emerald-500" },
+};
+
+const PRIORITY_LABEL: Record<IssuePriority, Record<Lang, string>> = {
+ urgent: { zh: "紧急", en: "Urgent" },
+ high: { zh: "高", en: "High" },
+ medium: { zh: "中", en: "Medium" },
+ low: { zh: "低", en: "Low" },
+};
+
+function StatusGlyph({ status, className }: { status: IssueStatus; className?: string }) {
+ const color = STATUS_META[status].color;
+ if (status === "done") return <CheckCircle2 className={cn("size-3.5 shrink-0", color, className)} />;
+ if (status === "in_progress" || status === "in_review") return <CircleDot className={cn("size-3.5 shrink-0", color, className)} />;
+ return <Circle className={cn("size-3.5 shrink-0", color, className)} />;
+}
+
+interface HistoryEntry {
+ item: DemoInboxIssue;
+ index: number;
+ kind: "archived" | "snoozed";
+}
+
+interface BufferState {
+ issueId: string;
+ causeText: string;
+ progress: number;
+ paused: boolean;
+}
+
+type LoadStage =
+ | "ready"
+ | "current-bar-gone"
+ | "current-skeleton"
+ | "current-issue-only"
+ | "current-top-blank-sidebar"
+ | "steady-loading-body";
+
+interface LeavingSnapshot {
+ issue: DemoInboxIssue;
+ direction: "next" | "prev";
+ seq: number;
+}
+
+/** First 3 unread rows that production's `useInboxIssuePrefetch` warms on idle. */
+function initialWarmSet(list: DemoInboxIssue[]): Set<string> {
+ return new Set(list.filter((i) => !i.coldInCurrent).map((i) => i.id));
+}
+
+export function InboxWorkbench({
+ initialDirection = "buffer",
+ allowSwitchDirection = true,
+ heightClass = "h-screen",
+}: {
+ initialDirection?: DirectionId;
+ allowSwitchDirection?: boolean;
+ heightClass?: string;
+}) {
+ const { lang } = useStoryEnv();
+ const [direction, setDirection] = useState<DirectionId>(initialDirection);
+ const [slowMo, setSlowMo] = useState(false);
+ const [latencyMs, setLatencyMs] = useState<LatencyPreset>(250);
+ const [sidebarOpen, setSidebarOpen] = useState(true);
+
+ const [items, setItems] = useState<DemoInboxIssue[]>(() => createSeedIssues());
+ const [selectedId, setSelectedId] = useState<string | null>("mul-9865");
+ const [collapsingIds, setCollapsingIds] = useState<string[]>([]);
+ const [enteringRowId, setEnteringRowId] = useState<string | null>(null);
+ const [history, setHistory] = useState<HistoryEntry[]>([]);
+ const [toastMsg, setToastMsg] = useState<{ id: number; text: string } | null>(null);
+ const [composerText, setComposerText] = useState("");
+
+ // Realistic prefetch cache:
+ // - `warmIds`: issues whose detail + timeline are in TanStack Query cache.
+ // - `warmImageIds`: issues whose images have already been decoded in browser cache (only reused in B/C/D/E or repeat visits).
+ const [warmIds, setWarmIds] = useState<Set<string>>(() => initialWarmSet(createSeedIssues()));
+ const [warmImageIds, setWarmImageIds] = useState<Set<string>>(() => new Set(["mul-9865"]));
+ const [warmingNextId, setWarmingNextId] = useState<string | null>(null);
+
+ // Transition & network load state
+ const [navSeq, setNavSeq] = useState(0);
+ const [navDir, setNavDir] = useState<"next" | "prev" | "jump">("jump");
+ const [loadStage, setLoadStage] = useState<LoadStage>("ready");
+ const [buffer, setBuffer] = useState<BufferState | null>(null);
+ const [leavingCard, setLeavingCard] = useState<LeavingSnapshot | null>(null);
+ const [flashComment, setFlashComment] = useState(false);
+
+ // Live telemetry so reviewers can verify scroll depth, cache hits, and image CLS
+ const [telemetry, setTelemetry] = useState<{
+ scrollTop: number;
+ cacheHit: boolean;
+ clsPx: number;
+ loadMs: number;
+ }>({ scrollTop: 0, cacheHit: true, clsPx: 0, loadMs: 0 });
+
+ const scrollRef = useRef<HTMLDivElement | null>(null);
+ const timersRef = useRef<number[]>([]);
+ const bufferRafRef = useRef<number | null>(null);
+ const toastTimerRef = useRef<number | null>(null);
+
+ const motionScale = slowMo ? 2.5 : 1;
+
+ const clearPendingTimers = useCallback(() => {
+ for (const id of timersRef.current) window.clearTimeout(id);
+ timersRef.current = [];
+ if (bufferRafRef.current !== null) {
+ window.cancelAnimationFrame(bufferRafRef.current);
+ bufferRafRef.current = null;
+ }
+ }, []);
+
+ const schedule = useCallback(
+ (fn: () => void, ms: number) => {
+ const id = window.setTimeout(fn, Math.round(ms * motionScale));
+ timersRef.current.push(id);
+ return id;
+ },
+ [motionScale],
+ );
+
+ const showToast = useCallback((text: string) => {
+ if (toastTimerRef.current !== null) window.clearTimeout(toastTimerRef.current);
+ setToastMsg({ id: Date.now(), text });
+ toastTimerRef.current = window.setTimeout(() => setToastMsg(null), 6500);
+ }, []);
+
+ const resetWorkbench = useCallback(
+ (nextDir?: DirectionId) => {
+ clearPendingTimers();
+ if (nextDir) setDirection(nextDir);
+ const seed = createSeedIssues();
+ setItems(seed);
+ setSelectedId(seed[0]!.id);
+ setCollapsingIds([]);
+ setEnteringRowId(null);
+ setHistory([]);
+ setToastMsg(null);
+ setComposerText("");
+ setWarmIds(initialWarmSet(seed));
+ setWarmImageIds(new Set([seed[0]!.id]));
+ setWarmingNextId(null);
+ setLoadStage("ready");
+ setBuffer(null);
+ setLeavingCard(null);
+ setNavDir("jump");
+ setNavSeq((s) => s + 1);
+ setTelemetry({ scrollTop: 0, cacheHit: true, clsPx: 0, loadMs: 0 });
+ },
+ [clearPendingTimers],
+ );
+
+ useEffect(() => {
+ setDirection(initialDirection);
+ }, [initialDirection]);
+
+ const visibleRows = items;
+ const activeIssue = items.find((i) => i.id === selectedId) ?? null;
+
+ const pickNextId = useCallback(
+ (list: DemoInboxIssue[], removingId: string): string | null => {
+ const idx = list.findIndex((i) => i.id === removingId);
+ if (idx === -1) return list[0]?.id ?? null;
+ for (let i = idx + 1; i < list.length; i++) {
+ const candidate = list[i]!;
+ if (!collapsingIds.includes(candidate.id)) return candidate.id;
+ }
+ for (let i = idx - 1; i >= 0; i--) {
+ const candidate = list[i]!;
+ if (!collapsingIds.includes(candidate.id)) return candidate.id;
+ }
+ return null;
+ },
+ [collapsingIds],
+ );
+
+ const nextIdForCurrent = selectedId ? pickNextId(visibleRows, selectedId) : null;
+ const nextIsWarm = !nextIdForCurrent || latencyMs === 0 || warmIds.has(nextIdForCurrent);
+
+ // Anchor prefetch in B / C / D / E: automatically warms `next` and `next+1` (including read rows!)
+ // in the background after `latencyMs`, mirroring the real solution. Rapidly pressing E outruns it!
+ useEffect(() => {
+ if (direction === "current" || !selectedId || latencyMs === 0) {
+ setWarmingNextId(null);
+ return;
+ }
+ const nextId = pickNextId(items, selectedId);
+ if (!nextId) {
+ setWarmingNextId(null);
+ return;
+ }
+ const nextNextId = pickNextId(
+ items.filter((i) => i.id !== selectedId),
+ nextId,
+ );
+ const pending: number[] = [];
+
+ if (!warmIds.has(nextId)) {
+ setWarmingNextId(nextId);
+ pending.push(
+ window.setTimeout(() => {
+ setWarmIds((prev) => new Set(prev).add(nextId));
+ setWarmImageIds((prev) => new Set(prev).add(nextId));
+ setWarmingNextId((curr) => (curr === nextId ? null : curr));
+ }, Math.round(latencyMs * 0.85 * motionScale)),
+ );
+ } else {
+ setWarmingNextId(null);
+ }
+
+ if (nextNextId && !warmIds.has(nextNextId)) {
+ pending.push(
+ window.setTimeout(() => {
+ setWarmIds((prev) => new Set(prev).add(nextNextId));
+ setWarmImageIds((prev) => new Set(prev).add(nextNextId));
+ }, Math.round(latencyMs * 1.65 * motionScale)),
+ );
+ }
+
+ return () => {
+ for (const id of pending) window.clearTimeout(id);
+ };
+ }, [direction, selectedId, items, latencyMs, warmIds, pickNextId, motionScale]);
+
+ // Scroll landing alignment:
+ // - In `current-issue-only` or `current-top-blank-sidebar`: deliberately paints scrollTop = 0 first!
+ // - In `ready`: aligns to the deep target comment (~3,000px down) BEFORE paint on B/C/D/E,
+ // and teleports there on A once `ready` lands!
+ useLayoutEffect(() => {
+ const el = scrollRef.current;
+ if (!el || !activeIssue) return;
+ if (
+ loadStage === "current-issue-only" ||
+ loadStage === "current-top-blank-sidebar" ||
+ loadStage === "current-skeleton" ||
+ loadStage === "steady-loading-body"
+ ) {
+ el.scrollTop = 0;
+ setTelemetry((t) => ({ ...t, scrollTop: 0 }));
+ return;
+ }
+ const target = el.querySelector<HTMLElement>("[data-target-comment='true']");
+ if (target) {
+ el.scrollTop = 0;
+ const containerRect = el.getBoundingClientRect();
+ const targetRect = target.getBoundingClientRect();
+ const alignedTop = Math.max(0, Math.round(targetRect.top - containerRect.top - 110));
+ el.scrollTop = alignedTop;
+ setTelemetry((t) => ({ ...t, scrollTop: alignedTop }));
+ } else {
+ el.scrollTop = 0;
+ setTelemetry((t) => ({ ...t, scrollTop: 0 }));
+ }
+ }, [activeIssue, navSeq, loadStage]);
+
+ // Flash target comment once settled.
+ useEffect(() => {
+ if (!activeIssue || loadStage !== "ready") return;
+ setFlashComment(true);
+ const id = window.setTimeout(() => setFlashComment(false), Math.round(1600 * motionScale));
+ return () => window.clearTimeout(id);
+ }, [activeIssue, navSeq, loadStage, motionScale]);
+
+ const handleUnreservedImageExpand = useCallback((heightPx: number) => {
+ setTelemetry((t) => ({ ...t, clsPx: t.clsPx + heightPx }));
+ }, []);
+
+ const navigateToIssue = useCallback(
+ (targetIssue: DemoInboxIssue | null, dir: "next" | "prev" | "jump", fromIssue: DemoInboxIssue | null) => {
+ if (!targetIssue) {
+ setSelectedId(null);
+ setLoadStage("ready");
+ setNavDir(dir);
+ setNavSeq((s) => s + 1);
+ setTelemetry({ scrollTop: 0, cacheHit: true, clsPx: 0, loadMs: 0 });
+ return;
+ }
+
+ const effectiveLatency = latencyMs;
+ const isWarm = effectiveLatency === 0 || warmIds.has(targetIssue.id);
+
+ if (direction === "current") {
+ // Production multi-stage cascade on real latency:
+ // 1) Bar drops on old issue (-40px jump)
+ setLoadStage("current-bar-gone");
+ const barDropMs = Math.max(75, Math.round(effectiveLatency * 0.3));
+
+ if (!isWarm) {
+ // 2) Cold miss: Skeleton WITHOUT 40px InboxBar
+ schedule(() => {
+ setSelectedId(targetIssue.id);
+ setLoadStage("current-skeleton");
+ setNavDir(dir);
+ setNavSeq((s) => s + 1);
+ setTelemetry({ scrollTop: 0, cacheHit: false, clsPx: 0, loadMs: effectiveLatency });
+ }, barDropMs);
+
+ // 3) Issue detail JSON arrives (+40px bar pops back, right sidebar blanks, scrollTop=0, timeline still loading)
+ schedule(() => {
+ setLoadStage("current-issue-only");
+ }, barDropMs + Math.round(effectiveLatency * 0.65));
+
+ // 4) Timeline JSON arrives: still flashes top + blank sidebar briefly, then teleports 3,500px down!
+ schedule(() => {
+ setLoadStage("current-top-blank-sidebar");
+ }, barDropMs + Math.round(effectiveLatency * 1.15));
+
+ schedule(() => {
+ setWarmIds((prev) => new Set(prev).add(targetIssue.id));
+ setLoadStage("ready");
+ setNavSeq((s) => s + 1);
+ }, barDropMs + Math.round(effectiveLatency * 1.15) + 145);
+ } else {
+ // Warm cache in Current STILL suffers: -40px bar drop -> top-of-page + blank sidebar -> teleport down -> unreserved image CLS!
+ schedule(() => {
+ setSelectedId(targetIssue.id);
+ setLoadStage("current-top-blank-sidebar");
+ setNavDir(dir);
+ setNavSeq((s) => s + 1);
+ setTelemetry({ scrollTop: 0, cacheHit: true, clsPx: 0, loadMs: 0 });
+ }, barDropMs);
+
+ schedule(() => {
+ setLoadStage("ready");
+ setNavSeq((s) => s + 1);
+ }, barDropMs + 150);
+ }
+ return;
+ }
+
+ // Directions B / C / D / E:
+ if (direction === "card-stack" && fromIssue && (dir === "next" || dir === "prev")) {
+ const snapSeq = Date.now();
+ setLeavingCard({ issue: fromIssue, direction: dir, seq: snapSeq });
+ schedule(() => {
+ setLeavingCard((curr) => (curr?.seq === snapSeq ? null : curr));
+ }, 220);
+ } else {
+ setLeavingCard(null);
+ }
+
+ setSelectedId(targetIssue.id);
+ setNavDir(dir);
+ setNavSeq((s) => s + 1);
+
+ if (isWarm) {
+ // Warm hit: 0ms instant aligned switch, zero skeleton!
+ setLoadStage("ready");
+ setTelemetry({ scrollTop: 0, cacheHit: true, clsPx: 0, loadMs: 0 });
+ } else {
+ // Outran prefetch (rapid E-E-E on slow network):
+ // Keep BreadcrumbHeader + 40px InboxBar populated immediately from Inbox row metadata!
+ // Show calm body skeleton with thin 2px top progress bar, then align scroll BEFORE reveal.
+ setLoadStage("steady-loading-body");
+ setTelemetry({ scrollTop: 0, cacheHit: false, clsPx: 0, loadMs: effectiveLatency });
+ schedule(() => {
+ setWarmIds((prev) => new Set(prev).add(targetIssue.id));
+ setLoadStage("ready");
+ setNavSeq((s) => s + 1);
+ }, effectiveLatency);
+ }
+ },
+ [direction, latencyMs, warmIds, schedule],
+ );
+
+ const performAdvance = useCallback(
+ (targetId: string, kind: "archived" | "snoozed", toastLabel: string) => {
+ clearPendingTimers();
+ setBuffer(null);
+ const idx = items.findIndex((i) => i.id === targetId);
+ if (idx === -1) return;
+ const removing = items[idx]!;
+ const nextId = pickNextId(items, targetId);
+ const nextIssue = nextId ? items.find((i) => i.id === nextId) ?? null : null;
+
+ setHistory((prev) => [...prev, { item: removing, index: idx, kind }]);
+ setComposerText("");
+ showToast(toastLabel);
+
+ if (direction === "current") {
+ setItems((prev) => prev.filter((i) => i.id !== targetId));
+ navigateToIssue(nextIssue, "next", removing);
+ return;
+ }
+
+ // Smoothly collapse row in left Work panel
+ setCollapsingIds((prev) => (prev.includes(targetId) ? prev : [...prev, targetId]));
+ window.setTimeout(() => {
+ setItems((prev) => prev.filter((i) => i.id !== targetId));
+ setCollapsingIds((prev) => prev.filter((id) => id !== targetId));
+ }, Math.round(165 * motionScale));
+
+ navigateToIssue(nextIssue, "next", removing);
+ },
+ [clearPendingTimers, items, pickNextId, showToast, direction, navigateToIssue, motionScale],
+ );
+
+ const cancelBufferAndStay = useCallback(() => {
+ if (!buffer || buffer.paused) return;
+ if (bufferRafRef.current !== null) {
+ window.cancelAnimationFrame(bufferRafRef.current);
+ bufferRafRef.current = null;
+ }
+ setBuffer((curr) => (curr ? { ...curr, paused: true, progress: 0 } : null));
+ }, [buffer]);
+
+ const handleManualArchive = useCallback(() => {
+ if (!activeIssue) return;
+ performAdvance(activeIssue.id, "archived", COPY.toastArchived[lang]);
+ }, [activeIssue, performAdvance, lang]);
+
+ const handleManualSnooze = useCallback(() => {
+ if (!activeIssue) return;
+ performAdvance(activeIssue.id, "snoozed", COPY.toastSnoozed[lang]);
+ }, [activeIssue, performAdvance, lang]);
+
+ const triggerAutoArchive = useCallback(
+ (kind: "done" | "assign" | "comment", causeText: string) => {
+ if (!activeIssue) return;
+ const targetId = activeIssue.id;
+
+ setItems((prev) =>
+ prev.map((issue) => {
+ if (issue.id !== targetId) return issue;
+ if (kind === "done") return { ...issue, status: "done" };
+ if (kind === "assign") return { ...issue, assignee: ACTORS.emacs, agentRunning: true };
+ return {
+ ...issue,
+ agentRunning: true,
+ comments: [
+ ...issue.comments,
+ {
+ id: `sent-${Date.now()}`,
+ author: ACTORS.jiayuan,
+ time: { zh: "刚刚", en: "just now" },
+ body: {
+ zh: [composerText.trim() || "@Emacs 帮我看一下多图弱网下的锚点偏移,确认没问题就提 PR。"],
+ en: [composerText.trim() || "@Emacs please verify multi-image anchor shift on slow networks, then open a PR."],
+ },
+ },
+ ],
+ };
+ }),
+ );
+ if (kind === "comment") setComposerText("");
+
+ if (direction === "current") {
+ // Reproduce HTTP + WS inbox:batch-archived + /api/inbox refetch round-trip rug-pull
+ clearPendingTimers();
+ const serverRoundTrip = Math.max(260, Math.round(latencyMs * 1.45));
+ schedule(() => {
+ performAdvance(targetId, "archived", COPY.toastAutoArchived[lang]);
+ }, serverRoundTrip);
+ return;
+ }
+
+ if (direction === "buffer") {
+ clearPendingTimers();
+ const totalMs = Math.round(1400 * motionScale);
+ const start = performance.now();
+ setBuffer({ issueId: targetId, causeText, progress: 0, paused: false });
+ const tick = (now: number) => {
+ const p = Math.min(1, (now - start) / totalMs);
+ setBuffer((curr) => (curr && curr.issueId === targetId && !curr.paused ? { ...curr, progress: p } : curr));
+ if (p < 1) {
+ bufferRafRef.current = window.requestAnimationFrame(tick);
+ } else {
+ bufferRafRef.current = null;
+ performAdvance(targetId, "archived", COPY.toastAutoArchived[lang]);
+ }
+ };
+ bufferRafRef.current = window.requestAnimationFrame(tick);
+ return;
+ }
+
+ clearPendingTimers();
+ schedule(() => {
+ performAdvance(targetId, "archived", COPY.toastAutoArchived[lang]);
+ }, 180);
+ },
+ [activeIssue, composerText, direction, clearPendingTimers, latencyMs, schedule, performAdvance, lang, motionScale],
+ );
+
+ const handleUndo = useCallback(() => {
+ if (buffer) {
+ clearPendingTimers();
+ setBuffer(null);
+ if (activeIssue?.status === "done") {
+ setItems((prev) => prev.map((i) => (i.id === activeIssue.id ? { ...i, status: "in_review" } : i)));
+ }
+ return;
+ }
+ const last = history[history.length - 1];
+ if (!last) return;
+ clearPendingTimers();
+ setLoadStage("ready");
+ setHistory((prev) => prev.slice(0, -1));
+ setToastMsg(null);
+
+ if (direction === "card-stack" && activeIssue) {
+ const snapSeq = Date.now();
+ setLeavingCard({ issue: activeIssue, direction: "prev", seq: snapSeq });
+ schedule(() => {
+ setLeavingCard((curr) => (curr?.seq === snapSeq ? null : curr));
+ }, 220);
+ } else {
+ setLeavingCard(null);
+ }
+
+ setItems((prev) => {
+ if (prev.some((i) => i.id === last.item.id)) return prev;
+ const copy = [...prev];
+ copy.splice(Math.min(last.index, copy.length), 0, last.item);
+ return copy;
+ });
+ if (direction !== "current") {
+ setEnteringRowId(last.item.id);
+ schedule(() => setEnteringRowId((curr) => (curr === last.item.id ? null : curr)), 200);
+ }
+ setSelectedId(last.item.id);
+ setNavDir("prev");
+ setNavSeq((s) => s + 1);
+ setTelemetry((t) => ({ ...t, cacheHit: true, clsPx: 0, loadMs: 0 }));
+ }, [buffer, history, clearPendingTimers, activeIssue, direction, schedule]);
+
+ // Global Inbox keyboard shortcuts
+ useEffect(() => {
+ const onKeyDown = (event: KeyboardEvent) => {
+ const target = event.target as HTMLElement | null;
+ const editable =
+ !!target &&
+ (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable);
+ if (event.key === "Escape" && buffer && !buffer.paused) {
+ event.preventDefault();
+ cancelBufferAndStay();
+ return;
+ }
+ if (editable || event.metaKey || event.ctrlKey || event.altKey) return;
+ const k = event.key.toLowerCase();
+ if (k === "e") {
+ event.preventDefault();
+ handleManualArchive();
+ } else if (k === "h") {
+ event.preventDefault();
+ handleManualSnooze();
+ } else if (k === "z") {
+ event.preventDefault();
+ handleUndo();
+ } else if (k === "r") {
+ event.preventDefault();
+ resetWorkbench();
+ } else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
+ if (visibleRows.length === 0) return;
+ event.preventDefault();
+ const currIdx = visibleRows.findIndex((r) => r.id === selectedId);
+ const step = event.key === "ArrowDown" ? 1 : -1;
+ const nextIdx =
+ currIdx < 0
+ ? step === 1
+ ? 0
+ : visibleRows.length - 1
+ : Math.min(Math.max(currIdx + step, 0), visibleRows.length - 1);
+ const targetRow = visibleRows[nextIdx];
+ if (targetRow && targetRow.id !== selectedId) {
+ clearPendingTimers();
+ setBuffer(null);
+ navigateToIssue(targetRow, step === 1 ? "next" : "prev", activeIssue);
+ }
+ }
+ };
+ window.addEventListener("keydown", onKeyDown);
+ return () => window.removeEventListener("keydown", onKeyDown);
+ }, [
+ buffer,
+ cancelBufferAndStay,
+ handleManualArchive,
+ handleManualSnooze,
+ handleUndo,
+ resetWorkbench,
+ visibleRows,
+ selectedId,
+ clearPendingTimers,
+ navigateToIssue,
+ activeIssue,
+ ]);
+
+ const unreadCount = visibleRows.filter((i) => i.unread && !collapsingIds.includes(i.id)).length;
+ const activeMeta = DIRECTION_BY_ID[direction];
+
+ const bodyEnterClass =
+ direction === "current" || loadStage !== "ready"
+ ? ""
+ : direction === "crossfade"
+ ? "inbox-stage-crossfade-enter"
+ : direction === "glide" || direction === "buffer"
+ ? navDir === "prev"
+ ? "inbox-stage-glide-prev"
+ : navDir === "next"
+ ? "inbox-stage-glide-next"
+ : ""
+ : direction === "card-stack"
+ ? navDir === "prev"
+ ? "inbox-card-enter-prev"
+ : navDir === "next"
+ ? "inbox-card-enter-next"
+ : ""
+ : "";
+
+ const hideInboxBarForGlitch =
+ direction === "current" && (loadStage === "current-bar-gone" || loadStage === "current-skeleton");
+ const showCurrentFullSkeleton = direction === "current" && loadStage === "current-skeleton";
+ const showCurrentTimelineSkeleton = direction === "current" && loadStage === "current-issue-only";
+ const showSteadyBodySkeleton = direction !== "current" && loadStage === "steady-loading-body";
+ const blankSidebarForGlitch =
+ direction === "current" &&
+ (loadStage === "current-skeleton" ||
+ loadStage === "current-issue-only" ||
+ loadStage === "current-top-blank-sidebar");
+
+ const reserveImages = direction !== "current";
+
+ const renderIssueBody = (issue: DemoInboxIssue, interactive: boolean) => {
+ const imagesAlreadyWarm = reserveImages && (latencyMs === 0 || warmImageIds.has(issue.id));
+ const targetIdx = issue.comments.findIndex((c) => c.isTarget);
+
+ return (
+ <div className="mx-auto max-w-[740px] px-8 py-7">
+ <h1 className="text-display-sm font-semibold leading-snug tracking-tight text-foreground">
+ {issue.title[lang]}
+ </h1>
+
+ <div className="mt-4 space-y-3 text-body leading-relaxed text-foreground/90">
+ {issue.description[lang].map((para, i) => (
+ <p key={i}>{para}</p>
+ ))}
+ </div>
+
+ {issue.subIssues.length > 0 && (
+ <div className="mt-6 rounded-lg border border-border bg-card/50 p-3">
+ <div className="mb-2 flex items-center justify-between text-caption font-medium text-muted-foreground">
+ <span>{COPY.subIssues[lang]}</span>
+ <span className="tabular-nums">
+ {issue.subIssues.filter((s) => s.done).length}/{issue.subIssues.length}
+ </span>
+ </div>
+ <div className="space-y-1.5">
+ {issue.subIssues.map((sub) => (
+ <div key={sub.id} className="flex items-center gap-2 text-body">
+ <StatusGlyph status={sub.done ? "done" : "todo"} />
+ <span className="text-caption tabular-nums text-muted-foreground">{sub.id}</span>
+ <span className={cn("truncate", sub.done && "text-muted-foreground line-through")}>
+ {sub.title[lang]}
+ </span>
+ </div>
+ ))}
+ </div>
+ </div>
+ )}
+
+ <div className="my-7 border-t border-border" />
+
+ <div className="mb-3 flex items-center justify-between">
+ <h2 className="text-label font-medium text-muted-foreground">{COPY.activity[lang]}</h2>
+ <span className="text-caption tabular-nums text-faint-foreground">
+ {issue.comments.length} {lang === "zh" ? "条评论" : "comments"}
+ </span>
+ </div>
+
+ {interactive && showCurrentTimelineSkeleton ? (
+ <div className="space-y-4 pb-8">
+ <p className="text-caption text-muted-foreground">{COPY.loadingTimeline[lang]}</p>
+ {Array.from({ length: 4 }).map((_, i) => (
+ <div key={i} className="rounded-lg border border-border p-4 space-y-2.5">
+ <div className="flex items-center gap-2">
+ <Skeleton className="size-6 rounded-full" />
+ <Skeleton className="h-3.5 w-28" />
+ </div>
+ <Skeleton className="h-3.5 w-full" />
+ <Skeleton className="h-3.5 w-4/5" />
+ </div>
+ ))}
+ </div>
+ ) : (
+ <div className="space-y-3 pb-8">
+ {issue.comments.map((comment, idx) => {
+ const isTarget = !!comment.isTarget;
+ const isAboveTarget = targetIdx >= 0 && idx < targetIdx;
+ const imgDelayMs =
+ !comment.image || latencyMs === 0 || imagesAlreadyWarm
+ ? 0
+ : Math.round(Math.max(180, latencyMs * comment.image.delayMultiplier) * motionScale);
+
+ return (
+ <div
+ key={comment.id}
+ data-target-comment={interactive && isTarget ? "true" : undefined}
+ className={cn(
+ "rounded-lg border border-border bg-card px-4 py-3 transition-colors",
+ isTarget && interactive && flashComment && "inbox-comment-flash",
+ )}
+ >
+ <div className="flex flex-wrap items-center gap-2">
+ <ActorAvatar
+ name={comment.author.name}
+ initials={comment.author.initials}
+ isAgent={comment.author.isAgent}
+ size="sm"
+ />
+ <span className="text-body font-medium text-foreground">{comment.author.name}</span>
+ <span className="text-caption text-muted-foreground">{comment.time[lang]}</span>
+ {comment.runBadge && (
+ <Badge variant="outline" className="text-micro font-normal text-muted-foreground">
+ {comment.runBadge[lang]}
+ </Badge>
+ )}
+ <span className="ml-auto flex items-center gap-1.5">
+ {isTarget && (
+ <Badge variant="secondary" className="text-micro font-normal text-brand">
+ {COPY.targetTag[lang]}
+ </Badge>
+ )}
+ <span className="text-micro tabular-nums text-faint-foreground">#{idx + 1}</span>
+ </span>
+ </div>
+
+ <div className="mt-2 space-y-2 text-body leading-relaxed text-foreground/90">
+ {comment.body[lang].map((p, pIdx) => (
+ <p key={pIdx}>{p}</p>
+ ))}
+ </div>
+
+ {comment.code && (
+ <pre className="mt-2.5 overflow-x-auto rounded-md border border-border/70 bg-muted/60 px-3 py-2 font-mono text-caption text-foreground/90">
+ <code>{comment.code}</code>
+ </pre>
+ )}
+
+ {comment.image && (
+ <DelayedCommentImage
+ key={`${issue.id}-${comment.id}-${navSeq}-${reserveImages ? "r" : "u"}`}
+ kind={comment.image.kind}
+ caption={comment.image.caption}
+ delayMs={interactive ? imgDelayMs : 0}
+ reserveAspectRatio={reserveImages}
+ loadedInitially={!interactive || imagesAlreadyWarm}
+ onExpandedWithoutReserve={
+ interactive && isAboveTarget ? handleUnreservedImageExpand : undefined
+ }
+ lang={lang}
+ />
+ )}
+ </div>
+ );
+ })}
+ </div>
+ )}
+
+ {interactive && !showCurrentTimelineSkeleton && (
+ <div
+ className="rounded-xl border border-border bg-card p-3 shadow-xs transition-colors focus-within:border-ring"
+ onFocus={cancelBufferAndStay}
+ >
+ <textarea
+ value={composerText}
+ onChange={(e) => setComposerText(e.target.value)}
+ rows={2}
+ placeholder={COPY.composerPlaceholder[lang]}
+ className="block w-full resize-none bg-transparent text-body text-foreground outline-none placeholder:text-muted-foreground"
+ />
+ <div className="mt-2 flex items-center justify-between gap-2 border-t border-border/60 pt-2">
+ <Button
+ size="sm"
+ variant="ghost"
+ className="h-7 gap-1.5 text-caption text-muted-foreground hover:text-foreground"
+ onClick={() => triggerAutoArchive("comment", COPY.commentCause[lang])}
+ >
+ <Sparkles className="size-3.5 text-brand" />
+ {COPY.quickAgentReply[lang]}
+ </Button>
+ <Button
+ size="sm"
+ className="h-7 gap-1.5"
+ disabled={!composerText.trim()}
+ onClick={() => triggerAutoArchive("comment", COPY.commentCause[lang])}
+ >
+ <Send className="size-3" />
+ {COPY.send[lang]}
+ </Button>
+ </div>
+ </div>
+ )}
+ </div>
+ );
+ };
+
+ const lastCleared = history[history.length - 1] ?? null;
+ const targetCommentNumber = activeIssue
+ ? activeIssue.comments.findIndex((c) => c.isTarget) + 1
+ : 0;
+ const imageCount = activeIssue ? activeIssue.comments.filter((c) => !!c.image).length : 0;
+
+ return (
+ <div
+ style={{ ["--inbox-motion-scale" as string]: String(motionScale) }}
+ className={cn("flex w-full flex-col overflow-hidden bg-background text-foreground", heightClass)}
+ >
+ {/* Prototype control strip: Direction switcher + Network latency + Prefetch status + Slow-mo + Reset */}
+ <div className="flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border bg-surface px-3 py-1.5">
+ <div className="flex min-w-0 items-center gap-2">
+ {allowSwitchDirection ? (
+ <div className="inline-flex items-center gap-0.5 rounded-lg bg-muted p-0.5">
+ {DIRECTIONS.map((d) => {
+ const active = d.id === direction;
+ return (
+ <button
+ key={d.id}
+ type="button"
+ onClick={() => resetWorkbench(d.id)}
+ className={cn(
+ "inline-flex cursor-pointer items-center gap-1 rounded-md px-2.5 py-1 text-caption font-medium transition-colors",
+ active
+ ? "bg-background text-foreground shadow-xs"
+ : "text-muted-foreground hover:text-foreground",
+ )}
+ >
+ <span className={cn("text-micro", active ? "text-brand" : "opacity-60")}>{d.letter}</span>
+ <span>{d.shortName[lang]}</span>
+ </button>
+ );
+ })}
+ </div>
+ ) : (
+ <div className="flex items-center gap-2 text-caption">
+ <span className="font-semibold text-brand">{activeMeta.letter}</span>
+ <span className="font-semibold text-foreground">{activeMeta.name[lang]}</span>
+ </div>
+ )}
+
+ {/* Live prefetch status pill for the next item */}
+ {nextIdForCurrent && latencyMs > 0 && (
+ <span className="hidden items-center gap-1.5 rounded-md border border-border bg-background px-2 py-0.5 text-micro text-muted-foreground xl:inline-flex">
+ <span
+ className={cn(
+ "size-1.5 rounded-full",
+ nextIsWarm
+ ? "bg-emerald-500"
+ : warmingNextId
+ ? "animate-pulse bg-amber-500"
+ : "bg-red-500",
+ )}
+ />
+ {nextIsWarm
+ ? COPY.prefetchWarm[lang]
+ : warmingNextId
+ ? COPY.prefetchWarming[lang]
+ : COPY.prefetchCold[lang]}
+ </span>
+ )}
+ </div>
+
+ <div className="flex items-center gap-1.5">
+ {/* Network request latency preset */}
+ <div className="inline-flex items-center gap-0.5 rounded-lg bg-muted p-0.5 text-caption">
+ <span className="px-1.5 text-micro text-muted-foreground">{COPY.latencyLabel[lang]}</span>
+ {([0, 250, 600] as LatencyPreset[]).map((ms) => (
+ <button
+ key={ms}
+ type="button"
+ onClick={() => {
+ setLatencyMs(ms);
+ setWarmIds(initialWarmSet(items));
+ setWarmImageIds(new Set(selectedId ? [selectedId] : []));
+ }}
+ className={cn(
+ "cursor-pointer rounded-md px-2 py-0.5 text-micro font-medium tabular-nums transition-colors",
+ latencyMs === ms
+ ? "bg-background text-foreground shadow-xs"
+ : "text-muted-foreground hover:text-foreground",
+ )}
+ >
+ {ms}ms
+ </button>
+ ))}
+ </div>
+
+ <Button
+ size="sm"
+ variant={slowMo ? "secondary" : "ghost"}
+ className="h-7 gap-1 text-caption"
+ onClick={() => setSlowMo((v) => !v)}
+ >
+ <Gauge className="size-3.5" />
+ {COPY.slowMo[lang]}
+ </Button>
+ <Button size="sm" variant="outline" className="h-7 gap-1 text-caption" onClick={() => resetWorkbench()}>
+ <RotateCcw className="size-3.5" />
+ {COPY.reset[lang]}
+ <Kbd>R</Kbd>
+ </Button>
+ </div>
+ </div>
+
+ {/* Main Multica desktop shell */}
+ <div className="relative flex min-h-0 flex-1 overflow-hidden">
+ {/* Left Work Panel */}
+ <aside className="flex w-[268px] shrink-0 flex-col border-r border-border bg-app-shell">
+ <div className="flex h-12 shrink-0 items-center justify-between pl-4 pr-2.5">
+ <span className="text-title-sm font-semibold text-foreground">{COPY.work[lang]}</span>
+ <span className="text-caption text-faint-foreground">{activeMeta.letter}</span>
+ </div>
+
+ <div className="min-h-0 flex-1 overflow-y-auto px-2 pb-4">
+ <section className="mb-3">
+ <div className="flex h-7 items-center gap-1 px-2 text-caption font-medium text-muted-foreground">
+ <ChevronDown className="size-3 text-faint-foreground" />
+ <span>{COPY.pinned[lang]}</span>
+ </div>
+ <div className="space-y-0.5">
+ <div className="flex h-7 items-center gap-2 rounded-md px-2 text-caption text-muted-foreground">
+ <Pin className="size-3.5 shrink-0 text-faint-foreground" />
+ <span className="truncate">Q4 Roadmap · Multica 0.13</span>
+ </div>
+ </div>
+ </section>
+
+ <section className="mb-3">
+ <div className="flex h-7 items-center justify-between px-2">
+ <div className="flex items-center gap-1 text-caption font-medium text-muted-foreground">
+ <ChevronDown className="size-3 text-faint-foreground" />
+ <span>{COPY.inbox[lang]}</span>
+ </div>
+ {unreadCount > 0 && (
+ <span className="text-caption font-medium tabular-nums text-brand">{unreadCount}</span>
+ )}
+ </div>
+
+ {visibleRows.length === 0 ? (
+ <p className="px-6 py-2 text-caption text-faint-foreground">{COPY.inboxEmpty[lang]}</p>
+ ) : (
+ <ul className="space-y-0.5">
+ {visibleRows.map((item) => {
+ const isSelected = item.id === selectedId;
+ const isCollapsing = collapsingIds.includes(item.id);
+ const isEntering = enteringRowId === item.id;
+ const isWarmRow = latencyMs === 0 || warmIds.has(item.id);
+ return (
+ <li
+ key={item.id}
+ className="inbox-row-wrap"
+ data-motion={direction === "current" ? "instant" : "smooth"}
+ data-state={isCollapsing ? "collapsing" : isEntering ? "entering" : "idle"}
+ >
+ <div className="overflow-hidden">
+ <div
+ role="button"
+ tabIndex={0}
+ onClick={() => {
+ clearPendingTimers();
+ setBuffer(null);
+ navigateToIssue(item, "jump", activeIssue);
+ }}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" || e.key === " ") {
+ e.preventDefault();
+ clearPendingTimers();
+ setBuffer(null);
+ navigateToIssue(item, "jump", activeIssue);
+ }
+ }}
+ className={cn(
+ "group/inbox relative flex cursor-default select-none items-start gap-2 rounded-md px-2 py-1.5 text-left transition-colors",
+ isSelected
+ ? "bg-surface-selected text-foreground"
+ : "text-foreground/85 hover:bg-surface-hover",
+ )}
+ >
+ <span className="mt-[3px] flex shrink-0">
+ <StatusGlyph status={item.status} />
+ </span>
+ <div className="min-w-0 flex-1">
+ <div className="flex items-center gap-1.5 leading-5">
+ <span
+ className={cn(
+ "min-w-0 flex-1 truncate text-body",
+ item.unread ? "font-medium text-foreground" : "text-muted-foreground",
+ )}
+ >
+ {item.title[lang]}
+ </span>
+ <span className="shrink-0 text-caption tabular-nums text-faint-foreground group-hover/inbox:invisible">
+ {item.timeAgo[lang]}
+ </span>
+ </div>
+ <div className="mt-0.5 flex items-center gap-1.5 text-caption leading-4 text-muted-foreground">
+ <ActorAvatar
+ name={item.actor.name}
+ initials={item.actor.initials}
+ isAgent={item.actor.isAgent}
+ size="xs"
+ />
+ <span className="min-w-0 flex-1 truncate">{item.reason[lang]}</span>
+ {!isWarmRow && latencyMs > 0 && (
+ <span
+ title={lang === "zh" ? "未缓存" : "Cold"}
+ className="text-micro text-faint-foreground"
+ >
+ {lang === "zh" ? "冷" : "cold"}
+ </span>
+ )}
+ {item.agentRunning && <Bot className="size-3 shrink-0 text-brand" />}
+ {item.unread && <span className="size-1.5 shrink-0 rounded-full bg-brand" />}
+ </div>
+ </div>
+
+ <div className="absolute top-1.5 right-1.5 hidden items-center gap-0.5 rounded-md bg-app-shell/90 group-hover/inbox:flex">
+ <TooltipHint label={COPY.snooze[lang]} side="bottom">
+ <button
+ type="button"
+ aria-label={COPY.snooze[lang]}
+ onClick={(e) => {
+ e.stopPropagation();
+ performAdvance(item.id, "snoozed", COPY.toastSnoozed[lang]);
+ }}
+ className="flex size-5 items-center justify-center rounded-md text-muted-foreground hover:bg-surface-selected hover:text-foreground"
+ >
+ <AlarmClock className="size-3" />
+ </button>
+ </TooltipHint>
+ <TooltipHint label={COPY.archive[lang]} side="bottom">
+ <button
+ type="button"
+ aria-label={COPY.archive[lang]}
+ onClick={(e) => {
+ e.stopPropagation();
+ performAdvance(item.id, "archived", COPY.toastArchived[lang]);
+ }}
+ className="flex size-5 items-center justify-center rounded-md text-muted-foreground hover:bg-surface-selected hover:text-foreground"
+ >
+ <Archive className="size-3" />
+ </button>
+ </TooltipHint>
+ </div>
+ </div>
+ </div>
+ </li>
+ );
+ })}
+ </ul>
+ )}
+ </section>
+
+ <section>
+ <div className="flex h-7 items-center gap-1 px-2 text-caption font-medium text-muted-foreground">
+ <ChevronDown className="size-3 text-faint-foreground" />
+ <span>{COPY.projects[lang]}</span>
+ </div>
+ <div className="space-y-0.5 text-caption text-muted-foreground">
+ <div className="flex h-7 items-center gap-2 rounded-md px-2">
+ <Folder className="size-3.5 text-faint-foreground" />
+ <span className="truncate">{lang === "zh" ? "收件箱体验" : "Inbox Experience"}</span>
+ </div>
+ <div className="flex h-7 items-center gap-2 rounded-md px-2">
+ <Folder className="size-3.5 text-faint-foreground" />
+ <span className="truncate">{lang === "zh" ? "工作区壳层" : "Workspace Shell"}</span>
+ </div>
+ </div>
+ </section>
+ </div>
+ </aside>
+
+ {/* Center Issue Detail */}
+ <main className="relative flex min-w-0 flex-1 flex-col bg-background">
+ {!activeIssue ? (
+ <>
+ <div className="flex h-12 shrink-0 items-center border-b border-border px-5">
+ <span className="flex items-center gap-1.5 text-body font-semibold">
+ <Inbox className="size-4 text-muted-foreground" />
+ {COPY.inbox[lang]}
+ </span>
+ </div>
+ <div
+ key={`zero-${navSeq}`}
+ className={cn(
+ "relative flex min-h-0 flex-1 flex-col items-center justify-center overflow-hidden px-6 text-center",
+ bodyEnterClass,
+ )}
+ >
+ <MulticaBleedMark
+ enterDelay={0.15}
+ className="pointer-events-none absolute -right-[12%] -bottom-[24%] w-[min(460px,52%)] text-muted"
+ />
+ <div className="relative z-10 -mt-6 flex max-w-md flex-col items-center">
+ <div className="mb-4 flex size-11 items-center justify-center rounded-xl border border-surface-border bg-surface text-success shadow-xs">
+ <Check className="size-5" />
+ </div>
+ <h2 className="text-title font-semibold text-foreground">{COPY.clearedTitle[lang]}</h2>
+ {lastCleared && (
+ <p className="mt-1.5 flex items-center gap-1.5 text-label text-muted-foreground">
+ <span>
+ {COPY.clearedSub[lang]} {lastCleared.item.identifier}
+ </span>
+ <span aria-hidden className="text-faint-foreground">·</span>
+ <button
+ type="button"
+ onClick={handleUndo}
+ className="inline-flex cursor-pointer items-center gap-1 rounded-md px-1.5 py-0.5 text-caption font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
+ >
+ <Undo2 className="size-3" />
+ {COPY.undo[lang]}
+ <Kbd>Z</Kbd>
+ </button>
+ </p>
+ )}
+ <div className="mt-2 inline-flex items-center gap-1.5 text-caption text-faint-foreground">
+ <AlarmClock className="size-3.5" />
+ <span>{COPY.snoozedSummary[lang]}</span>
+ </div>
+ </div>
+ </div>
+ </>
+ ) : (
+ <>
+ {/* 48px BreadcrumbHeader — immediately populated from Inbox row metadata in B/C/D/E even on cold miss */}
+ <header className="flex h-12 shrink-0 items-center justify-between gap-3 border-b border-border px-6">
+ <div className="flex min-w-0 items-center gap-1.5 text-body">
+ {showCurrentFullSkeleton ? (
+ <>
+ <Skeleton className="h-4 w-16" />
+ <Skeleton className="h-4 w-4" />
+ <Skeleton className="h-4 w-32" />
+ </>
+ ) : (
+ <>
+ <span className="shrink-0 text-muted-foreground">{activeIssue.project[lang]}</span>
+ <span className="text-faint-foreground">/</span>
+ <span className="shrink-0 tabular-nums text-muted-foreground">{activeIssue.identifier}</span>
+ <span className="truncate font-medium text-foreground">{activeIssue.title[lang]}</span>
+ </>
+ )}
+ </div>
+ <div className="flex shrink-0 items-center gap-1">
+ <IconButton label="More" className="text-muted-foreground">
+ <MoreHorizontal />
+ </IconButton>
+ <IconButton
+ label="Toggle sidebar"
+ variant={sidebarOpen ? "secondary" : "ghost"}
+ className={sidebarOpen ? "" : "text-muted-foreground"}
+ onClick={() => setSidebarOpen((v) => !v)}
+ >
+ <PanelRight />
+ </IconButton>
+ </div>
+ </header>
+
+ {/* 40px InboxBar — rock-steady in B/C/D/E; drops out mid-switch in A */}
+ {!hideInboxBarForGlitch && (
+ <div
+ className={cn(
+ "relative flex h-10 shrink-0 items-center gap-1 border-b border-border px-6 transition-colors",
+ buffer?.issueId === activeIssue.id && "bg-muted/40",
+ )}
+ >
+ {buffer?.issueId === activeIssue.id ? (
+ <>
+ <span className="mr-1 flex min-w-0 flex-1 items-center gap-1.5 text-caption text-muted-foreground">
+ <CheckCircle2 className="size-3.5 shrink-0 text-emerald-500" />
+ <span className="truncate font-medium text-foreground">{buffer.causeText}</span>
+ <span aria-hidden className="text-faint-foreground">·</span>
+ <span className="shrink-0">
+ {buffer.paused ? COPY.bufferPaused[lang] : COPY.bufferAdvancing[lang]}
+ </span>
+ </span>
+ {!buffer.paused && (
+ <Button
+ size="sm"
+ variant="ghost"
+ className="h-7 gap-1 text-caption text-muted-foreground"
+ onClick={cancelBufferAndStay}
+ >
+ <X className="size-3.5" />
+ {COPY.stayHere[lang]}
+ <Kbd>Esc</Kbd>
+ </Button>
+ )}
+ <Button
+ size="sm"
+ variant="ghost"
+ className="h-7 gap-1 text-caption text-muted-foreground"
+ onClick={handleUndo}
+ >
+ <Undo2 className="size-3.5" />
+ {COPY.undo[lang]}
+ <Kbd>Z</Kbd>
+ </Button>
+ <Button
+ size="sm"
+ variant="outline"
+ className="h-7 gap-1 text-caption"
+ onClick={handleManualArchive}
+ >
+ {COPY.next[lang]}
+ <ArrowDown className="size-3.5" />
+ <Kbd>E</Kbd>
+ </Button>
+ {!buffer.paused && (
+ <div
+ className="pointer-events-none absolute right-0 bottom-0 left-0 h-[2px] origin-left bg-brand"
+ style={{ transform: `scaleX(${buffer.progress})` }}
+ />
+ )}
+ </>
+ ) : (
+ <>
+ <span className="mr-1 flex min-w-0 flex-1 items-center gap-1.5 text-caption text-muted-foreground">
+ <ActorAvatar
+ name={activeIssue.actor.name}
+ initials={activeIssue.actor.initials}
+ isAgent={activeIssue.actor.isAgent}
+ size="xs"
+ />
+ <span className="truncate">{activeIssue.reason[lang]}</span>
+ <span className="shrink-0 tabular-nums text-faint-foreground">
+ · {activeIssue.timeAgo[lang]}
+ </span>
+ </span>
+
+ <Button
+ size="sm"
+ variant="ghost"
+ className="h-7 gap-1.5 text-caption"
+ onClick={() => triggerAutoArchive("done", COPY.doneCause[lang])}
+ >
+ <CheckCircle2 className="size-3.5 text-emerald-500" />
+ {COPY.markDone[lang]}
+ </Button>
+ <Button
+ size="sm"
+ variant="ghost"
+ className="h-7 gap-1.5 text-caption text-muted-foreground hover:text-foreground"
+ onClick={() => triggerAutoArchive("assign", COPY.assignCause[lang])}
+ >
+ <Bot className="size-3.5" />
+ {COPY.assignAgent[lang]}
+ </Button>
+
+ <span aria-hidden className="mx-1 h-4 w-px shrink-0 bg-border" />
+
+ <TooltipHint label={COPY.unsubscribe[lang]} side="bottom">
+ <IconButton
+ label={COPY.unsubscribe[lang]}
+ className="text-muted-foreground"
+ onClick={handleManualArchive}
+ >
+ <BellOff />
+ </IconButton>
+ </TooltipHint>
+ <Button
+ size="sm"
+ variant="ghost"
+ className="h-7 gap-1 text-caption text-muted-foreground hover:text-foreground"
+ onClick={handleManualSnooze}
+ >
+ <AlarmClock className="size-3.5" />
+ {COPY.snooze[lang]}
+ <Kbd>H</Kbd>
+ </Button>
+ <Button
+ size="sm"
+ variant="ghost"
+ className="h-7 gap-1 text-caption text-muted-foreground hover:text-foreground"
+ onClick={handleManualArchive}
+ >
+ <Archive className="size-3.5" />
+ {COPY.archive[lang]}
+ <Kbd>E</Kbd>
+ </Button>
+
+ {/* Calm loading hairline when rapid E outruns anchor prefetch */}
+ {showSteadyBodySkeleton && (
+ <div className="pointer-events-none absolute right-0 bottom-0 left-0 h-[2px] overflow-hidden bg-muted">
+ <div className="h-full w-2/3 animate-pulse bg-brand" />
+ </div>
+ )}
+ </>
+ )}
+ </div>
+ )}
+
+ {/* Scrollable Reading Column */}
+ <div className="relative min-h-0 flex-1 overflow-hidden">
+ {direction === "card-stack" && leavingCard && (
+ <div
+ key={`leave-${leavingCard.seq}`}
+ className={cn(
+ "pointer-events-none absolute inset-0 z-10 overflow-hidden bg-background",
+ leavingCard.direction === "next" ? "inbox-card-leave-next" : "inbox-card-leave-prev",
+ )}
+ >
+ {renderIssueBody(leavingCard.issue, false)}
+ </div>
+ )}
+
+ <div
+ ref={scrollRef}
+ onWheel={cancelBufferAndStay}
+ onMouseDown={cancelBufferAndStay}
+ onScroll={(e) => {
+ const top = Math.round(e.currentTarget.scrollTop);
+ setTelemetry((t) => (Math.abs(t.scrollTop - top) > 12 ? { ...t, scrollTop: top } : t));
+ }}
+ className="h-full overflow-y-auto [scrollbar-gutter:stable_both-edges]"
+ >
+ {showCurrentFullSkeleton || showSteadyBodySkeleton ? (
+ <div className="mx-auto max-w-[740px] space-y-6 px-8 py-7">
+ {showSteadyBodySkeleton ? (
+ <h1 className="text-display-sm font-semibold leading-snug tracking-tight text-foreground">
+ {activeIssue.title[lang]}
+ </h1>
+ ) : (
+ <Skeleton className="h-8 w-3/4" />
+ )}
+ <div className="space-y-2.5">
+ <Skeleton className="h-4 w-full" />
+ <Skeleton className="h-4 w-5/6" />
+ <Skeleton className="h-4 w-2/3" />
+ </div>
+ <Skeleton className="h-px w-full" />
+ <div className="space-y-4">
+ <div className="flex items-center justify-between">
+ <Skeleton className="h-4 w-24" />
+ {showSteadyBodySkeleton && (
+ <span className="text-caption tabular-nums text-muted-foreground">
+ {COPY.loadingTimeline[lang]} ({latencyMs}ms)
+ </span>
+ )}
+ </div>
+ {Array.from({ length: 3 }).map((_, i) => (
+ <div key={i} className="rounded-lg border border-border p-4 space-y-2.5">
+ <div className="flex items-center gap-2">
+ <Skeleton className="size-6 rounded-full" />
+ <Skeleton className="h-3.5 w-32" />
+ </div>
+ <Skeleton className="h-3.5 w-full" />
+ <Skeleton className="h-3.5 w-4/5" />
+ {i === 0 && <Skeleton className="mt-2 h-44 w-full rounded-md" />}
+ </div>
+ ))}
+ </div>
+ </div>
+ ) : (
+ <div
+ key={`${activeIssue.id}-${navSeq}`}
+ className={cn(bodyEnterClass, direction === "card-stack" && "bg-background")}
+ >
+ {renderIssueBody(activeIssue, true)}
+ </div>
+ )}
+ </div>
+ </div>
+ </>
+ )}
+ </main>
+
+ {/* Right Properties Sidebar */}
+ {sidebarOpen && activeIssue && (
+ <aside className="hidden w-[256px] shrink-0 flex-col border-l border-border bg-background px-4 py-4 lg:flex">
+ <div
+ className={cn(
+ "space-y-4 transition-opacity duration-100",
+ blankSidebarForGlitch ? "opacity-0" : "opacity-100",
+ )}
+ >
+ <PropRow label={COPY.status[lang]}>
+ <button
+ type="button"
+ onClick={() => triggerAutoArchive("done", COPY.doneCause[lang])}
+ className="inline-flex cursor-pointer items-center gap-1.5 rounded-md px-1.5 py-0.5 text-body font-medium hover:bg-muted"
+ >
+ <StatusGlyph status={activeIssue.status} />
+ <span>{STATUS_META[activeIssue.status].label[lang]}</span>
+ </button>
+ </PropRow>
+
+ <PropRow label={COPY.priority[lang]}>
+ <span className="px-1.5 text-body text-foreground">
+ {PRIORITY_LABEL[activeIssue.priority][lang]}
+ </span>
+ </PropRow>
+
+ <PropRow label={COPY.assignee[lang]}>
+ <button
+ type="button"
+ onClick={() => triggerAutoArchive("assign", COPY.assignCause[lang])}
+ className="inline-flex cursor-pointer items-center gap-1.5 rounded-md px-1.5 py-0.5 text-body hover:bg-muted"
+ >
+ <ActorAvatar
+ name={activeIssue.assignee.name}
+ initials={activeIssue.assignee.initials}
+ isAgent={activeIssue.assignee.isAgent}
+ size="xs"
+ />
+ <span>{activeIssue.assignee.name}</span>
+ {activeIssue.agentRunning && (
+ <Badge variant="secondary" className="text-micro font-normal text-brand">
+ {COPY.running[lang]}
+ </Badge>
+ )}
+ </button>
+ </PropRow>
+
+ <PropRow label={COPY.project[lang]}>
+ <span className="inline-flex items-center gap-1.5 px-1.5 text-body text-foreground">
+ <Folder className="size-3.5 text-muted-foreground" />
+ {activeIssue.project[lang]}
+ </span>
+ </PropRow>
+
+ <PropRow label={COPY.labels[lang]}>
+ <div className="flex flex-wrap gap-1 px-1">
+ {activeIssue.labels[lang].map((lb) => (
+ <Badge key={lb} variant="secondary" className="font-normal">
+ {lb}
+ </Badge>
+ ))}
+ </div>
+ </PropRow>
+ </div>
+ </aside>
+ )}
+
+ {/* Bottom-right Undo Toast */}
+ {toastMsg && (
+ <div
+ key={toastMsg.id}
+ className="absolute right-4 bottom-4 z-30 flex items-center gap-3 rounded-lg border border-border bg-popover px-3.5 py-2.5 text-caption text-popover-foreground shadow-md animate-in fade-in slide-in-from-bottom-2 duration-150"
+ >
+ <CheckCircle2 className="size-4 text-emerald-500" />
+ <span>{toastMsg.text}</span>
+ <button
+ type="button"
+ onClick={handleUndo}
+ className="inline-flex cursor-pointer items-center gap-1 rounded-md border border-border bg-background px-2 py-0.5 text-caption font-medium text-foreground hover:bg-muted"
+ >
+ {COPY.undo[lang]}
+ <Kbd>Z</Kbd>
+ </button>
+ </div>
+ )}
+ </div>
+
+ {/* Telemetry footer showing live scroll depth, comment #, cache hit, and image CLS */}
+ <footer className="flex shrink-0 flex-wrap items-center justify-between gap-3 border-t border-border bg-surface px-4 py-1.5 text-caption text-muted-foreground">
+ <div className="flex min-w-0 items-center gap-2 tabular-nums">
+ {activeIssue && (
+ <>
+ <span className="font-medium text-foreground">
+ {lang === "zh"
+ ? `定位评论 #${targetCommentNumber}/${activeIssue.comments.length}`
+ : `Target #${targetCommentNumber}/${activeIssue.comments.length}`}
+ </span>
+ <span aria-hidden className="text-faint-foreground">·</span>
+ <span>
+ {imageCount} {lang === "zh" ? "张图" : "images"}
+ </span>
+ <span aria-hidden className="text-faint-foreground">·</span>
+ <span>scrollTop {telemetry.scrollTop}px</span>
+ <span aria-hidden className="text-faint-foreground">·</span>
+ <span className={telemetry.cacheHit ? "text-emerald-600 dark:text-emerald-400" : "text-amber-600 dark:text-amber-400"}>
+ {telemetry.cacheHit
+ ? lang === "zh"
+ ? "缓存命中 0ms"
+ : "Cache hit 0ms"
+ : lang === "zh"
+ ? `冷请求 ${telemetry.loadMs}ms`
+ : `Cold fetch ${telemetry.loadMs}ms`}
+ </span>
+ {telemetry.clsPx > 0 && (
+ <>
+ <span aria-hidden className="text-faint-foreground">·</span>
+ <span className="font-medium text-red-600 dark:text-red-400">
+ {lang === "zh"
+ ? `图片展开偏移 +${telemetry.clsPx}px`
+ : `Image shift +${telemetry.clsPx}px`}
+ </span>
+ </>
+ )}
+ </>
+ )}
+ </div>
+ <span className="shrink-0 text-faint-foreground">{COPY.shortcutsHint[lang]}</span>
+ </footer>
+ </div>
+ );
+}
+
+function PropRow({ label, children }: { label: string; children: React.ReactNode }) {
+ return (
+ <div className="grid grid-cols-[64px_1fr] items-center gap-2">
+ <span className="text-caption text-muted-foreground">{label}</span>
+ <div className="min-w-0">{children}</div>
+ </div>
+ );
+}
diff --git a/apps/storybook/src/inbox-transition/mock-images.tsx b/apps/storybook/src/inbox-transition/mock-images.tsx
new file mode 100644
index 0000000000..16944684c5
--- /dev/null
+++ b/apps/storybook/src/inbox-transition/mock-images.tsx
@@ -0,0 +1,174 @@
+import { useEffect, useState } from "react";
+import { Skeleton } from "@multica/ui/components/ui/skeleton";
+import { cn } from "@multica/ui/lib/utils";
+import type { Lang } from "../voice-input/copy";
+
+export type MockImageKind = "perf-chart" | "ui-compare" | "ci-matrix" | "trace-waterfall";
+
+function svgToDataUri(svg: string): string {
+ return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
+}
+
+const IMAGE_DATA_URI: Record<MockImageKind, string> = {
+ "perf-chart": svgToDataUri(`<svg xmlns="http://www.w3.org/2000/svg" width="640" height="340" viewBox="0 0 640 340">
+ <rect width="640" height="340" rx="12" fill="#0f172a"/>
+ <text x="28" y="38" fill="#e2e8f0" font-family="system-ui,sans-serif" font-size="14" font-weight="600">Inbox Switch Latency &amp; CLS Breakdown (n=50)</text>
+ <text x="28" y="58" fill="#94a3b8" font-family="system-ui,sans-serif" font-size="11">Cold cache vs. Anchor prefetch + reserved image aspect ratio</text>
+ <g stroke="#1e293b" stroke-width="1">
+ <line x1="28" y1="95" x2="612" y2="95"/><line x1="28" y1="150" x2="612" y2="150"/>
+ <line x1="28" y1="205" x2="612" y2="205"/><line x1="28" y1="260" x2="612" y2="260"/>
+ </g>
+ <rect x="64" y="112" width="68" height="148" rx="6" fill="#ef4444" fill-opacity="0.85"/>
+ <rect x="148" y="218" width="68" height="42" rx="6" fill="#3b82f6"/>
+ <rect x="274" y="138" width="68" height="122" rx="6" fill="#ef4444" fill-opacity="0.85"/>
+ <rect x="358" y="238" width="68" height="22" rx="6" fill="#3b82f6"/>
+ <rect x="484" y="168" width="68" height="92" rx="6" fill="#f59e0b" fill-opacity="0.9"/>
+ <rect x="568" y="254" width="32" height="6" rx="3" fill="#10b981"/>
+ <g fill="#cbd5e1" font-family="system-ui,sans-serif" font-size="11" text-anchor="middle">
+ <text x="98" y="104">480ms</text><text x="182" y="210">92ms</text>
+ <text x="308" y="130">340ms</text><text x="392" y="230">44ms</text>
+ <text x="518" y="160">0.21 CLS</text><text x="584" y="246">0.00</text>
+ <text x="140" y="284" fill="#94a3b8">Cold Switch</text>
+ <text x="350" y="284" fill="#94a3b8">Warm Anchor Jump</text>
+ <text x="545" y="284" fill="#94a3b8">Image Shift</text>
+ </g>
+ <g font-family="system-ui,sans-serif" font-size="11">
+ <rect x="28" y="306" width="10" height="10" rx="2" fill="#ef4444"/><text x="44" y="315" fill="#94a3b8">Current</text>
+ <rect x="112" y="306" width="10" height="10" rx="2" fill="#3b82f6"/><text x="128" y="315" fill="#94a3b8">Prefetched + Steady Chrome</text>
+ <rect x="298" y="306" width="10" height="10" rx="2" fill="#10b981"/><text x="314" y="315" fill="#94a3b8">Reserved Aspect Ratio</text>
+ </g>
+ </svg>`),
+ "ui-compare": svgToDataUri(`<svg xmlns="http://www.w3.org/2000/svg" width="640" height="340" viewBox="0 0 640 340">
+ <rect width="640" height="340" rx="12" fill="#18181b"/>
+ <text x="24" y="34" fill="#f4f4f5" font-family="system-ui,sans-serif" font-size="13" font-weight="600">InboxBar 40px Slot Stability — Before vs After</text>
+ <rect x="24" y="52" width="284" height="260" rx="8" fill="#27272a" stroke="#3f3f46"/>
+ <rect x="332" y="52" width="284" height="260" rx="8" fill="#27272a" stroke="#3b82f6"/>
+ <text x="40" y="76" fill="#fca5a5" font-family="system-ui,sans-serif" font-size="11" font-weight="600">Before: Bar unmounts (-40px jump)</text>
+ <rect x="40" y="90" width="252" height="26" rx="4" fill="#3f3f46"/>
+ <rect x="40" y="122" width="252" height="24" rx="4" fill="#7f1d1d" stroke="#ef4444" stroke-dasharray="4 3"/>
+ <text x="166" y="138" fill="#fecaca" font-family="system-ui,sans-serif" font-size="10" text-anchor="middle">Missing 40px InboxBar during switch</text>
+ <rect x="40" y="154" width="190" height="14" rx="3" fill="#52525b"/>
+ <rect x="40" y="176" width="230" height="10" rx="3" fill="#3f3f46"/>
+ <rect x="40" y="194" width="210" height="10" rx="3" fill="#3f3f46"/>
+ <rect x="40" y="220" width="252" height="72" rx="6" fill="#18181b"/>
+ <text x="348" y="76" fill="#93c5fd" font-family="system-ui,sans-serif" font-size="11" font-weight="600">After: Locked 40px bar + 2px progress</text>
+ <rect x="348" y="90" width="252" height="26" rx="4" fill="#3f3f46"/>
+ <rect x="348" y="122" width="252" height="24" rx="4" fill="#1e293b" stroke="#334155"/>
+ <rect x="348" y="144" width="168" height="2" fill="#3b82f6"/>
+ <text x="360" y="138" fill="#cbd5e1" font-family="system-ui,sans-serif" font-size="10">Changed to Done · opening next...</text>
+ <rect x="348" y="158" width="190" height="14" rx="3" fill="#71717a"/>
+ <rect x="348" y="180" width="230" height="10" rx="3" fill="#52525b"/>
+ <rect x="348" y="198" width="210" height="10" rx="3" fill="#52525b"/>
+ <rect x="348" y="220" width="252" height="72" rx="6" fill="#1e293b" stroke="#3b82f6" stroke-opacity="0.5"/>
+ </svg>`),
+ "ci-matrix": svgToDataUri(`<svg xmlns="http://www.w3.org/2000/svg" width="640" height="320" viewBox="0 0 640 320">
+ <rect width="640" height="320" rx="12" fill="#09090b"/>
+ <text x="26" y="36" fill="#fafafa" font-family="system-ui,sans-serif" font-size="14" font-weight="600">Playwright Visual &amp; E2E Verification Snapshot</text>
+ <rect x="26" y="56" width="588" height="44" rx="8" fill="#18181b" stroke="#27272a"/>
+ <circle cx="48" cy="78" r="7" fill="#10b981"/><text x="66" y="82" fill="#e4e4e7" font-family="system-ui,sans-serif" font-size="12">inbox-jump.spec.ts — warm p50: 46ms, longest task: 24ms</text>
+ <rect x="26" y="110" width="588" height="44" rx="8" fill="#18181b" stroke="#27272a"/>
+ <circle cx="48" cy="132" r="7" fill="#10b981"/><text x="66" y="136" fill="#e4e4e7" font-family="system-ui,sans-serif" font-size="12">inbox-page.test.tsx — 64/64 passed (archived + live + undo)</text>
+ <rect x="26" y="164" width="588" height="44" rx="8" fill="#18181b" stroke="#27272a"/>
+ <circle cx="48" cy="186" r="7" fill="#10b981"/><text x="66" y="190" fill="#e4e4e7" font-family="system-ui,sans-serif" font-size="12">issue-inbox-actions.test.tsx — settled bar + auto-archive buffer</text>
+ <rect x="26" y="218" width="588" height="72" rx="8" fill="#172554" fill-opacity="0.45" stroke="#1d4ed8"/>
+ <text x="44" y="246" fill="#93c5fd" font-family="ui-monospace,monospace" font-size="11">scrollTop before image load: 3420px</text>
+ <text x="44" y="268" fill="#93c5fd" font-family="ui-monospace,monospace" font-size="11">scrollTop after 3 images load: 3420px (delta: 0px)</text>
+ </svg>`),
+ "trace-waterfall": svgToDataUri(`<svg xmlns="http://www.w3.org/2000/svg" width="640" height="320" viewBox="0 0 640 320">
+ <rect width="640" height="320" rx="12" fill="#111827"/>
+ <text x="26" y="34" fill="#f9fafb" font-family="system-ui,sans-serif" font-size="13" font-weight="600">Network &amp; Render Waterfall — Auto-Advance Transition</text>
+ <g font-family="ui-monospace,monospace" font-size="11" fill="#9ca3af">
+ <text x="26" y="74">GET /issues/MUL-9806</text>
+ <text x="26" y="114">GET /issues/.../timeline</text>
+ <text x="26" y="154">GET /issues/.../tasks</text>
+ <text x="26" y="194">IMG screenshot-1.png</text>
+ <text x="26" y="234">IMG screenshot-2.png</text>
+ <text x="26" y="274">Scroll anchor align</text>
+ </g>
+ <rect x="210" y="60" width="120" height="18" rx="4" fill="#3b82f6"/>
+ <rect x="210" y="100" width="195" height="18" rx="4" fill="#6366f1"/>
+ <rect x="210" y="140" width="148" height="18" rx="4" fill="#8b5cf6"/>
+ <rect x="405" y="180" width="110" height="18" rx="4" fill="#f59e0b"/>
+ <rect x="405" y="220" width="165" height="18" rx="4" fill="#f59e0b"/>
+ <rect x="405" y="260" width="18" height="18" rx="4" fill="#10b981"/>
+ <text x="580" y="233" fill="#fbbf24" font-family="system-ui,sans-serif" font-size="10">+480px CLS</text>
+ <text x="430" y="273" fill="#34d399" font-family="system-ui,sans-serif" font-size="10">pre-paint align</text>
+ </svg>`),
+};
+
+export function DelayedCommentImage({
+ kind,
+ caption,
+ delayMs,
+ reserveAspectRatio,
+ loadedInitially,
+ onExpandedWithoutReserve,
+ lang,
+}: {
+ kind: MockImageKind;
+ caption: Record<Lang, string>;
+ delayMs: number;
+ reserveAspectRatio: boolean;
+ loadedInitially: boolean;
+ onExpandedWithoutReserve?: (heightPx: number) => void;
+ lang: Lang;
+}) {
+ const [loaded, setLoaded] = useState(loadedInitially || delayMs <= 0);
+
+ useEffect(() => {
+ if (loadedInitially || delayMs <= 0) {
+ setLoaded(true);
+ return;
+ }
+ setLoaded(false);
+ const id = window.setTimeout(() => {
+ setLoaded(true);
+ if (!reserveAspectRatio) onExpandedWithoutReserve?.(340);
+ }, delayMs);
+ return () => window.clearTimeout(id);
+ }, [delayMs, loadedInitially, reserveAspectRatio, onExpandedWithoutReserve]);
+
+ // Current (A): unreserved image starts at 0px height and suddenly expands to 240px,
+ // pushing the target comment below it right out of the reader's gaze.
+ if (!reserveAspectRatio && !loaded) {
+ return (
+ <div className="mt-2 text-micro text-faint-foreground">
+ {lang === "zh" ? "图片加载中…" : "Loading image…"}
+ </div>
+ );
+ }
+
+ return (
+ <figure className="mt-3 overflow-hidden rounded-lg border border-border bg-muted/40">
+ <div className="relative aspect-[640/340] w-full overflow-hidden bg-muted/60">
+ {!loaded && (
+ <div className="absolute inset-0 flex flex-col justify-between p-4">
+ <Skeleton className="h-4 w-44" />
+ <Skeleton className="flex-1 my-3 w-full rounded-md" />
+ <Skeleton className="h-3 w-32" />
+ </div>
+ )}
+ <img
+ src={IMAGE_DATA_URI[kind]}
+ alt={caption[lang]}
+ className={cn(
+ "h-full w-full object-contain transition-opacity duration-200",
+ loaded ? "opacity-100" : "opacity-0",
+ )}
+ />
+ </div>
+ <figcaption className="flex items-center justify-between border-t border-border/60 px-3 py-1.5 text-micro text-muted-foreground">
+ <span className="truncate">{caption[lang]}</span>
+ <span className="shrink-0 tabular-nums text-faint-foreground">
+ {loaded
+ ? reserveAspectRatio
+ ? "CLS 0px"
+ : lang === "zh"
+ ? "展开 +340px"
+ : "+340px shift"
+ : `${delayMs}ms`}
+ </span>
+ </figcaption>
+ </figure>
+ );
+}
diff --git a/packages/core/inbox/selection-store.test.ts b/packages/core/inbox/selection-store.test.ts
new file mode 100644
index 0000000000..84e0ab67b0
--- /dev/null
+++ b/packages/core/inbox/selection-store.test.ts
@@ -0,0 +1,38 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { useInboxSelectionStore } from "./selection-store";
+
+describe("useInboxSelectionStore transitions", () => {
+ beforeEach(() => {
+ vi.useFakeTimers();
+ vi.setSystemTime(new Date("2026-11-23T00:00:00Z"));
+ useInboxSelectionStore.setState({ transitionByWorkspace: {} });
+ });
+
+ afterEach(() => {
+ vi.useRealTimers();
+ });
+
+ it("consumes a matching directional transition once", () => {
+ const store = useInboxSelectionStore.getState();
+ store.recordTransition("ws-1", "issue-2", "next");
+
+ expect(store.consumeTransition("ws-1", "issue-other")).toBeNull();
+ expect(store.consumeTransition("ws-1", "issue-2")).toBe("next");
+ expect(store.consumeTransition("ws-1", "issue-2")).toBeNull();
+ });
+
+ it("supports prev direction for undo return", () => {
+ const store = useInboxSelectionStore.getState();
+ store.recordTransition("ws-1", "issue-1", "prev");
+ expect(store.consumeTransition("ws-1", "issue-1")).toBe("prev");
+ });
+
+ it("expires stale transitions after 3 seconds", () => {
+ const store = useInboxSelectionStore.getState();
+ store.recordTransition("ws-1", "issue-2", "next");
+ vi.advanceTimersByTime(3_001);
+
+ expect(store.consumeTransition("ws-1", "issue-2")).toBeNull();
+ expect(useInboxSelectionStore.getState().transitionByWorkspace["ws-1"]).toBeUndefined();
+ });
+});
diff --git a/packages/core/inbox/selection-store.ts b/packages/core/inbox/selection-store.ts
index c4ccc273cb..19ef786ca7 100644
--- a/packages/core/inbox/selection-store.ts
+++ b/packages/core/inbox/selection-store.ts
@@ -45,12 +45,34 @@ export type LastInboxCleared =
clearedAt: number;
};
+export type InboxTransitionDirection = "next" | "prev";
+
+/**
+ * Directional hint recorded right before the Inbox advances to the next item
+ * (`"next"`) or undoes back to a cleared one (`"prev"`), so the arriving
+ * detail can play a subtle 12px glide aligned with list order.
+ */
+export interface InboxTransition {
+ targetKey: string;
+ direction: InboxTransitionDirection;
+ at: number;
+}
+
+const INBOX_TRANSITION_TTL_MS = 3_000;
+
interface InboxSelectionState {
lastResolvedKeyByWorkspace: Record<string, string>;
rememberResolvedKey: (wsId: string, key: string) => void;
/** The issue last opened from the Work panel's Inbox section. */
sidebarIssueByWorkspace: Record<string, string | null>;
rememberSidebarIssue: (wsId: string, issueId: string | null) => void;
+ /**
+ * Pending directional transition into the next (or undone) Inbox item.
+ * Consumed once when that destination mounts; stale entries expire.
+ */
+ transitionByWorkspace: Record<string, InboxTransition>;
+ recordTransition: (wsId: string, targetKey: string, direction: InboxTransitionDirection) => void;
+ consumeTransition: (wsId: string, key: string) => InboxTransitionDirection | null;
/**
* Issues the Inbox section opened in another tab of this window. Desktop
* tabs share this store, so each of these keeps counting as opened from
@@ -104,7 +126,7 @@ const heldRowId = (wsId: string, list: string) => `${wsId}:${list}`;
// Keep only the last resolved pointer per workspace, for this client run.
// Notification data and its cache lifetime remain owned by TanStack Query.
-export const useInboxSelectionStore = create<InboxSelectionState>()((set) => ({
+export const useInboxSelectionStore = create<InboxSelectionState>()((set, get) => ({
lastResolvedKeyByWorkspace: {},
rememberResolvedKey: (wsId, key) =>
set((state) => state.lastResolvedKeyByWorkspace[wsId] === key ? state : {
@@ -115,6 +137,25 @@ export const useInboxSelectionStore = create<InboxSelectionState>()((set) => ({
set((state) => (state.sidebarIssueByWorkspace[wsId] ?? null) === issueId ? state : {
sidebarIssueByWorkspace: { ...state.sidebarIssueByWorkspace, [wsId]: issueId },
}),
+ transitionByWorkspace: {},
+ recordTransition: (wsId, targetKey, direction) =>
+ set((state) => ({
+ transitionByWorkspace: {
+ ...state.transitionByWorkspace,
+ [wsId]: { targetKey, direction, at: Date.now() },
+ },
+ })),
+ consumeTransition: (wsId, key) => {
+ const entry = get().transitionByWorkspace[wsId];
+ if (!entry || entry.targetKey !== key) return null;
+ const fresh = Date.now() - entry.at <= INBOX_TRANSITION_TTL_MS;
+ set((state) => {
+ if (state.transitionByWorkspace[wsId] !== entry) return state;
+ const { [wsId]: _consumed, ...transitionByWorkspace } = state.transitionByWorkspace;
+ return { transitionByWorkspace };
+ });
+ return fresh ? entry.direction : null;
+ },
sidebarTabIssuesByWorkspace: {},
rememberSidebarTabIssue: (wsId, issueId) =>
set((state) => {
diff --git a/packages/ui/styles/base.css b/packages/ui/styles/base.css
index 69670eeb77..6d1c088d61 100644
--- a/packages/ui/styles/base.css
+++ b/packages/ui/styles/base.css
@@ -139,6 +139,75 @@
animation: onboarding-enter 0.4s ease both;
}
+/* Inbox auto-advance / undo detail transition (MUL-9865).
+ * `backwards` fill-mode commits the initial offset pre-paint and releases
+ * `transform` once finished so sticky/fixed descendants inside the reading
+ * column keep their normal containing block. */
+@keyframes inbox-enter-next {
+ from {
+ opacity: 0;
+ transform: translateY(12px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+@keyframes inbox-enter-prev {
+ from {
+ opacity: 0;
+ transform: translateY(-12px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+@keyframes inbox-enter-fade {
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
+ }
+}
+
+@keyframes inbox-auto-advance-bar {
+ from {
+ transform: scaleX(0);
+ }
+ to {
+ transform: scaleX(1);
+ }
+}
+
+.animate-inbox-enter-next {
+ animation: inbox-enter-next 160ms cubic-bezier(0.23, 1, 0.32, 1) backwards;
+}
+
+.animate-inbox-enter-prev {
+ animation: inbox-enter-prev 160ms cubic-bezier(0.23, 1, 0.32, 1) backwards;
+}
+
+.animate-inbox-enter-fade {
+ animation: inbox-enter-fade 130ms ease-out backwards;
+}
+
+.animate-inbox-auto-advance-bar {
+ transform-origin: left center;
+ animation: inbox-auto-advance-bar var(--inbox-advance-duration, 1400ms) linear forwards;
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .animate-inbox-enter-next,
+ .animate-inbox-enter-prev {
+ animation-name: inbox-enter-fade;
+ animation-duration: 120ms;
+ }
+}
+
/* Chat FAB: gentle color + border tint while a chat task is running.
* Keeps the ring at the same thickness — only hue shifts towards brand
* at half-cycle, no outer glow. */
diff --git a/packages/views/inbox/components/inbox-bar.tsx b/packages/views/inbox/components/inbox-bar.tsx
index 6e75ecafb9..340295318b 100644
--- a/packages/views/inbox/components/inbox-bar.tsx
+++ b/packages/views/inbox/components/inbox-bar.tsx
@@ -3,6 +3,7 @@
import type { ComponentProps, ReactNode } from "react";
import { Archive } from "@multica/ui/icons";
import { Button } from "@multica/ui/components/ui/button";
+import { Skeleton } from "@multica/ui/components/ui/skeleton";
import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { cn } from "@multica/ui/lib/utils";
import type { ShortcutActionId } from "@multica/core/shortcuts";
@@ -30,7 +31,7 @@ export function InboxBar({ settled = false, children }: { settled?: boolean; chi
role={settled ? "status" : undefined}
data-inbox-bar={settled ? "settled" : "open"}
className={cn(
- "@container/inbox-bar flex h-10 shrink-0 items-center gap-1 border-b",
+ "@container/inbox-bar relative flex h-10 shrink-0 items-center gap-1 border-b",
settled && "bg-muted/40",
PAGE_GUTTER,
)}
@@ -40,6 +41,37 @@ export function InboxBar({ settled = false, children }: { settled?: boolean; chi
);
}
+/**
+ * Reserves the 40px InboxBar slot while a cold issue opened from the Inbox
+ * loads, so the reading column below never shifts 40px when the issue lands.
+ * When the Inbox list already holds the notification row, renders its real
+ * actor and reason immediately.
+ */
+export function InboxBarSkeleton({ item }: { item?: InboxItem | null }) {
+ return (
+ <InboxBar>
+ {item ? (
+ <InboxBarReason item={item} />
+ ) : (
+ <span className="mr-1 flex min-w-0 flex-1 items-center gap-1.5">
+ <Skeleton className="size-4 shrink-0 rounded-full" />
+ <Skeleton className="h-3.5 w-40" />
+ </span>
+ )}
+ <div className="flex shrink-0 items-center gap-1.5">
+ <Skeleton className="h-6 w-14 rounded-md" />
+ <Skeleton className="h-6 w-14 rounded-md" />
+ </div>
+ <span
+ aria-hidden
+ className="pointer-events-none absolute inset-x-0 bottom-0 h-0.5 overflow-hidden bg-muted"
+ >
+ <span className="block h-full w-2/3 animate-pulse bg-brand/70" />
+ </span>
+ </InboxBar>
+ );
+}
+
/**
* The open notification's bar: why it is here, the issue's actions, and the
* notification's own (`children`).
diff --git a/packages/views/inbox/components/inbox-empty-state.tsx b/packages/views/inbox/components/inbox-empty-state.tsx
index 1724f8f9d7..24eabc742e 100644
--- a/packages/views/inbox/components/inbox-empty-state.tsx
+++ b/packages/views/inbox/components/inbox-empty-state.tsx
@@ -144,6 +144,7 @@ export function InboxEmptyState({
return;
}
store.returnRow(wsId, entry.key);
+ store.recordTransition(wsId, entry.key, "prev");
if (entry.kind === "unsubscribed") store.rememberSidebarIssue(wsId, entry.issueId);
else if (entry.href.includes("/issues/")) store.rememberSidebarIssue(wsId, entry.key);
push?.(entry.href);
diff --git a/packages/views/inbox/components/inbox-kept-actions.tsx b/packages/views/inbox/components/inbox-kept-actions.tsx
index 46c63716d0..28ac64d91d 100644
--- a/packages/views/inbox/components/inbox-kept-actions.tsx
+++ b/packages/views/inbox/components/inbox-kept-actions.tsx
@@ -1,21 +1,25 @@
"use client";
-import type { ReactNode } from "react";
-import { Archive, ArrowDown, ArrowRight, CheckCircle2, Undo2 } from "@multica/ui/icons";
+import type { CSSProperties, ReactNode } from "react";
+import { Archive, ArrowDown, ArrowRight, CheckCircle2, Undo2, X } from "@multica/ui/icons";
import { Button } from "@multica/ui/components/ui/button";
import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";
import type { InboxBarAction } from "@multica/core/inbox/auto-archive";
import type { KeptInboxRow } from "@multica/core/inbox/open-row";
+import { createShortcutChord } from "@multica/core/shortcuts";
import { useActorName } from "@multica/core/workspace/hooks";
import type { InboxItem } from "@multica/core/types";
import { useLocale, useT } from "../../i18n";
-import { ActionShortcutKeycaps } from "../../common/shortcut-keycaps";
+import { ActionShortcutKeycaps, ShortcutKeycaps } from "../../common/shortcut-keycaps";
import { useStatusLabel } from "../../issues/utils/status-label";
import { formatSnoozeTime } from "./inbox-snooze-time";
import { getInboxDisplayTitle, isAutopilotQuotaNotice } from "./inbox-display";
import { InboxBar, InboxBarSeparator, InboxBarStatus } from "./inbox-bar";
import { useInboxUndoShortcut } from "./use-inbox-shortcut";
+import type { AutoAdvanceBuffer } from "./use-move-on-after-auto-archive";
+
+const ESCAPE_SHORTCUT = createShortcutChord("Escape");
/**
* How a kept row (`keepOpenInboxRow`) says why it is settled: `line` in its
@@ -80,6 +84,7 @@ export function InboxKeptActions({
onUndo,
next,
onNext,
+ autoAdvance = null,
inboxCleared = false,
snoozedCount = 0,
onSnoozedClick,
@@ -93,6 +98,8 @@ export function InboxKeptActions({
/** The notification `onNext` opens; without one there is nothing to move on to. */
next: InboxItem | null;
onNext: () => void;
+ /** Active auto-advance buffer after an auto-archive (`after_auto_archive = "next"`). */
+ autoAdvance?: AutoAdvanceBuffer | null;
/** True when archiving this row emptied the entire unfiltered Inbox (stay-in-place mode). */
inboxCleared?: boolean;
snoozedCount?: number;
@@ -121,6 +128,14 @@ export function InboxKeptActions({
</>
)}
</span>
+ ) : autoAdvance ? (
+ <span className="flex min-w-0 items-center gap-1.5 truncate">
+ <span className="truncate">{label}</span>
+ <span aria-hidden className="text-faint-foreground @max-[38rem]/inbox-bar:hidden">·</span>
+ <span className="shrink-0 text-faint-foreground @max-[38rem]/inbox-bar:hidden">
+ {t(($) => $.kept.opening_next)}
+ </span>
+ </span>
) : (
label
);
@@ -129,7 +144,16 @@ export function InboxKeptActions({
<InboxBar settled>
<InboxBarStatus icon={statusIcon} label={statusLabel} />
{issueActions}
- {issueActions && (onUndo || next || (inboxCleared && onGoToMyWork)) && <InboxBarSeparator />}
+ {issueActions && (autoAdvance || onUndo || next || (inboxCleared && onGoToMyWork)) && <InboxBarSeparator />}
+ {autoAdvance && (
+ <Button size="sm" variant="ghost" className="shrink-0 text-muted-foreground" onClick={autoAdvance.cancel}>
+ <X />
+ {t(($) => $.kept.stay_here)}
+ <span aria-hidden className="flex @max-[34rem]/inbox-bar:hidden">
+ <ShortcutKeycaps shortcut={ESCAPE_SHORTCUT} />
+ </span>
+ </Button>
+ )}
{onUndo && (
<Button size="sm" variant="ghost" className="shrink-0 text-muted-foreground" onClick={onUndo}>
<Undo2 />
@@ -147,6 +171,14 @@ export function InboxKeptActions({
<ArrowRight />
</Button>
) : null}
+ {autoAdvance && (
+ <span
+ aria-hidden
+ data-inbox-auto-advance-bar=""
+ style={{ ["--inbox-advance-duration" as string]: `${autoAdvance.durationMs}ms` } as CSSProperties}
+ className="animate-inbox-auto-advance-bar pointer-events-none absolute inset-x-0 bottom-0 h-0.5 bg-brand"
+ />
+ )}
</InboxBar>
);
}
diff --git a/packages/views/inbox/components/inbox-page-query.test.tsx b/packages/views/inbox/components/inbox-page-query.test.tsx
index 897e65be69..2eeff530f6 100644
--- a/packages/views/inbox/components/inbox-page-query.test.tsx
+++ b/packages/views/inbox/components/inbox-page-query.test.tsx
@@ -15,6 +15,7 @@ import { InboxPage } from "./inbox-page";
vi.mock("sonner", () => ({ toast: { success: vi.fn(), error: vi.fn() } }));
let workspaceId = "workspace-1";
vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => workspaceId }));
+vi.mock("@multica/core/permissions", () => ({ useIsGuest: () => false }));
vi.mock("@multica/core/paths", () => ({
useWorkspacePaths: () => ({
inbox: () => "/acme/inbox",
diff --git a/packages/views/inbox/components/inbox-page.tsx b/packages/views/inbox/components/inbox-page.tsx
index fdd0f3b41a..64cbe6d4f5 100644
--- a/packages/views/inbox/components/inbox-page.tsx
+++ b/packages/views/inbox/components/inbox-page.tsx
@@ -126,6 +126,7 @@ import {
useRestoreInbox,
} from "./use-leave-inbox-row";
import { useInboxSnooze } from "./use-inbox-snooze";
+import { useInboxIssuePrefetch } from "./use-inbox-issue-prefetch";
import { useInboxShortcut } from "./use-inbox-shortcut";
import { InboxAppRequest } from "../../common/app-requests";
import { useT } from "../../i18n";
@@ -595,8 +596,17 @@ export function InboxPage() {
// The rows in the order the user sees them: on desktop the Work panel
// section's, which applies the same filters.
const listedItems = opensAnyLiveRow ? sectionList.rows : selectionItems;
+ // Warm the next two rows around the active selection on Archived & compact
+ // lists so unarchive/archive auto-advance renders from cache without flashing.
+ useInboxIssuePrefetch(
+ wsId,
+ isArchivedView || isCompact ? listedItems : [],
+ (item) => inboxRowHref(wsPaths, item),
+ selectedKey || null,
+ );
const leaveRow = useInboxSelectionStore((s) => s.leaveRow);
const recordLastCleared = useInboxSelectionStore((s) => s.recordLastCleared);
+ const recordTransition = useInboxSelectionStore((s) => s.recordTransition);
// Moving the selection off a row (an Inbox action on it) lets it go rather
// than keep it in place.
const advanceSelectionPast = (id: string, list: InboxItem[], cleared?: LastInboxCleared) => {
@@ -607,7 +617,9 @@ export function InboxPage() {
// Only clear the selection when nothing else is left.
const next = nextInboxRow(list, selectedKey);
if (!next && cleared) recordLastCleared(wsId, cleared);
- setSelectedKey(next ? inboxRowKey(next) : "");
+ const nextKey = next ? inboxRowKey(next) : "";
+ recordTransition(wsId, nextKey, "next");
+ setSelectedKey(nextKey);
};
// A batch archive that takes the open row moves on to the next one it leaves.
const archiveBatch = (
@@ -666,7 +678,7 @@ export function InboxPage() {
});
};
- const settledCause = useMoveOnAfterAutoArchive({
+ const { cause: settledCause, autoAdvance: settledAutoAdvance } = useMoveOnAfterAutoArchive({
settled: settledRow,
next: settledRow ? nextInboxRow(listedItems, settledRow.key) : null,
onNext: () => {
@@ -1010,6 +1022,7 @@ export function InboxPage() {
}
next={nextInboxRow(listedItems, settledRow.key)}
onNext={() => advanceSelectionPast(settledRow.item.id, listedItems)}
+ autoAdvance={settledAutoAdvance}
/>
) : null;
diff --git a/packages/views/inbox/components/use-inbox-issue-prefetch.test.tsx b/packages/views/inbox/components/use-inbox-issue-prefetch.test.tsx
index 6daeddfe9d..7355fd7530 100644
--- a/packages/views/inbox/components/use-inbox-issue-prefetch.test.tsx
+++ b/packages/views/inbox/components/use-inbox-issue-prefetch.test.tsx
@@ -28,12 +28,17 @@ function row(id: string, read = false): InboxItem {
return { id: `n-${id}`, issue_id: id, issue_identifier: `MUL-${id}`, read } as InboxItem;
}
-function setup(rows: InboxItem[]) {
+function setup(rows: InboxItem[], openKey?: string | null) {
const qc = new QueryClient({ defaultOptions: { queries: { retry: false, staleTime: Infinity } } });
const wrapper = ({ children }: { children: ReactNode }) => <QueryClientProvider client={qc}>{children}</QueryClientProvider>;
- const hook = renderHook(({ items }) => useInboxIssuePrefetch("ws", items, (item) => `/ws/issues/${item.issue_identifier}`), {
- wrapper, initialProps: { items: rows },
- });
+ const hook = renderHook(
+ ({ items, activeKey }) =>
+ useInboxIssuePrefetch("ws", items, (item) => `/ws/issues/${item.issue_identifier}`, activeKey),
+ {
+ wrapper,
+ initialProps: { items: rows, activeKey: openKey },
+ },
+ );
return { qc, hook };
}
@@ -86,8 +91,32 @@ describe("useInboxIssuePrefetch", () => {
it("does not restart when realtime replaces the same rows", async () => {
const { hook } = setup([row("a")]);
- hook.rerender({ items: [row("a")] });
+ hook.rerender({ items: [row("a")], activeKey: undefined });
await act(async () => { await vi.advanceTimersByTimeAsync(1000); });
expect(api.getIssue).toHaveBeenCalledTimes(1);
});
+
+ it("anchors prefetch on the next two rows after the currently open row, including read rows past index 3", async () => {
+ const rows = [
+ row("a"),
+ row("b"),
+ row("c"),
+ row("d", true),
+ row("e", true),
+ row("f", true),
+ row("g"),
+ ];
+ setup(rows, "d");
+
+ await act(async () => { await vi.advanceTimersByTimeAsync(1000); });
+
+ // next1 ("e", read) and next2 ("f", read) warm first, followed by the top unread rows.
+ expect(vi.mocked(api.getIssue).mock.calls.map(([id]) => id)).toEqual([
+ "MUL-e",
+ "MUL-f",
+ "MUL-a",
+ "MUL-b",
+ "MUL-c",
+ ]);
+ });
});
diff --git a/packages/views/inbox/components/use-inbox-issue-prefetch.ts b/packages/views/inbox/components/use-inbox-issue-prefetch.ts
index 47e64ee963..6cbd40c034 100644
--- a/packages/views/inbox/components/use-inbox-issue-prefetch.ts
+++ b/packages/views/inbox/components/use-inbox-issue-prefetch.ts
@@ -2,6 +2,7 @@
import { useCallback, useEffect, useMemo } from "react";
import { useQueryClient } from "@tanstack/react-query";
+import { inboxRowKey, nextInboxRow } from "@multica/core/inbox/open-row";
import { prefetchIssuePage } from "@multica/core/issues/queries";
import { useIsGuest } from "@multica/core/permissions";
import type { InboxItem } from "@multica/core/types";
@@ -12,14 +13,16 @@ export const INBOX_IDLE_PREFETCH_LIMIT = 3;
/**
* Opening a notification should render from cache, not wait on the issue's
- * request chain. The first few unread rows are warmed one issue at a time when
- * the browser is idle; any other row is warmed when it is pointed at or
- * focused. Returns the per-row warm-up for those events.
+ * request chain. While reading an open notification (`openKey`), its next two
+ * neighbours in list order (read or unread) are warmed first so auto-advancing
+ * stays instant; the first few unread rows follow when idle. Any other row is
+ * warmed when it is pointed at or focused.
*/
export function useInboxIssuePrefetch(
wsId: string,
rows: readonly InboxItem[],
hrefOf: (item: InboxItem) => string,
+ openKey?: string | null,
) {
const qc = useQueryClient();
const { prefetch: prefetchRoute } = useNavigation();
@@ -36,10 +39,36 @@ export function useInboxIssuePrefetch(
[qc, wsId, guest],
);
- const idleTargets = useMemo(
- () => rows.filter((item) => item.issue_id && item.read !== true).slice(0, INBOX_IDLE_PREFETCH_LIMIT),
- [rows],
- );
+ const idleTargets = useMemo(() => {
+ const picked: InboxItem[] = [];
+ const seen = new Set<string>();
+ const add = (item: InboxItem | null | undefined) => {
+ if (!item?.issue_id || seen.has(item.issue_id)) return;
+ seen.add(item.issue_id);
+ picked.push(item);
+ };
+
+ if (openKey) {
+ const next1 = nextInboxRow(rows, openKey);
+ add(next1);
+ if (next1) {
+ const next1Key = inboxRowKey(next1);
+ const next2 = nextInboxRow(rows, next1Key, (row) => inboxRowKey(row) === openKey);
+ add(next2);
+ }
+ }
+
+ let unreadAdded = 0;
+ for (const item of rows) {
+ if (unreadAdded >= INBOX_IDLE_PREFETCH_LIMIT) break;
+ if (!item.issue_id || item.read === true) continue;
+ if (openKey && inboxRowKey(item) === openKey) continue;
+ add(item);
+ unreadAdded += 1;
+ }
+
+ return picked;
+ }, [rows, openKey]);
// Effect identity follows the issues, not the row objects, which realtime
// patches replace on every inbox event.
const idleKey = idleTargets.map((item) => item.issue_id).join(",");
@@ -55,14 +84,15 @@ export function useInboxIssuePrefetch(
await prefetchRow(item);
}
};
+ const timeout = openKey ? 150 : 500;
if (typeof window.requestIdleCallback === "function") {
- const id = window.requestIdleCallback(() => void run(), { timeout: 500 });
+ const id = window.requestIdleCallback(() => void run(), { timeout });
return () => {
cancelled = true;
window.cancelIdleCallback(id);
};
}
- const timer = window.setTimeout(() => void run(), 300);
+ const timer = window.setTimeout(() => void run(), openKey ? 100 : 300);
return () => {
cancelled = true;
window.clearTimeout(timer);
diff --git a/packages/views/inbox/components/use-leave-inbox-row.ts b/packages/views/inbox/components/use-leave-inbox-row.ts
index 7b584c38f9..2ad044771c 100644
--- a/packages/views/inbox/components/use-leave-inbox-row.ts
+++ b/packages/views/inbox/components/use-leave-inbox-row.ts
@@ -49,19 +49,22 @@ export function useLeaveInboxRow() {
const leaveRow = useInboxSelectionStore((s) => s.leaveRow);
const rememberSidebarIssue = useInboxSelectionStore((s) => s.rememberSidebarIssue);
const recordLastCleared = useInboxSelectionStore((s) => s.recordLastCleared);
+ const recordTransition = useInboxSelectionStore((s) => s.recordTransition);
return useCallback(
(key: string, next: InboxItem | null, cleared?: LastInboxCleared) => {
leaveRow(wsId, key);
if (!next) {
rememberSidebarIssue(wsId, null);
+ recordTransition(wsId, "", "next");
if (cleared) recordLastCleared(wsId, cleared);
push(p.inbox());
return;
}
rememberSidebarIssue(wsId, next.issue_id ?? null);
+ recordTransition(wsId, inboxRowKey(next), "next");
push(inboxRowHref(p, next));
},
- [wsId, p, push, leaveRow, rememberSidebarIssue, recordLastCleared],
+ [wsId, p, push, leaveRow, rememberSidebarIssue, recordLastCleared, recordTransition],
);
}
diff --git a/packages/views/inbox/components/use-move-on-after-auto-archive.test.tsx b/packages/views/inbox/components/use-move-on-after-auto-archive.test.tsx
index 21c8942de9..7d4b1d597b 100644
--- a/packages/views/inbox/components/use-move-on-after-auto-archive.test.tsx
+++ b/packages/views/inbox/components/use-move-on-after-auto-archive.test.tsx
@@ -13,7 +13,7 @@ import { notificationPreferenceKeys } from "@multica/core/notification-preferenc
import { issueDetailOptions } from "@multica/core/issues/queries";
import type { InboxItem, Issue } from "@multica/core/types";
import { getTestResources } from "../../test/i18n";
-import { useMoveOnAfterAutoArchive } from "./use-move-on-after-auto-archive";
+import { AUTO_ARCHIVE_ADVANCE_DELAY_MS, useMoveOnAfterAutoArchive } from "./use-move-on-after-auto-archive";
vi.mock("sonner", () => ({ toast: { success: vi.fn(), error: vi.fn() } }));
vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => "ws" }));
@@ -66,28 +66,120 @@ function setup(
return {
onNext,
settle: (row: KeptInboxRow | null) => view.rerender({ settled: row }),
- cause: () => view.result.current,
+ cause: () => view.result.current.cause,
+ autoAdvance: () => view.result.current.autoAdvance,
qc,
};
}
beforeEach(() => {
+ vi.useFakeTimers();
vi.clearAllMocks();
setApiInstance(api as unknown as ApiClient);
vi.spyOn(document, "hasFocus").mockReturnValue(true);
});
afterEach(() => {
cleanup();
+ vi.useRealTimers();
vi.restoreAllMocks();
});
describe("useMoveOnAfterAutoArchive", () => {
- it("opens the next notification when your action archived the open one", () => {
- const { onNext, settle } = setup({ after_auto_archive: "next" });
+ it("buffers then opens the next notification when your action archived the open one", () => {
+ const { onNext, settle, autoAdvance } = setup({ after_auto_archive: "next" });
noteInboxAutoArchive({ issue_id: "issue-a", reason: "actor_acted" });
settle(archived("issue-a"));
+
+ expect(onNext).not.toHaveBeenCalled();
+ expect(autoAdvance()).toMatchObject({ durationMs: AUTO_ARCHIVE_ADVANCE_DELAY_MS });
+
+ act(() => { vi.advanceTimersByTime(AUTO_ARCHIVE_ADVANCE_DELAY_MS); });
expect(onNext).toHaveBeenCalledTimes(1);
expect(toast.success).toHaveBeenCalledWith("Notification archived", expect.anything());
+ expect(autoAdvance()).toBeNull();
+ });
+
+ it("cancels the auto-advance buffer on explicit cancel, Escape, wheel, outside pointerdown, or editable focus", () => {
+ // Explicit cancel
+ {
+ const { onNext, settle, autoAdvance } = setup({ after_auto_archive: "next" });
+ noteInboxAutoArchive({ issue_id: "issue-c1", reason: "actor_acted" });
+ settle(archived("issue-c1"));
+ act(() => autoAdvance()?.cancel());
+ expect(autoAdvance()).toBeNull();
+ act(() => { vi.advanceTimersByTime(AUTO_ARCHIVE_ADVANCE_DELAY_MS * 2); });
+ expect(onNext).not.toHaveBeenCalled();
+ cleanup();
+ }
+
+ // Escape key
+ {
+ const { onNext, settle, autoAdvance } = setup({ after_auto_archive: "next" });
+ noteInboxAutoArchive({ issue_id: "issue-c2", reason: "actor_acted" });
+ settle(archived("issue-c2"));
+ act(() => {
+ window.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }));
+ });
+ expect(autoAdvance()).toBeNull();
+ act(() => { vi.advanceTimersByTime(AUTO_ARCHIVE_ADVANCE_DELAY_MS * 2); });
+ expect(onNext).not.toHaveBeenCalled();
+ cleanup();
+ }
+
+ // Wheel scroll
+ {
+ const { onNext, settle, autoAdvance } = setup({ after_auto_archive: "next" });
+ noteInboxAutoArchive({ issue_id: "issue-c3", reason: "actor_acted" });
+ settle(archived("issue-c3"));
+ act(() => {
+ window.dispatchEvent(new Event("wheel"));
+ });
+ expect(autoAdvance()).toBeNull();
+ act(() => { vi.advanceTimersByTime(AUTO_ARCHIVE_ADVANCE_DELAY_MS * 2); });
+ expect(onNext).not.toHaveBeenCalled();
+ cleanup();
+ }
+
+ // Outside pointerdown cancels; pointerdown inside [data-inbox-bar] does not
+ {
+ const { onNext, settle, autoAdvance } = setup({ after_auto_archive: "next" });
+ const bar = document.createElement("div");
+ bar.setAttribute("data-inbox-bar", "settled");
+ document.body.appendChild(bar);
+ noteInboxAutoArchive({ issue_id: "issue-c4", reason: "actor_acted" });
+ settle(archived("issue-c4"));
+
+ act(() => {
+ bar.dispatchEvent(new MouseEvent("pointerdown", { bubbles: true }));
+ });
+ expect(autoAdvance()).not.toBeNull();
+
+ act(() => {
+ document.body.dispatchEvent(new MouseEvent("pointerdown", { bubbles: true }));
+ });
+ expect(autoAdvance()).toBeNull();
+ act(() => { vi.advanceTimersByTime(AUTO_ARCHIVE_ADVANCE_DELAY_MS * 2); });
+ expect(onNext).not.toHaveBeenCalled();
+ bar.remove();
+ cleanup();
+ }
+
+ // Focusing an editable target cancels
+ {
+ const { onNext, settle, autoAdvance } = setup({ after_auto_archive: "next" });
+ const input = document.createElement("textarea");
+ document.body.appendChild(input);
+ noteInboxAutoArchive({ issue_id: "issue-c5", reason: "actor_acted" });
+ settle(archived("issue-c5"));
+
+ act(() => {
+ input.dispatchEvent(new FocusEvent("focusin", { bubbles: true }));
+ });
+ expect(autoAdvance()).toBeNull();
+ act(() => { vi.advanceTimersByTime(AUTO_ARCHIVE_ADVANCE_DELAY_MS * 2); });
+ expect(onNext).not.toHaveBeenCalled();
+ input.remove();
+ }
});
it("undoes by restoring the notification and returning its row", async () => {
@@ -95,6 +187,7 @@ describe("useMoveOnAfterAutoArchive", () => {
const { settle } = setup({ after_auto_archive: "next" });
noteInboxAutoArchive({ issue_id: "issue-b", reason: "issue_status_terminal" });
settle(archived("issue-b"));
+ act(() => { vi.advanceTimersByTime(AUTO_ARCHIVE_ADVANCE_DELAY_MS); });
const action = (vi.mocked(toast.success).mock.calls.at(-1)?.[1] as unknown as { action: { onClick: () => void } }).action;
await act(async () => action.onClick());
expect(returnRow).toHaveBeenCalledWith("ws", "issue-b");
@@ -102,15 +195,19 @@ describe("useMoveOnAfterAutoArchive", () => {
});
it("stays by default", () => {
- const { onNext, settle } = setup({});
+ const { onNext, settle, autoAdvance } = setup({});
noteInboxAutoArchive({ issue_id: "issue-c", reason: "actor_acted" });
settle(archived("issue-c"));
+ expect(autoAdvance()).toBeNull();
+ act(() => { vi.advanceTimersByTime(AUTO_ARCHIVE_ADVANCE_DELAY_MS * 2); });
expect(onNext).not.toHaveBeenCalled();
});
it("stays when something other than your action archived it", () => {
- const { onNext, settle } = setup({ after_auto_archive: "next" });
+ const { onNext, settle, autoAdvance } = setup({ after_auto_archive: "next" });
settle(archived("issue-d"));
+ expect(autoAdvance()).toBeNull();
+ act(() => { vi.advanceTimersByTime(AUTO_ARCHIVE_ADVANCE_DELAY_MS * 2); });
expect(onNext).not.toHaveBeenCalled();
});
@@ -118,15 +215,18 @@ describe("useMoveOnAfterAutoArchive", () => {
const { onNext, settle } = setup({ after_auto_archive: "next" }, null, null);
noteInboxAutoArchive({ issue_id: "issue-last", reason: "actor_acted" });
settle(archived("issue-last"));
+ act(() => { vi.advanceTimersByTime(AUTO_ARCHIVE_ADVANCE_DELAY_MS); });
expect(onNext).toHaveBeenCalledTimes(1);
expect(toast.success).toHaveBeenCalledWith("Notification archived", expect.anything());
});
it("stays when the action happened in another window", () => {
vi.mocked(document.hasFocus).mockReturnValue(false);
- const { onNext, settle } = setup({ after_auto_archive: "next" });
+ const { onNext, settle, autoAdvance } = setup({ after_auto_archive: "next" });
noteInboxAutoArchive({ issue_id: "issue-e", reason: "actor_acted" });
settle(archived("issue-e"));
+ expect(autoAdvance()).toBeNull();
+ act(() => { vi.advanceTimersByTime(AUTO_ARCHIVE_ADVANCE_DELAY_MS * 2); });
expect(onNext).not.toHaveBeenCalled();
});
diff --git a/packages/views/inbox/components/use-move-on-after-auto-archive.ts b/packages/views/inbox/components/use-move-on-after-auto-archive.ts
index 94afb87d9f..a2b9e123d1 100644
--- a/packages/views/inbox/components/use-move-on-after-auto-archive.ts
+++ b/packages/views/inbox/components/use-move-on-after-auto-archive.ts
@@ -1,6 +1,6 @@
"use client";
-import { useLayoutEffect, useRef, useState } from "react";
+import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { useWorkspaceId } from "@multica/core/hooks";
import { type InboxBarAction, takeInboxAutoArchive, takeInboxBarAction } from "@multica/core/inbox/auto-archive";
@@ -9,22 +9,39 @@ import { useInboxSelectionStore } from "@multica/core/inbox/selection-store";
import { issueDetailOptions } from "@multica/core/issues/queries";
import { notificationPreferenceOptions } from "@multica/core/notification-preferences/queries";
import { notificationPreferenceValue } from "@multica/core/notification-preferences/patch";
+import { isEditableShortcutTarget } from "@multica/core/shortcuts";
import type { InboxItem, Issue } from "@multica/core/types";
import { useT } from "../../i18n";
import { toastInboxUndo } from "./inbox-undo-toast";
import { useRestoreInbox } from "./use-leave-inbox-row";
/**
- * Opens the next notification once the open one is archived because the user
- * handled its issue (`takeInboxAutoArchive`), when their `after_auto_archive`
- * preference says "next", and confirms it with a toast that can undo it.
- * Otherwise the row stays in place, settled, as `keepOpenInboxRow` keeps it.
+ * Brief confirmation beat before auto-advancing after an issue action
+ * auto-archived the open notification (MUL-9865). Long enough to see the
+ * status/comment take effect and read the settled InboxBar cause, short enough
+ * to keep hands-free triage moving; any interaction cancels it immediately.
+ */
+export const AUTO_ARCHIVE_ADVANCE_DELAY_MS = 1_400;
+
+export interface AutoAdvanceBuffer {
+ /** Total countdown length in milliseconds, driving the 2px progress line. */
+ durationMs: number;
+ /** Cancel the countdown and stay on the settled issue. */
+ cancel: () => void;
+}
+
+/**
+ * Opens the next notification after a brief, cancellable buffer once the open
+ * one is archived because the user handled its issue (`takeInboxAutoArchive`),
+ * when their `after_auto_archive` preference says "next", and confirms it with
+ * a toast that can undo it. Otherwise the row stays in place, settled, as
+ * `keepOpenInboxRow` keeps it.
*
* Only the focused window moves on: acting in another window or tab must not
* pull this one away from what it shows.
*
- * Returns the Inbox bar action that archived the settled row, when it was
- * taken in this window, so the bar can say what the user did.
+ * Returns the Inbox bar action that archived the settled row (when taken in
+ * this window) and the active `autoAdvance` buffer while the countdown runs.
*/
export function useMoveOnAfterAutoArchive({
settled,
@@ -34,7 +51,7 @@ export function useMoveOnAfterAutoArchive({
settled: KeptInboxRow | null;
next: InboxItem | null;
onNext: () => void;
-}): InboxBarAction | null {
+}): { cause: InboxBarAction | null; autoAdvance: AutoAdvanceBuffer | null } {
const { t } = useT("inbox");
const wsId = useWorkspaceId();
const { data } = useQuery(notificationPreferenceOptions(wsId));
@@ -43,34 +60,98 @@ export function useMoveOnAfterAutoArchive({
const qc = useQueryClient();
const archivedKey = settled?.reason === "archived" ? settled.key : null;
const [cause, setCause] = useState<{ key: string; action: InboxBarAction } | null>(null);
+ const [pendingKey, setPendingKey] = useState<string | null>(null);
const latest = useRef({ settled, next, onNext, movesOn });
useLayoutEffect(() => {
latest.current = { settled, next, onNext, movesOn };
});
- // Before paint, so the settled bar never shows the plain archive first.
+ // Before paint, so the settled bar shows the real action cause and starts
+ // the 2px progress hairline on its very first frame.
useLayoutEffect(() => {
- if (!archivedKey) return;
- const { settled: row, onNext: moveOn, movesOn: moves } = latest.current;
+ if (!archivedKey) {
+ setPendingKey(null);
+ return;
+ }
+ const { settled: row, movesOn: moves } = latest.current;
const own = takeInboxAutoArchive(archivedKey);
const action = takeInboxBarAction(archivedKey);
const shown = own && action && reflects(qc.getQueryData(issueDetailOptions(wsId, archivedKey).queryKey), action);
setCause(shown ? { key: archivedKey, action } : null);
- if (!own || !moves || !row || !document.hasFocus()) return;
- moveOn();
- toastInboxUndo(t(($) => $.toasts.archived), {
- label: t(($) => $.toasts.undo),
- undo: () => {
- const store = useInboxSelectionStore.getState();
- store.returnRow(wsId, archivedKey);
- store.clearLastCleared(wsId, archivedKey);
- void restore(row.item.id, { quiet: true });
- },
- });
- }, [archivedKey, wsId, qc, restore, t]);
+ if (!own || !moves || !row || !document.hasFocus()) {
+ setPendingKey(null);
+ return;
+ }
+ setPendingKey(archivedKey);
+ }, [archivedKey, wsId, qc]);
+
+ const cancel = useCallback(() => {
+ setPendingKey(null);
+ }, []);
+
+ const activeKey = pendingKey && pendingKey === archivedKey ? archivedKey : null;
+
+ // Run the 1.4s countdown and cancel immediately on any user interaction in
+ // the page (Escape, scrolling, clicking outside the InboxBar, or focusing an
+ // editable field) so auto-advance never pulls the rug out mid-reading.
+ useEffect(() => {
+ if (!activeKey) return;
+ const timer = window.setTimeout(() => {
+ const { settled: row, onNext: moveOn } = latest.current;
+ setPendingKey(null);
+ if (!row || row.key !== activeKey || !document.hasFocus()) return;
+ moveOn();
+ toastInboxUndo(t(($) => $.toasts.archived), {
+ label: t(($) => $.toasts.undo),
+ undo: () => {
+ const store = useInboxSelectionStore.getState();
+ store.returnRow(wsId, activeKey);
+ store.clearLastCleared(wsId, activeKey);
+ void restore(row.item.id, { quiet: true });
+ },
+ });
+ }, AUTO_ARCHIVE_ADVANCE_DELAY_MS);
+
+ const onKeyDown = (event: KeyboardEvent) => {
+ if (event.key === "Escape") {
+ event.preventDefault();
+ setPendingKey(null);
+ }
+ };
+ const onWheel = () => setPendingKey(null);
+ const onPointerDown = (event: PointerEvent) => {
+ const el = event.target instanceof Element ? event.target : null;
+ if (el?.closest("[data-inbox-bar]")) return;
+ setPendingKey(null);
+ };
+ const onFocusIn = (event: FocusEvent) => {
+ if (isEditableShortcutTarget(event.target)) setPendingKey(null);
+ };
+
+ window.addEventListener("keydown", onKeyDown);
+ window.addEventListener("wheel", onWheel, { passive: true });
+ document.addEventListener("pointerdown", onPointerDown, true);
+ document.addEventListener("focusin", onFocusIn, true);
+
+ return () => {
+ window.clearTimeout(timer);
+ window.removeEventListener("keydown", onKeyDown);
+ window.removeEventListener("wheel", onWheel);
+ document.removeEventListener("pointerdown", onPointerDown, true);
+ document.removeEventListener("focusin", onFocusIn, true);
+ };
+ }, [activeKey, wsId, restore, t]);
+
+ const autoAdvance = useMemo<AutoAdvanceBuffer | null>(
+ () => (activeKey ? { durationMs: AUTO_ARCHIVE_ADVANCE_DELAY_MS, cancel } : null),
+ [activeKey, cancel],
+ );
- return cause && cause.key === archivedKey ? cause.action : null;
+ return {
+ cause: cause && cause.key === archivedKey ? cause.action : null,
+ autoAdvance,
+ };
}
/**
diff --git a/packages/views/issues/actions/__tests__/issue-inbox-actions.test.tsx b/packages/views/issues/actions/__tests__/issue-inbox-actions.test.tsx
index df35d60b4e..f1df43ac52 100644
--- a/packages/views/issues/actions/__tests__/issue-inbox-actions.test.tsx
+++ b/packages/views/issues/actions/__tests__/issue-inbox-actions.test.tsx
@@ -11,6 +11,7 @@ import { useInboxFilterStore } from "@multica/core/inbox/filter-store";
import { inboxListOptions, snoozedInboxOptions } from "@multica/core/inbox/queries";
import { useInboxSelectionStore } from "@multica/core/inbox/selection-store";
import { childIssuesOptions, issueDetailOptions, issueSubscribersOptions } from "@multica/core/issues/queries";
+import { notificationPreferenceKeys } from "@multica/core/notification-preferences/queries";
import { agentListOptions } from "@multica/core/workspace/queries";
import type { Agent, InboxItem, Issue, SnoozedInboxIssue } from "@multica/core/types";
import { renderWithI18n } from "../../../test/i18n";
@@ -567,4 +568,46 @@ describe("IssueInboxBar once an action is undone", () => {
act(() => nav.qc.setQueryData(inboxListOptions("ws").queryKey, []));
expect(await screen.findByText("Notification archived")).toBeInTheDocument();
});
+
+ it("keeps the 40px InboxBar mounted while handing off to the next notification", async () => {
+ const nav = setup();
+ fireEvent.click(screen.getByRole("button", { name: "Archive" }));
+ expect(nav.push).toHaveBeenCalledWith("/acme/issues/issue-2#comment-c-9");
+ expect(useInboxSelectionStore.getState().transitionByWorkspace.ws).toMatchObject({
+ targetKey: "issue-2",
+ direction: "next",
+ });
+
+ // Simulate the archive mutation removing the row from the Inbox cache before
+ // the next issue's route mounts: the bar keeps its 40px slot instead of collapsing.
+ act(() => nav.qc.setQueryData(inboxListOptions("ws").queryKey, [ROWS[1]!]));
+ expect(document.querySelector("[data-inbox-bar]")).not.toBeNull();
+ });
+
+ it("shows a cancellable auto-advance buffer with Stay here when after_auto_archive=next", async () => {
+ const focusSpy = vi.spyOn(document, "hasFocus").mockReturnValue(true);
+ try {
+ const nav = setup();
+ act(() => {
+ nav.qc.setQueryData(notificationPreferenceKeys.all("ws"), {
+ workspace_id: "ws",
+ preferences: { after_auto_archive: "next" },
+ });
+ });
+ noteInboxBarAction("issue-1", { type: "status", status: "done" });
+ noteInboxAutoArchive({ issue_id: "issue-1", reason: "actor_acted" });
+ act(() => nav.qc.setQueryData(inboxListOptions("ws").queryKey, [ROWS[1]!]));
+
+ expect(await screen.findByRole("button", { name: "Stay here" })).toBeInTheDocument();
+ expect(document.querySelector("[data-inbox-auto-advance-bar]")).not.toBeNull();
+ expect(nav.push).not.toHaveBeenCalled();
+
+ fireEvent.click(screen.getByRole("button", { name: "Stay here" }));
+ expect(screen.queryByRole("button", { name: "Stay here" })).toBeNull();
+ expect(document.querySelector("[data-inbox-auto-advance-bar]")).toBeNull();
+ expect(nav.push).not.toHaveBeenCalled();
+ } finally {
+ focusSpy.mockRestore();
+ }
+ });
});
diff --git a/packages/views/issues/actions/issue-inbox-actions.tsx b/packages/views/issues/actions/issue-inbox-actions.tsx
index 85f727d5e2..135a25567a 100644
--- a/packages/views/issues/actions/issue-inbox-actions.tsx
+++ b/packages/views/issues/actions/issue-inbox-actions.tsx
@@ -1,8 +1,8 @@
"use client";
-import { useMemo, type ReactNode, useState } from "react";
+import { useMemo, useRef, type ReactNode, useState } from "react";
import { useQuery } from "@tanstack/react-query";
-import { AlarmClock, ChevronDown } from "@multica/ui/icons";
+import { AlarmClock, Archive, ChevronDown } from "@multica/ui/icons";
import { Button } from "@multica/ui/components/ui/button";
import { useWorkspaceId } from "@multica/core/hooks";
import type { InboxUnsubscribeScope } from "@multica/core/inbox/mutations";
@@ -56,7 +56,7 @@ export function IssueInboxBar({ issueId, issueActions }: { issueId: string; issu
const { push } = useNavigation();
const builtinNav = useBuiltinViewNavigation();
const guest = useIsGuest(wsId);
- const { fromInbox } = useSidebarInboxIssue(wsId, issueId);
+ const { fromInbox, movingOn } = useSidebarInboxIssue(wsId, issueId);
const { rows, kept, filtered } = useFilteredInboxRows(wsId, issueId, fromInbox);
const index = fromInbox ? rows.findIndex((row) => row.issue_id === issueId) : -1;
const row = index >= 0 ? rows[index]! : null;
@@ -64,6 +64,12 @@ export function IssueInboxBar({ issueId, issueActions }: { issueId: string; issu
const settled = kept && kept.reason !== "filtered" ? kept : null;
const item = settled ? null : row;
const next = row ? nextInboxRow(rows, issueId) : null;
+ // Remember that this issue mounted an InboxBar so while the router is still
+ // handing off to the next notification (`movingOn`), the 40px bar holds its
+ // slot instead of unmounting and shifting the old issue up by 40px.
+ const hadBarForIssueRef = useRef<string | null>(null);
+ if (item || settled) hadBarForIssueRef.current = issueId;
+ else if (!movingOn && hadBarForIssueRef.current === issueId) hadBarForIssueRef.current = null;
const leave = useLeaveInboxRow();
const archiveWithUndo = useArchiveInboxWithUndo();
const restore = useRestoreInbox();
@@ -145,7 +151,7 @@ export function IssueInboxBar({ issueId, issueActions }: { issueId: string; issu
: undefined;
leave(issueId, next, cleared);
};
- const cause = useMoveOnAfterAutoArchive({ settled, next, onNext: moveOn });
+ const { cause, autoAdvance } = useMoveOnAfterAutoArchive({ settled, next, onNext: moveOn });
// Archived already, E moves on (to the next notification or Inbox Zero).
useInboxShortcut("archiveInboxItem", item ? archiveItem : settled ? moveOn : null);
@@ -168,7 +174,16 @@ export function IssueInboxBar({ issueId, issueActions }: { issueId: string; issu
/>
);
}
- if (!settled) return null;
+ if (!settled) {
+ if (fromInbox && movingOn && hadBarForIssueRef.current === issueId) {
+ return (
+ <InboxBar settled>
+ <InboxBarStatus icon={<Archive />} label={t(($) => $.kept.notification_archived)} />
+ </InboxBar>
+ );
+ }
+ return null;
+ }
const inboxCleared = !next && !filtered;
return (
<InboxKeptActions
@@ -177,6 +192,7 @@ export function IssueInboxBar({ issueId, issueActions }: { issueId: string; issu
onUndo={() => restore(settled.item.id, { quiet: true })}
next={next}
onNext={moveOn}
+ autoAdvance={autoAdvance}
inboxCleared={inboxCleared}
snoozedCount={inboxCleared ? activeSnoozedCount : 0}
onSnoozedClick={
diff --git a/packages/views/issues/components/issue-detail-route.test.tsx b/packages/views/issues/components/issue-detail-route.test.tsx
index e478b0aa61..9b384621a6 100644
--- a/packages/views/issues/components/issue-detail-route.test.tsx
+++ b/packages/views/issues/components/issue-detail-route.test.tsx
@@ -5,6 +5,10 @@ import type { ReactNode } from "react";
import { setApiInstance } from "@multica/core/api";
import { ApiError } from "@multica/core/api/client";
import type { ApiClient } from "@multica/core/api/client";
+import { inboxKeys } from "@multica/core/inbox/queries";
+import { useInboxSelectionStore } from "@multica/core/inbox/selection-store";
+import type { InboxItem } from "@multica/core/types";
+import { renderWithI18n } from "../../test/i18n";
import { NavigationProvider } from "../../navigation";
import type { NavigationAdapter } from "../../navigation";
import { IssueDetail, IssueDetailSkeleton } from "./issue-detail";
@@ -269,4 +273,47 @@ describe("IssueDetailSkeleton embedded layouts", () => {
view.unmount();
localStorage.removeItem(storageKey);
});
+
+ it("reserves the 40px InboxBar slot with cached notification metadata while resolving from Inbox", () => {
+ useInboxSelectionStore.setState({ sidebarIssueByWorkspace: { "ws-1": "issue-42" } });
+ const getIssue = vi.fn(() => new Promise<never>(() => {}));
+ setApiInstance({ getIssue, getBaseUrl: () => "" } as unknown as ApiClient);
+ const qc = new QueryClient({ defaultOptions: { queries: { retry: false, gcTime: 0 } } });
+ qc.setQueryData<InboxItem[]>(inboxKeys.list("ws-1"), [
+ {
+ id: "n-42",
+ workspace_id: "ws-1",
+ recipient_type: "member",
+ recipient_id: "member-1",
+ actor_type: "agent",
+ actor_id: "agent-1",
+ type: "new_comment",
+ severity: "info",
+ issue_id: "issue-42",
+ issue_identifier: "MUL-42",
+ title: "Keep Inbox chrome steady",
+ body: null,
+ issue_status: "in_review",
+ issue_priority: "none",
+ read: false,
+ archived: false,
+ created_at: "2026-11-23T00:00:00Z",
+ details: null,
+ },
+ ]);
+
+ const view = renderWithI18n(
+ <QueryClientProvider client={qc}>
+ {wrapper({ children: <IssueDetailRoute routeId="MUL-42" /> })}
+ </QueryClientProvider>,
+ );
+
+ expect(view.container.querySelector("[data-inbox-bar]")).not.toBeNull();
+ expect(view.getByText("MUL-42")).toBeInTheDocument();
+ expect(view.getByText("Keep Inbox chrome steady")).toHaveClass("text-display-sm", "font-semibold");
+
+ view.unmount();
+ qc.clear();
+ useInboxSelectionStore.setState({ sidebarIssueByWorkspace: {} });
+ });
});
diff --git a/packages/views/issues/components/issue-detail-route.tsx b/packages/views/issues/components/issue-detail-route.tsx
index 5aa862abf5..846512a0f8 100644
--- a/packages/views/issues/components/issue-detail-route.tsx
+++ b/packages/views/issues/components/issue-detail-route.tsx
@@ -1,10 +1,13 @@
"use client";
import { useCallback, useEffect, useRef } from "react";
+import { useQueryClient } from "@tanstack/react-query";
import { useCanonicalIssue } from "@multica/core/issues/canonical-id";
import { useWorkspaceId } from "@multica/core/hooks";
+import { inboxKeys } from "@multica/core/inbox/queries";
import { useWorkspacePaths, issueRouteRef } from "@multica/core/paths";
import { useInboxSelectionStore } from "@multica/core/inbox/selection-store";
+import type { InboxItem } from "@multica/core/types";
import { useNavigation } from "../../navigation";
import { IssueDetail, IssueDetailSkeleton, IssueNotFound, IssueLoadError } from "./issue-detail";
import { IssuePeekHost } from "./issue-peek";
@@ -88,9 +91,26 @@ function useHighlightHash(): { hash: string; commentId?: string; appRequestId?:
*/
export function IssueDetailRoute({ routeId, onDelete, deliverable }: IssueDetailRouteProps) {
const wsId = useWorkspaceId();
+ const qc = useQueryClient();
const {
canonicalId, issue, isResolving, notFound, loadFailed, isRetrying, retry, hasLoaded,
} = useCanonicalIssue(wsId, routeId);
+ const sidebarInboxIssue = useInboxSelectionStore((s) =>
+ wsId ? (s.sidebarIssueByWorkspace[wsId] ?? null) : null,
+ );
+ const cachedInboxRow = wsId
+ ? (qc.getQueryData<InboxItem[]>(inboxKeys.list(wsId)) ?? []).find(
+ (item) =>
+ !item.archived &&
+ (item.issue_id === (canonicalId ?? routeId) ||
+ (item.issue_identifier != null && item.issue_identifier.toUpperCase() === routeId.toUpperCase())),
+ ) ?? null
+ : null;
+ const fromInboxSkeleton =
+ !!sidebarInboxIssue &&
+ (sidebarInboxIssue === routeId ||
+ sidebarInboxIssue === canonicalId ||
+ (cachedInboxRow?.issue_id != null && sidebarInboxIssue === cachedInboxRow.issue_id));
const highlight = useHighlightHash();
const landing = useInboxSelectionStore((s) =>
s.landing && s.landing.issueId === canonicalId ? s.landing : null,
@@ -122,7 +142,14 @@ export function IssueDetailRoute({ routeId, onDelete, deliverable }: IssueDetail
return <IssueLoadError showBackLink={!onDelete} onRetry={retry} isRetrying={isRetrying} />;
}
- if (isResolving || (!issue && !notFound)) return <IssueDetailSkeleton />;
+ if (isResolving || (!issue && !notFound)) {
+ return (
+ <IssueDetailSkeleton
+ showInboxBar={fromInboxSkeleton}
+ inboxItem={fromInboxSkeleton ? cachedInboxRow : undefined}
+ />
+ );
+ }
// Render not-found here rather than handing the unresolved segment down.
// `IssueDetail` would mount a second observer on the query that just failed,
diff --git a/packages/views/issues/components/issue-detail.tsx b/packages/views/issues/components/issue-detail.tsx
index 3f6a72e504..d002d2b229 100644
--- a/packages/views/issues/components/issue-detail.tsx
+++ b/packages/views/issues/components/issue-detail.tsx
@@ -77,9 +77,11 @@ import { MemberProfileCard } from "../../members/member-profile-card";
import { HoverCard, HoverCardTrigger, HoverCardContent } from "@multica/ui/components/ui/hover-card";
import { ActionShortcutKeycaps } from "../../common/shortcut-keycaps";
import { UnsubscribeArchiveButton } from "../../inbox/components/unsubscribe-archive-button";
-import { InboxArchiveButton, InboxOpenBar } from "../../inbox/components/inbox-bar";
+import { InboxArchiveButton, InboxBarSkeleton, InboxOpenBar } from "../../inbox/components/inbox-bar";
import { InboxIssueActions } from "./inbox-issue-actions";
import type { InboxUnsubscribeScope } from "@multica/core/inbox/mutations";
+import { useInboxSelectionStore, type InboxTransitionDirection } from "@multica/core/inbox/selection-store";
+import { useReducedMotion } from "@multica/core/appearance";
import { PropRow } from "../../common/prop-row";
import { useIsGuest } from "@multica/core/permissions";
import { TimelineHandoff } from "../../workflows/timeline-handoff";
@@ -1307,17 +1309,47 @@ export function IssueLoadError({
// Loading skeleton
const ISSUE_DETAIL_LAYOUT_ID = "multica_issue_detail_layout";
+const ISSUE_PAGE_TITLE_CLASS = "text-display-sm font-semibold";
/**
* Exported so `IssueDetailRoute` can show the identical frame while it resolves
* an identifier URL to its issue — the two waits are indistinguishable to the
* user, and rendering the same skeleton keeps them that way.
*/
+function IssueSidebarSkeletonRows({ className }: { className?: string }) {
+ return (
+ <div className={cn("space-y-5", className)}>
+ {Array.from({ length: 4 }).map((_, i) => (
+ <div key={i} className="flex items-center gap-2">
+ <Skeleton className="h-3 w-16 shrink-0" />
+ <Skeleton className="h-5 w-24" />
+ </div>
+ ))}
+ <Skeleton className="h-px w-full" />
+ {Array.from({ length: 3 }).map((_, i) => (
+ <div key={i} className="flex items-center gap-2">
+ <Skeleton className="h-3 w-16 shrink-0" />
+ <Skeleton className="h-4 w-28" />
+ </div>
+ ))}
+ </div>
+ );
+}
+
export function IssueDetailSkeleton({
leading,
trailing,
sidebar = true,
layoutId = ISSUE_DETAIL_LAYOUT_ID,
-}: { leading?: ReactNode; trailing?: ReactNode; sidebar?: boolean; layoutId?: string } = {}) {
+ showInboxBar = false,
+ inboxItem,
+}: {
+ leading?: ReactNode;
+ trailing?: ReactNode;
+ sidebar?: boolean;
+ layoutId?: string;
+ showInboxBar?: boolean;
+ inboxItem?: InboxItem | null;
+} = {}) {
const { defaultLayout } = useDefaultLayout({ id: layoutId });
const sidebarOpen = sidebar && getAnimatedRightSidebarInitialOpen(true, defaultLayout);
@@ -1328,13 +1360,20 @@ export function IssueDetailSkeleton({
to offer while this skeleton owns the screen. */}
<DetailStateBar trailing={trailing}>
{leading ?? (
- <>
- <Skeleton className="h-4 w-16" />
- <Skeleton className="h-4 w-4" />
- <Skeleton className="h-4 w-24" />
- </>
+ inboxItem?.issue_identifier ? (
+ <span className="text-caption font-medium text-muted-foreground">
+ {inboxItem.issue_identifier}
+ </span>
+ ) : (
+ <>
+ <Skeleton className="h-4 w-16" />
+ <Skeleton className="h-4 w-4" />
+ <Skeleton className="h-4 w-24" />
+ </>
+ )
)}
</DetailStateBar>
+ {(showInboxBar || inboxItem) && <InboxBarSkeleton item={inboxItem} />}
<div className="flex flex-1 min-h-0">
{/* Same scrollbar-gutter as the loaded scroller below, so the skeleton
column doesn't shift sideways when real content mounts. */}
@@ -1343,7 +1382,13 @@ export function IssueDetailSkeleton({
comment), so the skeleton doesn't reflow sideways when real
content mounts. */}
<div className={cn(READING_COLUMN, "px-[var(--space-sm,0.75rem)] py-[var(--space-lg,1.5rem)] space-y-6 md:px-[var(--space-xl,2rem)] md:py-[var(--space-xl,2rem)]")}>
- <Skeleton className="h-8 w-3/4" />
+ {inboxItem?.title ? (
+ <div className={cn("w-full leading-snug text-foreground", ISSUE_PAGE_TITLE_CLASS)}>
+ {inboxItem.title}
+ </div>
+ ) : (
+ <Skeleton className="h-8 w-3/4" />
+ )}
<div className="space-y-2">
<Skeleton className="h-4 w-full" />
<Skeleton className="h-4 w-5/6" />
@@ -1363,20 +1408,8 @@ export function IssueDetailSkeleton({
</div>
</div>
{sidebarOpen && (
- <div className="hidden md:block w-80 border-l p-4 space-y-5">
- {Array.from({ length: 4 }).map((_, i) => (
- <div key={i} className="flex items-center gap-2">
- <Skeleton className="h-3 w-16 shrink-0" />
- <Skeleton className="h-5 w-24" />
- </div>
- ))}
- <Skeleton className="h-px w-full" />
- {Array.from({ length: 3 }).map((_, i) => (
- <div key={i} className="flex items-center gap-2">
- <Skeleton className="h-3 w-16 shrink-0" />
- <Skeleton className="h-4 w-28" />
- </div>
- ))}
+ <div className="hidden md:block w-80 border-l p-4">
+ <IssueSidebarSkeletonRows />
</div>
)}
</div>
@@ -1558,12 +1591,32 @@ export function IssueDetail({ issueId, onDelete, onArchive, onUnsubscribeArchive
() => (landingAtMount ? 0 : null),
);
const [landingSettled, setLandingSettled] = useState(false);
+ const [landingAligned, setLandingAligned] = useState(() => !landingAtMount);
const releaseLandingOverscan = useCallback(() => setLandingSettled(true), []);
// The landing frame also leaves out what is off the reading path: the
// properties sidebar, the composer and the thread rail. They mount once the
// target has painted, a frame or two after it.
const [landingChromeHeld, setLandingChromeHeld] = useState(() => landingAtMount);
const releaseLandingChrome = useCallback(() => setLandingChromeHeld(false), []);
+ const reduceMotion = useReducedMotion();
+ const fromSidebarInbox = useInboxSelectionStore(
+ (s) => !!wsId && s.sidebarIssueByWorkspace[wsId] === id,
+ );
+ const pendingInboxTransition = useInboxSelectionStore((s) =>
+ wsId ? s.transitionByWorkspace[wsId] : undefined,
+ );
+ const [inboxTransition, setInboxTransition] = useState<{
+ issueId: string;
+ direction: InboxTransitionDirection;
+ } | null>(null);
+ const activeInboxTransition: InboxTransitionDirection | null = isPeek
+ ? null
+ : inboxTransition?.issueId === id
+ ? inboxTransition.direction
+ : pendingInboxTransition?.targetKey === id
+ ? pendingInboxTransition.direction
+ : null;
+ const hideUnalignedLanding = landingAtMount && !landingAligned && landingChromeHeld;
// A landing request whose link names no comment has nothing to land on.
// The fragment is in by the next frame, so a hold still without a target
// then is let go.
@@ -1571,6 +1624,7 @@ export function IssueDetail({ issueId, onDelete, onArchive, onUnsubscribeArchive
useEffect(() => {
if (!holdingWithoutTarget) return;
const frame = requestAnimationFrame(() => {
+ setLandingAligned(true);
releaseLandingChrome();
releaseLandingOverscan();
});
@@ -2600,6 +2654,11 @@ export function IssueDetail({ issueId, onDelete, onArchive, onUnsubscribeArchive
}, [allChildrenSelected, childIssueIds, deselectIds, selectIds]);
const loading = issueLoading;
+ useEffect(() => {
+ if (loading || isPeek || !wsId) return;
+ const direction = useInboxSelectionStore.getState().consumeTransition(wsId, id);
+ if (direction) setInboxTransition({ issueId: id, direction });
+ }, [loading, isPeek, wsId, id]);
// Deep links keep the timeline virtualized. Mount the enclosing row by
// index, then center and highlight the exact comment once its anchor exists.
@@ -2677,6 +2736,7 @@ export function IssueDetail({ issueId, onDelete, onArchive, onUnsubscribeArchive
didHighlightRef.current = highlightCommentId;
writeViewState(issueHighlightMementoKey(id), highlightCommentId);
onHighlightLandedRef.current?.();
+ setLandingAligned(true);
releaseLandingChrome();
releaseLandingOverscan();
};
@@ -2693,6 +2753,7 @@ export function IssueDetail({ issueId, onDelete, onArchive, onUnsubscribeArchive
container, virtualizer: virtuosoRef.current,
index: targetIdx, commentId: landingId,
onMounted: () => {
+ setLandingAligned(true);
// After the frame that paints the target, not inside it.
requestAnimationFrame(() => window.setTimeout(releaseLandingChrome, 0));
didHighlightRef.current = highlightCommentId;
@@ -3135,7 +3196,16 @@ export function IssueDetail({ issueId, onDelete, onArchive, onUnsubscribeArchive
if (loading) {
// The host's trailing controls hold the peek's only close button, so the
// waiting and missing states carry them too.
- return <IssueDetailSkeleton leading={leadingAction} trailing={trailingActions} sidebar={!isPeek && desktopSidebarOpen} layoutId={layoutId} />;
+ return (
+ <IssueDetailSkeleton
+ leading={leadingAction}
+ trailing={trailingActions}
+ sidebar={!isPeek && desktopSidebarOpen}
+ layoutId={layoutId}
+ showInboxBar={!isPeek && (!!inboxItem || fromSidebarInbox)}
+ inboxItem={isPeek ? undefined : inboxItem}
+ />
+ );
}
if (!issue) {
@@ -3617,7 +3687,9 @@ export function IssueDetail({ issueId, onDelete, onArchive, onUnsubscribeArchive
metadata: <MetadataSection metadata={issue.metadata ?? {}} />,
};
- const sidebarContent = landingChromeHeld ? null : (
+ const sidebarContent = landingChromeHeld ? (
+ <IssueSidebarSkeletonRows className="p-2" />
+ ) : (
<IssueSidebarSections
sections={sidebarSections}
available={ISSUE_SIDEBAR_SECTIONS.filter(
@@ -3749,7 +3821,7 @@ export function IssueDetail({ issueId, onDelete, onArchive, onUnsubscribeArchive
]
: [];
- const titleSizeClass = isPeek ? "text-title-lg font-semibold" : "text-display-sm font-semibold";
+ const titleSizeClass = isPeek ? "text-title-lg font-semibold" : ISSUE_PAGE_TITLE_CLASS;
// What the header names the issue: the identifier only in a peek, where the
// title is right below it; identifier and title on the page.
@@ -3901,6 +3973,14 @@ export function IssueDetail({ issueId, onDelete, onArchive, onUnsubscribeArchive
isPeek
? "mx-auto w-full px-6 py-5"
: cn(READING_COLUMN, "px-[var(--space-sm,0.75rem)] py-[var(--space-lg,1.5rem)] max-md:pb-chat-launcher md:px-[var(--space-xl,2rem)] md:py-[var(--space-xl,2rem)]"),
+ hideUnalignedLanding && "opacity-0",
+ !hideUnalignedLanding &&
+ activeInboxTransition &&
+ (reduceMotion
+ ? "animate-inbox-enter-fade"
+ : activeInboxTransition === "next"
+ ? "animate-inbox-enter-next"
+ : "animate-inbox-enter-prev"),
)}
>
<IssueDuplicateBanner
diff --git a/packages/views/layout/panels/inbox-section.tsx b/packages/views/layout/panels/inbox-section.tsx
index aeb41ef805..253835b610 100644
--- a/packages/views/layout/panels/inbox-section.tsx
+++ b/packages/views/layout/panels/inbox-section.tsx
@@ -1,11 +1,14 @@
"use client";
import { memo, type ReactNode, type Ref, useLayoutEffect, useMemo, useRef, useState } from "react";
+import { AnimatePresence, motion, useIsPresent } from "motion/react";
import { useVirtualizer } from "@tanstack/react-virtual";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { toast } from "sonner";
+import { useReducedMotion } from "@multica/core/appearance";
import { AlarmClock, Archive, BellOff, BookCheck, CheckCheck, History, ListChecks, MoreHorizontal } from "@multica/ui/icons";
import { IconButton } from "@multica/ui/components/common/icon-button";
+import { UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import { cn } from "@multica/ui/lib/utils";
import { useIsCompact } from "@multica/ui/hooks/use-mobile";
import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
@@ -170,7 +173,7 @@ export function InboxSection({
const key = inboxRowKey(item);
if (key === openRowKey) leave(key, nextInboxRow(all, key), cleared);
};
- const prefetchRow = useInboxIssuePrefetch(wsId, collapsed ? [] : displayed, (item) => inboxRowHref(p, item));
+ const prefetchRow = useInboxIssuePrefetch(wsId, collapsed ? [] : all, (item) => inboxRowHref(p, item), openRowKey);
// What arrived on each issue while it was snoozed, for the rows back from one.
const updatesWhileSnoozed = useMemo(() => {
const counts = new Map<string, number>();
@@ -296,7 +299,9 @@ export function InboxSection({
<VirtualInboxList items={displayed} compact={compact} renderRow={renderRow} />
) : (
<PanelList data-sidebar-list={INBOX_LIST} className={compact ? undefined : "space-y-0.5"}>
- {displayed.map((item) => renderRow(item))}
+ <AnimatePresence initial={false}>
+ {displayed.map((item) => renderRow(item))}
+ </AnimatePresence>
</PanelList>
)
) : list.load === "failed" ? (
@@ -717,16 +722,10 @@ const InboxRow = memo(function InboxRow({
</ShimmerText>
);
- return (
- <li
- ref={measureRef}
- data-index={measureIndex}
- data-inbox-row
- data-read={unread ? "false" : "true"}
- className="group/inbox relative"
- onPointerEnter={onPrefetch}
- onFocus={onPrefetch}
- >
+ const isPresent = useIsPresent();
+ const reduceMotion = useReducedMotion();
+ const rowChildren = (
+ <>
<HoverCard
open={cardOpen && !snoozeOpen}
onOpenChange={(open) => {
@@ -890,7 +889,45 @@ const InboxRow = memo(function InboxRow({
</button>
</TooltipHint>
)}
- </li>
+ </>
+ );
+
+ if (measureRef) {
+ return (
+ <li
+ ref={measureRef}
+ data-index={measureIndex}
+ data-inbox-row
+ data-read={unread ? "false" : "true"}
+ className="group/inbox relative"
+ onPointerEnter={onPrefetch}
+ onFocus={onPrefetch}
+ >
+ {rowChildren}
+ </li>
+ );
+ }
+
+ return (
+ <motion.li
+ data-inbox-row={isPresent ? "" : undefined}
+ data-read={unread ? "false" : "true"}
+ aria-hidden={!isPresent || undefined}
+ initial={false}
+ exit={{
+ opacity: 0,
+ height: 0,
+ marginTop: 0,
+ marginBottom: 0,
+ overflow: "hidden",
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.fast, ease: UI_EASE_OUT },
+ }}
+ className={cn("group/inbox relative", !isPresent && "pointer-events-none")}
+ onPointerEnter={onPrefetch}
+ onFocus={onPrefetch}
+ >
+ {rowChildren}
+ </motion.li>
);
});
diff --git a/packages/views/locales/en/inbox.json b/packages/views/locales/en/inbox.json
index 0b69eaa59e..32239b8eed 100644
--- a/packages/views/locales/en/inbox.json
+++ b/packages/views/locales/en/inbox.json
@@ -153,7 +153,9 @@
"unassigned": "Unassigned",
"ran_quick_action": "Ran {{name}}",
"next": "Next",
- "next_tooltip": "Open next: {{title}}"
+ "next_tooltip": "Open next: {{title}}",
+ "opening_next": "Opening next",
+ "stay_here": "Stay here"
},
"errors": {
"archived_lookup_failed": "Failed to load the linked notification",
diff --git a/packages/views/locales/es/inbox.json b/packages/views/locales/es/inbox.json
index 8cf0bd824d..7f59be3ccc 100644
--- a/packages/views/locales/es/inbox.json
+++ b/packages/views/locales/es/inbox.json
@@ -153,7 +153,9 @@
"unassigned": "Desasignada",
"ran_quick_action": "Se ejecutó {{name}}",
"next": "Siguiente",
- "next_tooltip": "Abrir la siguiente: {{title}}"
+ "next_tooltip": "Abrir la siguiente: {{title}}",
+ "opening_next": "Abriendo la siguiente",
+ "stay_here": "Quedarme aquí"
},
"errors": {
"archived_lookup_failed": "No se ha podido cargar la notificación enlazada",
diff --git a/packages/views/locales/fr/inbox.json b/packages/views/locales/fr/inbox.json
index 4c12b1bba1..afc528e577 100644
--- a/packages/views/locales/fr/inbox.json
+++ b/packages/views/locales/fr/inbox.json
@@ -153,7 +153,9 @@
"unassigned": "Désassigné",
"ran_quick_action": "Action lancée : {{name}}",
"next": "Suivante",
- "next_tooltip": "Ouvrir la suivante : {{title}}"
+ "next_tooltip": "Ouvrir la suivante : {{title}}",
+ "opening_next": "Passage à la suivante",
+ "stay_here": "Rester ici"
},
"errors": {
"archived_lookup_failed": "Échec du chargement de la notification liée",
diff --git a/packages/views/locales/ja/inbox.json b/packages/views/locales/ja/inbox.json
index 78adf4c491..18c014ae43 100644
--- a/packages/views/locales/ja/inbox.json
+++ b/packages/views/locales/ja/inbox.json
@@ -150,7 +150,9 @@
"unassigned": "割り当て解除",
"ran_quick_action": "{{name}} を実行",
"next": "次へ",
- "next_tooltip": "次を開く:{{title}}"
+ "next_tooltip": "次を開く:{{title}}",
+ "opening_next": "次を開きます",
+ "stay_here": "ここに留まる"
},
"errors": {
"archived_lookup_failed": "リンク先の通知を読み込めませんでした",
diff --git a/packages/views/locales/ko/inbox.json b/packages/views/locales/ko/inbox.json
index 4b005a04b9..3978f41d9a 100644
--- a/packages/views/locales/ko/inbox.json
+++ b/packages/views/locales/ko/inbox.json
@@ -150,7 +150,9 @@
"unassigned": "할당 해제됨",
"ran_quick_action": "{{name}} 실행됨",
"next": "다음",
- "next_tooltip": "다음 열기: {{title}}"
+ "next_tooltip": "다음 열기: {{title}}",
+ "opening_next": "다음 항목 열기 예정",
+ "stay_here": "여기에 머무르기"
},
"errors": {
"archived_lookup_failed": "링크된 알림을 불러오지 못했습니다",
diff --git a/packages/views/locales/ru/inbox.json b/packages/views/locales/ru/inbox.json
index 68e3104729..68edfc04e8 100644
--- a/packages/views/locales/ru/inbox.json
+++ b/packages/views/locales/ru/inbox.json
@@ -159,7 +159,9 @@
"unassigned": "Исполнитель снят",
"ran_quick_action": "Запущено: {{name}}",
"next": "Следующее",
- "next_tooltip": "Открыть следующее: {{title}}"
+ "next_tooltip": "Открыть следующее: {{title}}",
+ "opening_next": "Открытие следующего",
+ "stay_here": "Остаться здесь"
},
"errors": {
"archived_lookup_failed": "Не удалось загрузить связанное уведомление",
diff --git a/packages/views/locales/zh-Hans/inbox.json b/packages/views/locales/zh-Hans/inbox.json
index ad6c5559f8..bbbc1e1793 100644
--- a/packages/views/locales/zh-Hans/inbox.json
+++ b/packages/views/locales/zh-Hans/inbox.json
@@ -150,7 +150,9 @@
"unassigned": "已取消分配",
"ran_quick_action": "已运行 {{name}}",
"next": "下一条",
- "next_tooltip": "打开下一条:{{title}}"
+ "next_tooltip": "打开下一条:{{title}}",
+ "opening_next": "即将打开下一条",
+ "stay_here": "留在这里"
},
"errors": {
"archived_lookup_failed": "无法加载链接指向的通知",
diff --git a/packages/views/locales/zh-Hant/inbox.json b/packages/views/locales/zh-Hant/inbox.json
index 94bd5bfbe0..3db7133ffa 100644
--- a/packages/views/locales/zh-Hant/inbox.json
+++ b/packages/views/locales/zh-Hant/inbox.json
@@ -150,7 +150,9 @@
"unassigned": "已取消分配",
"ran_quick_action": "已執行 {{name}}",
"next": "下一條",
- "next_tooltip": "開啟下一條:{{title}}"
+ "next_tooltip": "開啟下一條:{{title}}",
+ "opening_next": "即將開啟下一條",
+ "stay_here": "留在這裡"
},
"errors": {
"archived_lookup_failed": "無法載入連結指向的通知",