Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(issues): put the issue sidebar on floating cards (MUL-9592) (#10922)
Jiayuan Zhang24761d76a0c6
diff --git a/apps/docs/content/docs/environments.fr.mdx b/apps/docs/content/docs/environments.fr.mdxindex 82bef85680..bfd4a712c3 100644--- a/apps/docs/content/docs/environments.fr.mdx+++ b/apps/docs/content/docs/environments.fr.mdx@@ -197,7 +197,7 @@ Les environnements appartiennent à la tâche, pas à une exécution : une exécChaque environnement affiche son état, quand il a démarré ou s'est terminé, quand il expire et qui l'a démarré. **Ouvrir** ouvre son URL et **Copier l'URL** la copie. Les environnements terminés sont regroupés sous « N terminés ».-- **Démarrer** : cliquez sur **+** à côté de **Environnements**. Le menu liste les environnements déclarés par la dernière exécution sur chaque appareil, et démarre celui que vous choisissez avec le code de cette exécution. Si la tâche n'a pas encore été exécutée ou si ce code a été nettoyé, il propose plutôt de le demander à un agent : l'agent prépare le code et lance `multica env start`, ou détermine comment démarrer le projet s'il ne déclare rien.+- **Démarrer** : tant que la tâche n'a aucun environnement, la section **Environnements** est masquée ; cliquez sur **+** en haut de la barre latérale de la tâche et choisissez **Démarrer un environnement**, proposé seulement s'il y a quelque chose à démarrer ou un agent à qui le demander. Une fois un environnement listé, cliquez sur **+** à côté de **Environnements**. Le menu liste les environnements déclarés par la dernière exécution sur chaque appareil, et démarre celui que vous choisissez avec le code de cette exécution. Si la tâche n'a pas encore été exécutée ou si ce code a été nettoyé, il propose plutôt de le demander à un agent : l'agent prépare le code et lance `multica env start`, ou détermine comment démarrer le projet s'il ne déclare rien.- **Arrêter, redémarrer, voir les journaux** : ouvrez le menu **Plus d'actions** de l'environnement. **Redémarrer** relit la déclaration dans le checkout ; le checkout et son `.multica/environments.toml` doivent donc encore exister. Un serveur détecté ne propose que **Arrêter**, après confirmation.Démarrer, arrêter et redémarrer demandent d'être un membre de l'espace de travail qui a accès à la tâche et peut utiliser le runtime de cet appareil (voir [Daemon et runtimes](/daemon-runtimes)). L'appareil doit être en ligne, avec une version de Multica qui prend en charge le contrôle des environnements ; sinon, les boutons indiquent ce qui manque. Lire les journaux demande seulement l'accès à la tâche.diff --git a/apps/docs/content/docs/environments.ja.mdx b/apps/docs/content/docs/environments.ja.mdxindex 7534685a64..e2e1262144 100644--- a/apps/docs/content/docs/environments.ja.mdx+++ b/apps/docs/content/docs/environments.ja.mdx@@ -197,7 +197,7 @@ services:各環境には、状態、起動・終了の時刻、期限、起動した人が表示されます。**開く**で URL を開き、**URL をコピー**でコピーします。終了した環境は「終了済み N 件」にまとめられます。-- **起動**: **環境**の横の **+** をクリックします。各マシンで最新の実行が宣言した環境が並び、選んだものをその実行のコードで起動します。タスクがまだ実行されていないか、そのコードが削除されている場合は、代わりにエージェントへの依頼を提案します。エージェントはコードを用意して `multica env start` を実行し、宣言がなければ起動方法を自分で判断します。+- **起動**: タスクにまだ環境がないときは**環境**セクションが表示されないため、タスクのサイドバー上部の **+** をクリックして**環境を起動**を選びます。起動できる環境か依頼できるエージェントがあるときだけ表示されます。環境が一覧に出た後は、**環境**の横の **+** をクリックします。各マシンで最新の実行が宣言した環境が並び、選んだものをその実行のコードで起動します。タスクがまだ実行されていないか、そのコードが削除されている場合は、代わりにエージェントへの依頼を提案します。エージェントはコードを用意して `multica env start` を実行し、宣言がなければ起動方法を自分で判断します。- **停止・再起動・ログを表示**: 環境の**その他の操作**メニューを開きます。**再起動**はチェックアウト内の宣言を読み直すため、チェックアウトとその `.multica/environments.toml` が残っている必要があります。自動検出されたサーバーは確認のうえ**停止**だけができます。起動・停止・再起動には、タスクにアクセスでき、そのマシンのランタイムを使えるワークスペースメンバーである必要があります([デーモンとランタイム](/daemon-runtimes)を参照)。マシンがオンラインで、その Multica が環境の操作に対応したバージョンである必要もあります。足りないものがあればボタンが理由を示します。ログの表示に必要なのはタスクへのアクセスだけです。diff --git a/apps/docs/content/docs/environments.ko.mdx b/apps/docs/content/docs/environments.ko.mdxindex 9113ef168b..9837f73f5e 100644--- a/apps/docs/content/docs/environments.ko.mdx+++ b/apps/docs/content/docs/environments.ko.mdx@@ -197,7 +197,7 @@ services:각 환경에는 상태, 시작·종료 시각, 만료 시각, 시작한 사람이 표시됩니다. **열기**는 URL을 열고 **URL 복사**는 URL을 복사합니다. 종료된 환경은 "종료됨 N개" 아래에 접혀 있습니다.-- **시작**: **환경** 옆의 **+** 버튼을 클릭합니다. 각 기기에서 최근 실행이 선언한 환경이 나열되며, 고른 환경을 그 실행의 코드로 시작합니다. 태스크가 아직 실행되지 않았거나 그 코드가 정리되었다면 대신 에이전트에게 맡기도록 제안합니다. 에이전트는 코드를 준비해 `multica env start`를 실행하고, 선언이 없으면 시작 방법을 스스로 판단합니다.+- **시작**: 태스크에 아직 환경이 없으면 **환경** 영역이 보이지 않으므로, 태스크 사이드바 위쪽의 **+** 버튼을 누르고 **환경 시작**을 선택합니다. 시작할 수 있는 환경이나 맡길 수 있는 에이전트가 있을 때만 나타납니다. 환경이 목록에 나온 뒤에는 **환경** 옆의 **+** 버튼을 클릭합니다. 각 기기에서 최근 실행이 선언한 환경이 나열되며, 고른 환경을 그 실행의 코드로 시작합니다. 태스크가 아직 실행되지 않았거나 그 코드가 정리되었다면 대신 에이전트에게 맡기도록 제안합니다. 에이전트는 코드를 준비해 `multica env start`를 실행하고, 선언이 없으면 시작 방법을 스스로 판단합니다.- **중지, 재시작, 로그 보기**: 환경의 **추가 작업** 메뉴를 엽니다. **재시작**은 체크아웃의 선언을 다시 읽으므로 체크아웃과 그 안의 `.multica/environments.toml`이 남아 있어야 합니다. 자동 감지된 서버는 확인 후 **중지**만 할 수 있습니다.시작, 중지, 재시작은 태스크에 접근할 수 있고 그 기기의 런타임을 사용할 수 있는 워크스페이스 멤버만 할 수 있습니다([데몬과 런타임](/daemon-runtimes) 참고). 기기가 온라인이어야 하고, 그 기기의 Multica가 환경 조작을 지원하는 버전이어야 합니다. 조건이 맞지 않으면 버튼이 무엇이 부족한지 알려 줍니다. 로그를 보는 데는 태스크 접근 권한만 있으면 됩니다.diff --git a/apps/docs/content/docs/environments.mdx b/apps/docs/content/docs/environments.mdxindex aae76f3c99..0b83bfbe01 100644--- a/apps/docs/content/docs/environments.mdx+++ b/apps/docs/content/docs/environments.mdx@@ -197,7 +197,7 @@ Environments belong to the issue, not to a single run: a later run on the same iEach environment shows its state, when it started or ended, when it expires, and who started it. **Open** opens its URL and **Copy URL** copies it. Environments that ended are folded under "N ended".-- **Start**: click **+** next to **Environments**. The menu lists the environments the latest run on each machine declared, and starts the one you pick in that run's code. If the issue has not run yet or that code has been cleaned up, it offers to ask an agent instead: the agent gets the code ready and runs `multica env start`, or works out how to start the project if it declares nothing.+- **Start**: before the issue has an environment, the **Environments** section is hidden, so click **+** at the top of the issue sidebar and choose **Start an environment**; it is offered only when there is something to start or an agent to ask. Once an environment is listed, click **+** next to **Environments**. The menu lists the environments the latest run on each machine declared, and starts the one you pick in that run's code. If the issue has not run yet or that code has been cleaned up, it offers to ask an agent instead: the agent gets the code ready and runs `multica env start`, or works out how to start the project if it declares nothing.- **Stop, restart, view logs**: open an environment's **More actions** menu. **Restart** reads the declaration in the checkout again, so the checkout and its `.multica/environments.toml` must still exist. A detected server offers only **Stop**, after a confirmation.Starting, stopping, and restarting require a workspace member who can access the issue and use that machine's runtime (see [Daemon and runtimes](/daemon-runtimes)). The machine must be online, and its Multica must be recent enough to support environment controls; otherwise the buttons explain what is missing. Reading logs only requires access to the issue.diff --git a/apps/docs/content/docs/environments.zh-Hant.mdx b/apps/docs/content/docs/environments.zh-Hant.mdxindex e4538906f8..18f87ca863 100644--- a/apps/docs/content/docs/environments.zh-Hant.mdx+++ b/apps/docs/content/docs/environments.zh-Hant.mdx@@ -197,7 +197,7 @@ services:每個環境顯示狀態、啟動或結束的時間、到期時間和啟動者。**開啟**會開啟它的 URL,**複製位址**會複製 URL。已經結束的環境收在"N 個已結束"裡。-- **啟動**:點擊**環境**旁邊的 **+**。選單列出每台機器上最近一次執行宣告的環境,選中後用那次執行的程式碼啟動。這條任務還沒執行過、或者那份程式碼已被清理時,選單會改為讓 AI 代理來啟動:AI 代理準備好程式碼後執行 `multica env start`;專案裡沒有宣告時,它會自己判斷怎麼啟動。+- **啟動**:任務還沒有環境時,**環境**區域不顯示,請點任務側欄頂部的 **+**,選擇**啟動環境**;只有存在可啟動的環境或可委派的 AI 代理時才會出現這一項。列出環境後,點擊**環境**旁邊的 **+**。選單列出每台機器上最近一次執行宣告的環境,選中後用那次執行的程式碼啟動。這條任務還沒執行過、或者那份程式碼已被清理時,選單會改為讓 AI 代理來啟動:AI 代理準備好程式碼後執行 `multica env start`;專案裡沒有宣告時,它會自己判斷怎麼啟動。- **停止、重新啟動、查看日誌**:開啟環境的**更多操作**選單。**重新啟動**會重新讀取程式碼裡的宣告,所以那份程式碼和其中的 `.multica/environments.toml` 必須還在。自動識別的服務只有**停止**,並且需要確認。啟動、停止和重新啟動需要工作區成員能存取這條任務,並且能使用那台機器的執行時(參見[守護程序與執行時](/daemon-runtimes))。機器必須在線上,且上面的 Multica 版本支援環境操作;否則按鈕會說明缺了什麼。查看日誌只需要能存取這條任務。diff --git a/apps/docs/content/docs/environments.zh.mdx b/apps/docs/content/docs/environments.zh.mdxindex d6e653e8b9..b6f4ded5de 100644--- a/apps/docs/content/docs/environments.zh.mdx+++ b/apps/docs/content/docs/environments.zh.mdx@@ -197,7 +197,7 @@ services:每个环境显示状态、启动或结束的时间、到期时间和启动者。**打开**会打开它的 URL,**复制地址**会复制 URL。已经结束的环境收在"N 个已结束"里。-- **启动**:点击**环境**旁边的 **+**。菜单列出每台机器上最近一次运行声明的环境,选中后用那次运行的代码启动。这条任务还没运行过、或者那份代码已被清理时,菜单会改为让智能体来启动:智能体准备好代码后执行 `multica env start`;项目里没有声明时,它会自己判断怎么启动。+- **启动**:任务还没有环境时,**环境**区域不显示,请点任务侧栏顶部的 **+**,选择**启动环境**;只有存在可启动的环境或可委托的智能体时才会出现这一项。列出环境后,点击**环境**旁边的 **+**。菜单列出每台机器上最近一次运行声明的环境,选中后用那次运行的代码启动。这条任务还没运行过、或者那份代码已被清理时,菜单会改为让智能体来启动:智能体准备好代码后执行 `multica env start`;项目里没有声明时,它会自己判断怎么启动。- **停止、重启、查看日志**:打开环境的**更多操作**菜单。**重启**会重新读取代码里的声明,所以那份代码和其中的 `.multica/environments.toml` 必须还在。自动识别的服务只有**停止**,并且需要确认。启动、停止和重启需要工作区成员能访问这条任务,并且能使用那台机器的运行时(参见[守护进程与运行时](/daemon-runtimes))。机器必须在线,且上面的 Multica 版本支持环境操作;否则按钮会说明缺了什么。查看日志只需要能访问这条任务。diff --git a/apps/docs/content/docs/github-integration.fr.mdx b/apps/docs/content/docs/github-integration.fr.mdxindex 7cfb71c69e..65a17d1ae3 100644--- a/apps/docs/content/docs/github-integration.fr.mdx+++ b/apps/docs/content/docs/github-integration.fr.mdx@@ -82,7 +82,7 @@ Resolves MUL-123Une simple mention dans la description, comme `Related to MUL-123`, n'associe pas du tout la PR à cette tâche. Les messages de commit et les commentaires de PR ne déclenchent pas non plus l'association.-Vous pouvez aussi associer une PR à la main : dans le bloc **Pull requests** de la tâche, cliquez sur **+** et collez l'URL de la PR. Pour retirer une PR d'une tâche, ouvrez le menu **⋯** de sa ligne et choisissez **Retirer de la tâche** ; Multica ne la réassociera plus à partir de son titre ou de sa branche.+Vous pouvez aussi associer une PR à la main en collant son URL. Tant que la tâche n'a aucune PR, le bloc **Pull requests** est masqué : cliquez sur **+** en haut de la barre latérale de la tâche et choisissez **Lier une pull request**. Une fois une PR associée, utilisez le **+** de l'en-tête du bloc **Pull requests**. Pour retirer une PR d'une tâche, ouvrez le menu **⋯** de sa ligne et choisissez **Retirer de la tâche** ; Multica ne la réassociera plus à partir de son titre ou de sa branche.## Voir les PR d'une tâche@@ -107,7 +107,7 @@ Une PR fusionnée ne signifie pas forcément que la tâche est terminée : c'estUne tâche passe au statut choisi lorsque toutes les conditions suivantes sont réunies :1. toutes les PR associées sont `Merged` : une PR `Open` ou `Draft` fait attendre la tâche, tout comme une PR fermée sans fusion tant que vous ne l'avez pas retirée de la tâche ;-2. la tâche n'est pas `done` ou `cancelled`, n'est pas en Triage, n'a pas déjà le statut cible et n'a pas été exclue pour elle seule (**Pull requests → ⋯ → Garder le statut à la fusion des PR**).+2. la tâche n'est pas `done` ou `cancelled`, n'est pas en Triage, n'a pas déjà le statut cible et n'a pas été exclue pour elle seule (**Garder le statut à la fusion des PR** : avant la première PR, dans le menu **+** en haut de la barre latérale de la tâche ; ensuite, dans le menu **⋯** du bloc **Pull requests**). Réglez-le avant d'associer une PR déjà fusionnée, car l'associer peut changer le statut immédiatement.<PrLinkDemo />diff --git a/apps/docs/content/docs/github-integration.ja.mdx b/apps/docs/content/docs/github-integration.ja.mdxindex c29d080520..4b16695503 100644--- a/apps/docs/content/docs/github-integration.ja.mdx+++ b/apps/docs/content/docs/github-integration.ja.mdx@@ -80,7 +80,7 @@ Resolves MUL-123本文に `Related to MUL-123` のような通常の参照を書いただけでは、そのタスクへまったく紐づきません。Commit message と PR コメントも紐づけの対象外です。-手動で紐づけることもできます。タスクの **Pull requests** セクションで **+** をクリックし、PR の URL を貼り付けます。PR をタスクから外すには、その行の **⋯** メニューから **タスクから外す** を選びます。以後、Multica がタイトルやブランチから再び紐づけることはありません。+PR の URL を貼り付けて手動で紐づけることもできます。タスクにまだ PR がないときは **Pull requests** セクションが表示されないため、タスクのサイドバー上部の **+** をクリックして **PR を関連付け** を選びます。PR を紐づけた後は、**Pull requests** セクションの見出しにある **+** を使います。PR をタスクから外すには、その行の **⋯** メニューから **タスクから外す** を選びます。以後、Multica がタイトルやブランチから再び紐づけることはありません。## タスクから PR を確認する@@ -105,7 +105,7 @@ PR がマージされても、必ずしもタスクが完了するわけでは次の条件をすべて満たすと、タスクは選んだステータスに変わります。1. タスクに紐づく PR がすべて `Merged` である。`Open` や `Draft` の PR が残っているとタスクは待機を続けます。マージされずにクローズされた PR も、タスクから外すまで同様です。-2. タスクが `done` または `cancelled` ではなく、Triage 中でもなく、すでに変更先のステータスでもなく、このタスクだけ変更をオフにしていない(**Pull requests → ⋯ → PR マージ後もステータスを変えない**)。+2. タスクが `done` または `cancelled` ではなく、Triage 中でもなく、すでに変更先のステータスでもなく、このタスクだけ変更をオフにしていない(**PR マージ後もステータスを変えない**: 最初の PR を紐づける前はタスクのサイドバー上部の **+** メニュー、その後は **Pull requests** セクションの **⋯** メニューにあります)。マージ済みの PR を紐づけると、その時点でステータスが変わることがあるため、先にこの設定をしてください。<PrLinkDemo />diff --git a/apps/docs/content/docs/github-integration.ko.mdx b/apps/docs/content/docs/github-integration.ko.mdxindex f3ad081006..99e38f1df9 100644--- a/apps/docs/content/docs/github-integration.ko.mdx+++ b/apps/docs/content/docs/github-integration.ko.mdx@@ -80,7 +80,7 @@ Resolves MUL-123본문에 `Related to MUL-123`처럼 단순히 언급만 하면 해당 태스크와 전혀 연결되지 않습니다. Commit message와 PR 댓글도 연결을 트리거하지 않습니다.-직접 연결할 수도 있습니다. 태스크의 **Pull requests** 영역에서 **+** 버튼을 누르고 PR URL을 붙여넣습니다. PR을 태스크에서 빼려면 해당 행의 **⋯** 메뉴에서 **태스크에서 제거**를 선택합니다. 이후 Multica는 제목이나 브랜치를 보고 다시 연결하지 않습니다.+PR URL을 붙여넣어 직접 연결할 수도 있습니다. 태스크에 아직 PR이 없으면 **Pull requests** 영역이 보이지 않으므로, 태스크 사이드바 위쪽의 **+** 버튼을 누르고 **PR 연결**을 선택합니다. PR을 연결한 뒤에는 **Pull requests** 영역 제목 줄의 **+** 버튼을 사용합니다. PR을 태스크에서 빼려면 해당 행의 **⋯** 메뉴에서 **태스크에서 제거**를 선택합니다. 이후 Multica는 제목이나 브랜치를 보고 다시 연결하지 않습니다.## 태스크에서 PR 확인@@ -105,7 +105,7 @@ PR이 merge되었다고 해서 태스크가 반드시 끝난 것은 아닙니다다음 조건을 모두 만족하면 태스크가 선택한 상태로 바뀝니다.1. 태스크에 연결된 PR이 모두 `Merged` 상태입니다. `Open`이나 `Draft` PR이 남아 있으면 태스크는 계속 기다립니다. merge되지 않고 닫힌 PR도 태스크에서 제거할 때까지 마찬가지입니다.-2. 태스크가 `done` 또는 `cancelled`가 아니고, Triage 중이 아니며, 이미 대상 상태가 아니고, 이 태스크만 상태 변경을 끄지 않았습니다(**Pull requests → ⋯ → PR 병합 후에도 상태 유지**).+2. 태스크가 `done` 또는 `cancelled`가 아니고, Triage 중이 아니며, 이미 대상 상태가 아니고, 이 태스크만 상태 변경을 끄지 않았습니다(**PR 병합 후에도 상태 유지**: 첫 PR을 연결하기 전에는 태스크 사이드바 위쪽의 **+** 메뉴, 그 뒤에는 **Pull requests** 영역의 **⋯** 메뉴에 있습니다). 이미 병합된 PR을 연결하면 그 즉시 상태가 바뀔 수 있으므로 먼저 이 설정을 하세요.<PrLinkDemo />diff --git a/apps/docs/content/docs/github-integration.mdx b/apps/docs/content/docs/github-integration.mdxindex 270a421460..6ba54b783e 100644--- a/apps/docs/content/docs/github-integration.mdx+++ b/apps/docs/content/docs/github-integration.mdx@@ -82,7 +82,7 @@ Resolves MUL-123A bare mention in the body, such as `Related to MUL-123`, doesn't link the PR at all. Commit messages and PR comments don't trigger linking either.-You can also link a PR by hand: in the issue's **Pull requests** block, click **+** and paste the PR URL. To take a PR off an issue, open the **⋯** menu on its row and choose **Remove from issue**; Multica won't link it again from its title or branch.+You can also link a PR by hand by pasting its URL. Before an issue has any PR, the **Pull requests** block is hidden: click **+** at the top of the issue sidebar and choose **Link pull request**. Once a PR is linked, use the **+** in the **Pull requests** block's header. To take a PR off an issue, open the **⋯** menu on its row and choose **Remove from issue**; Multica won't link it again from its title or branch.## View PRs on an issue@@ -107,7 +107,7 @@ A merged PR doesn't necessarily mean the issue is finished, so the workspace decAn issue moves to the chosen status when all of the following hold:1. every linked PR is `Merged`: an `Open` or `Draft` PR keeps the issue waiting, and so does a PR closed without merging until you remove it from the issue;-2. the issue isn't `done` or `cancelled`, isn't in Triage, doesn't already have the target status, and hasn't been switched off for this issue (**Pull requests → ⋯ → Keep status when PRs merge**).+2. the issue isn't `done` or `cancelled`, isn't in Triage, doesn't already have the target status, and hasn't been switched off for this issue (**Keep status when PRs merge**: before the first PR, in the **+** menu at the top of the issue sidebar; after that, in the **⋯** menu of the **Pull requests** block). Set it before linking a PR that has already merged, since linking that PR can move the issue right away.<PrLinkDemo />diff --git a/apps/docs/content/docs/github-integration.zh-Hant.mdx b/apps/docs/content/docs/github-integration.zh-Hant.mdxindex a5abce8837..039052a2ec 100644--- a/apps/docs/content/docs/github-integration.zh-Hant.mdx+++ b/apps/docs/content/docs/github-integration.zh-Hant.mdx@@ -82,7 +82,7 @@ Resolves MUL-123正文中的普通提及,例如 `Related to MUL-123`,不會與該任務建立關聯。Commit message 和 PR 評論也不會觸發關聯。-也可以手動關聯:在任務的 **Pull requests** 區塊點 **+**,貼上 PR 連結。要把 PR 從任務上移除,開啟這一行的 **⋯** 選單,選擇 **移除關聯**;之後 Multica 不會再根據標題或分支把它關聯回來。+也可以手動關聯,貼上 PR 連結即可。任務還沒有 PR 時,**Pull requests** 區塊不顯示:點任務側欄頂部的 **+**,選擇 **關聯 PR**。關聯過 PR 後,用 **Pull requests** 區塊標題列的 **+**。要把 PR 從任務上移除,開啟這一行的 **⋯** 選單,選擇 **移除關聯**;之後 Multica 不會再根據標題或分支把它關聯回來。## 在任務中檢視 PR@@ -107,7 +107,7 @@ PR 合併不一定代表任務已完成,所以由工作區決定合併後做以下條件同時成立時,任務會改為選定的狀態:1. 所有關聯 PR 都是 `Merged`。仍為 `Open` 或 `Draft` 的 PR 會讓任務繼續等待;關閉但未合併的 PR 也一樣,直到你把它從任務上移除;-2. 任務當前不是 `done` 或 `cancelled`,不在 Triage 中,還不是目標狀態,也沒有單獨設定合併後不改狀態(**Pull requests → ⋯ → 此任務合併後不改狀態**)。+2. 任務當前不是 `done` 或 `cancelled`,不在 Triage 中,還不是目標狀態,也沒有單獨設定合併後不改狀態(**此任務合併後不改狀態**:還沒有 PR 時在任務側欄頂部的 **+** 選單裡,之後在 **Pull requests** 區塊的 **⋯** 選單裡)。要關聯一個已經合併的 PR,請先設定這一項,因為關聯時任務就可能改狀態。<PrLinkDemo />diff --git a/apps/docs/content/docs/github-integration.zh.mdx b/apps/docs/content/docs/github-integration.zh.mdxindex ebc8c0ca11..82cbfde0ba 100644--- a/apps/docs/content/docs/github-integration.zh.mdx+++ b/apps/docs/content/docs/github-integration.zh.mdx@@ -82,7 +82,7 @@ Resolves MUL-123正文中的普通提及,例如 `Related to MUL-123`,不会与该任务建立关联。Commit message 和 PR 评论也不会触发关联。-也可以手动关联:在任务的 **Pull requests** 区块点 **+**,粘贴 PR 链接。要把 PR 从任务上移除,打开这一行的 **⋯** 菜单,选择 **移除关联**;之后 Multica 不会再根据标题或分支把它关联回来。+也可以手动关联,粘贴 PR 链接即可。任务还没有 PR 时,**Pull requests** 区块不显示:点任务侧栏顶部的 **+**,选择 **关联 PR**。关联过 PR 后,用 **Pull requests** 区块标题栏的 **+**。要把 PR 从任务上移除,打开这一行的 **⋯** 菜单,选择 **移除关联**;之后 Multica 不会再根据标题或分支把它关联回来。## 在任务中查看 PR@@ -107,7 +107,7 @@ PR 合并不一定代表任务已完成,所以由工作区决定合并后做以下条件同时成立时,任务会改为选定的状态:1. 所有关联 PR 都是 `Merged`。仍为 `Open` 或 `Draft` 的 PR 会让任务继续等待;关闭但未合并的 PR 也一样,直到你把它从任务上移除;-2. 任务当前不是 `done` 或 `cancelled`,不在 Triage 中,还不是目标状态,也没有单独设置合并后不改状态(**Pull requests → ⋯ → 此任务合并后不改状态**)。+2. 任务当前不是 `done` 或 `cancelled`,不在 Triage 中,还不是目标状态,也没有单独设置合并后不改状态(**此任务合并后不改状态**:还没有 PR 时在任务侧栏顶部的 **+** 菜单里,之后在 **Pull requests** 区块的 **⋯** 菜单里)。要关联一个已经合并的 PR,请先设置这一项,因为关联时任务就可能改状态。<PrLinkDemo />diff --git a/apps/docs/content/docs/issues.mdx b/apps/docs/content/docs/issues.mdxindex 44b745fa75..b0d0a7bde6 100644--- a/apps/docs/content/docs/issues.mdx+++ b/apps/docs/content/docs/issues.mdx@@ -140,7 +140,7 @@ An issue belongs to at most one [project](/projects); the project provides shareLarger work can be split into sub-issues: the parent issue keeps the overall goal while sub-issues progress independently. Parent and child statuses do not affect each other.-Open a direct child from **Sub-issues** in the issue's right sidebar. With 10 or fewer children, their order matches the inline list. With more, it initially shows 10, putting unfinished children first and keeping stage order within each group. **Show N more** expands all children in the sidebar; **Collapse** returns to the first 10. Both keep your reading position and leave the narrow-screen sidebar open. Progress counts all children. **Customize sidebar** lets you hide or reorder this section.+Open a direct child from **Sub-issues** in the issue's right sidebar. With 10 or fewer children, their order matches the inline list. With more, it initially shows 10, putting unfinished children first and keeping stage order within each group. **Show N more** expands all children in the sidebar; **Collapse** returns to the first 10. Both keep your reading position and leave the narrow-screen sidebar open. Progress counts all children. **Customize sidebar** lets you hide this section.Creating a sub-issue from a parent prefills its project and, when set, its assignee. In manual create, **Copy parent fields** lets you choose priority, labels, dates, or individual custom properties to copy. Only the selected values replace your form values, once; later parent changes do not sync. The child keeps its own description and status. Labels, start date, and custom properties stay in the manual draft when switching to Create with agent.diff --git a/apps/docs/content/docs/issues.zh.mdx b/apps/docs/content/docs/issues.zh.mdxindex 7e034c2bc3..d917cc8680 100644--- a/apps/docs/content/docs/issues.zh.mdx+++ b/apps/docs/content/docs/issues.zh.mdx@@ -140,7 +140,7 @@ import { DeliverablesDemo } from "@/components/demos/deliverables-demo";较大的工作可以拆成子任务:父任务保留整体目标,子任务各自独立推进。父子状态互不联动。-在任务右侧栏的**子任务**区可以直接打开子任务。不超过 10 条时,顺序与正文列表一致;超过时默认显示 10 条,未完成项优先,两组内各自保持阶段顺序。点击**再显示 N 条**会在侧栏展开全部,点击**收起**恢复前 10 条,正文阅读位置不变,窄屏侧栏也不会关闭。进度始终统计全部子任务。通过**自定义侧边栏**可以隐藏或调整这个分区的顺序。+在任务右侧栏的**子任务**区可以直接打开子任务。不超过 10 条时,顺序与正文列表一致;超过时默认显示 10 条,未完成项优先,两组内各自保持阶段顺序。点击**再显示 N 条**会在侧栏展开全部,点击**收起**恢复前 10 条,正文阅读位置不变,窄屏侧栏也不会关闭。进度始终统计全部子任务。通过**自定义侧边栏**可以隐藏这个分区。从父任务创建子任务时,会预填项目;父任务已指派时,也会预填负责人。手动创建中可通过**复制父任务字段**选择优先级、标签、日期或某个自定义属性。仅覆盖选中的字段,复制一次,父任务后续修改不再同步。子任务的描述和状态独立。切换到智能体创建时,标签、开始日期和自定义属性保留在手动草稿中。diff --git a/apps/storybook/.storybook/preview.tsx b/apps/storybook/.storybook/preview.tsxindex bc35ee8ff5..a351c3e620 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: ["Comment box", ["Compare all", "*"], "Voice input", ["Composer (A + C)", "Waveform", ["Compare all", "*"], "Settings", "First use", "Edge cases", "Explored", ["All directions", "*"]]] },+ storySort: { order: ["Issue sidebar cards", ["Compare all", "Close-up 4×", "Try it"], "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/issue-sidebar-cards/issue-sidebar-cards.stories.tsx b/apps/storybook/src/issue-sidebar-cards/issue-sidebar-cards.stories.tsxnew file mode 100644index 0000000000..81438be351--- /dev/null+++ b/apps/storybook/src/issue-sidebar-cards/issue-sidebar-cards.stories.tsx@@ -0,0 +1,161 @@+import { useState, type ReactNode } from "react";+import type { Meta, StoryObj } from "@storybook/react-vite";+import { cn } from "@multica/ui/lib/utils";+import { CardStack, IssuePage, PropertiesCard } from "./parts";+import {+ BORDERS, FILLS, PRESETS, RADII, SHADOWS, describe,+ type BorderId, type FillId, type Preset, type Radius, type ShadowId, type Treatment,+} from "./treatments";++const meta = {+ title: "Issue sidebar cards",+ id: "issue-sidebar-cards",+ parameters: { layout: "fullscreen" },+} satisfies Meta;+export default meta;+type Story = StoryObj<typeof meta>;++function PresetHeading({ preset }: { preset: Preset }) {+ return (+ <div className="w-[308px]">+ <div className="flex items-center gap-2">+ <span className="text-caption font-medium text-brand">{preset.letter}</span>+ <h2 className="text-body font-semibold">{preset.name}</h2>+ {preset.recommended && <span className="rounded-xs bg-foreground px-1.5 text-micro font-medium text-background">推荐</span>}+ </div>+ <p className="mt-0.5 font-mono text-micro text-muted-foreground">{describe(preset)}</p>+ <p className="mt-1.5 min-h-[54px] text-caption text-muted-foreground">{preset.note}</p>+ </div>+ );+}++function ComparePage() {+ return (+ <div className="min-h-screen bg-page-canvas p-10">+ <header className="max-w-3xl">+ <h1 className="text-title font-semibold">右侧卡片的边框和阴影:六种写法</h1>+ <p className="mt-1.5 text-body text-muted-foreground">+ 背景就是任务页的画布(--page-canvas),卡片内容和尺寸完全一样,只换描边、阴影、底色和圆角。工具栏的 Theme 可以切到深色。+ </p>+ </header>+ <div className="mt-8 grid grid-cols-[repeat(3,308px)] gap-x-12 gap-y-10">+ {PRESETS.map((preset) => (+ <section key={preset.id}>+ <PresetHeading preset={preset} />+ <div className="mt-3"><CardStack t={preset} short /></div>+ </section>+ ))}+ </div>+ </div>+ );+}++/** The bottom-left corner at 4×: that is where the shadow falls, so a 1px edge and a 2px shadow show up as pixels. */+function Zoomed({ t }: { t: Treatment }) {+ return (+ <div className="relative h-[260px] w-[308px] overflow-hidden rounded-lg bg-page-canvas ring-1 ring-border">+ <div className="absolute bottom-0 left-0" style={{ zoom: 4 }}>+ <div className="w-[200px] p-3">+ <PropertiesCard t={t} />+ </div>+ </div>+ </div>+ );+}++function CloseUpPage() {+ return (+ <div className="min-h-screen bg-page-canvas p-10">+ <header className="max-w-3xl">+ <h1 className="text-title font-semibold">放大 4 倍看卡片左下角</h1>+ <p className="mt-1.5 text-body text-muted-foreground">+ 阴影都往下落,所以看左下角。看三件事:描边和画布的对比够不够、阴影有多重、圆角配不配。每格都是真实渲染再放大,不是截图。+ </p>+ </header>+ <div className="mt-8 grid grid-cols-[repeat(3,308px)] gap-x-12 gap-y-10">+ {PRESETS.map((preset) => (+ <section key={preset.id}>+ <PresetHeading preset={preset} />+ <div className="mt-3"><Zoomed t={preset} /></div>+ </section>+ ))}+ </div>+ </div>+ );+}++function Segmented<T extends string | number>({+ label, value, options, onChange,+}: {+ label: string;+ value: T;+ options: { value: T; label: ReactNode }[];+ onChange: (value: T) => void;+}) {+ return (+ <div className="flex items-center gap-2">+ <span className="text-caption text-muted-foreground">{label}</span>+ <div className="flex rounded-lg bg-muted p-0.5">+ {options.map((option) => (+ <button+ key={String(option.value)}+ type="button"+ aria-pressed={option.value === value}+ onClick={() => onChange(option.value)}+ className={cn(+ "h-6 rounded-md px-2 text-caption text-muted-foreground transition-colors",+ option.value === value && "bg-surface font-medium text-foreground shadow-[var(--surface-shadow)] ring-1 ring-border",+ )}+ >+ {option.label}+ </button>+ ))}+ </div>+ </div>+ );+}++function TryItPage() {+ const [t, setT] = useState<Treatment>(PRESETS.find((p) => p.recommended)!);+ const set = <K extends keyof Treatment>(key: K) => (value: Treatment[K]) => setT((prev) => ({ ...prev, [key]: value }));+ const match = PRESETS.find((p) => p.border === t.border && p.shadow === t.shadow && p.fill === t.fill && p.radius === t.radius);+ return (+ <div className="flex h-screen flex-col bg-app-shell">+ <div className="flex flex-wrap items-center gap-x-5 gap-y-2 border-b bg-page-canvas px-4 py-2.5">+ <div className="flex items-center gap-1">+ {PRESETS.map((p) => (+ <button+ key={p.id}+ type="button"+ title={p.name}+ aria-pressed={match?.id === p.id}+ onClick={() => setT(p)}+ className={cn(+ "size-7 rounded-md text-caption font-medium text-muted-foreground transition-colors hover:bg-accent",+ match?.id === p.id && "bg-foreground text-background hover:bg-foreground",+ )}+ >+ {p.letter}+ </button>+ ))}+ </div>+ <Segmented<BorderId> label="描边" value={t.border} onChange={set("border")}+ options={(Object.keys(BORDERS) as BorderId[]).map((id) => ({ value: id, label: BORDERS[id].label }))} />+ <Segmented<ShadowId> label="阴影" value={t.shadow} onChange={set("shadow")}+ options={(Object.keys(SHADOWS) as ShadowId[]).map((id) => ({ value: id, label: SHADOWS[id].label }))} />+ <Segmented<FillId> label="底色" value={t.fill} onChange={set("fill")}+ options={(Object.keys(FILLS) as FillId[]).map((id) => ({ value: id, label: FILLS[id].label }))} />+ <Segmented<Radius> label="圆角" value={t.radius} onChange={set("radius")}+ options={RADII.map((r) => ({ value: r, label: `${r}` }))} />+ <span className="ml-auto text-caption text-muted-foreground">{match ? `${match.letter} · ${match.name}` : "自定义"}</span>+ </div>+ <div className="min-h-0 flex-1 p-2">+ <IssuePage t={t} />+ </div>+ </div>+ );+}++export const Compare: Story = { name: "Compare all", render: () => <ComparePage /> };+export const CloseUp: Story = { name: "Close-up 4×", render: () => <CloseUpPage /> };+export const TryIt: Story = { name: "Try it", render: () => <TryItPage /> };diff --git a/apps/storybook/src/issue-sidebar-cards/parts.tsx b/apps/storybook/src/issue-sidebar-cards/parts.tsxnew file mode 100644index 0000000000..e94c731499--- /dev/null+++ b/apps/storybook/src/issue-sidebar-cards/parts.tsx@@ -0,0 +1,242 @@+import type { ReactNode } from "react";+import {+ ArrowUpRight, Bell, Box, Calendar, CheckCircle2, ChevronDown, ChevronRight,+ FileText, GitPullRequest, MoreHorizontal, PanelRight, Plus, Tag,+} from "@multica/ui/icons";+import { ActorAvatar } from "@multica/ui/components/common/actor-avatar";+import { Button } from "@multica/ui/components/ui/button";+import { cn } from "@multica/ui/lib/utils";+import { cardStyle, type Treatment } from "./treatments";++type Status = "todo" | "in_progress" | "in_review" | "done";++/** Same drawing as packages/views/issues/components/status-icon.tsx. */+export function StatusIcon({ status, className }: { status: Status; className?: string }) {+ const color = status === "done" ? "text-info" : status === "todo" ? "text-muted-foreground" : "text-warning";+ return (+ <svg viewBox="0 0 14 14" className={cn("size-3.5 shrink-0", color, className)} aria-hidden="true">+ <circle cx="7" cy="7" r="6" fill="none" stroke="currentColor" strokeWidth="1.5" />+ {status === "in_progress" && <path d="M7,7 L7,3.5 A3.5,3.5 0 0,1 7,10.5 Z" fill="currentColor" />}+ {status === "in_review" && <path d="M7,7 L7,3.5 A3.5,3.5 0 1,1 3.5,7 Z" fill="currentColor" />}+ {status === "done" && (+ <>+ <circle cx="7" cy="7" r="6" fill="currentColor" />+ <path d="M10.95 4.25a.85.85 0 0 1 0 1.2l-5 5a.85.85 0 0 1-1.2 0l-2-2a.85.85 0 0 1 1.2-1.2l1.4 1.4 4.4-4.4a.85.85 0 0 1 1.2 0Z" fill="var(--surface)" />+ </>+ )}+ </svg>+ );+}++function PriorityHigh() {+ return (+ <svg viewBox="0 0 16 16" className="size-3.5 shrink-0 text-priority-high" aria-hidden="true">+ {[0, 1, 2, 3].map((i) => (+ <rect key={i} x={1.5 + i * 3.5} y={12 - (i + 1) * 2.6} width="2.4" height={(i + 1) * 2.6} rx="0.8" fill="currentColor" opacity={i > 2 ? 0.25 : 1} />+ ))}+ </svg>+ );+}++const Lambda = () => <ActorAvatar name="Lambda" initials="L" isAgent size="xs" className="bg-brand text-brand-foreground" />;++function LabelChip({ children, dot }: { children: ReactNode; dot: string }) {+ return (+ <span className="inline-flex h-6 items-center gap-1.5 rounded-full border px-2.5 text-label">+ <span className="size-1.5 rounded-full" style={{ background: dot }} />+ {children}+ </span>+ );+}++export function Card({ t, children, className }: { t: Treatment; children: ReactNode; className?: string }) {+ return (+ <section className={cn("pb-1.5", className)} style={cardStyle(t)}>+ {children}+ </section>+ );+}++function CardTitle({ children, right }: { children: ReactNode; right?: ReactNode }) {+ return (+ <div className="flex h-10 items-center gap-1 px-4 pt-1 text-label font-medium text-muted-foreground">+ {children}+ <ChevronDown aria-hidden="true" className="size-3 text-faint-foreground" />+ {right && <span className="ml-auto flex items-center gap-1.5 text-caption font-normal">{right}</span>}+ </div>+ );+}++function Rows({ children }: { children: ReactNode }) {+ return <div className="px-2">{children}</div>;+}++function Row({ children, className }: { children: ReactNode; className?: string }) {+ return (+ <div className={cn("flex min-h-[34px] min-w-0 items-center gap-2 rounded-md px-2 text-label transition-colors hover:bg-accent/60", className)}>+ {children}+ </div>+ );+}++export function TopCard({ t }: { t: Treatment }) {+ return (+ <Card t={t} className="pt-1.5 pb-3.5">+ <Rows>+ <Row><StatusIcon status="in_review" /><span className="font-medium">审核中</span></Row>+ <Row><Lambda />Lambda</Row>+ </Rows>+ <div className="px-4 pt-2.5">+ <div className="flex items-center gap-2 text-label font-semibold">+ <GitPullRequest className="size-3.5 text-brand" />等你审阅 PR #4182+ </div>+ <div className="pl-[22px] text-caption text-muted-foreground">12/12 检查通过 · 可合入 · 8 分钟前</div>+ <div className="mt-2.5 flex gap-1.5 pl-[22px]">+ <Button size="sm">审阅 PR</Button>+ <Button size="sm" variant="outline">合入并关闭</Button>+ </div>+ </div>+ </Card>+ );+}++export function PropertiesCard({ t }: { t: Treatment }) {+ return (+ <Card t={t}>+ <CardTitle>属性</CardTitle>+ <Rows>+ <Row><Box className="size-3.5 text-muted-foreground" />Web 客户端</Row>+ <Row><PriorityHigh />高优先级</Row>+ <Row><Calendar className="size-3.5 text-muted-foreground" />11月21日截止</Row>+ <Row><Tag className="size-3.5 text-muted-foreground" /><LabelChip dot="var(--destructive)">Bug</LabelChip><LabelChip dot="var(--info)">收件箱</LabelChip></Row>+ <Row className="text-muted-foreground"><Plus className="size-3.5" />添加字段</Row>+ </Rows>+ </Card>+ );+}++export function OutputCard({ t }: { t: Treatment }) {+ return (+ <Card t={t}>+ <CardTitle right={<Plus className="size-3.5" />}>产出 <span className="font-normal tabular-nums">4</span></CardTitle>+ <Rows>+ <Row className="items-start py-2">+ <GitPullRequest className="mt-0.5 size-3.5 text-success" />+ <div className="min-w-0 flex-1">+ <div className="flex min-w-0 gap-1.5"><span className="text-muted-foreground">#4182</span><span className="truncate">fix(inbox): 切换工作区时重置未读计数</span></div>+ <div className="flex items-center gap-1.5 text-caption text-muted-foreground">+ <CheckCircle2 className="size-3 text-success" />12/12 检查通过 · <span className="text-success">可合入</span>+ </div>+ </div>+ </Row>+ <Row><FileText className="size-3.5 text-muted-foreground" /><span className="flex-1 truncate">inbox-before-after.png</span><span className="rounded-xs bg-muted px-1 text-micro text-muted-foreground">v2</span></Row>+ <Row><span className="mx-1 size-1.5 rounded-full bg-success" />web-preview<span className="flex-1 truncate text-caption text-muted-foreground">运行中 · 2 小时后过期</span><ArrowUpRight className="size-3.5 text-muted-foreground" /></Row>+ </Rows>+ </Card>+ );+}++export function RelationsCard({ t }: { t: Treatment }) {+ const subs: [Status, string, string][] = [+ ["done", "MUL-9418", "补充切换工作区的 e2e 用例"],+ ["done", "MUL-9419", "未读计数改为按工作区缓存"],+ ["in_progress", "MUL-9420", "桌面端多窗口之间同步未读计数"],+ ];+ return (+ <Card t={t}>+ <CardTitle right={<span className="tabular-nums">子任务 2/3</span>}>关联</CardTitle>+ <Rows>+ <Row><span className="text-caption text-muted-foreground">属于</span><StatusIcon status="in_progress" /><span className="text-muted-foreground">MUL-9380</span><span className="truncate">收件箱体验修复</span></Row>+ {subs.map(([s, id, title]) => (+ <Row key={id}><StatusIcon status={s} /><span className="shrink-0 text-muted-foreground">{id}</span><span className="truncate">{title}</span></Row>+ ))}+ </Rows>+ </Card>+ );+}++export function ExecutionCard({ t }: { t: Treatment }) {+ return (+ <Card t={t}>+ <CardTitle right={<span className="tabular-nums">4 次 · 38 分钟 · $1.84</span>}>执行</CardTitle>+ <Rows>+ <Row className="text-caption"><Lambda /><span className="flex-1 truncate text-muted-foreground">第 4 次运行完成 · 评论触发</span><span className="text-micro text-muted-foreground">8 分钟前</span></Row>+ </Rows>+ </Card>+ );+}++export function AutomationCard({ t }: { t: Treatment }) {+ return (+ <Card t={t} className="pb-0">+ <div className="flex h-10 items-center gap-1 px-4 text-label font-medium text-muted-foreground">+ 自动化<ChevronRight aria-hidden="true" className="size-3 text-faint-foreground" />+ <span className="ml-auto text-caption font-normal">1 个唤醒 · 2 个快捷操作 · GitHub</span>+ </div>+ </Card>+ );+}++/** The full stack as it sits on the page canvas: no column, no divider. */+export function CardStack({ t, short = false }: { t: Treatment; short?: boolean }) {+ return (+ <div className="flex flex-col gap-2">+ <TopCard t={t} />+ <PropertiesCard t={t} />+ {!short && (+ <>+ <OutputCard t={t} />+ <RelationsCard t={t} />+ <ExecutionCard t={t} />+ <AutomationCard t={t} />+ <div className="px-4 pt-1 text-caption text-muted-foreground">Jiayuan 创建于 11月17日 · 元数据 3 项</div>+ </>+ )}+ </div>+ );+}++function Comment({ who, when, children }: { who: "Jiayuan" | "Lambda"; when: string; children: ReactNode }) {+ return (+ <div className="mt-3 rounded-xl border bg-card px-3 py-2.5">+ <div className="flex items-center gap-2 text-label">+ {who === "Lambda" ? <Lambda /> : <ActorAvatar name="Jiayuan" initials="J" size="xs" className="bg-priority-high text-brand-foreground" />}+ <span className="font-medium">{who}</span><span className="text-muted-foreground">{when}</span>+ </div>+ <div className="mt-1.5 text-body">{children}</div>+ </div>+ );+}++/** Issue page with the header spanning both columns and the cards floating on the canvas. */+export function IssuePage({ t }: { t: Treatment }) {+ return (+ <div className="flex h-full min-h-0 flex-col overflow-hidden rounded-page bg-page-canvas shadow-[var(--surface-shadow)] ring-1 ring-page-border">+ <header className="flex h-12 shrink-0 items-center gap-2 border-b px-5 text-body">+ <span className="flex items-center gap-1.5 text-muted-foreground"><Box className="size-3.5" />Web 客户端</span>+ <ChevronRight className="size-3 text-faint-foreground" />+ <span className="truncate font-medium">MUL-9417 收件箱未读计数在切换工作区后不刷新</span>+ <span className="ml-auto flex items-center gap-1 text-muted-foreground">+ <span className="flex size-7 items-center justify-center"><Bell className="size-4" /></span>+ <span className="flex size-7 items-center justify-center"><MoreHorizontal className="size-4" /></span>+ <span className="flex size-7 items-center justify-center rounded-md bg-muted text-foreground"><PanelRight className="size-4" /></span>+ </span>+ </header>+ <div className="flex min-h-0 flex-1">+ <main className="min-w-0 flex-1 overflow-y-auto">+ <div className="mx-auto max-w-[720px] px-8 py-8">+ <div className="text-caption text-muted-foreground">MUL-9417</div>+ <h1 className="mt-1 text-display-sm font-semibold">收件箱未读计数在切换工作区后不刷新</h1>+ <p className="mt-3 text-body-lg">在工作区 A 有 3 条未读,切到工作区 B 后,收件箱角标仍然显示 3,直到刷新页面才正确。</p>+ <div className="mt-7 border-b pb-2 text-label font-medium">活动</div>+ <Comment who="Jiayuan" when="11月17日"><span className="text-brand">@Lambda</span> 看一下,顺便把桌面端多窗口的同步也拆成子任务。</Comment>+ <Comment who="Lambda" when="8 分钟前">已修复:切换工作区时按工作区 ID 重置未读计数缓存,补了 e2e 用例。</Comment>+ </div>+ </main>+ <aside className="w-[316px] shrink-0 overflow-y-auto pt-3 pr-2 pb-4">+ <CardStack t={t} />+ </aside>+ </div>+ </div>+ );+}diff --git a/apps/storybook/src/issue-sidebar-cards/treatments.ts b/apps/storybook/src/issue-sidebar-cards/treatments.tsnew file mode 100644index 0000000000..66b4e9d1c9--- /dev/null+++ b/apps/storybook/src/issue-sidebar-cards/treatments.ts@@ -0,0 +1,108 @@+/** Edge and elevation choices for the issue sidebar cards (MUL-9592). */++export const BORDERS = {+ none: { label: "无描边", css: null },+ border: { label: "--border", css: "var(--border)" },+ surface: { label: "--surface-border", css: "var(--surface-border)" },+} as const;++export const SHADOWS = {+ none: { label: "无阴影", css: null },+ surface: { label: "--surface-shadow", css: "var(--surface-shadow)" },+ soft: {+ label: "柔和投影",+ css: "0 1px 3px color-mix(in oklab, var(--foreground) 7%, transparent), 0 6px 16px -6px color-mix(in oklab, var(--foreground) 8%, transparent)",+ },+ menu: { label: "--menu-shadow", css: "var(--menu-shadow)" },+} as const;++export const FILLS = {+ surface: { label: "--surface", css: "var(--surface)" },+ muted: { label: "--muted", css: "var(--muted)" },+} as const;++export const RADII = [6, 8, 10, 12] as const;++export type BorderId = keyof typeof BORDERS;+export type ShadowId = keyof typeof SHADOWS;+export type FillId = keyof typeof FILLS;+export type Radius = (typeof RADII)[number];++export interface Treatment {+ border: BorderId;+ shadow: ShadowId;+ fill: FillId;+ radius: Radius;+}++export interface Preset extends Treatment {+ id: string;+ letter: string;+ name: string;+ note: string;+ recommended?: boolean;+}++export const PRESETS: Preset[] = [+ {+ id: "hairline",+ letter: "A",+ name: "细描边,无阴影",+ note: "只有 1px --border。最平,卡片像印在画布上,浅色模式下和画布几乎分不开。",+ border: "border", shadow: "none", fill: "surface", radius: 8,+ },+ {+ id: "linear",+ letter: "B",+ name: "细描边 + 贴地阴影",+ note: "1px --border 加 --surface-shadow(1–2px 的淡投影)。和 Linear 截图量出来的一致:边框 #EFEFEF 左右,阴影只在下沿。",+ border: "border", shadow: "surface", fill: "surface", radius: 8, recommended: true,+ },+ {+ id: "shadow-only",+ letter: "C",+ name: "只有阴影",+ note: "不画描边,靠柔和投影分出卡片。浅色好看,深色模式下投影几乎看不见,卡片边缘会糊。",+ border: "none", shadow: "soft", fill: "surface", radius: 10,+ },+ {+ id: "raised",+ letter: "D",+ name: "浮起",+ note: "描边加菜单阴影(--menu-shadow)。卡片像弹出层,比正文的评论卡片更抢眼。",+ border: "border", shadow: "menu", fill: "surface", radius: 10,+ },+ {+ id: "first-draft",+ letter: "E",+ name: "深描边(第一版 mock)",+ note: "--surface-border 比评论卡片的边框深一档,再加 12px 圆角,卡片显得重。",+ border: "surface", shadow: "surface", fill: "surface", radius: 12,+ },+ {+ id: "tinted",+ letter: "F",+ name: "灰底,无描边",+ note: "不画边也不加阴影,卡片用 --muted 底色和画布区分。像分组列表,不像浮在画布上。",+ border: "none", shadow: "none", fill: "muted", radius: 8,+ },+];++export function cardStyle(t: Treatment) {+ const border = BORDERS[t.border].css;+ return {+ background: FILLS[t.fill].css,+ border: `1px solid ${border ?? "transparent"}`,+ boxShadow: SHADOWS[t.shadow].css ?? "none",+ borderRadius: t.radius,+ };+}++export function describe(t: Treatment): string {+ return [+ BORDERS[t.border].css ? `1px ${BORDERS[t.border].label}` : BORDERS[t.border].label,+ SHADOWS[t.shadow].label,+ t.fill === "surface" ? null : `底色 ${FILLS[t.fill].label}`,+ `圆角 ${t.radius}px`,+ ].filter(Boolean).join(" · ");+}diff --git a/docs/theming.md b/docs/theming.mdindex 3685a929fd..8217ea8dad 100644--- a/docs/theming.md+++ b/docs/theming.md@@ -682,6 +682,7 @@ and dark differ, both defaults are given.| --- | --- | --- || `--radius` | `0.5rem` | Base corner radius. Every `rounded-*` step and component radius below derives from it. || `--surface-shadow` | `0 1px 2px rgb(15 23 42 / 0.04), 0 1px 1px rgb(15 23 42 / 0.03)` / `0 1px 2px rgb(0 0 0 / 0.2), 0 1px 1px rgb(0 0 0 / 0.16)` | Resting shadow of cards and the page. |+| `--surface-card-shadow` | `0 0 0 1px rgb(0 0 0 / 0.03), 0 1px 2px rgb(0 0 0 / 0.05), 0 3px 6px -1px rgb(0 0 0 / 0.06)` / `0 0 0 1px rgb(255 255 255 / 0.07), 0 1px 2px rgb(0 0 0 / 0.3), 0 3px 6px -1px rgb(0 0 0 / 0.3)` | Outline and shadow of borderless cards on the page canvas, like the issue sidebar's. || `--floating-shadow` | `0 16px 40px rgb(15 23 42 / 0.14), 0 3px 10px rgb(15 23 42 / 0.08)` / `0 20px 48px rgb(0 0 0 / 0.46), 0 4px 12px rgb(0 0 0 / 0.28)` | Dialogs and sheets. || `--menu-shadow` | `0 8px 24px rgb(15 23 42 / 0.08), 0 2px 6px rgb(15 23 42 / 0.05)` / `0 10px 28px rgb(0 0 0 / 0.3), 0 2px 8px rgb(0 0 0 / 0.18)` | Menus, selects and popovers. || `--tooltip` | `oklch(0.21 0.006 285.885)` / `oklch(0.3 0.006 286.033)` | Tooltip fill (dark in both modes). |diff --git a/packages/core/appearance/theme-variables.ts b/packages/core/appearance/theme-variables.tsindex 1bb9cac4fa..ecb7d921af 100644--- a/packages/core/appearance/theme-variables.ts+++ b/packages/core/appearance/theme-variables.ts@@ -174,6 +174,7 @@ const STATUS: Entry[] = [const SHAPE: Entry[] = [["radius", "Base corner radius. Every `rounded-*` step and component radius below derives from it."],["surface-shadow", "Resting shadow of cards and the page."],+ ["surface-card-shadow", "Outline and shadow of borderless cards on the page canvas, like the issue sidebar's."],["floating-shadow", "Dialogs and sheets."],["menu-shadow", "Menus, selects and popovers."],["tooltip", "Tooltip fill (dark in both modes)."],diff --git a/packages/core/issues/stores/index.ts b/packages/core/issues/stores/index.tsindex 4135d07b46..353e69f813 100644--- a/packages/core/issues/stores/index.ts+++ b/packages/core/issues/stores/index.ts@@ -24,10 +24,9 @@ export {export { useCommentCollapseStore } from "./comment-collapse-store";export {useIssueSidebarSectionsStore,- selectIssueSidebarOrder,selectIssueSidebarCustomized,- resolveIssueSidebarOrder,resolveIssueSidebarHidden,+ ISSUE_SIDEBAR_GROUPS,ISSUE_SIDEBAR_SECTIONS,ISSUE_SIDEBAR_ALWAYS_SHOWN,type IssueSidebarSection,diff --git a/packages/core/issues/stores/issue-sidebar-sections-persistence.test.ts b/packages/core/issues/stores/issue-sidebar-sections-persistence.test.tsindex b2ef00e896..f4595fbf3f 100644--- a/packages/core/issues/stores/issue-sidebar-sections-persistence.test.ts+++ b/packages/core/issues/stores/issue-sidebar-sections-persistence.test.ts@@ -1,16 +1,12 @@// @vitest-environment jsdomimport { beforeEach, describe, expect, it } from "vitest";-import {- ISSUE_SIDEBAR_SECTIONS,- selectIssueSidebarOrder,- useIssueSidebarSectionsStore,-} from "@multica/core/issues/stores";+import { useIssueSidebarSectionsStore } from "@multica/core/issues/stores";const STORAGE_KEY = "multica_issue_sidebar_sections";-// The order persisted before the Sub-issues section was introduced.+// A save from before the sidebar became cards, when sections could be reordered.const OLD_ORDER = [- "properties", "quick_actions", "wakeups", "plugins", "parent", "duplicates",- "pull_requests", "environments", "deliverables", "apps", "execution_log", "details", "metadata",+ "execution_log", "properties", "quick_actions", "wakeups", "plugins", "parent", "sub_issues", "duplicates",+ "pull_requests", "environments", "deliverables", "apps", "details", "metadata",];async function reloadPreferences() {@@ -20,54 +16,31 @@ async function reloadPreferences() {await useIssueSidebarSectionsStore.persist.rehydrate();}-describe("Sub-issues sidebar persisted preferences", () => {+describe("issue sidebar persisted preferences", () => {beforeEach(() => {localStorage.clear();useIssueSidebarSectionsStore.getState().reset();});- it.each([- { name: "default", order: OLD_ORDER },- { name: "customized", order: [...OLD_ORDER].reverse() },- ])("hydrates an older $name order without changing existing relative order", async ({ order: savedOrder }) => {+ it("keeps the sections an older save hid and drops its order", async () => {localStorage.setItem(STORAGE_KEY, JSON.stringify({- state: { order: [...savedOrder, "unknown", "parent"], hidden: ["parent", "apps", "properties", "apps", "unknown"] },+ state: { order: OLD_ORDER, hidden: ["parent", "apps", "properties", "apps", "unknown"] },version: 0,}));await useIssueSidebarSectionsStore.persist.rehydrate();- const state = useIssueSidebarSectionsStore.getState();- const order = [...selectIssueSidebarOrder(state)];- expect(order.filter((id) => id !== "sub_issues")).toEqual(savedOrder);- expect(order.indexOf("sub_issues")).toBe(order.indexOf("parent") + 1);- expect(order.filter((id) => id === "sub_issues")).toHaveLength(1);- expect(state.hidden).toEqual(["parent", "apps"]);- await reloadPreferences();- expect(selectIssueSidebarOrder(useIssueSidebarSectionsStore.getState())).toEqual(order);expect(useIssueSidebarSectionsStore.getState().hidden).toEqual(["parent", "apps"]);++ useIssueSidebarSectionsStore.getState().setHidden("metadata", true);+ expect(JSON.parse(localStorage.getItem(STORAGE_KEY)!).state).toEqual({ hidden: ["parent", "apps", "metadata"] });});- it("persists hiding and reordering Sub-issues, then restores defaults", async () => {+ it("persists hiding a section, then restores defaults", async () => {const store = useIssueSidebarSectionsStore;store.getState().setHidden("sub_issues", true);- store.getState().setOrder(["sub_issues", ...ISSUE_SIDEBAR_SECTIONS]);await reloadPreferences();- expect(selectIssueSidebarOrder(store.getState())[0]).toBe("sub_issues");expect(store.getState().hidden).toEqual(["sub_issues"]);- store.getState().setHidden("sub_issues", false);- await reloadPreferences();- expect(store.getState().hidden).toEqual([]);- expect(selectIssueSidebarOrder(store.getState())[0]).toBe("sub_issues");store.getState().reset();await reloadPreferences();- expect(store.getState().order).toBeNull();expect(store.getState().hidden).toEqual([]);- expect(selectIssueSidebarOrder(store.getState())).toEqual(ISSUE_SIDEBAR_SECTIONS);- });-- it("shows a newly added section for an uncustomized older save", async () => {- localStorage.setItem(STORAGE_KEY, JSON.stringify({ state: { order: null, hidden: ["metadata"] }, version: 0 }));- await useIssueSidebarSectionsStore.persist.rehydrate();- expect(selectIssueSidebarOrder(useIssueSidebarSectionsStore.getState())).toContain("sub_issues");- expect(useIssueSidebarSectionsStore.getState().hidden).toEqual(["metadata"]);});});diff --git a/packages/core/issues/stores/issue-sidebar-sections-store.test.ts b/packages/core/issues/stores/issue-sidebar-sections-store.test.tsindex cd71666526..40fa85cbd2 100644--- a/packages/core/issues/stores/issue-sidebar-sections-store.test.ts+++ b/packages/core/issues/stores/issue-sidebar-sections-store.test.ts@@ -1,29 +1,16 @@import { beforeEach, describe, expect, it } from "vitest";import {+ ISSUE_SIDEBAR_GROUPS,ISSUE_SIDEBAR_SECTIONS,resolveIssueSidebarHidden,- resolveIssueSidebarOrder,selectIssueSidebarCustomized,- selectIssueSidebarOrder,useIssueSidebarSectionsStore,} from "./issue-sidebar-sections-store";-describe("resolveIssueSidebarOrder", () => {- it("falls back to the default order", () => {- expect(resolveIssueSidebarOrder(null)).toEqual([...ISSUE_SIDEBAR_SECTIONS]);- });-- it("drops unknown and repeated ids", () => {- const order = resolveIssueSidebarOrder(["execution_log", "nope", "execution_log", 3, ...ISSUE_SIDEBAR_SECTIONS]);- expect(order[0]).toBe("execution_log");- expect(order).toHaveLength(ISSUE_SIDEBAR_SECTIONS.length);- expect(new Set(order).size).toBe(order.length);- });-- it("puts a section the save predates after the one it follows by default", () => {- const saved = ISSUE_SIDEBAR_SECTIONS.filter((id) => id !== "plugins").reverse();- const order = resolveIssueSidebarOrder(saved);- expect(order.indexOf("plugins")).toBe(order.indexOf("wakeups") + 1);+describe("ISSUE_SIDEBAR_SECTIONS", () => {+ it("lists every grouped section once, in card order", () => {+ expect(ISSUE_SIDEBAR_SECTIONS).toEqual(ISSUE_SIDEBAR_GROUPS.flat());+ expect(new Set(ISSUE_SIDEBAR_SECTIONS).size).toBe(ISSUE_SIDEBAR_SECTIONS.length);});});@@ -36,15 +23,6 @@ describe("resolveIssueSidebarHidden", () => {describe("useIssueSidebarSectionsStore", () => {beforeEach(() => useIssueSidebarSectionsStore.getState().reset());- it("stores no order while it matches the default", () => {- const { setOrder } = useIssueSidebarSectionsStore.getState();- setOrder(["execution_log", ...ISSUE_SIDEBAR_SECTIONS]);- expect(selectIssueSidebarOrder(useIssueSidebarSectionsStore.getState())[0]).toBe("execution_log");-- setOrder(ISSUE_SIDEBAR_SECTIONS);- expect(useIssueSidebarSectionsStore.getState().order).toBeNull();- });-it("hides and shows sections", () => {const { setHidden } = useIssueSidebarSectionsStore.getState();setHidden("details", true);@@ -56,24 +34,21 @@ describe("useIssueSidebarSectionsStore", () => {expect(useIssueSidebarSectionsStore.getState().hidden).toEqual(["metadata"]);});- it("resets order and visibility together", () => {- const state = useIssueSidebarSectionsStore.getState();- state.setOrder(["metadata"]);- state.setHidden("apps", true);+ it("resets visibility", () => {+ useIssueSidebarSectionsStore.getState().setHidden("apps", true);expect(selectIssueSidebarCustomized(useIssueSidebarSectionsStore.getState())).toBe(true);useIssueSidebarSectionsStore.getState().reset();expect(selectIssueSidebarCustomized(useIssueSidebarSectionsStore.getState())).toBe(false);});- it("sanitizes what it reads back from storage", () => {+ it("sanitizes what it reads back from storage and drops a saved order", () => {const { merge } = useIssueSidebarSectionsStore.persist.getOptions();const state = merge!({ order: ["metadata", "bogus", ...ISSUE_SIDEBAR_SECTIONS], hidden: ["properties", "apps"] },useIssueSidebarSectionsStore.getState(),);- expect(state.order?.[0]).toBe("metadata");- expect(state.order).toHaveLength(ISSUE_SIDEBAR_SECTIONS.length);expect(state.hidden).toEqual(["apps"]);+ expect(state).not.toHaveProperty("order");});});diff --git a/packages/core/issues/stores/issue-sidebar-sections-store.ts b/packages/core/issues/stores/issue-sidebar-sections-store.tsindex 49d53dc0aa..fe0ad5371f 100644--- a/packages/core/issues/stores/issue-sidebar-sections-store.ts+++ b/packages/core/issues/stores/issue-sidebar-sections-store.ts@@ -4,48 +4,30 @@ import { create } from "zustand";import { createJSONStorage, persist } from "zustand/middleware";import { defaultStorage } from "../../platform/storage";-/** The issue sidebar's sections, in their default order. */-export const ISSUE_SIDEBAR_SECTIONS = [- "properties",- "quick_actions",- "wakeups",- "plugins",- "parent",- "sub_issues",- "duplicates",- "pull_requests",- "environments",- "deliverables",- "apps",- "execution_log",- "details",- "metadata",+/**+ * The issue sidebar's cards, top to bottom, and the sections each one holds.+ * The last group is not a card: it is the small print under them.+ */+export const ISSUE_SIDEBAR_GROUPS = [+ ["properties"],+ ["pull_requests", "deliverables", "environments"],+ ["parent", "sub_issues", "duplicates"],+ ["execution_log"],+ ["quick_actions", "wakeups", "plugins", "apps"],+ ["details", "metadata"],] as const;-export type IssueSidebarSection = (typeof ISSUE_SIDEBAR_SECTIONS)[number];+export type IssueSidebarSection = (typeof ISSUE_SIDEBAR_GROUPS)[number][number];++/** Every section, in the order the sidebar shows them. */+export const ISSUE_SIDEBAR_SECTIONS: readonly IssueSidebarSection[] = ISSUE_SIDEBAR_GROUPS.flat();-/** Sections every issue shows. They can move, but not be hidden. */+/** Sections every issue shows. */export const ISSUE_SIDEBAR_ALWAYS_SHOWN: readonly IssueSidebarSection[] = ["properties"];const SECTION_IDS = new Set<string>(ISSUE_SIDEBAR_SECTIONS);const isSection = (id: unknown): id is IssueSidebarSection => typeof id === "string" && SECTION_IDS.has(id);-/**- * The sections in the user's order. Unknown and repeated ids are dropped; a- * section missing from the saved order (one added since it was saved) is- * placed right after the section it follows by default.- */-export function resolveIssueSidebarOrder(saved: readonly unknown[] | null): IssueSidebarSection[] {- if (!saved) return [...ISSUE_SIDEBAR_SECTIONS];- const order = [...new Set(saved)].filter(isSection);- ISSUE_SIDEBAR_SECTIONS.forEach((id, i) => {- if (order.includes(id)) return;- const previous = i === 0 ? -1 : order.indexOf(ISSUE_SIDEBAR_SECTIONS[i - 1]!);- order.splice(previous + 1, 0, id);- });- return order;-}-/** Known sections the user hid, without repeats or the always-shown ones. */export function resolveIssueSidebarHidden(saved: readonly unknown[] | null): IssueSidebarSection[] {if (!saved) return [];@@ -55,42 +37,34 @@ export function resolveIssueSidebarHidden(saved: readonly unknown[] | null): Iss}interface IssueSidebarSectionsState {- /** `null` until the user reorders, so the default order can still evolve. */- order: IssueSidebarSection[] | null;hidden: IssueSidebarSection[];- setOrder: (order: readonly IssueSidebarSection[]) => void;setHidden: (section: IssueSidebarSection, hidden: boolean) => void;reset: () => void;}-/** This device's issue sidebar sections, shared by every issue and workspace. */+/**+ * This device's hidden issue sidebar sections, shared by every issue and+ * workspace. Saves from before the sidebar became cards also carry an+ * `order`; the cards fix the order, so it is dropped on read.+ */export const useIssueSidebarSectionsStore = create<IssueSidebarSectionsState>()(persist((set, get) => ({- order: null,hidden: [],- setOrder: (next) => {- const order = resolveIssueSidebarOrder(next);- const isDefault = order.every((id, i) => id === ISSUE_SIDEBAR_SECTIONS[i]);- set({ order: isDefault ? null : order });- },setHidden: (section, hidden) => {const current = get().hidden.filter((id) => id !== section);set({ hidden: resolveIssueSidebarHidden(hidden ? [...current, section] : current) });},- reset: () => set({ order: null, hidden: [] }),+ reset: () => set({ hidden: [] }),}),{name: "multica_issue_sidebar_sections",storage: createJSONStorage(() => defaultStorage),- partialize: (state) => ({ order: state.order, hidden: state.hidden }),+ partialize: (state) => ({ hidden: state.hidden }),merge: (persisted, current) => {- const saved = persisted as { order?: unknown; hidden?: unknown } | undefined;- const order = Array.isArray(saved?.order) ? resolveIssueSidebarOrder(saved.order) : null;- const isDefault = order?.every((id, i) => id === ISSUE_SIDEBAR_SECTIONS[i]) ?? true;+ const saved = persisted as { hidden?: unknown } | undefined;return {...current,- order: isDefault ? null : order,hidden: Array.isArray(saved?.hidden) ? resolveIssueSidebarHidden(saved.hidden) : [],};},@@ -98,8 +72,4 @@ export const useIssueSidebarSectionsStore = create<IssueSidebarSectionsState>()(),);-export const selectIssueSidebarOrder = (state: IssueSidebarSectionsState): readonly IssueSidebarSection[] =>- state.order ?? ISSUE_SIDEBAR_SECTIONS;--export const selectIssueSidebarCustomized = (state: IssueSidebarSectionsState) =>- state.order !== null || state.hidden.length > 0;+export const selectIssueSidebarCustomized = (state: IssueSidebarSectionsState) => state.hidden.length > 0;diff --git a/packages/ui/styles/tokens.css b/packages/ui/styles/tokens.cssindex dc82d7b6dc..55a34e0218 100644--- a/packages/ui/styles/tokens.css+++ b/packages/ui/styles/tokens.css@@ -170,6 +170,10 @@--surface-selected-foreground: oklch(0.141 0.005 285.823);--surface-border: oklch(0.92 0.004 286.32);--surface-shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 1px 1px rgb(15 23 42 / 0.03);+ /* A surface card resting on the page canvas, outlined by its shadow+ rather than a border: a hairline ring, faintest on top, and a short+ drop below. */+ --surface-card-shadow: 0 0 0 1px rgb(0 0 0 / 0.03), 0 1px 2px rgb(0 0 0 / 0.05), 0 3px 6px -1px rgb(0 0 0 / 0.06);--floating-shadow: 0 16px 40px rgb(15 23 42 / 0.14), 0 3px 10px rgb(15 23 42 / 0.08);/* Below `md` the chat launcher is an overlay pinned to the dashboard's@@ -293,6 +297,7 @@--surface-selected-foreground: oklch(0.985 0 0);--surface-border: oklch(1 0 0 / 10%);--surface-shadow: 0 1px 2px rgb(0 0 0 / 0.2), 0 1px 1px rgb(0 0 0 / 0.16);+ --surface-card-shadow: 0 0 0 1px rgb(255 255 255 / 0.07), 0 1px 2px rgb(0 0 0 / 0.3), 0 3px 6px -1px rgb(0 0 0 / 0.3);--floating-shadow: 0 20px 48px rgb(0 0 0 / 0.46), 0 4px 12px rgb(0 0 0 / 0.28);--menu-shadow: 0 10px 28px rgb(0 0 0 / 0.3), 0 2px 8px rgb(0 0 0 / 0.18);--tooltip: oklch(0.3 0.006 286.033);diff --git a/packages/views/common/prop-row.tsx b/packages/views/common/prop-row.tsxindex c4f4488732..ffd5b76c1e 100644--- a/packages/views/common/prop-row.tsx+++ b/packages/views/common/prop-row.tsx@@ -54,7 +54,7 @@ export function PropRow({className,)}>- <span className="flex min-h-8 min-w-0 items-center gap-1.5 text-label text-muted-foreground">+ <span data-slot="prop-row-label" className="flex min-h-8 min-w-0 items-center gap-1.5 text-label text-muted-foreground">{label}</span><div className="flex min-h-8 min-w-0 items-center gap-1.5 truncate text-label">diff --git a/packages/views/issues/components/environment-start-menu.tsx b/packages/views/issues/components/environment-start-menu.tsxindex 11ba671a54..070cfa385f 100644--- a/packages/views/issues/components/environment-start-menu.tsx+++ b/packages/views/issues/components/environment-start-menu.tsx@@ -27,12 +27,53 @@ export interface StartMenuMachine {const NOTE_CLASS = "px-2 py-1.5 text-caption text-muted-foreground";+export interface EnvironmentStartMenuProps {+ configs: IssueEnvironmentConfig[];+ machineFor: (runtimeId: string) => StartMenuMachine;+ runLabel: (taskId: string) => string | null;+ declaredState: (config: IssueEnvironmentConfig, declared: DeclaredEnvironment) => DeclaredState;+ onStart: (config: IssueEnvironmentConfig, declared: DeclaredEnvironment) => void;+ /** Who the start goes to; null lets the reader pick from `agentChoices`. */+ agent: Agent | null;+ agentChoices: Agent[];+ preparing: boolean;+ onAskAgent: (agent: Agent) => void;+}++/** Whether the menu has anything enabled: an environment to start here, or an agent to ask. */+export function canStartEnvironment({ configs, machineFor, declaredState, agent, agentChoices, preparing }: EnvironmentStartMenuProps) {+ const startable = configs.some((config) =>+ config.can_control &&+ !machineFor(config.runtime_id).offline &&+ config.environments.some((declared) => declaredState(config, declared) === "available"));+ return startable || (!preparing && (!!agent || agentChoices.length > 0));+}+/*** The section's "+": every environment the latest run on each machine* declared, started from that run's code, and a way to have an agent prepare* the code and start it when there is nothing to start directly.*/-export function EnvironmentStartMenu({+export function EnvironmentStartMenu(props: EnvironmentStartMenuProps) {+ const { t } = useT("issues");+ return (+ <DropdownMenu>+ <DropdownMenuTrigger+ render={+ <IconButton variant="ghost" size="icon-xs" label={t(($) => $.environments.start_menu.trigger)}>+ <Plus />+ </IconButton>+ }+ />+ <DropdownMenuContent align="end" className="w-80 max-w-(--available-width)">+ <EnvironmentStartMenuItems {...props} />+ </DropdownMenuContent>+ </DropdownMenu>+ );+}++/** The menu's items, also offered from the sidebar's "+" menu while the section is empty. */+export function EnvironmentStartMenuItems({configs,machineFor,runLabel,@@ -42,18 +83,7 @@ export function EnvironmentStartMenu({agentChoices,preparing,onAskAgent,-}: {- configs: IssueEnvironmentConfig[];- machineFor: (runtimeId: string) => StartMenuMachine;- runLabel: (taskId: string) => string | null;- declaredState: (config: IssueEnvironmentConfig, declared: DeclaredEnvironment) => DeclaredState;- onStart: (config: IssueEnvironmentConfig, declared: DeclaredEnvironment) => void;- /** Who the start goes to; null lets the reader pick from `agentChoices`. */- agent: Agent | null;- agentChoices: Agent[];- preparing: boolean;- onAskAgent: (agent: Agent) => void;-}) {+}: EnvironmentStartMenuProps) {const { t } = useT("issues");const declaring = configs.filter((config) => config.environments.length > 0);const askLabel = agent@@ -62,92 +92,83 @@ export function EnvironmentStartMenu({const askSide = preparing ? t(($) => $.environments.start_menu.preparing) : t(($) => $.environments.start_menu.new_run);return (- <DropdownMenu>- <DropdownMenuTrigger- render={- <IconButton variant="ghost" size="icon-xs" label={t(($) => $.environments.start_menu.trigger)}>- <Plus />- </IconButton>- }- />- <DropdownMenuContent align="end" className="w-80 max-w-(--available-width)">- {declaring.map((config, index) => {- const machine = machineFor(config.runtime_id);- const run = runLabel(config.task_id);- return (- <Fragment key={config.runtime_id}>- {index > 0 && <DropdownMenuSeparator />}- <DropdownMenuGroup>- <DropdownMenuLabel className="flex min-w-0 items-center gap-1.5">- <span className="min-w-0 truncate">{run ? `${machine.title} · ${run}` : machine.title}</span>- {machine.offline && (- <span className="shrink-0 rounded-xs bg-warning/10 px-1 text-micro font-medium text-warning">{t(($) => $.environments.offline)}</span>- )}- </DropdownMenuLabel>- {config.environments.map((declared) => {- const state = declaredState(config, declared);- const disabled = state !== "available" || machine.offline || !config.can_control;- return (- <DropdownMenuItem- key={`${declared.repo}/${declared.name}`}- disabled={disabled}- onClick={() => onStart(config, declared)}- >- <Server className="text-muted-foreground" />- <span className="min-w-0 truncate">{declared.label || declared.name}</span>- <span className="ml-auto max-w-[50%] shrink-0 truncate pl-3 text-caption text-muted-foreground">- {state === "running"- ? t(($) => $.environments.state.running)- : state === "starting"- ? t(($) => $.environments.state.starting)- : <code className="font-mono">{declared.start}</code>}- </span>- </DropdownMenuItem>- );- })}- </DropdownMenuGroup>- </Fragment>- );- })}- {declaring.length > 0 ? (- <p className={NOTE_CLASS}>- {declaring.some((config) => !config.can_control)- ? t(($) => $.environments.start_menu.no_permission)- : t(($) => $.environments.start_menu.note)}- </p>- ) : configs.length === 0 ? (- <p className={NOTE_CLASS}>{t(($) => $.environments.start_menu.nothing_to_start)}</p>- ) : null}- {(declaring.length > 0 || configs.length === 0) && <DropdownMenuSeparator />}- {agent ? (- <DropdownMenuItem disabled={preparing} onClick={() => onAskAgent(agent)}>+ <>+ {declaring.map((config, index) => {+ const machine = machineFor(config.runtime_id);+ const run = runLabel(config.task_id);+ return (+ <Fragment key={config.runtime_id}>+ {index > 0 && <DropdownMenuSeparator />}+ <DropdownMenuGroup>+ <DropdownMenuLabel className="flex min-w-0 items-center gap-1.5">+ <span className="min-w-0 truncate">{run ? `${machine.title} · ${run}` : machine.title}</span>+ {machine.offline && (+ <span className="shrink-0 rounded-xs bg-warning/10 px-1 text-micro font-medium text-warning">{t(($) => $.environments.offline)}</span>+ )}+ </DropdownMenuLabel>+ {config.environments.map((declared) => {+ const state = declaredState(config, declared);+ const disabled = state !== "available" || machine.offline || !config.can_control;+ return (+ <DropdownMenuItem+ key={`${declared.repo}/${declared.name}`}+ disabled={disabled}+ onClick={() => onStart(config, declared)}+ >+ <Server className="text-muted-foreground" />+ <span className="min-w-0 truncate">{declared.label || declared.name}</span>+ <span className="ml-auto max-w-[50%] shrink-0 truncate pl-3 text-caption text-muted-foreground">+ {state === "running"+ ? t(($) => $.environments.state.running)+ : state === "starting"+ ? t(($) => $.environments.state.starting)+ : <code className="font-mono">{declared.start}</code>}+ </span>+ </DropdownMenuItem>+ );+ })}+ </DropdownMenuGroup>+ </Fragment>+ );+ })}+ {declaring.length > 0 ? (+ <p className={NOTE_CLASS}>+ {declaring.some((config) => !config.can_control)+ ? t(($) => $.environments.start_menu.no_permission)+ : t(($) => $.environments.start_menu.note)}+ </p>+ ) : configs.length === 0 ? (+ <p className={NOTE_CLASS}>{t(($) => $.environments.start_menu.nothing_to_start)}</p>+ ) : null}+ {(declaring.length > 0 || configs.length === 0) && <DropdownMenuSeparator />}+ {agent ? (+ <DropdownMenuItem disabled={preparing} onClick={() => onAskAgent(agent)}>+ <Bot className="text-muted-foreground" />+ <span className="min-w-0 truncate">{askLabel}</span>+ <span className="ml-auto shrink-0 pl-3 text-caption text-muted-foreground">{askSide}</span>+ </DropdownMenuItem>+ ) : (+ <DropdownMenuSub>+ <DropdownMenuSubTrigger disabled={preparing || agentChoices.length === 0}><Bot className="text-muted-foreground" /><span className="min-w-0 truncate">{askLabel}</span>- <span className="ml-auto shrink-0 pl-3 text-caption text-muted-foreground">{askSide}</span>- </DropdownMenuItem>- ) : (- <DropdownMenuSub>- <DropdownMenuSubTrigger disabled={preparing || agentChoices.length === 0}>- <Bot className="text-muted-foreground" />- <span className="min-w-0 truncate">{askLabel}</span>- </DropdownMenuSubTrigger>- <DropdownMenuSubContent className="max-h-72 w-56">- {agentChoices.map((choice) => (- <DropdownMenuItem key={choice.id} onClick={() => onAskAgent(choice)}>- <span className="min-w-0 truncate">{choice.name}</span>- </DropdownMenuItem>- ))}- </DropdownMenuSubContent>- </DropdownMenuSub>- )}- {declaring.length === 0 && (- <p className={NOTE_CLASS}>- {agent- ? t(($) => $.environments.start_menu.ask_agent_hint, { name: agent.name })- : t(($) => $.environments.start_menu.ask_any_agent_hint)}- </p>- )}- </DropdownMenuContent>- </DropdownMenu>+ </DropdownMenuSubTrigger>+ <DropdownMenuSubContent className="max-h-72 w-56">+ {agentChoices.map((choice) => (+ <DropdownMenuItem key={choice.id} onClick={() => onAskAgent(choice)}>+ <span className="min-w-0 truncate">{choice.name}</span>+ </DropdownMenuItem>+ ))}+ </DropdownMenuSubContent>+ </DropdownMenuSub>+ )}+ {declaring.length === 0 && (+ <p className={NOTE_CLASS}>+ {agent+ ? t(($) => $.environments.start_menu.ask_agent_hint, { name: agent.name })+ : t(($) => $.environments.start_menu.ask_any_agent_hint)}+ </p>+ )}+ </>);}diff --git a/packages/views/issues/components/execution-log-section.tsx b/packages/views/issues/components/execution-log-section.tsxindex 09e0663429..686486f840 100644--- a/packages/views/issues/components/execution-log-section.tsx+++ b/packages/views/issues/components/execution-log-section.tsx@@ -794,16 +794,16 @@ function RowShell({multiline ? "items-start" : "items-center",)}>- <span className={cn("flex shrink-0", multiline && "mt-0.5")}>+ <span className={cn("-mr-0.5 flex shrink-0", multiline && "mt-0.5")}>{task.agent_id ? (<ActorAvataractorType="agent"actorId={task.agent_id}- size="sm"+ size="xs"enableHoverCard/>) : (- <span className="inline-block h-5 w-5 rounded-full bg-muted" />+ <span className="inline-block size-4 rounded-full bg-muted" />)}</span>{showIssue && (diff --git a/packages/views/issues/components/issue-detail.test.tsx b/packages/views/issues/components/issue-detail.test.tsxindex d696632685..97a8f5516c 100644--- a/packages/views/issues/components/issue-detail.test.tsx+++ b/packages/views/issues/components/issue-detail.test.tsx@@ -1761,7 +1761,7 @@ describe("IssueDetail (shared)", () => {renderIssueDetail();await waitFor(() => {- expect(screen.getByText("Details")).toBeInTheDocument();+ expect(screen.getByRole("region", { name: "Details" })).toBeInTheDocument();});expect(screen.queryByRole("button", { name: /^Metadata\b/ })).not.toBeInTheDocument();@@ -2045,6 +2045,59 @@ describe("IssueDetail (shared)", () => {expect(container.querySelector(`#comment-${root.id}`)?.querySelector(`[data-run-id="${second.id}"]`)).not.toBeNull();});+ describe("overview Reply", () => {+ const replyButton = async () => {+ const nextStep = await waitFor(() => {+ const el = document.querySelector<HTMLElement>('[data-slot="issue-next-step"]');+ expect(el).not.toBeNull();+ return el!;+ });+ return within(nextStep).getByRole("button", { name: "Reply" });+ };++ it("lands on an agent comment its run regrouped under the triggering comment", async () => {+ const root = mockTimeline[0]!;+ const task: AgentTask = { id: "ba2e8d1c-7f9b-4e2a-9c1d-123456789ab0", agent_id: "agent-1", runtime_id: "runtime-1", issue_id: "issue-1",+ status: "completed", priority: 0, created_at: root.created_at, started_at: root.created_at, dispatched_at: root.created_at,+ completed_at: "2026-01-16T00:01:00Z", result: null, error: null, trigger_comment_id: root.id, delivered_comment_ids: [root.id] };+ const answer: TimelineEntry = { ...mockTimeline[1]!, id: "agent-answer", parent_id: null, source_task_id: task.id,+ content: "Which schema should I keep?", created_at: "2026-01-16T00:01:00Z", updated_at: "2026-01-16T00:01:00Z" };+ mockApiObj.getIssue.mockResolvedValue({ ...mockIssue, status: "blocked" });+ mockApiObj.listTimeline.mockResolvedValue([root, answer]);+ mockApiObj.listTasksByIssue.mockResolvedValue([task]);+ useCommentCollapseStore.setState({ collapsedByIssue: { "issue-1": [root.id] } });+ renderIssueDetail();++ await screen.findByText("Started working on this");+ expect(document.getElementById("comment-agent-answer")).toBeNull();+ fireEvent.click(await replyButton());++ await waitFor(() => {+ expect(document.getElementById("comment-agent-answer")?.className).toContain(highlightedCommentBackgroundClass);+ });+ expect(document.getElementById("comment-agent-answer")?.closest(`#comment-${root.id}`)).not.toBeNull();+ expect(useCommentCollapseStore.getState().isCollapsed("issue-1", root.id)).toBe(false);+ });++ it("unfolds a collapsed thread to land on the agent's latest reply", async () => {+ const reply: TimelineEntry = { ...mockTimeline[1]!, id: "agent-reply", parent_id: "comment-1",+ content: "Blocked on the API key", created_at: "2026-01-18T00:00:00Z", updated_at: "2026-01-18T00:00:00Z" };+ mockApiObj.getIssue.mockResolvedValue({ ...mockIssue, status: "blocked" });+ mockApiObj.listTimeline.mockResolvedValue([...mockTimeline, reply]);+ useCommentCollapseStore.setState({ collapsedByIssue: { "issue-1": ["comment-1"] } });+ renderIssueDetail();++ await screen.findByText("Started working on this");+ expect(document.getElementById("comment-agent-reply")).toBeNull();+ fireEvent.click(await replyButton());++ await waitFor(() => {+ expect(document.getElementById("comment-agent-reply")?.className).toContain(highlightedCommentBackgroundClass);+ });+ expect(useCommentCollapseStore.getState().isCollapsed("issue-1", "comment-1")).toBe(false);+ });+ });+// MUL-7628: Elon was asked first but replied last; his review used to render// under the request, above the rest of the thread.it("orders thread replies by send time and quotes the request a late reply answers", async () => {@@ -2236,8 +2289,8 @@ describe("IssueDetail (shared)", () => {});});- // Details is creator + immutable timestamps, so it ranks below the- // execution log, which is what people actually open the sidebar for.+ // Details is creator + immutable timestamps, so it is small print under+ // the cards, below the execution log people actually open the sidebar for.it("orders the Details section after the execution log", async () => {mockApiObj.listTasksByIssue.mockResolvedValue([{@@ -2260,7 +2313,7 @@ describe("IssueDetail (shared)", () => {renderIssueDetail();const executionLog = await screen.findByText("Execution log");- const details = screen.getByText("Details");+ const details = screen.getByRole("region", { name: "Details" });// DOCUMENT_POSITION_FOLLOWING: Details comes after the execution log.expect(@@ -2329,14 +2382,14 @@ describe("IssueDetail (shared)", () => {it("does not re-render comment cards when unrelated page state changes", async () => {renderIssueDetail();await screen.findByText("I can help with this");- await screen.findByText("Details");+ await screen.findByRole("button", { name: "Properties" });const commentBodies = new Set(mockTimeline.map((entry) => entry.content));const cardRenders = () =>readonlyContentRenders.filter((content) => commentBodies.has(content)).length;const before = cardRenders();- fireEvent.click(screen.getByText("Details"));+ fireEvent.click(screen.getByRole("button", { name: "Properties" }));expect(cardRenders()).toBe(before);});@@ -2481,10 +2534,10 @@ describe("IssueDetail (shared)", () => {renderIssueDetail();expect(await screen.findByText("created this issue on behalf of Test User")).toBeInTheDocument();- fireEvent.click(screen.getByText("Details"));- const creatorRow = screen.getByText("Created by").parentElement!;- expect(creatorRow).toHaveTextContent("Claude Agent");- expect(within(creatorRow).getByRole("link", { name: "On behalf of Test User" }))+ const details = screen.getByRole("region", { name: "Details" });+ expect(details).toHaveTextContent("Created by");+ expect(details).toHaveTextContent("Claude Agent");+ expect(within(details).getByRole("link", { name: "On behalf of Test User" })).toHaveAttribute("href", "/test/members/user-1");expect(screen.queryByText("Requested by")).not.toBeInTheDocument();});@@ -2505,7 +2558,6 @@ describe("IssueDetail (shared)", () => {renderIssueDetail();expect(await screen.findByText("created this issue")).toBeInTheDocument();- fireEvent.click(screen.getByText("Details"));expect(screen.queryByText(/On behalf of/)).not.toBeInTheDocument();expect(screen.queryByText("Requested by")).not.toBeInTheDocument();});@@ -2522,8 +2574,7 @@ describe("IssueDetail (shared)", () => {renderIssueDetail();expect(await screen.findByText("created this issue on behalf of Unknown")).toBeInTheDocument();- fireEvent.click(screen.getByText("Details"));- expect(screen.getByText("Created by").parentElement).toHaveTextContent("On behalf of Unknown");+ expect(screen.getByRole("region", { name: "Details" })).toHaveTextContent("On behalf of Unknown");});});diff --git a/packages/views/issues/components/issue-detail.tsx b/packages/views/issues/components/issue-detail.tsxindex 50e0815b71..0dc6aa5c1d 100644--- a/packages/views/issues/components/issue-detail.tsx+++ b/packages/views/issues/components/issue-detail.tsx@@ -209,7 +209,8 @@ import { ProgressRing } from "./progress-ring";import { matchesPinyin } from "../../editor/extensions/pinyin-match";import { MetadataSection } from "./metadata-section";import { IssueSidebarSectionHeader, IssueSidebarPropertyGrid } from "./issue-sidebar-section";-import { IssueSidebarSections, letSidebarSettingsDragKeysThrough } from "./issue-sidebar-settings";+import { IssueSidebarSections } from "./issue-sidebar-settings";+import { IssueNextStep } from "./issue-next-step";import { useT } from "../../i18n";import { useIssueDetailScrollRestore } from "../hooks/use-issue-detail-scroll-restore";import { useIssueTimelineAnchor } from "../hooks/use-issue-timeline-anchor";@@ -1577,7 +1578,6 @@ export function IssueDetail({ issueId, onDelete, onDone, onUnsubscribeArchive, d}, [isMobile]);const sidebarOpen = isMobile ? mobileSidebarOpen : desktopSidebarOpen;const [propertiesOpen, setPropertiesOpen] = useState(true);- const [detailsOpen, setDetailsOpen] = useState(false);const [parentIssueOpen, setParentIssueOpen] = useState(true);const [sidebarSubIssuesOpen, setSidebarSubIssuesOpen] = useState(true);const [sidebarSubIssuesExpanded, setSidebarSubIssuesExpanded] = useState(false);@@ -2900,23 +2900,29 @@ export function IssueDetail({ issueId, onDelete, onDone, onUnsubscribeArchive, d[deliverableSources],);- // File origins use the deep-link landing path: load missing thread context,+ // In-page jumps use the deep-link landing path: load missing thread context,// unfold it and wait for virtual rows and their measured heights to settle.- const locateOrigin = useCallback(- (origin: DeliverableOrigin) => {- if (origin.kind === "description") {- scrollContainerEl?.scrollTo({ top: 0, behavior: "smooth" });- return;- }+ const landOnComment = useCallback(+ (commentId: string) => {setDeliverableJump((previous) => ({issueId: id,linkedCommentId,linkedRequestToken,- commentId: origin.commentId,+ commentId,token: Math.max(previous?.token ?? 0, linkedRequestToken ?? 0) + 1,}));},- [scrollContainerEl, id, linkedCommentId, linkedRequestToken],+ [id, linkedCommentId, linkedRequestToken],+ );+ const locateOrigin = useCallback(+ (origin: DeliverableOrigin) => {+ if (origin.kind === "description") {+ scrollContainerEl?.scrollTo({ top: 0, behavior: "smooth" });+ return;+ }+ landOnComment(origin.commentId);+ },+ [scrollContainerEl, landOnComment],);// Identifier form, like the issue's own copy link: a pasted link should say@@ -3238,12 +3244,12 @@ export function IssueDetail({ issueId, onDelete, onDone, onUnsubscribeArchive, d// that opens a Popover listing optional fields not yet displayed. Hidden// once every optional field is on screen.const addPropertyRow = canAddProperty && (- <div className="col-span-2 mt-1">+ <div className="col-span-2"><Popover open={addPropPopoverOpen} onOpenChange={setAddPropPopoverOpen}><PopoverTrigger- className="-mx-2 flex items-center gap-1.5 rounded-md px-2 py-1 text-label text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground"+ className="-mx-2 flex h-8 items-center gap-2 rounded-md px-2 text-label text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground">- <Plus className="h-3 w-3 shrink-0" />+ <span aria-hidden="true" className="flex size-3.5 shrink-0 items-center justify-center"><Plus className="size-3" /></span><span>{t(($) => $.detail.add_property_action)}</span></PopoverTrigger>{/* Each option leads with the icon the resulting picker uses, so the@@ -3323,26 +3329,49 @@ export function IssueDetail({ issueId, onDelete, onDone, onUnsubscribeArchive, d</div>);+ // A blocked issue waits on whoever wrote last; when that is an agent, the+ // overview card offers to jump to that comment. The raw timeline, because the+ // display one folds a run's comment into the run; the jump then lands where+ // the comment renders — inside its run, wherever that run was regrouped —+ // and unfolds whatever hides it.+ const latestComment = issue.status === "blocked"+ ? timeline.findLast((e) => e.type === "comment" && !isDeletedComment(e))+ : undefined;+ const nextStepReply = latestComment?.actor_type === "agent" ? {+ authorName: getActorName("agent", latestComment.actor_id),+ onReply: () => {+ setMobileSidebarOpen(false);+ landOnComment(latestComment.id);+ },+ } : null;++ const sidebarOverview = (+ <div>+ <IssueSidebarPropertyGrid>+ <PropRow label={t(($) => $.detail.prop_status)}>+ <StatusPicker+ status={issue.status}+ onUpdate={handleUpdateField}+ align="start"+ projectId={issue.project_id}+ issue={issue}+ onMarkDuplicate={actions.openMarkDuplicate}+ isDuplicate={isDuplicateIssue(issue)}+ />+ </PropRow>+ <PropRow label={t(($) => $.detail.prop_assignee)}>+ <AssigneePicker assigneeType={issue.assignee_type} assigneeId={issue.assignee_id} onUpdate={handleUpdateField} align="start" />+ </PropRow>+ </IssueSidebarPropertyGrid>+ <IssueNextStep issueId={id} status={issue.status} reply={nextStepReply} />+ </div>+ );+const sidebarSections: Record<IssueSidebarSection, ReactNode> = {properties: (<div><IssueSidebarSectionHeader title={t(($) => $.detail.section_properties)} open={propertiesOpen} onOpenChange={setPropertiesOpen} />{propertiesOpen && <IssueSidebarPropertyGrid>- {/* Core props — always rendered. */}- <PropRow label={t(($) => $.detail.prop_status)}>- <StatusPicker- status={issue.status}- onUpdate={handleUpdateField}- align="start"- projectId={issue.project_id}- issue={issue}- onMarkDuplicate={actions.openMarkDuplicate}- isDuplicate={isDuplicateIssue(issue)}- />- </PropRow>- <PropRow label={t(($) => $.detail.prop_assignee)}>- <AssigneePicker assigneeType={issue.assignee_type} assigneeId={issue.assignee_id} onUpdate={handleUpdateField} align="start" />- </PropRow><PropRow label={t(($) => $.detail.prop_project)}><IssueProjectPickerprojectId={issue.project_id}@@ -3505,7 +3534,7 @@ export function IssueDetail({ issueId, onDelete, onDone, onUnsubscribeArchive, dhref={paths.issueDetail(child.id)}title={`${child.identifier} ${child.title}`}aria-label={`${child.identifier} ${child.title}, ${resolveStatusLabel(child.status)}`}- className="group flex min-w-0 items-center gap-1.5 rounded-md px-2 py-2 text-label transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"+ className="group flex min-w-0 items-center gap-2 rounded-md px-2 py-2 text-label transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"><span role="img" aria-label={resolveStatusLabel(child.status)} className="shrink-0"><StatusIcon@@ -3569,54 +3598,42 @@ export function IssueDetail({ issueId, onDelete, onDone, onUnsubscribeArchive, dapps: <IssueAppsSection issueId={id} />,// Execution summary owns its query, realtime updates and disclosure.execution_log: <ExecutionLogSection key={id} issueId={id} identifier={issue.identifier} issueTitle={issue.title} hasChildren={childIssues.length > 0} />,- // Details — creator and timestamps. Defaults to below the execution- // log because it is the least-read block in the sidebar: the values- // never change once the issue exists, while the log above it is- // what people actually come here to check.+ // Details — creator and timestamps, as small print under the cards: the+ // values never change once the issue exists, so they never need a card.details: (- <div>- <IssueSidebarSectionHeader title={t(($) => $.detail.section_details)} open={detailsOpen} onOpenChange={setDetailsOpen} />- {detailsOpen && <IssueSidebarPropertyGrid>- <PropRow- interactive={false}- label={t(($) => $.detail.prop_created_by)}- className={requesterName ? "items-start py-1.5" : undefined}- >- <div className="flex min-w-0 flex-1 items-start gap-1.5">- <ActorAvatar actorType={issue.creator_type} actorId={issue.creator_id} size="sm" enableHoverCard />- <div className="flex min-w-0 flex-1 flex-col">- <span className="cursor-pointer truncate">{getActorName(issue.creator_type, issue.creator_id)}</span>- {requesterName && issue.requester_id && (- <HoverCard>- <HoverCardTrigger- render={<AppLink href={paths.memberDetail(issue.requester_id)} />}- className="block truncate text-caption text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"- title={t(($) => $.execution_log.attribution.on_behalf_of, { name: requesterName })}- >- {t(($) => $.execution_log.attribution.on_behalf_of, { name: requesterName })}- </HoverCardTrigger>- <HoverCardContent align="start" className="w-72">- <MemberProfileCard userId={issue.requester_id} />- </HoverCardContent>- </HoverCard>- )}- </div>- </div>- </PropRow>- <PropRow interactive={false} label={t(($) => $.detail.prop_created)}>- <span className="text-muted-foreground">{shortDate(issue.created_at, locale)}</span>- </PropRow>- <PropRow interactive={false} label={t(($) => $.detail.prop_updated)}>- <span className="text-muted-foreground">{shortDate(issue.updated_at, locale)}</span>- </PropRow>- </IssueSidebarPropertyGrid>}- </div>+ <section aria-label={t(($) => $.detail.section_details)} className="flex flex-col gap-1 px-4 text-caption text-muted-foreground">+ <div className="flex min-w-0 items-center gap-1.5">+ <span className="shrink-0">{t(($) => $.detail.prop_created_by)}</span>+ <ActorAvatar actorType={issue.creator_type} actorId={issue.creator_id} size="xs" enableHoverCard />+ <span className="truncate text-foreground">{getActorName(issue.creator_type, issue.creator_id)}</span>+ </div>+ {requesterName && issue.requester_id && (+ <HoverCard>+ <HoverCardTrigger+ render={<AppLink href={paths.memberDetail(issue.requester_id)} />}+ className="block truncate hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"+ title={t(($) => $.execution_log.attribution.on_behalf_of, { name: requesterName })}+ >+ {t(($) => $.execution_log.attribution.on_behalf_of, { name: requesterName })}+ </HoverCardTrigger>+ <HoverCardContent align="start" className="w-72">+ <MemberProfileCard userId={issue.requester_id} />+ </HoverCardContent>+ </HoverCard>+ )}+ <p className="truncate">+ {t(($) => $.detail.prop_created)} {shortDate(issue.created_at, locale)}+ <span aria-hidden="true" className="px-1.5 text-faint-foreground">·</span>+ {t(($) => $.detail.prop_updated)} {shortDate(issue.updated_at, locale)}+ </p>+ </section>),metadata: <MetadataSection metadata={issue.metadata ?? {}} />,};const sidebarContent = landingChromeHeld ? null : (<IssueSidebarSections+ overview={sidebarOverview}sections={sidebarSections}available={ISSUE_SIDEBAR_SECTIONS.filter((section) => (section !== "pull_requests" || githubSettings.prSidebar) && (section !== "plugins" || pluginsEnabled),@@ -4628,8 +4645,7 @@ export function IssueDetail({ issueId, onDelete, onDone, onUnsubscribeArchive, d<SheetContentside="right"showCloseButton={false}- className="w-[320px] overflow-y-auto [scrollbar-gutter:stable] px-2 py-4"- onKeyDown={letSidebarSettingsDragKeysThrough}+ className="w-[320px] overflow-y-auto [scrollbar-gutter:stable] pb-4">{sidebarContent}</SheetContent>@@ -4656,10 +4672,9 @@ export function IssueDetail({ issueId, onDelete, onDone, onUnsubscribeArchive, dpanelRef={sidebarRef}onResize={handleDesktopSidebarResize}>- {/* Sections inset their own bodies and rows, so the panel itself only- needs a narrow gutter. pt-2.5 centres the first 28px section- header on the 48px page header beside it. */}- <AnimatedRightSidebar open={desktopSidebarVisualOpen} motionEnabled={desktopSidebarMotionEnabled} contentClassName="px-2 pt-2.5 pb-4">+ {/* No divider: the cards sit on the same canvas as the reading+ column, under a strip that carries the page header's rule across. */}+ <AnimatedRightSidebar open={desktopSidebarVisualOpen} motionEnabled={desktopSidebarMotionEnabled} className="border-l-0" contentClassName="pb-4">{sidebarContent}</AnimatedRightSidebar></ResizablePanel>diff --git a/packages/views/issues/components/issue-environments-section.test.tsx b/packages/views/issues/components/issue-environments-section.test.tsxindex 99b25566bc..029274c15e 100644--- a/packages/views/issues/components/issue-environments-section.test.tsx+++ b/packages/views/issues/components/issue-environments-section.test.tsx@@ -82,6 +82,7 @@ const toastError = vi.hoisted(() => vi.fn());vi.mock("sonner", () => ({ toast: { error: toastError, success: vi.fn() } }));const focusEnvironment = vi.fn();+import { IssueSidebarAddMenu, IssueSidebarAddMenuProvider } from "./issue-sidebar-add-menu";import { IssueEnvironmentsSection } from "./issue-environments-section";const HOUR = 3_600_000;@@ -182,12 +183,25 @@ function renderSection(props: { assigneeType?: "agent" | "member" | null; assignreturn render(<QueryClientProvider client={qc}><I18nProvider resources={TEST_RESOURCES} locale="en">- <IssueEnvironmentsSection issueId="issue-1" {...props} />+ <IssueSidebarAddMenuProvider>+ <IssueSidebarAddMenu />+ <div data-testid="section">+ <IssueEnvironmentsSection issueId="issue-1" {...props} />+ </div>+ </IssueSidebarAddMenuProvider></I18nProvider></QueryClientProvider>,);}+/** With no environment yet, starting one goes through the sidebar's "+" menu. */+async function openStartFromAddMenu() {+ fireEvent.click(await screen.findByRole("button", { name: "Add" }));+ fireEvent.click(await screen.findByRole("menuitem", { name: "Start an environment" }));+ await waitFor(() => expect(screen.getAllByRole("menu")).toHaveLength(2));+ return screen.getAllByRole("menu")[1]!;+}+async function openRowMenu(row: HTMLElement) {fireEvent.click(within(row).getByRole("button", { name: "More actions" }));return screen.findByRole("menu");@@ -213,11 +227,29 @@ describe("IssueEnvironmentsSection", () => {apiMock.getIssueEnvironmentCommand.mockReset();});- it("keeps the header and its start menu while the issue has no environments", async () => {+ it("renders nothing while the issue has no environments and offers starting one from the + menu", async () => {+ mockTasks = [];+ renderSection();+ const menu = await openStartFromAddMenu();+ expect(within(menu).getByRole("menuitem", { name: /Ask an agent to start it/ })).toBeInTheDocument();+ expect(screen.getByTestId("section")).toBeEmptyDOMElement();+ expect(screen.queryByRole("button", { name: "Start an environment" })).toBeNull();+ });++ it("offers no start entry when nothing could start one or be asked to", async () => {mockTasks = [];+ mockAgents = [];renderSection();- expect(await screen.findByText("Environments")).toBeVisible();- expect(screen.queryByTestId("environment-row")).not.toBeInTheDocument();+ await waitFor(() => expect(screen.getByTestId("section")).toBeEmptyDOMElement());+ expect(screen.queryByRole("button", { name: "Add" })).toBeNull();+ });++ it("leaves the + menu once an environment is listed", async () => {+ mockEnvironments = [environment({})];+ renderSection();+ await screen.findByTestId("environment-row");+ expect(screen.getByRole("button", { name: "Start an environment" })).toBeVisible();+ expect(screen.queryByRole("button", { name: "Add" })).toBeNull();});it("groups live environments by machine and links the running ones", async () => {@@ -636,8 +668,7 @@ describe("IssueEnvironmentsSection", () => {it("asks the agent to start it when nothing can be started directly", async () => {mockTasks = [];renderSection({ assigneeType: "agent", assigneeId: "agent-1" });- fireEvent.click(await screen.findByRole("button", { name: "Start an environment" }));- const menu = await screen.findByRole("menu");+ const menu = await openStartFromAddMenu();expect(within(menu).getByText(/hasn't run yet/)).toBeInTheDocument();fireEvent.click(within(menu).getByRole("menuitem", { name: /Ask Lambda to start it/ }));expect(createComment).toHaveBeenCalledTimes(1);diff --git a/packages/views/issues/components/issue-environments-section.tsx b/packages/views/issues/components/issue-environments-section.tsxindex 48261efe2a..2b60b942fb 100644--- a/packages/views/issues/components/issue-environments-section.tsx+++ b/packages/views/issues/components/issue-environments-section.tsx@@ -56,6 +56,9 @@ import {DropdownMenuItem,DropdownMenuLabel,DropdownMenuSeparator,+ DropdownMenuSub,+ DropdownMenuSubContent,+ DropdownMenuSubTrigger,DropdownMenuTrigger,} from "@multica/ui/components/ui/dropdown-menu";import { Spinner } from "@multica/ui/components/ui/spinner";@@ -80,7 +83,14 @@ import {recentFailure,runOrdinals,} from "./environment-model";-import { EnvironmentStartMenu, type DeclaredState } from "./environment-start-menu";+import {+ canStartEnvironment,+ EnvironmentStartMenu,+ EnvironmentStartMenuItems,+ type DeclaredState,+ type EnvironmentStartMenuProps,+} from "./environment-start-menu";+import { useIssueSidebarAddEntry } from "./issue-sidebar-add-menu";import { IssueSidebarSectionHeader } from "./issue-sidebar-section";type IssuesT = ReturnType<typeof useT<"issues">>["t"];@@ -385,6 +395,41 @@ export function IssueEnvironmentsSection({);};+ const startMenu: EnvironmentStartMenuProps = {+ configs,+ machineFor: (runtimeId) => ({ title: machineTitle(runtimeId), offline: isOffline(runtimeId) }),+ runLabel,+ declaredState,+ onStart: (config, declared) =>+ runControl({ action: "start", body: { task_id: config.task_id, repo: declared.repo, name: declared.name } }),+ agent: startAgent,+ agentChoices: activeAgents,+ preparing: !!preparing || justRequested !== null,+ onAskAgent: askAgent,+ };++ // With nothing to list the section renders nothing, and starting the first+ // environment moves to the sidebar's "+" menu — only while something here+ // can actually start one or ask an agent to.+ const showsPreparing = !!(preparingShown || justRequested) && !!preparingAgentName;+ const empty = !!data && mainItems.length === 0 && ended.length === 0 && !showsPreparing;+ useIssueSidebarAddEntry("environments", empty && canStartEnvironment(startMenu) ? {+ order: 1,+ items: (+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>+ <Server className="text-muted-foreground" />+ {t(($) => $.environments.start_menu.trigger)}+ </DropdownMenuSubTrigger>+ <DropdownMenuSubContent className="w-80 max-w-(--available-width)">+ <EnvironmentStartMenuItems {...startMenu} />+ </DropdownMenuSubContent>+ </DropdownMenuSub>+ ),+ } : null);++ if (!data || empty) return null;+return (<div><IssueSidebarSectionHeader@@ -398,25 +443,11 @@ export function IssueEnvironmentsSection({{t(($) => $.environments.running_count, { count: running })}</span>) : undefined}- actions={- <EnvironmentStartMenu- configs={configs}- machineFor={(runtimeId) => ({ title: machineTitle(runtimeId), offline: isOffline(runtimeId) })}- runLabel={runLabel}- declaredState={declaredState}- onStart={(config, declared) =>- runControl({ action: "start", body: { task_id: config.task_id, repo: declared.repo, name: declared.name } })- }- agent={startAgent}- agentChoices={activeAgents}- preparing={!!preparing || justRequested !== null}- onAskAgent={askAgent}- />- }+ actions={<EnvironmentStartMenu {...startMenu} />}/>{open && (<div className="px-2">- {(preparingShown || justRequested) && preparingAgentName && (+ {showsPreparing && (<StatusRowicon={<Bot className="mt-px size-3.5 shrink-0 text-muted-foreground" />}title={t(($) => $.environments.preparing_title, { name: preparingAgentName })}diff --git a/packages/views/issues/components/issue-next-step.test.tsx b/packages/views/issues/components/issue-next-step.test.tsxnew file mode 100644index 0000000000..c1f9659e82--- /dev/null+++ b/packages/views/issues/components/issue-next-step.test.tsx@@ -0,0 +1,82 @@+import { fireEvent, render, screen } from "@testing-library/react";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { beforeEach, describe, expect, it, vi } from "vitest";+import { I18nProvider } from "@multica/core/i18n/react";+import { githubKeys } from "@multica/core/github";+import type { GitHubPullRequest, GitHubPullRequestState } from "@multica/core/types";+import enCommon from "../../locales/en/common.json";+import enIssues from "../../locales/en/issues.json";+import { IssueNextStep, type IssueNextStepReply } from "./issue-next-step";++const githubSettings = vi.hoisted(() => ({ enabled: true, prSidebar: true, coAuthor: true, autoLinkPRs: true }));+vi.mock("@multica/core/github", async (importOriginal) => ({+ ...(await importOriginal<typeof import("@multica/core/github")>()),+ useGitHubSettings: () => githubSettings,+}));++const TEST_RESOURCES = { en: { common: enCommon, issues: enIssues } };++const pr = (number: number, state: GitHubPullRequestState) =>+ ({ id: `pr-${number}`, number, state, title: `Fix ${number}`, html_url: `https://github.com/o/r/pull/${number}` }) as GitHubPullRequest;++function renderNextStep(+ status: string,+ { prs = [] as GitHubPullRequest[] | null, reply = null as IssueNextStepReply | null } = {},+) {+ const client = new QueryClient({ defaultOptions: { queries: { retry: false, staleTime: Infinity } } });+ if (prs) client.setQueryData(githubKeys.pullRequests("issue-1"), { pull_requests: prs, auto_complete: null });+ const result = render(+ <I18nProvider resources={TEST_RESOURCES} locale="en">+ <QueryClientProvider client={client}>+ <IssueNextStep issueId="issue-1" status={status} reply={reply} />+ </QueryClientProvider>+ </I18nProvider>,+ );+ return { ...result, client };+}++describe("IssueNextStep", () => {+ beforeEach(() => {+ Object.assign(githubSettings, { enabled: true, prSidebar: true });+ });++ it("asks for a review of the open PR while the issue is in review", () => {+ renderNextStep("in_review", { prs: [pr(1, "merged"), pr(2, "open")] });+ expect(screen.getByText("Ready for review")).toBeInTheDocument();+ expect(screen.getByText("#2 Fix 2")).toBeInTheDocument();+ expect(screen.getByRole("link", { name: "Review PR" })).toHaveAttribute("href", "https://github.com/o/r/pull/2");+ });++ it("stays quiet in review when no PR is open", () => {+ const { container } = renderNextStep("in_review", { prs: [pr(1, "draft"), pr(2, "merged")] });+ expect(container).toBeEmptyDOMElement();+ });++ it.each([+ ["the GitHub integration", { enabled: false, prSidebar: false }],+ ["the PR sidebar", { enabled: true, prSidebar: false }],+ ])("neither asks for nor fetches a review with %s turned off", (_, settings) => {+ Object.assign(githubSettings, settings);+ const { container } = renderNextStep("in_review", { prs: [pr(2, "open")] });+ expect(container).toBeEmptyDOMElement();++ const { client } = renderNextStep("in_review", { prs: null });+ expect(client.getQueryCache().find({ queryKey: githubKeys.pullRequests("issue-1") })?.isDisabled()).toBe(true);+ });++ it("offers to reply when a blocked issue is waiting on an agent", () => {+ const onReply = vi.fn();+ renderNextStep("blocked", { reply: { authorName: "Lambda", onReply } });+ expect(screen.getByText("Lambda is waiting for a reply")).toBeInTheDocument();+ fireEvent.click(screen.getByRole("button", { name: "Reply" }));+ expect(onReply).toHaveBeenCalledOnce();+ });++ it.each([+ ["blocked", null],+ ["todo", { authorName: "Lambda", onReply: () => {} }],+ ])("renders nothing for %s without a rule that applies", (status, reply) => {+ const { container } = renderNextStep(status, { prs: [pr(1, "open")], reply });+ expect(container).toBeEmptyDOMElement();+ });+});diff --git a/packages/views/issues/components/issue-next-step.tsx b/packages/views/issues/components/issue-next-step.tsxnew file mode 100644index 0000000000..9d6837a0f7--- /dev/null+++ b/packages/views/issues/components/issue-next-step.tsx@@ -0,0 +1,82 @@+"use client";++import type { ReactNode } from "react";+import { useQuery } from "@tanstack/react-query";+import { issuePullRequestsOptions, useGitHubSettings } from "@multica/core/github";+import { GitPullRequest, MessageSquare } from "@multica/ui/icons";+import { Button } from "@multica/ui/components/ui/button";+import { useT } from "../../i18n";++/** The comment a blocked issue is waiting on, when an agent wrote the latest one. */+export interface IssueNextStepReply {+ authorName: string;+ onReply: () => void;+}++/**+ * The overview card's "what does this need from me" line. Built-in rules only,+ * each backed by data the page already has: an issue in review with an open+ * PR asks for a review; a blocked issue whose latest comment came from an+ * agent asks for a reply. Anything else renders nothing.+ */+export function IssueNextStep({+ issueId,+ status,+ reply,+}: {+ issueId: string;+ status: string;+ reply: IssueNextStepReply | null;+}) {+ const { t } = useT("issues");+ // Off with the workspace's GitHub integration or its PR sidebar, the same+ // switch that hides the Pull requests section.+ const { prSidebar } = useGitHubSettings();+ const asksReview = status === "in_review" && prSidebar;+ const { data } = useQuery({ ...issuePullRequestsOptions(issueId), enabled: asksReview });+ const openPr = asksReview ? data?.pull_requests.find((pr) => pr.state === "open") : undefined;++ if (openPr) {+ return (+ <NextStep+ icon={<GitPullRequest className="size-3.5 text-success" />}+ title={t(($) => $.detail.next_step.review_title)}+ detail={`#${openPr.number} ${openPr.title}`}+ action={+ <Button size="xs" render={<a href={openPr.html_url} target="_blank" rel="noreferrer noopener" />}>+ {t(($) => $.detail.next_step.review_action)}+ </Button>+ }+ />+ );+ }+ if (status === "blocked" && reply) {+ return (+ <NextStep+ icon={<MessageSquare className="size-3.5 text-muted-foreground" />}+ title={t(($) => $.detail.next_step.reply_title, { name: reply.authorName })}+ action={+ <Button size="xs" variant="outline" onClick={reply.onReply}>+ {t(($) => $.detail.next_step.reply_action)}+ </Button>+ }+ />+ );+ }+ return null;+}++function NextStep({ icon, title, detail, action }: { icon: ReactNode; title: string; detail?: string; action: ReactNode }) {+ return (+ <div data-slot="issue-next-step" className="flex flex-col gap-2 px-4 pt-1 pb-1.5">+ <div className="flex min-w-0 items-start gap-2">+ <span className="flex h-5 shrink-0 items-center">{icon}</span>+ <div className="min-w-0 flex-1">+ <p className="text-label font-medium">{title}</p>+ {detail && <p className="truncate text-caption text-muted-foreground" title={detail}>{detail}</p>}+ </div>+ </div>+ <div className="pl-5.5">{action}</div>+ </div>+ );+}diff --git a/packages/views/issues/components/issue-sidebar-add-menu.tsx b/packages/views/issues/components/issue-sidebar-add-menu.tsxnew file mode 100644index 0000000000..7f8ef9e51a--- /dev/null+++ b/packages/views/issues/components/issue-sidebar-add-menu.tsx@@ -0,0 +1,104 @@+"use client";++import {+ createContext,+ Fragment,+ useCallback,+ useContext,+ useLayoutEffect,+ useState,+ type ReactNode,+} from "react";+import { Plus } from "@multica/ui/icons";+import { IconButton } from "@multica/ui/components/common/icon-button";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuSeparator,+ DropdownMenuTrigger,+} from "@multica/ui/components/ui/dropdown-menu";+import { useT } from "../../i18n";++/** Menu items an empty section offers from the sidebar's "+" menu. */+export interface IssueSidebarAddEntry {+ /** Position among the other entries; sidebar order. */+ order: number;+ items: ReactNode;+}++type Entries = ReadonlyMap<string, IssueSidebarAddEntry>;+type SetEntry = (key: string, entry: IssueSidebarAddEntry | null) => void;++// Two contexts: sections only set entries, so a change to the entries+// re-renders the menu without re-rendering the sections that offer them.+const SetEntryContext = createContext<SetEntry | null>(null);+const EntriesContext = createContext<Entries>(new Map());++export function IssueSidebarAddMenuProvider({ children }: { children: ReactNode }) {+ const [entries, setEntries] = useState<Entries>(() => new Map());+ const setEntry = useCallback<SetEntry>((key, entry) => {+ setEntries((current) => {+ if ((current.get(key) ?? null) === entry) return current;+ const next = new Map(current);+ if (entry) next.set(key, entry);+ else next.delete(key);+ return next;+ });+ }, []);+ return (+ <SetEntryContext.Provider value={setEntry}>+ <EntriesContext.Provider value={entries}>{children}</EntriesContext.Provider>+ </SetEntryContext.Provider>+ );+}++/**+ * Offers `entry` from the sidebar's "+" menu while it is non-null. A section+ * with nothing to list renders nothing, so its card can go, and hands the way+ * to add its first item to this menu instead. The items render in the menu+ * but keep the section's state and handlers, since the section stays mounted.+ */+export function useIssueSidebarAddEntry(key: string, entry: IssueSidebarAddEntry | null) {+ const setEntry = useContext(SetEntryContext);+ // Every render: the items close over the section's latest state. Only the+ // menu reads the entries, so this cannot feed back into the section. A+ // layout effect commits the "+" with the section that went empty, ready to+ // open, instead of a frame later with its menu still being set up.+ useLayoutEffect(() => {+ setEntry?.(key, entry);+ });+ useLayoutEffect(() => () => setEntry?.(key, null), [setEntry, key]);+}++/** The sidebar's "+": what empty sections offer to add. Absent when none do. */+export function IssueSidebarAddMenu() {+ const { t } = useT("issues");+ const entries = useContext(EntriesContext);+ if (entries.size === 0) return null;+ const sorted = [...entries.entries()].sort(([, a], [, b]) => a.order - b.order);++ return (+ <DropdownMenu>+ <DropdownMenuTrigger+ render={+ <IconButton+ variant="ghost"+ size="icon-xs"+ label={t(($) => $.detail.sidebar_add)}+ className="text-muted-foreground data-popup-open:bg-accent data-popup-open:text-foreground"+ >+ <Plus />+ </IconButton>+ }+ />+ <DropdownMenuContent align="end" className="w-64 max-w-(--available-width)">+ {sorted.map(([key, entry], index) => (+ <Fragment key={key}>+ {index > 0 && <DropdownMenuSeparator />}+ {entry.items}+ </Fragment>+ ))}+ </DropdownMenuContent>+ </DropdownMenu>+ );+}diff --git a/packages/views/issues/components/issue-sidebar-section.tsx b/packages/views/issues/components/issue-sidebar-section.tsxindex c7e7c28246..26e3d6156b 100644--- a/packages/views/issues/components/issue-sidebar-section.tsx+++ b/packages/views/issues/components/issue-sidebar-section.tsx@@ -25,7 +25,7 @@ export function IssueSidebarSectionHeader({id?: string;}) {return (- <div data-slot="issue-sidebar-section-header" className="mb-1 flex min-w-0 items-center gap-1 px-2">+ <div data-slot="issue-sidebar-section-header" className="mb-1 flex h-8 min-w-0 items-center gap-1 px-2">{collapsible ? <Buttonid={id}type="button"@@ -33,7 +33,7 @@ export function IssueSidebarSectionHeader({size="sm"aria-expanded={open}onClick={() => onOpenChange(!open)}- className={cn("min-w-0 flex-1 shrink justify-start px-[7px] font-medium aria-expanded:bg-transparent active:not-aria-[haspopup]:translate-y-0", !open && "text-muted-foreground")}+ className={cn("h-8 min-w-0 flex-1 shrink justify-start px-[7px] font-medium aria-expanded:bg-transparent active:not-aria-[haspopup]:translate-y-0", !open && "text-muted-foreground")}><span className="truncate">{title}</span><ChevronRight aria-hidden="true" className={cn("!size-3 shrink-0 text-faint-foreground transition-transform motion-reduce:transition-none", open && "rotate-90")} />@@ -44,7 +44,7 @@ export function IssueSidebarSectionHeader({</>)}</Button> : (- <div id={id} className={cn(buttonVariants({ variant: "ghost", size: "sm" }), "min-w-0 flex-1 shrink justify-start px-[7px] font-medium hover:bg-transparent dark:hover:bg-transparent")}>+ <div id={id} className={cn(buttonVariants({ variant: "ghost", size: "sm" }), "h-8 min-w-0 flex-1 shrink justify-start px-[7px] font-medium hover:bg-transparent dark:hover:bg-transparent")}><span className="truncate">{title}</span></div>)}@@ -54,12 +54,29 @@ export function IssueSidebarSectionHeader({);}-/** Shared spacing separates rendered sections without adding divider lines. */-export function IssueSidebarStack({ children, className }: { children: ReactNode; className?: string }) {- return <div className={cn("flex flex-col gap-6 [overflow-anchor:none] [&>*]:flow-root", className)}>{children}</div>;+/**+ * A card on the page canvas holding one or more sections. Sections keep their+ * own inset, so headers and rows land 16px inside the card's edge.+ */+export function IssueSidebarCard({ children, className }: { children: ReactNode; className?: string }) {+ return (+ <div+ data-slot="issue-sidebar-card"+ className={cn(+ "flex flex-col gap-3 rounded-xl bg-surface py-1.5 shadow-[var(--surface-card-shadow)] [overflow-anchor:none] [&>*]:flow-root",+ className,+ )}+ >+ {children}+ </div>+ );}-/** Fits labels to their content while reserving space for values and the hover gutter. */+/**+ * Fits labels to their content while reserving space for values and the hover+ * gutter. The label column never drops below 4.5rem, so grids in different+ * cards start their values on the same line.+ */export function IssueSidebarPropertyGrid({ children }: { children: ReactNode }) {- return <div className="grid grid-cols-[fit-content(min(44%,11rem))_minmax(0,1fr)] gap-x-2 gap-y-1 px-4">{children}</div>;+ return <div className="grid grid-cols-[fit-content(min(44%,11rem))_minmax(0,1fr)] gap-x-2 gap-y-1 px-4 [&_[data-slot=prop-row-label]]:min-w-18">{children}</div>;}diff --git a/packages/views/issues/components/issue-sidebar-settings.test.tsx b/packages/views/issues/components/issue-sidebar-settings.test.tsxindex 3d0ef0e351..8ac30b92f1 100644--- a/packages/views/issues/components/issue-sidebar-settings.test.tsx+++ b/packages/views/issues/components/issue-sidebar-settings.test.tsx@@ -1,5 +1,5 @@import { act, fireEvent, render, screen, within } from "@testing-library/react";-import { beforeEach, describe, expect, it, vi } from "vitest";+import { beforeEach, describe, expect, it } from "vitest";import { I18nProvider } from "@multica/core/i18n/react";import {ISSUE_SIDEBAR_SECTIONS,@@ -8,7 +8,9 @@ import {} from "@multica/core/issues/stores";import enCommon from "../../locales/en/common.json";import enIssues from "../../locales/en/issues.json";-import { IssueSidebarSections, letSidebarSettingsDragKeysThrough } from "./issue-sidebar-settings";+import { DropdownMenuItem } from "@multica/ui/components/ui/dropdown-menu";+import { useIssueSidebarAddEntry } from "./issue-sidebar-add-menu";+import { IssueSidebarSections } from "./issue-sidebar-settings";const TEST_RESOURCES = { en: { common: enCommon, issues: enIssues } };@@ -21,12 +23,13 @@ const available = ISSUE_SIDEBAR_SECTIONS.filter((id) => id !== "plugins");function renderSections(revealed?: IssueSidebarSection[]) {return render(<I18nProvider resources={TEST_RESOURCES} locale="en">- <IssueSidebarSections sections={sections} available={available} revealed={revealed} />+ <IssueSidebarSections sections={sections} available={available} revealed={revealed} overview={<p>overview</p>} /></I18nProvider>,);}const renderedOrder = () => screen.getAllByText(/^body:/).map((el) => el.textContent!.slice("body:".length));+const cardOf = (text: string) => screen.getByText(text).closest("[data-slot=issue-sidebar-card]");async function openSettings() {fireEvent.click(screen.getByRole("button", { name: "Customize sidebar" }));@@ -36,24 +39,62 @@ async function openSettings() {describe("IssueSidebarSections", () => {beforeEach(() => useIssueSidebarSectionsStore.getState().reset());- it("renders the available sections in the default order", () => {+ it("puts the overview first, then groups related sections into cards", () => {renderSections();expect(renderedOrder()).toEqual(available.filter((id) => id !== "apps"));+ const cards = document.querySelectorAll("[data-slot=issue-sidebar-card]");+ expect(cards[0]).toHaveTextContent("overview");+ expect(cardOf("body:pull_requests")).toBe(cardOf("body:environments"));+ expect(cardOf("body:parent")).toBe(cardOf("body:duplicates"));+ expect(cardOf("body:pull_requests")).not.toBe(cardOf("body:parent"));+ // Creator and timestamps are small print under the cards, not a card.+ expect(cardOf("body:details")).toBeNull();});- it("follows the saved order and leaves hidden sections out", () => {+ it("leaves hidden sections out, and drops a card once all of its sections are hidden", () => {act(() => {- useIssueSidebarSectionsStore.getState().setOrder(["execution_log", ...ISSUE_SIDEBAR_SECTIONS]);- useIssueSidebarSectionsStore.getState().setHidden("details", true);+ useIssueSidebarSectionsStore.getState().setHidden("execution_log", true);useIssueSidebarSectionsStore.getState().setHidden("metadata", true);});- renderSections();+ const { container } = renderSections();- expect(renderedOrder().slice(0, 2)).toEqual(["execution_log", "properties"]);- expect(screen.queryByText("body:details")).toBeNull();+ expect(screen.queryByText("body:execution_log")).toBeNull();+ expect(container.querySelector('[data-issue-sidebar-section="execution_log"]')).toBeNull();expect(screen.getByRole("button", { name: /2 sections hidden/ })).toBeInTheDocument();});+ it("collapses the Output card while it has nothing to show, offering its actions from the strip's + menu", async () => {+ function EmptyOutput({ id, label }: { id: string; label: string }) {+ useIssueSidebarAddEntry(id, { order: 0, items: <DropdownMenuItem>{label}</DropdownMenuItem> });+ return null;+ }+ render(+ <I18nProvider resources={TEST_RESOURCES} locale="en">+ <IssueSidebarSections+ sections={{+ ...sections,+ pull_requests: <EmptyOutput id="pull_requests" label="Link pull request" />,+ environments: <EmptyOutput id="environments" label="Start an environment" />,+ deliverables: null,+ }}+ available={available}+ overview={<p>overview</p>}+ />+ </I18nProvider>,+ );+ const outputCard = document.querySelector('[data-issue-sidebar-section="pull_requests"]')!.parentElement!;+ // The card hides itself once every section slot in it is empty.+ expect([...outputCard.children].every((slot) => slot.childNodes.length === 0)).toBe(true);+ fireEvent.click(screen.getByRole("button", { name: "Add" }));+ expect(await screen.findByRole("menuitem", { name: "Link pull request" })).toBeInTheDocument();+ expect(screen.getByRole("menuitem", { name: "Start an environment" })).toBeInTheDocument();+ });++ it("leaves the + menu out while no section has an action to offer", () => {+ renderSections();+ expect(screen.queryByRole("button", { name: "Add" })).toBeNull();+ });+it("shows a hidden section the reader jumped to", () => {act(() => useIssueSidebarSectionsStore.getState().setHidden("wakeups", true));renderSections(["wakeups"]);@@ -61,11 +102,13 @@ describe("IssueSidebarSections", () => {expect(screen.queryByRole("button", { name: /hidden/ })).toBeNull();});- it("lists the available sections, marks the empty and locked ones, and hides on toggle", async () => {+ it("lists the available sections by card, marks the empty and locked ones, and hides on toggle", async () => {renderSections();const dialog = await openSettings();expect(within(dialog).queryByRole("switch", { name: "Plugins" })).toBeNull();+ expect(within(dialog).queryByRole("button", { name: /Reorder/ })).toBeNull();+ expect(within(dialog).getAllByRole("separator")).toHaveLength(5);expect(within(dialog).getByRole("switch", { name: "Properties" })).toHaveAttribute("aria-disabled", "true");expect(within(dialog).getByText("Always shown")).toBeInTheDocument();expect(within(dialog).getByRole("switch", { name: "Apps" }).closest("li")).toHaveTextContent("None on this issue");@@ -88,23 +131,3 @@ describe("IssueSidebarSections", () => {expect(within(dialog).getByRole("switch", { name: "Metadata" })).not.toBeChecked();});});--describe("letSidebarSettingsDragKeysThrough", () => {- const keyDownOn = (target: EventTarget) => {- const preventBaseUIHandler = vi.fn();- letSidebarSettingsDragKeysThrough({ target, preventBaseUIHandler } as unknown as Parameters<- typeof letSidebarSettingsDragKeysThrough- >[0]);- return preventBaseUIHandler;- };-- it("lets keys out of the dialog only while a settings row is held", () => {- const handle = document.createElement("button");- handle.setAttribute("data-sidebar-settings-handle", "");- expect(keyDownOn(handle)).not.toHaveBeenCalled();-- handle.setAttribute("aria-pressed", "true");- expect(keyDownOn(handle)).toHaveBeenCalledOnce();- expect(keyDownOn(document.createElement("button"))).not.toHaveBeenCalled();- });-});diff --git a/packages/views/issues/components/issue-sidebar-settings.tsx b/packages/views/issues/components/issue-sidebar-settings.tsxindex cebe22ef9d..7391491a11 100644--- a/packages/views/issues/components/issue-sidebar-settings.tsx+++ b/packages/views/issues/components/issue-sidebar-settings.tsx@@ -1,51 +1,24 @@"use client";-import { useRef, useState, type KeyboardEvent, type ReactElement, type ReactNode } from "react";-import {- DndContext,- KeyboardSensor,- PointerSensor,- closestCenter,- useSensor,- useSensors,- type DragEndEvent,-} from "@dnd-kit/core";-import { restrictToParentElement, restrictToVerticalAxis } from "@dnd-kit/modifiers";-import {- SortableContext,- arrayMove,- sortableKeyboardCoordinates,- useSortable,- verticalListSortingStrategy,-} from "@dnd-kit/sortable";-import { CSS } from "@dnd-kit/utilities";-import { EyeOff, GripVertical, RotateCcw, SlidersHorizontal } from "@multica/ui/icons";+import { Fragment, useRef, useState, type ReactElement, type ReactNode } from "react";+import { EyeOff, RotateCcw, SlidersHorizontal } from "@multica/ui/icons";import { IconButton } from "@multica/ui/components/common/icon-button";import { Popover, PopoverContent, PopoverTrigger } from "@multica/ui/components/ui/popover";import { Switch } from "@multica/ui/components/ui/switch";import { cn } from "@multica/ui/lib/utils";import {ISSUE_SIDEBAR_ALWAYS_SHOWN,+ ISSUE_SIDEBAR_GROUPS,selectIssueSidebarCustomized,- selectIssueSidebarOrder,useIssueSidebarSectionsStore,type IssueSidebarSection,} from "@multica/core/issues/stores";import { useT } from "../../i18n";-import { IssueSidebarStack } from "./issue-sidebar-section";--const DRAG_MODIFIERS = [restrictToVerticalAxis, restrictToParentElement];+import { IssueSidebarAddMenu, IssueSidebarAddMenuProvider } from "./issue-sidebar-add-menu";+import { IssueSidebarCard } from "./issue-sidebar-section";-/**- * Keyboard reordering listens for arrow keys on the document, but a Base UI- * dialog (the mobile sidebar sheet) stops them from leaving it. Pass this as- * the dialog popup's onKeyDown to let them through while a row is held.- */-export function letSidebarSettingsDragKeysThrough(event: KeyboardEvent & { preventBaseUIHandler: () => void }) {- if (event.target instanceof Element && event.target.closest('[data-sidebar-settings-handle][aria-pressed="true"]')) {- event.preventBaseUIHandler();- }-}+const CARD_GROUPS = ISSUE_SIDEBAR_GROUPS.slice(0, -1);+const FOOTER_GROUP = ISSUE_SIDEBAR_GROUPS[ISSUE_SIDEBAR_GROUPS.length - 1]!;export function useIssueSidebarSectionLabels(): Record<IssueSidebarSection, string> {const { t } = useT("issues");@@ -68,18 +41,22 @@ export function useIssueSidebarSectionLabels(): Record<IssueSidebarSection, stri}/**- * The issue sidebar's sections in the reader's order, minus the ones they- * hid. Each section sits in its own slot, which collapses while the section- * renders nothing; that is how settings tells an empty section from a shown one.+ * The issue sidebar: a strip level with the page header holding the "+" menu+ * and settings, then the overview card and one card per group of related+ * sections, minus the sections the reader hid. Each section sits in its own slot, which collapses while the+ * section renders nothing; a card whose slots all collapse goes with them.*/export function IssueSidebarSections({sections,available,+ overview,revealed = [],onRevealEnd,}: {sections: Record<IssueSidebarSection, ReactNode>;available: readonly IssueSidebarSection[];+ /** The first card: what state the issue is in, who has it, what it needs next. */+ overview?: ReactNode;/*** Hidden sections to show anyway, such as the one a header chip jumped to.* Switching one of them in settings ends its reveal, so the switch wins.@@ -88,49 +65,60 @@ export function IssueSidebarSections({onRevealEnd?: (section: IssueSidebarSection) => void;}) {const { t } = useT("issues");- const order = useIssueSidebarSectionsStore(selectIssueSidebarOrder);const hidden = useIssueSidebarSectionsStore((s) => s.hidden);const containerRef = useRef<HTMLDivElement>(null);- const isShown = (id: IssueSidebarSection) => !hidden.includes(id) || revealed.includes(id);- const visible = order.filter((id) => available.includes(id) && isShown(id));+ const isShown = (id: IssueSidebarSection) => available.includes(id) && (!hidden.includes(id) || revealed.includes(id));const hiddenCount = available.filter((id) => !isShown(id)).length;const onShownChange = (id: IssueSidebarSection) => {if (revealed.includes(id)) onRevealEnd?.(id);};const getEmptySections = () =>new Set(- visible.filter(- (id) => containerRef.current?.querySelector(`[data-issue-sidebar-section="${id}"]`)?.childElementCount === 0,+ available.filter(+ (id) => isShown(id) && containerRef.current?.querySelector(`[data-issue-sidebar-section="${id}"]`)?.childElementCount === 0,),);+ const slots = (group: readonly IssueSidebarSection[]) =>+ group.filter(isShown).map((id) => (+ <div key={id} data-issue-sidebar-section={id} className="empty:hidden">+ {sections[id]}+ </div>+ ));return (- <div ref={containerRef} data-mc="issue-properties" className="relative">- <IssueSidebarSettings- available={available}- getEmptySections={getEmptySections}- onShownChange={onShownChange}- trigger={- <IconButton- variant="ghost"- size="icon-xs"- label={t(($) => $.detail.sidebar_settings.open)}- className="absolute top-0.5 right-2 z-10 text-muted-foreground data-popup-open:bg-accent data-popup-open:text-foreground"- >- <SlidersHorizontal />- </IconButton>- }- />- {/* The first header to render shares its row with the settings button. */}- <IssueSidebarStack className="[&>:nth-child(1_of_:not(:empty))>*>[data-slot=issue-sidebar-section-header]]:pr-9">- {visible.map((id) => (- <div key={id} data-issue-sidebar-section={id} className="empty:hidden">- {sections[id]}- </div>- ))}- {hiddenCount > 0 && (- <div className="px-2">+ <IssueSidebarAddMenuProvider>+ <div ref={containerRef} data-mc="issue-properties">+ <div className="sticky top-0 z-10 flex h-12 items-center justify-end gap-1 border-b bg-background px-3">+ <IssueSidebarAddMenu />+ <IssueSidebarSettings+ available={available}+ getEmptySections={getEmptySections}+ onShownChange={onShownChange}+ trigger={+ <IconButton+ variant="ghost"+ size="icon-xs"+ label={t(($) => $.detail.sidebar_settings.open)}+ className="text-muted-foreground data-popup-open:bg-accent data-popup-open:text-foreground"+ >+ <SlidersHorizontal />+ </IconButton>+ }+ />+ </div>+ <div className="flex flex-col gap-2 p-2">+ {overview && <IssueSidebarCard>{overview}</IssueSidebarCard>}+ {CARD_GROUPS.map((group) => {+ const shown = slots(group);+ return shown.length > 0 && (+ <IssueSidebarCard key={group[0]} className="[&:not(:has(>:not(:empty)))]:hidden">+ {shown}+ </IssueSidebarCard>+ );+ })}+ <div className="flex flex-col gap-2 pt-1 [&>*]:flow-root">{slots(FOOTER_GROUP)}</div>+ {hiddenCount > 0 && (<IssueSidebarSettingsavailable={available}getEmptySections={getEmptySections}@@ -140,7 +128,7 @@ export function IssueSidebarSections({trigger={<buttontype="button"- className="flex h-7 max-w-full items-center gap-1.5 rounded-md px-2 text-caption text-muted-foreground transition-colors hover:bg-accent/50"+ className="flex h-7 max-w-full items-center gap-1.5 self-start rounded-md px-2 text-caption text-muted-foreground transition-colors hover:bg-accent/50"><EyeOff className="size-3.5 shrink-0" /><span className="truncate">{t(($) => $.detail.sidebar_settings.hidden_count, { count: hiddenCount })}</span>@@ -149,16 +137,16 @@ export function IssueSidebarSections({</button>}/>- </div>- )}- </IssueSidebarStack>- </div>+ )}+ </div>+ </div>+ </IssueSidebarAddMenuProvider>);}/**- * Chooses which sections the issue sidebar shows and in what order. Changes- * apply as they are made and hold for every issue on this device.+ * Chooses which sections the issue sidebar shows, listed by the card they sit+ * in. Changes apply as they are made and hold for every issue on this device.*/export function IssueSidebarSettings({available,@@ -179,26 +167,13 @@ export function IssueSidebarSettings({}) {const { t } = useT("issues");const labels = useIssueSidebarSectionLabels();- const fullOrder = useIssueSidebarSectionsStore(selectIssueSidebarOrder);const hidden = useIssueSidebarSectionsStore((s) => s.hidden);const customized = useIssueSidebarSectionsStore(selectIssueSidebarCustomized);- const setOrder = useIssueSidebarSectionsStore((s) => s.setOrder);const setHidden = useIssueSidebarSectionsStore((s) => s.setHidden);const reset = useIssueSidebarSectionsStore((s) => s.reset);const [empty, setEmpty] = useState<ReadonlySet<IssueSidebarSection>>(new Set());- const sensors = useSensors(- useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),- useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }),- );- const order = fullOrder.filter((id) => available.includes(id));-- const onDragEnd = ({ active, over }: DragEndEvent) => {- if (!over || active.id === over.id) return;- const from = fullOrder.indexOf(active.id as IssueSidebarSection);- const to = fullOrder.indexOf(over.id as IssueSidebarSection);- setOrder(arrayMove([...fullOrder], from, to));- };+ const groups = ISSUE_SIDEBAR_GROUPS.map((group) => group.filter((id) => available.includes(id))).filter((group) => group.length > 0);return (<Popover onOpenChange={(open) => open && setEmpty(getEmptySections?.() ?? new Set())}>@@ -216,10 +191,11 @@ export function IssueSidebarSettings({{t(($) => $.detail.sidebar_settings.reset)}</button></div>- <DndContext sensors={sensors} collisionDetection={closestCenter} modifiers={DRAG_MODIFIERS} onDragEnd={onDragEnd}>- <SortableContext items={order} strategy={verticalListSortingStrategy}>- <ul className="relative flex min-h-0 flex-col overflow-y-auto">- {order.map((id) => {+ <ul className="flex min-h-0 flex-col overflow-y-auto">+ {groups.map((group, i) => (+ <Fragment key={group[0]}>+ {i > 0 && <li role="separator" className="mx-2 my-1 h-px shrink-0 bg-border" />}+ {group.map((id) => {const locked = ISSUE_SIDEBAR_ALWAYS_SHOWN.includes(id);const shown = !hidden.includes(id);const note = locked@@ -228,23 +204,25 @@ export function IssueSidebarSettings({? t(($) => $.detail.sidebar_settings.empty): null;return (- <SectionRow- key={id}- id={id}- label={labels[id]}- note={note}- shown={shown}- locked={locked}- onShownChange={(next) => {- setHidden(id, !next);- onShownChange?.(id, next);- }}- />+ <li key={id} className="flex h-8 shrink-0 items-center gap-1.5 rounded-md px-2 text-label hover:bg-accent/50">+ <span className={cn("min-w-0 flex-1 truncate", !shown && "text-muted-foreground")}>{labels[id]}</span>+ {note && <span className="shrink-0 text-micro text-faint-foreground">{note}</span>}+ <Switch+ size="sm"+ checked={shown}+ disabled={locked}+ aria-label={labels[id]}+ onCheckedChange={(next) => {+ setHidden(id, !next);+ onShownChange?.(id, next);+ }}+ />+ </li>);})}- </ul>- </SortableContext>- </DndContext>+ </Fragment>+ ))}+ </ul><p className="-mx-1 mt-1 shrink-0 border-t px-3 pt-2 pb-1.5 text-micro text-muted-foreground">{t(($) => $.detail.sidebar_settings.footer)}</p>@@ -252,47 +230,3 @@ export function IssueSidebarSettings({</Popover>);}--function SectionRow({- id,- label,- note,- shown,- locked,- onShownChange,-}: {- id: IssueSidebarSection;- label: string;- note: string | null;- shown: boolean;- locked: boolean;- onShownChange: (shown: boolean) => void;-}) {- const { t } = useT("issues");- const { attributes, listeners, setNodeRef, setActivatorNodeRef, transform, transition, isDragging } = useSortable({ id });- return (- <li- ref={setNodeRef}- style={{ transform: CSS.Translate.toString(transform), transition }}- className={cn(- "flex h-8 shrink-0 items-center gap-1.5 rounded-md pr-2 pl-1 text-label",- isDragging ? "relative z-10 bg-popover shadow-[var(--menu-shadow)] ring-1 ring-surface-border" : "hover:bg-accent/50",- )}- >- <button- ref={setActivatorNodeRef}- type="button"- {...attributes}- {...listeners}- data-sidebar-settings-handle=""- aria-label={t(($) => $.detail.sidebar_settings.drag_handle, { section: label })}- className="flex size-5 shrink-0 cursor-grab touch-none items-center justify-center rounded-sm text-faint-foreground outline-none hover:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring active:cursor-grabbing"- >- <GripVertical className="size-3.5" />- </button>- <span className={cn("min-w-0 flex-1 truncate", !shown && "text-muted-foreground")}>{label}</span>- {note && <span className="shrink-0 text-micro text-faint-foreground">{note}</span>}- <Switch size="sm" checked={shown} disabled={locked} onCheckedChange={onShownChange} aria-label={label} />- </li>- );-}diff --git a/packages/views/issues/components/pull-requests-section.test.tsx b/packages/views/issues/components/pull-requests-section.test.tsxindex f0bd85c386..709a91acb9 100644--- a/packages/views/issues/components/pull-requests-section.test.tsx+++ b/packages/views/issues/components/pull-requests-section.test.tsx@@ -3,13 +3,14 @@ import { fireEvent, render, screen, waitFor } from "@testing-library/react";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import { I18nProvider } from "@multica/core/i18n/react";import { ApiError } from "@multica/core/api";-import type { PRAutoComplete } from "@multica/core/types";+import type { GitHubPullRequest, PRAutoComplete } from "@multica/core/types";import enCommon from "../../locales/en/common.json";import enIssues from "../../locales/en/issues.json";const TEST_RESOURCES = { en: { common: enCommon, issues: enIssues } };let queryFails = false;+let mockPullRequests: GitHubPullRequest[] = [];let mockAutoComplete: PRAutoComplete | null = null;vi.mock("@multica/core/github/queries", async () => {const actual = await vi.importActual<typeof import("@multica/core/github/queries")>(@@ -21,7 +22,7 @@ vi.mock("@multica/core/github/queries", async () => {queryKey: ["github", "pull-requests", issueId],queryFn: async () => {if (queryFails) throw new Error("Offline");- return { pull_requests: [], auto_complete: mockAutoComplete };+ return { pull_requests: mockPullRequests, auto_complete: mockAutoComplete };},enabled: !!issueId,}),@@ -35,6 +36,11 @@ vi.mock("@multica/core/api", async (importOriginal) => ({...(await importOriginal<typeof import("@multica/core/api")>()),api: apiMock,}));+const toastError = vi.hoisted(() => vi.fn());+vi.mock("sonner", async (importOriginal) => {+ const actual = await importOriginal<typeof import("sonner")>();+ return { ...actual, toast: Object.assign(vi.fn(), actual.toast, { error: toastError }) };+});const navigatePush = vi.hoisted(() => vi.fn());vi.mock("../../navigation", () => ({useNavigation: () => ({ push: navigatePush }),@@ -48,6 +54,7 @@ vi.mock("@multica/core/paths", async (importOriginal) => ({useCurrentWorkspace: () => ({ id: "ws-1", slug: "acme", settings: mockWorkspaceSettings }),}));+import { IssueSidebarAddMenu, IssueSidebarAddMenuProvider } from "./issue-sidebar-add-menu";import { PullRequestsSection } from "./pull-requests-section";function renderSection(cachedDecision?: PRAutoComplete) {@@ -58,12 +65,34 @@ function renderSection(cachedDecision?: PRAutoComplete) {return render(<QueryClientProvider client={qc}><I18nProvider resources={TEST_RESOURCES} locale="en">- <PullRequestsSection issueId="issue-1" identifier="MUL-1" open onOpenChange={() => {}} />+ <IssueSidebarAddMenuProvider>+ <IssueSidebarAddMenu />+ <div data-testid="section">+ <PullRequestsSection issueId="issue-1" identifier="MUL-1" open onOpenChange={() => {}} />+ </div>+ </IssueSidebarAddMenuProvider></I18nProvider></QueryClientProvider>,);}+/** The sidebar's "+" menu, where an issue with no PR offers the section's actions. */+async function openAddMenu() {+ fireEvent.click(await screen.findByRole("button", { name: "Add" }));+}++/** With no PR linked, linking starts from the "+" menu and continues in a dialog. */+async function openLinkForm() {+ await openAddMenu();+ fireEvent.click(await screen.findByRole("menuitem", { name: "Link pull request" }));+ return screen.findByRole("textbox", { name: "Link pull request" });+}++const linkedPR = {+ id: "pr-7", provider: "github", workspace_id: "ws-1", repo_owner: "acme", repo_name: "widget", number: 7,+ title: "Add widget", state: "open", html_url: "https://github.com/acme/widget/pull/7", branch: "mul-1",+} as GitHubPullRequest;+const decision: PRAutoComplete = {state: "none",pull_request_ids: [],@@ -74,25 +103,54 @@ const decision: PRAutoComplete = {describe("PullRequestsSection (MUL-7429)", () => {beforeEach(() => {queryFails = false;+ mockPullRequests = [];mockAutoComplete = decision;mockWorkspaceSettings = {};apiMock.linkIssuePullRequest.mockReset();apiMock.setIssuePRAutoComplete.mockReset();navigatePush.mockReset();+ toastError.mockReset();});- it("keeps the empty title static and retains linking without redundant copy", async () => {+ it("renders nothing while no PR is linked and offers the section's actions from the + menu", async () => {renderSection();- expect(await screen.findByRole("button", { name: "Link pull request" })).toBeVisible();- expect(screen.queryByRole("button", { name: "Pull requests" })).not.toBeInTheDocument();+ await openAddMenu();+ expect(await screen.findByRole("menuitem", { name: "Link pull request" })).toBeInTheDocument();+ expect(screen.getByRole("menuitem", { name: "Keep status when PRs merge" })).toBeInTheDocument();+ expect(screen.getByTestId("section")).toBeEmptyDOMElement();expect(screen.queryByText(enIssues.detail.pull_requests_empty_title)).not.toBeInTheDocument();});+ it("opens the + menu on a click the moment it appears", async () => {+ renderSection();+ await new Promise<void>((resolve) => {+ const observer = new MutationObserver(() => {+ const add = document.querySelector<HTMLElement>('button[aria-label="Add"]');+ if (!add) return;+ observer.disconnect();+ fireEvent.click(add);+ resolve();+ });+ observer.observe(document.body, { subtree: true, childList: true });+ });+ expect(await screen.findByRole("menuitem", { name: "Keep status when PRs merge" })).toBeInTheDocument();+ });++ it("shows the section header with its actions once a PR is linked, and leaves the + menu", async () => {+ mockPullRequests = [linkedPR];+ renderSection();+ expect(await screen.findByRole("button", { name: /^Pull requests/ })).toBeVisible();+ expect(screen.getByRole("button", { name: "Link pull request" })).toBeVisible();+ expect(screen.getByRole("button", { name: "Pull request automation" })).toBeVisible();+ expect(screen.queryByRole("button", { name: "Add" })).toBeNull();+ });+it("keeps a retry entry when loading fails with no cached PRs", async () => {queryFails = true;renderSection();expect(await screen.findByRole("button", { name: "Could not load. Retry" })).toBeVisible();expect(screen.queryByRole("button", { name: "Link pull request" })).not.toBeInTheDocument();+ expect(screen.queryByRole("button", { name: "Add" })).toBeNull();});it("retains linking after a failed refresh when cached data confirms backend support", async () => {@@ -105,8 +163,7 @@ describe("PullRequestsSection (MUL-7429)", () => {it("links a pasted PR URL", async () => {apiMock.linkIssuePullRequest.mockResolvedValue({ pull_requests: [], auto_complete: decision });renderSection();- fireEvent.click(await screen.findByRole("button", { name: "Link pull request" }));- fireEvent.change(await screen.findByRole("textbox", { name: "Link pull request" }), {+ fireEvent.change(await openLinkForm(), {target: { value: "https://github.com/acme/widget/pull/41" },});expect(screen.getByText("PRs with MUL-1 in the title or branch name link automatically.")).toBeInTheDocument();@@ -118,14 +175,28 @@ describe("PullRequestsSection (MUL-7429)", () => {);});- it("accepts a link pasted without a scheme", async () => {- apiMock.linkIssuePullRequest.mockResolvedValue({ pull_requests: [], auto_complete: decision });+ it("links from the section header once a PR is linked", async () => {+ mockPullRequests = [linkedPR];+ apiMock.linkIssuePullRequest.mockResolvedValue({ pull_requests: [linkedPR], auto_complete: decision });renderSection();fireEvent.click(await screen.findByRole("button", { name: "Link pull request" }));fireEvent.change(await screen.findByRole("textbox", { name: "Link pull request" }), {+ target: { value: "https://github.com/acme/widget/pull/42" },+ });+ fireEvent.click(screen.getByRole("button", { name: "Link" }));+ await waitFor(() =>+ expect(apiMock.linkIssuePullRequest).toHaveBeenCalledWith("issue-1", { url: "https://github.com/acme/widget/pull/42" }),+ );+ });++ it("accepts a link pasted without a scheme", async () => {+ apiMock.linkIssuePullRequest.mockResolvedValue({ pull_requests: [], auto_complete: decision });+ renderSection();+ const input = await openLinkForm();+ fireEvent.change(input, {target: { value: "github.com/acme/widget/pull/41/files" },});- fireEvent.submit(screen.getByRole("textbox", { name: "Link pull request" }).closest("form")!);+ fireEvent.submit(input.closest("form")!);await waitFor(() =>expect(apiMock.linkIssuePullRequest).toHaveBeenCalledWith("issue-1", { url: "github.com/acme/widget/pull/41/files" }),);@@ -134,8 +205,7 @@ describe("PullRequestsSection (MUL-7429)", () => {it("explains a PR Multica has not received", async () => {apiMock.linkIssuePullRequest.mockRejectedValue(new ApiError("not found", 404, "Not Found"));renderSection();- fireEvent.click(await screen.findByRole("button", { name: "Link pull request" }));- fireEvent.change(await screen.findByRole("textbox", { name: "Link pull request" }), {+ fireEvent.change(await openLinkForm(), {target: { value: "https://github.com/acme/widget/pull/999" },});fireEvent.click(screen.getByRole("button", { name: "Link" }));@@ -144,7 +214,18 @@ describe("PullRequestsSection (MUL-7429)", () => {);});+ // A PR that is already merged when it is linked moves the issue inside the+ // link request, so keeping the status must be settable before any PR.+ it("keeps this issue's status on merge before the first PR is linked", async () => {+ apiMock.setIssuePRAutoComplete.mockResolvedValue({ pull_requests: [], auto_complete: { ...decision, issue_disabled: true } });+ renderSection();+ await openAddMenu();+ fireEvent.click(await screen.findByRole("menuitem", { name: "Keep status when PRs merge" }));+ await waitFor(() => expect(apiMock.setIssuePRAutoComplete).toHaveBeenCalledWith("issue-1", true));+ });+it("keeps this issue's status on merge from the section menu", async () => {+ mockPullRequests = [linkedPR];apiMock.setIssuePRAutoComplete.mockResolvedValue({ pull_requests: [], auto_complete: { ...decision, issue_disabled: true } });renderSection();fireEvent.click(await screen.findByRole("button", { name: "Pull request automation" }));@@ -152,9 +233,31 @@ describe("PullRequestsSection (MUL-7429)", () => {await waitFor(() => expect(apiMock.setIssuePRAutoComplete).toHaveBeenCalledWith("issue-1", true));});- it("opens the GitHub setting from the section menu", async () => {+ // The menu closes, unmounting the item, before the request fails; the+ // failure must still be reported, or a merged PR linked next would move the+ // issue the reader meant to keep.+ it("reports a failed save of keep-status chosen from the + menu after the menu closed", async () => {+ apiMock.setIssuePRAutoComplete.mockRejectedValue(new Error("Offline"));+ renderSection();+ await openAddMenu();+ fireEvent.click(await screen.findByRole("menuitem", { name: "Keep status when PRs merge" }));+ await waitFor(() => expect(screen.queryByRole("menu")).toBeNull());+ await waitFor(() => expect(toastError).toHaveBeenCalledWith(enIssues.pr_automation.update_failed));+ });++ it("reports a failed save of keep-status chosen from the section menu after the menu closed", async () => {+ mockPullRequests = [linkedPR];+ apiMock.setIssuePRAutoComplete.mockRejectedValue(new Error("Offline"));renderSection();fireEvent.click(await screen.findByRole("button", { name: "Pull request automation" }));+ fireEvent.click(await screen.findByRole("menuitem", { name: "Keep status when PRs merge" }));+ await waitFor(() => expect(screen.queryByRole("menu")).toBeNull());+ await waitFor(() => expect(toastError).toHaveBeenCalledWith(enIssues.pr_automation.update_failed));+ });++ it("opens the GitHub setting from the + menu", async () => {+ renderSection();+ await openAddMenu();fireEvent.click(await screen.findByRole("menuitem", { name: "PR merge settings" }));expect(navigatePush).toHaveBeenCalledWith("/acme/settings?tab=code");});@@ -162,7 +265,7 @@ describe("PullRequestsSection (MUL-7429)", () => {it("offers only the settings link while the workspace leaves status alone", async () => {mockAutoComplete = { ...decision, workspace_enabled: false };renderSection();- fireEvent.click(await screen.findByRole("button", { name: "Pull request automation" }));+ await openAddMenu();expect(await screen.findByRole("menuitem", { name: "PR merge settings" })).toBeInTheDocument();expect(screen.queryByRole("menuitem", { name: "Keep status when PRs merge" })).toBeNull();});@@ -170,16 +273,16 @@ describe("PullRequestsSection (MUL-7429)", () => {it("drops the auto-link hint when the workspace does not auto-link PRs", async () => {mockWorkspaceSettings = { github_auto_link_prs_enabled: false };renderSection();- fireEvent.click(await screen.findByRole("button", { name: "Link pull request" }));- await screen.findByRole("textbox", { name: "Link pull request" });+ await openLinkForm();expect(screen.queryByText("PRs with MUL-1 in the title or branch name link automatically.")).toBeNull();});- it("hides the actions on a backend without auto-complete", async () => {+ it("offers nothing on a backend without auto-complete", async () => {mockAutoComplete = null;renderSection();await waitFor(() => expect(screen.queryByText("Pull requests")).not.toBeInTheDocument());expect(screen.queryByRole("button", { name: "Link pull request" })).toBeNull();expect(screen.queryByRole("button", { name: "Pull request automation" })).toBeNull();+ expect(screen.queryByRole("button", { name: "Add" })).toBeNull();});});diff --git a/packages/views/issues/components/pull-requests-section.tsx b/packages/views/issues/components/pull-requests-section.tsxindex 02ce748bae..37ffc7d881 100644--- a/packages/views/issues/components/pull-requests-section.tsx+++ b/packages/views/issues/components/pull-requests-section.tsx@@ -5,7 +5,7 @@ import { IssueSidebarSectionHeader } from "./issue-sidebar-section";import { useState } from "react";import { useQuery } from "@tanstack/react-query";import { toast } from "sonner";-import { CircleSlash, MoreHorizontal, Plus, RotateCcw, Settings } from "@multica/ui/icons";+import { CircleSlash, GitPullRequest, MoreHorizontal, Plus, RotateCcw, Settings } from "@multica/ui/icons";import { ApiError } from "@multica/core/api";import {issuePullRequestsOptions,@@ -14,12 +14,16 @@ import {useSetIssuePRAutoComplete,} from "@multica/core/github";import { useWorkspacePaths } from "@multica/core/paths";+import type { PRAutoComplete } from "@multica/core/types";import { Button } from "@multica/ui/components/ui/button";import { IconButton } from "@multica/ui/components/common/icon-button";+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@multica/ui/components/ui/dialog";import {DropdownMenu,DropdownMenuContent,+ DropdownMenuGroup,DropdownMenuItem,+ DropdownMenuLabel,DropdownMenuSeparator,DropdownMenuTrigger,} from "@multica/ui/components/ui/dropdown-menu";@@ -27,13 +31,17 @@ import { Input } from "@multica/ui/components/ui/input";import { Popover, PopoverContent, PopoverTrigger } from "@multica/ui/components/ui/popover";import { useNavigation } from "../../navigation";import { useT } from "../../i18n";+import { useIssueSidebarAddEntry } from "./issue-sidebar-add-menu";import { PullRequestList } from "./pull-request-list";/*** The issue sidebar's Pull requests section: the linked PRs, what merging them* will do to this issue's status, and the two exceptions a person can make —* link a PR by hand, or keep this one issue's status when its PRs merge- * (MUL-7429, MUL-7726).+ * (MUL-7429, MUL-7726). With no PR linked the section renders nothing and+ * offers both from the sidebar's "+" menu: keeping the status has to be+ * settable before the first link, because a PR that is already merged when+ * it is linked moves the issue right then.*/export function PullRequestsSection({issueId,@@ -47,24 +55,60 @@ export function PullRequestsSection({onOpenChange: (open: boolean) => void;}) {const { t } = useT("issues");- const { data, isLoading, isError } = useQuery(issuePullRequestsOptions(issueId));+ const { data, isLoading, isError, errorUpdateCount } = useQuery(issuePullRequestsOptions(issueId));+ const [linkOpen, setLinkOpen] = useState(false);// Older backends have no link / auto-complete endpoints; keep the header// actions hidden until the server says it supports them.- const supported = !!data?.auto_complete;+ const autoComplete = data?.auto_complete ?? null;const count = data?.pull_requests.length ?? 0;+ // A retry after a failure stays on the error row; dropping it would unmount+ // the list, whose remount retries again.+ const failed = isError || (isLoading && errorUpdateCount > 0);+ const empty = !isLoading && !failed && count === 0;- if (!isLoading && !isError && count === 0 && !supported) return null;+ useIssueSidebarAddEntry("pull_requests", empty && autoComplete ? {+ order: 0,+ items: (+ <DropdownMenuGroup>+ <DropdownMenuLabel>{t(($) => $.detail.section_pull_requests)}</DropdownMenuLabel>+ <DropdownMenuItem onClick={() => setLinkOpen(true)}>+ <GitPullRequest />+ {t(($) => $.pr_automation.link_action)}+ </DropdownMenuItem>+ <AutoCompleteItems issueId={issueId} autoComplete={autoComplete} />+ </DropdownMenuGroup>+ ),+ } : null);++ const linked = () => {+ setLinkOpen(false);+ onOpenChange(true);+ };++ if (isLoading && !failed) return null;+ if (empty) {+ return (+ <Dialog open={linkOpen} onOpenChange={setLinkOpen}>+ <DialogContent className="sm:max-w-sm">+ <DialogHeader>+ <DialogTitle>{t(($) => $.pr_automation.link_action)}</DialogTitle>+ </DialogHeader>+ <LinkPullRequestForm issueId={issueId} identifier={identifier} onLinked={linked} labelHidden />+ </DialogContent>+ </Dialog>+ );+ }return (<div><IssueSidebarSectionHeader- title={t(($) => $.detail.section_pull_requests)} open={open} onOpenChange={onOpenChange} count={count} collapsible={count > 0 || isLoading || isError}- actions={supported ? <>+ title={t(($) => $.detail.section_pull_requests)} open={open} onOpenChange={onOpenChange} count={count}+ actions={autoComplete ? <><LinkPullRequestPopover issueId={issueId} identifier={identifier} onLinked={() => onOpenChange(true)} />- <AutoCompleteMenu issueId={issueId} disabled={data?.auto_complete?.issue_disabled ?? false} workspaceEnabled={data?.auto_complete?.workspace_enabled ?? true} />+ <AutoCompleteMenu issueId={issueId} autoComplete={autoComplete} /></> : undefined}/>- {open && (count > 0 || isLoading || isError) && (+ {open && (<div className="px-2"><PullRequestList issueId={issueId} identifier={identifier} /></div>@@ -83,27 +127,10 @@ function LinkPullRequestPopover({onLinked: () => void;}) {const { t } = useT("issues");- const { autoLinkPRs } = useGitHubSettings();const [open, setOpen] = useState(false);- const [url, setUrl] = useState("");- const link = useLinkIssuePullRequest(issueId);- const error = link.error- ? link.error instanceof ApiError && link.error.status === 404- ? t(($) => $.pr_automation.link_not_found)- : t(($) => $.pr_automation.link_failed)- : null;return (- <Popover- open={open}- onOpenChange={(next) => {- setOpen(next);- if (!next) {- setUrl("");- link.reset();- }- }}- >+ <Popover open={open} onOpenChange={setOpen}><PopoverTriggerrender={<IconButton variant="ghost" size="icon-xs" label={t(($) => $.pr_automation.link_action)}>@@ -112,84 +139,99 @@ function LinkPullRequestPopover({}/><PopoverContent align="end" className="w-80">- <form- className="flex flex-col gap-2"- onSubmit={(e) => {- e.preventDefault();- const value = url.trim();- if (!value || link.isPending) return;- link.mutate(- { url: value },- {- onSuccess: () => {- setOpen(false);- setUrl("");- onLinked();- },- },- );+ <LinkPullRequestForm+ issueId={issueId}+ identifier={identifier}+ onLinked={() => {+ setOpen(false);+ onLinked();}}- >- <label htmlFor={`link-pr-${issueId}`} className="text-caption font-medium">- {t(($) => $.pr_automation.link_action)}- </label>- <Input- id={`link-pr-${issueId}`}- // Not type="url": the browser would block "github.com/…" without a- // scheme, which the server accepts.- type="text"- inputMode="url"- autoComplete="off"- spellCheck={false}- autoFocus- value={url}- placeholder={t(($) => $.pr_automation.link_placeholder)}- aria-invalid={error ? true : undefined}- aria-describedby={error || !autoLinkPRs ? undefined : `link-pr-${issueId}-hint`}- onChange={(e) => {- setUrl(e.target.value);- if (link.error) link.reset();- }}- />- {error ? (- <p role="alert" className="text-caption text-destructive">- {error}- </p>- ) : autoLinkPRs ? (- // Only true while the workspace auto-links PRs.- <p id={`link-pr-${issueId}-hint`} className="text-caption text-muted-foreground">- {t(($) => $.pr_automation.link_hint, { identifier })}- </p>- ) : null}- <div className="flex justify-end">- <Button- type="submit"- size="sm"- disabled={!url.trim() || link.isPending}- aria-busy={link.isPending || undefined}- >- {t(($) => $.pr_automation.link_submit)}- </Button>- </div>- </form>+ /></PopoverContent></Popover>);}-function AutoCompleteMenu({+/** Mounted only while its popover or dialog is open, so closing it clears the draft. */+function LinkPullRequestForm({issueId,- disabled,- workspaceEnabled,+ identifier,+ onLinked,+ labelHidden = false,}: {issueId: string;- disabled: boolean;- workspaceEnabled: boolean;+ identifier: string;+ onLinked: () => void;+ /** Whether a dialog title already names the field. */+ labelHidden?: boolean;}) {const { t } = useT("issues");- const paths = useWorkspacePaths();- const navigation = useNavigation();- const setAutoComplete = useSetIssuePRAutoComplete(issueId);+ const { autoLinkPRs } = useGitHubSettings();+ const [url, setUrl] = useState("");+ const link = useLinkIssuePullRequest(issueId);+ const error = link.error+ ? link.error instanceof ApiError && link.error.status === 404+ ? t(($) => $.pr_automation.link_not_found)+ : t(($) => $.pr_automation.link_failed)+ : null;++ return (+ <form+ className="flex flex-col gap-2"+ onSubmit={(e) => {+ e.preventDefault();+ const value = url.trim();+ if (!value || link.isPending) return;+ link.mutate({ url: value }, { onSuccess: onLinked });+ }}+ >+ <label htmlFor={`link-pr-${issueId}`} className={labelHidden ? "sr-only" : "text-caption font-medium"}>+ {t(($) => $.pr_automation.link_action)}+ </label>+ <Input+ id={`link-pr-${issueId}`}+ // Not type="url": the browser would block "github.com/…" without a+ // scheme, which the server accepts.+ type="text"+ inputMode="url"+ autoComplete="off"+ spellCheck={false}+ autoFocus+ value={url}+ placeholder={t(($) => $.pr_automation.link_placeholder)}+ aria-invalid={error ? true : undefined}+ aria-describedby={error || !autoLinkPRs ? undefined : `link-pr-${issueId}-hint`}+ onChange={(e) => {+ setUrl(e.target.value);+ if (link.error) link.reset();+ }}+ />+ {error ? (+ <p role="alert" className="text-caption text-destructive">+ {error}+ </p>+ ) : autoLinkPRs ? (+ // Only true while the workspace auto-links PRs.+ <p id={`link-pr-${issueId}-hint`} className="text-caption text-muted-foreground">+ {t(($) => $.pr_automation.link_hint, { identifier })}+ </p>+ ) : null}+ <div className="flex justify-end">+ <Button+ type="submit"+ size="sm"+ disabled={!url.trim() || link.isPending}+ aria-busy={link.isPending || undefined}+ >+ {t(($) => $.pr_automation.link_submit)}+ </Button>+ </div>+ </form>+ );+}++function AutoCompleteMenu({ issueId, autoComplete }: { issueId: string; autoComplete: PRAutoComplete }) {+ const { t } = useT("issues");// The only section menu left in the sidebar: it carries a real per-issue// action (keep status on merge), not just a link to settings.@@ -203,28 +245,42 @@ function AutoCompleteMenu({}/><DropdownMenuContent align="end" className="w-max max-w-(--available-width)">- {/* When the workspace leaves status alone, the issue switch changes nothing. */}- {workspaceEnabled ? (- <>- <DropdownMenuItem- disabled={setAutoComplete.isPending}- onClick={() =>- setAutoComplete.mutate(!disabled, {- onError: () => toast.error(t(($) => $.pr_automation.update_failed)),- })- }- >- {disabled ? <RotateCcw /> : <CircleSlash />}- {disabled ? t(($) => $.pr_automation.enable) : t(($) => $.pr_automation.disable)}- </DropdownMenuItem>- <DropdownMenuSeparator />- </>- ) : null}- <DropdownMenuItem onClick={() => navigation.push(`${paths.settings()}?tab=code`)}>- <Settings />- {t(($) => $.pr_automation.settings)}- </DropdownMenuItem>+ <AutoCompleteItems issueId={issueId} autoComplete={autoComplete} /></DropdownMenuContent></DropdownMenu>);}++function AutoCompleteItems({ issueId, autoComplete }: { issueId: string; autoComplete: PRAutoComplete }) {+ const { t } = useT("issues");+ const paths = useWorkspacePaths();+ const navigation = useNavigation();+ const setAutoComplete = useSetIssuePRAutoComplete(issueId);+ const disabled = autoComplete.issue_disabled;++ return (+ <>+ {/* When the workspace leaves status alone, the issue switch changes nothing. */}+ {autoComplete.workspace_enabled ? (+ <>+ <DropdownMenuItem+ disabled={setAutoComplete.isPending}+ // The menu closes, and unmounts this item, before the request+ // settles; per-call mutate callbacks would never fire.+ onClick={() =>+ setAutoComplete.mutateAsync(!disabled).catch(() => toast.error(t(($) => $.pr_automation.update_failed)))+ }+ >+ {disabled ? <RotateCcw /> : <CircleSlash />}+ {disabled ? t(($) => $.pr_automation.enable) : t(($) => $.pr_automation.disable)}+ </DropdownMenuItem>+ <DropdownMenuSeparator />+ </>+ ) : null}+ <DropdownMenuItem onClick={() => navigation.push(`${paths.settings()}?tab=code`)}>+ <Settings />+ {t(($) => $.pr_automation.settings)}+ </DropdownMenuItem>+ </>+ );+}diff --git a/packages/views/locales/en/issues.json b/packages/views/locales/en/issues.jsonindex c1639bcbb8..c6567ee6e7 100644--- a/packages/views/locales/en/issues.json+++ b/packages/views/locales/en/issues.json@@ -495,18 +495,24 @@"section_pull_requests": "Pull requests","section_metadata": "Metadata","section_details": "Details",+ "sidebar_add": "Add","sidebar_settings": {"open": "Customize sidebar","title": "Sidebar","reset": "Reset",- "footer": "Drag to reorder. Applies to every issue.",+ "footer": "Applies to every issue.","always_shown": "Always shown","empty": "None on this issue","customize": "Customize",- "drag_handle": "Reorder {{section}}","hidden_count_one": "{{count}} section hidden","hidden_count_other": "{{count}} sections hidden"},+ "next_step": {+ "review_title": "Ready for review",+ "review_action": "Review PR",+ "reply_title": "{{name}} is waiting for a reply",+ "reply_action": "Reply"+ },"section_quick_actions": "Quick Actions","quick_actions_more": "Show {{count}} more","quick_action_runs_as": "Runs as {{name}}",diff --git a/packages/views/locales/es/issues.json b/packages/views/locales/es/issues.jsonindex 572fe89ad0..c170246a2b 100644--- a/packages/views/locales/es/issues.json+++ b/packages/views/locales/es/issues.json@@ -467,18 +467,24 @@"section_pull_requests": "Pull requests","section_metadata": "Metadatos","section_details": "Detalles",+ "sidebar_add": "Añadir","sidebar_settings": {"open": "Personalizar barra lateral","title": "Barra lateral","reset": "Restablecer",- "footer": "Arrastra para reordenar. Se aplica a todas las tareas.",+ "footer": "Se aplica a todas las tareas.","always_shown": "Siempre visible","empty": "Nada en esta tarea","customize": "Personalizar",- "drag_handle": "Reordenar {{section}}","hidden_count_one": "{{count}} sección oculta","hidden_count_other": "{{count}} secciones ocultas"},+ "next_step": {+ "review_title": "Lista para revisar",+ "review_action": "Revisar PR",+ "reply_title": "{{name}} espera una respuesta",+ "reply_action": "Responder"+ },"section_quick_actions": "Acciones rápidas","quick_actions_more": "Mostrar {{count}} más","quick_action_runs_as": "Se ejecuta como {{name}}",diff --git a/packages/views/locales/fr/issues.json b/packages/views/locales/fr/issues.jsonindex ceb4bf8782..7b80652be4 100644--- a/packages/views/locales/fr/issues.json+++ b/packages/views/locales/fr/issues.json@@ -495,18 +495,24 @@"section_pull_requests": "Pull requests","section_metadata": "Métadonnées","section_details": "Détails",+ "sidebar_add": "Ajouter","sidebar_settings": {"open": "Personnaliser la barre latérale","title": "Barre latérale","reset": "Réinitialiser",- "footer": "Faites glisser pour réordonner. S'applique à toutes les tâches.",+ "footer": "S'applique à toutes les tâches.","always_shown": "Toujours affiché","empty": "Rien sur cette tâche","customize": "Personnaliser",- "drag_handle": "Réordonner {{section}}","hidden_count_one": "{{count}} section masquée","hidden_count_other": "{{count}} sections masquées"},+ "next_step": {+ "review_title": "Prête pour la revue",+ "review_action": "Relire la PR",+ "reply_title": "{{name}} attend une réponse",+ "reply_action": "Répondre"+ },"section_quick_actions": "Actions rapides","quick_actions_more": "Afficher {{count}} de plus","quick_action_runs_as": "S'exécute en tant que {{name}}",diff --git a/packages/views/locales/ja/issues.json b/packages/views/locales/ja/issues.jsonindex a835de7a3e..938f5ce73b 100644--- a/packages/views/locales/ja/issues.json+++ b/packages/views/locales/ja/issues.json@@ -489,17 +489,23 @@"section_pull_requests": "Pull requests","section_metadata": "メタデータ","section_details": "詳細",+ "sidebar_add": "追加","sidebar_settings": {"open": "サイドバーをカスタマイズ","title": "サイドバー","reset": "リセット",- "footer": "ドラッグで並べ替え。すべてのタスクに適用されます。",+ "footer": "すべてのタスクに適用されます。","always_shown": "常に表示","empty": "このタスクにはありません","customize": "カスタマイズ",- "drag_handle": "{{section}}を並べ替え","hidden_count_other": "{{count}} 個のセクションを非表示"},+ "next_step": {+ "review_title": "レビュー待ち",+ "review_action": "PR をレビュー",+ "reply_title": "{{name}} が返信を待っています",+ "reply_action": "返信"+ },"section_quick_actions": "クイックアクション","quick_actions_more": "残り {{count}} 件を表示","quick_action_runs_as": "{{name}} が実行します",diff --git a/packages/views/locales/ko/issues.json b/packages/views/locales/ko/issues.jsonindex 4907025097..6c63c9c007 100644--- a/packages/views/locales/ko/issues.json+++ b/packages/views/locales/ko/issues.json@@ -489,17 +489,23 @@"section_pull_requests": "Pull requests","section_metadata": "메타데이터","section_details": "세부 정보",+ "sidebar_add": "추가","sidebar_settings": {"open": "사이드바 사용자 지정","title": "사이드바","reset": "초기화",- "footer": "드래그해 순서를 바꿉니다. 모든 태스크에 적용됩니다.",+ "footer": "모든 태스크에 적용됩니다.","always_shown": "항상 표시","empty": "이 태스크에는 없음","customize": "사용자 지정",- "drag_handle": "{{section}} 순서 변경","hidden_count_other": "섹션 {{count}}개 숨김"},+ "next_step": {+ "review_title": "리뷰 대기 중",+ "review_action": "PR 리뷰",+ "reply_title": "{{name}} 님이 답장을 기다리고 있습니다",+ "reply_action": "답장"+ },"section_quick_actions": "퀵 액션","quick_actions_more": "{{count}}개 더 보기","quick_action_runs_as": "{{name}}이(가) 실행합니다",diff --git a/packages/views/locales/ru/issues.json b/packages/views/locales/ru/issues.jsonindex a73cd561b8..bbd4add107 100644--- a/packages/views/locales/ru/issues.json+++ b/packages/views/locales/ru/issues.json@@ -503,20 +503,26 @@"section_pull_requests": "Pull request'ы","section_metadata": "Метаданные","section_details": "Детали",+ "sidebar_add": "Добавить","sidebar_settings": {"open": "Настроить боковую панель","title": "Боковая панель","reset": "Сбросить",- "footer": "Перетаскивайте, чтобы менять порядок. Применяется ко всем задачам.",+ "footer": "Применяется ко всем задачам.","always_shown": "Показывается всегда","empty": "В этой задаче нет","customize": "Настроить",- "drag_handle": "Переместить «{{section}}»","hidden_count_one": "Скрыт {{count}} раздел","hidden_count_few": "Скрыто {{count}} раздела","hidden_count_many": "Скрыто {{count}} разделов","hidden_count_other": "Скрыто {{count}} раздела"},+ "next_step": {+ "review_title": "Ждёт ревью",+ "review_action": "Открыть PR",+ "reply_title": "{{name}} ждёт ответа",+ "reply_action": "Ответить"+ },"section_quick_actions": "Быстрые действия","quick_actions_more": "Показать ещё: {{count}}","quick_action_runs_as": "Выполняется от имени {{name}}",diff --git a/packages/views/locales/zh-Hans/issues.json b/packages/views/locales/zh-Hans/issues.jsonindex e7e66c0781..e4c884c06c 100644--- a/packages/views/locales/zh-Hans/issues.json+++ b/packages/views/locales/zh-Hans/issues.json@@ -489,17 +489,23 @@"section_pull_requests": "Pull Request","section_metadata": "元数据","section_details": "详情",+ "sidebar_add": "添加","sidebar_settings": {"open": "自定义侧边栏","title": "侧边栏","reset": "恢复默认",- "footer": "拖动调整顺序。所有任务共用这套设置。",+ "footer": "所有任务共用这套设置。","always_shown": "始终显示","empty": "本任务暂无","customize": "自定义",- "drag_handle": "调整{{section}}的位置","hidden_count_other": "已隐藏 {{count}} 个区块"},+ "next_step": {+ "review_title": "等待审阅",+ "review_action": "审阅 PR",+ "reply_title": "{{name}} 在等回复",+ "reply_action": "回复"+ },"section_quick_actions": "快捷操作","quick_actions_more": "显示其余 {{count}} 条","quick_action_runs_as": "由 {{name}} 执行",diff --git a/packages/views/locales/zh-Hant/issues.json b/packages/views/locales/zh-Hant/issues.jsonindex 94ec3f00b5..154d383388 100644--- a/packages/views/locales/zh-Hant/issues.json+++ b/packages/views/locales/zh-Hant/issues.json@@ -489,17 +489,23 @@"section_pull_requests": "Pull Request","section_metadata": "後設資料","section_details": "詳情",+ "sidebar_add": "新增","sidebar_settings": {"open": "自訂側邊欄","title": "側邊欄","reset": "恢復預設",- "footer": "拖動調整順序。所有任務共用這套設定。",+ "footer": "所有任務共用這套設定。","always_shown": "始終顯示","empty": "本任務暫無","customize": "自訂",- "drag_handle": "調整{{section}}的位置","hidden_count_other": "已隱藏 {{count}} 個區塊"},+ "next_step": {+ "review_title": "等待審閱",+ "review_action": "審閱 PR",+ "reply_title": "{{name}} 在等回覆",+ "reply_action": "回覆"+ },"section_quick_actions": "快捷操作","quick_actions_more": "顯示其餘 {{count}} 條","quick_action_runs_as": "由 {{name}} 執行",