diff --git a/apps/web/src/components/pullRequest/PullRequestChecksPopover.tsx b/apps/web/src/components/pullRequest/PullRequestChecksPopover.tsx
index b232c21954110..213848cc0ebfe 100644
--- a/apps/web/src/components/pullRequest/PullRequestChecksPopover.tsx
+++ b/apps/web/src/components/pullRequest/PullRequestChecksPopover.tsx
@@ -6,7 +6,7 @@ import type {
PullRequestRef,
ScopedThreadRef,
} from "@t3tools/contracts";
-import { msg, T, useGT, useMessages, Var } from "gt-react";
+import { msg, T, useGT, useMessages } from "gt-react";
import { useState } from "react";
import { useOpenLink } from "~/browser/useOpenLink";
@@ -23,6 +23,7 @@ import { toastManager } from "../ui/toast";
import { groupPullRequestChecks } from "./pullRequestDetail.logic";
import {
PullRequestCheckStatusIcon,
+ pullRequestChecksCountLabel,
pullRequestCheckStatusLabel,
pullRequestChecksStatePresentation,
summarizePullRequestChecks,
@@ -164,12 +165,7 @@ export function PullRequestChecksPopover({
const gt = useGT();
const resolve = useMessages();
const presentation = pullRequestChecksStatePresentation(checksState, resolve);
- const incompleteCount =
- checks?.filter((check) => check.status === "pending" || check.status === "action-required")
- .length ?? 0;
- const failedCount =
- checks?.filter((check) => check.status === "failure" || check.status === "cancelled").length ??
- 0;
+ const countLabel = checks === undefined ? null : pullRequestChecksCountLabel(checks, resolve);
const summary =
checks === undefined || stale ? null : summarizePullRequestChecks(checks, resolve);
return (
@@ -195,26 +191,8 @@ export function PullRequestChecksPopover({
onClick={(event) => event.stopPropagation()}
>
- {variant === "count" ? (
- <>
- {checks !== undefined && incompleteCount > 0 ? (
- // Clip the second line so "checks" disappears whole when the count must shrink.
-
-
-
- {checks.length - incompleteCount}/{checks.length}
- {" "}
- checks
-
-
- ) : failedCount > 0 ? (
-
- {gt("{count, plural, one {{count} failed} other {{count} failed}}", {
- count: failedCount,
- })}
-
- ) : null}
- >
+ {variant === "count" && countLabel !== null ? (
+ {countLabel}
) : null}
diff --git a/apps/web/src/components/pullRequest/pullRequestPresentation.test.ts b/apps/web/src/components/pullRequest/pullRequestPresentation.test.ts
new file mode 100644
index 0000000000000..9541f1f91fb6f
--- /dev/null
+++ b/apps/web/src/components/pullRequest/pullRequestPresentation.test.ts
@@ -0,0 +1,28 @@
+import type { PullRequestCheck } from "@t3tools/contracts";
+import { describe, expect, it } from "vite-plus/test";
+
+import { pullRequestChecksCountLabel } from "./pullRequestPresentation";
+
+const checks = (...statuses: ReadonlyArray): PullRequestCheck[] =>
+ statuses.map((status) => ({ name: "ci", status, description: null, url: null }));
+
+describe("pullRequestChecksCountLabel", () => {
+ it("names the most urgent group: failed, then awaiting action, then running", () => {
+ expect(
+ pullRequestChecksCountLabel(
+ checks("failure", "cancelled", "action-required", "pending", "success"),
+ ),
+ ).toBe("2 failed");
+ expect(pullRequestChecksCountLabel(checks("action-required", "pending", "pending"))).toBe(
+ "1 awaiting action",
+ );
+ expect(pullRequestChecksCountLabel(checks("pending", "pending", "success", "skipped"))).toBe(
+ "2 running",
+ );
+ });
+
+ it("shows nothing once no check is failed, waiting or running", () => {
+ expect(pullRequestChecksCountLabel(checks("success", "skipped", "neutral"))).toBeNull();
+ expect(pullRequestChecksCountLabel([])).toBeNull();
+ });
+});
diff --git a/apps/web/src/components/pullRequest/pullRequestPresentation.tsx b/apps/web/src/components/pullRequest/pullRequestPresentation.tsx
index 9a3316c184abf..32f40d02d5797 100644
--- a/apps/web/src/components/pullRequest/pullRequestPresentation.tsx
+++ b/apps/web/src/components/pullRequest/pullRequestPresentation.tsx
@@ -603,6 +603,36 @@ export function PullRequestMetaLine({
);
}
+/** The short label beside the checks icon; null when every check passed. */
+export function pullRequestChecksCountLabel(
+ checks: ReadonlyArray,
+ resolve: MessageResolver = m,
+): string | null {
+ const count = (statuses: ReadonlyArray) =>
+ checks.filter((check) => statuses.includes(check.status)).length;
+ const failed = count(["failure", "cancelled"]);
+ if (failed > 0) {
+ return resolve(
+ msg("{count, plural, one {{count} failed} other {{count} failed}}", { count: failed }),
+ );
+ }
+ const awaitingAction = count(["action-required"]);
+ if (awaitingAction > 0) {
+ return resolve(
+ msg("{count, plural, one {{count} awaiting action} other {{count} awaiting action}}", {
+ count: awaitingAction,
+ }),
+ );
+ }
+ const running = count(["pending"]);
+ if (running > 0) {
+ return resolve(
+ msg("{count, plural, one {{count} running} other {{count} running}}", { count: running }),
+ );
+ }
+ return null;
+}
+
export function summarizePullRequestChecks(
checks: ReadonlyArray,
resolve: MessageResolver = m,
diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json
index 493f5021da2b1..28826c221f4bf 100644
--- a/apps/web/src/i18n/translations/de.json
+++ b/apps/web/src/i18n/translations/de.json
@@ -6633,28 +6633,8 @@
"a6d75a4380173c60": "Checks öffnen: {summary}",
"be3d1766bad18693": "Checks: {summary}",
"425e4a3d6c5c2867": "{count, plural, one {{count} fehlgeschlagen} other {{count} fehlgeschlagen}}",
+ "fd63b391898889f9": "{count, plural, one {{count} wartet auf Aktion} other {{count} warten auf Aktion}}",
"cb116c139cdace98": "Keine Checks gemeldet",
- "d84d09b4818c50b7": [
- {
- "t": "span",
- "i": 1,
- "c": [
- {
- "i": 2,
- "k": "_gt_value_2",
- "v": "v"
- },
- "/",
- {
- "i": 3,
- "k": "_gt_value_3",
- "v": "v"
- }
- ]
- },
- " ",
- "Checks"
- ],
"60b56e201607c7ec": "Die Check-Details sind veraltet. Aktualisiere den Pull Request, um sie zu aktualisieren.",
"e74cd4e960cbb5e5": "Unveränderte Zeilen sind in einer Datei mit gekürzten Zeilen nicht verfügbar.",
"38d6169e04a9a4ce": "Weitere Kommentare konnten nicht geladen werden",
diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json
index 15101ae706800..2b8ba6b96a711 100644
--- a/apps/web/src/i18n/translations/en.json
+++ b/apps/web/src/i18n/translations/en.json
@@ -6640,28 +6640,8 @@
"a6d75a4380173c60": "Open checks: {summary}",
"be3d1766bad18693": "Checks: {summary}",
"425e4a3d6c5c2867": "{count, plural, one {{count} failed} other {{count} failed}}",
+ "fd63b391898889f9": "{count, plural, one {{count} awaiting action} other {{count} awaiting action}}",
"cb116c139cdace98": "No checks reported",
- "d84d09b4818c50b7": [
- {
- "t": "span",
- "i": 1,
- "c": [
- {
- "i": 2,
- "k": "_gt_value_2",
- "v": "v"
- },
- "/",
- {
- "i": 3,
- "k": "_gt_value_3",
- "v": "v"
- }
- ]
- },
- " ",
- "checks"
- ],
"60b56e201607c7ec": "Check details are out of date. Refresh the pull request to update them.",
"e74cd4e960cbb5e5": "Unchanged lines are unavailable in a file with cut lines.",
"38d6169e04a9a4ce": "More comments could not be loaded",
diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json
index 41ea55b0cce5e..5155eabe12959 100644
--- a/apps/web/src/i18n/translations/es.json
+++ b/apps/web/src/i18n/translations/es.json
@@ -6633,28 +6633,8 @@
"a6d75a4380173c60": "Abrir comprobaciones: {summary}",
"be3d1766bad18693": "Comprobaciones: {summary}",
"425e4a3d6c5c2867": "{count, plural, one {{count} con errores} other {{count} con errores}}",
+ "fd63b391898889f9": "{count, plural, one {{count} pendiente de acción} other {{count} pendientes de acción}}",
"cb116c139cdace98": "No se informó de ninguna comprobación",
- "d84d09b4818c50b7": [
- {
- "t": "span",
- "i": 1,
- "c": [
- {
- "i": 2,
- "k": "_gt_value_2",
- "v": "v"
- },
- "/",
- {
- "i": 3,
- "k": "_gt_value_3",
- "v": "v"
- }
- ]
- },
- " ",
- "comprobaciones"
- ],
"60b56e201607c7ec": "Los detalles de las comprobaciones están desactualizados. Actualiza la pull request para ponerlos al día.",
"e74cd4e960cbb5e5": "Las líneas sin cambios no están disponibles en un archivo con líneas cortadas.",
"38d6169e04a9a4ce": "No se pudieron cargar más comentarios",
diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json
index 3d27667384fdd..7738423b4484e 100644
--- a/apps/web/src/i18n/translations/fr.json
+++ b/apps/web/src/i18n/translations/fr.json
@@ -6634,28 +6634,8 @@
"a6d75a4380173c60": "Ouvrir les checks : {summary}",
"be3d1766bad18693": "Checks : {summary}",
"425e4a3d6c5c2867": "{count, plural, one {{count} en échec} other {{count} en échec}}",
+ "fd63b391898889f9": "{count, plural, one {{count} en attente d’action} other {{count} en attente d’action}}",
"cb116c139cdace98": "Aucun check signalé",
- "d84d09b4818c50b7": [
- {
- "t": "span",
- "i": 1,
- "c": [
- {
- "i": 2,
- "k": "_gt_value_2",
- "v": "v"
- },
- "/",
- {
- "i": 3,
- "k": "_gt_value_3",
- "v": "v"
- }
- ]
- },
- " ",
- "checks"
- ],
"60b56e201607c7ec": "Les détails des checks ne sont plus à jour. Actualisez la pull request pour les mettre à jour.",
"e74cd4e960cbb5e5": "Les lignes inchangées ne sont pas disponibles dans un fichier aux lignes tronquées.",
"38d6169e04a9a4ce": "Impossible de charger plus de commentaires",
diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json
index 27a9f41f8b7b9..e7facd4a09ef8 100644
--- a/apps/web/src/i18n/translations/ja.json
+++ b/apps/web/src/i18n/translations/ja.json
@@ -6603,28 +6603,8 @@
"a6d75a4380173c60": "チェックを開く: {summary}",
"be3d1766bad18693": "チェック: {summary}",
"425e4a3d6c5c2867": "{count, plural, other {{count} 件失敗}}",
+ "fd63b391898889f9": "{count, plural, other {{count} 件が操作待ち}}",
"cb116c139cdace98": "報告されたチェックはありません",
- "d84d09b4818c50b7": [
- {
- "t": "span",
- "i": 1,
- "c": [
- {
- "i": 2,
- "k": "_gt_value_2",
- "v": "v"
- },
- "/",
- {
- "i": 3,
- "k": "_gt_value_3",
- "v": "v"
- }
- ]
- },
- " ",
- "件のチェック"
- ],
"60b56e201607c7ec": "チェックの詳細が古くなっています。更新するにはプルリクエストを更新してください。",
"e74cd4e960cbb5e5": "行が省略されたファイルでは、変更されていない行を表示できません。",
"38d6169e04a9a4ce": "これ以上コメントを読み込めませんでした",
diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json
index deb87364861ed..1afa64ffa3d02 100644
--- a/apps/web/src/i18n/translations/ko.json
+++ b/apps/web/src/i18n/translations/ko.json
@@ -6605,28 +6605,8 @@
"a6d75a4380173c60": "검사 열기: {summary}",
"be3d1766bad18693": "검사: {summary}",
"425e4a3d6c5c2867": "{count, plural, other {{count}개 실패}}",
+ "fd63b391898889f9": "{count, plural, other {{count}개 조치 대기 중}}",
"cb116c139cdace98": "보고된 검사 없음",
- "d84d09b4818c50b7": [
- {
- "t": "span",
- "i": 1,
- "c": [
- {
- "i": 2,
- "k": "_gt_value_2",
- "v": "v"
- },
- "/",
- {
- "i": 3,
- "k": "_gt_value_3",
- "v": "v"
- }
- ]
- },
- " ",
- "검사"
- ],
"60b56e201607c7ec": "검사 세부 정보가 오래되었습니다. 업데이트하려면 풀 리퀘스트를 새로 고치세요.",
"e74cd4e960cbb5e5": "잘린 줄이 있는 파일에서는 변경되지 않은 줄을 사용할 수 없습니다.",
"38d6169e04a9a4ce": "댓글을 더 불러올 수 없습니다",
diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json
index 9b3534dd3fd7d..dae14eaae00ff 100644
--- a/apps/web/src/i18n/translations/pt-BR.json
+++ b/apps/web/src/i18n/translations/pt-BR.json
@@ -6633,28 +6633,8 @@
"a6d75a4380173c60": "Abrir verificações: {summary}",
"be3d1766bad18693": "Verificações: {summary}",
"425e4a3d6c5c2867": "{count, plural, one {{count} com falha} other {{count} com falha}}",
+ "fd63b391898889f9": "{count, plural, one {{count} aguardando ação} other {{count} aguardando ação}}",
"cb116c139cdace98": "Nenhuma verificação informada",
- "d84d09b4818c50b7": [
- {
- "t": "span",
- "i": 1,
- "c": [
- {
- "i": 2,
- "k": "_gt_value_2",
- "v": "v"
- },
- "/",
- {
- "i": 3,
- "k": "_gt_value_3",
- "v": "v"
- }
- ]
- },
- " ",
- "verificações"
- ],
"60b56e201607c7ec": "Os detalhes das verificações estão desatualizados. Atualize o pull request para atualizá-los.",
"e74cd4e960cbb5e5": "As linhas não alteradas não estão disponíveis em um arquivo com linhas cortadas.",
"38d6169e04a9a4ce": "Não foi possível carregar mais comentários",
diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json
index bfc04739cb8ad..a8cc118cb71c9 100644
--- a/apps/web/src/i18n/translations/ru.json
+++ b/apps/web/src/i18n/translations/ru.json
@@ -6633,28 +6633,8 @@
"a6d75a4380173c60": "Открыть проверки: {summary}",
"be3d1766bad18693": "Проверки: {summary}",
"425e4a3d6c5c2867": "{count, plural, one {Ошибок: {count}} few {Ошибок: {count}} many {Ошибок: {count}} other {Ошибок: {count}}}",
+ "fd63b391898889f9": "{count, plural, one {{count} ожидает действия} few {{count} ожидают действия} many {{count} ожидают действия} other {{count} ожидают действия}}",
"cb116c139cdace98": "Нет проверок",
- "d84d09b4818c50b7": [
- {
- "t": "span",
- "i": 1,
- "c": [
- {
- "i": 2,
- "k": "_gt_value_2",
- "v": "v"
- },
- "/",
- {
- "i": 3,
- "k": "_gt_value_3",
- "v": "v"
- }
- ]
- },
- " ",
- "проверок"
- ],
"60b56e201607c7ec": "Подробности проверок устарели. Обновите пул-реквест, чтобы обновить их.",
"e74cd4e960cbb5e5": "Неизменённые строки недоступны в файле с обрезанными строками.",
"38d6169e04a9a4ce": "Не удалось загрузить остальные комментарии",
diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json
index 4de2ac04990a3..7d4786b90a24c 100644
--- a/apps/web/src/i18n/translations/sv.json
+++ b/apps/web/src/i18n/translations/sv.json
@@ -6639,28 +6639,8 @@
"a6d75a4380173c60": "Öppna kontroller: {summary}",
"be3d1766bad18693": "Kontroller: {summary}",
"425e4a3d6c5c2867": "{count, plural, one {{count} misslyckades} other {{count} misslyckades}}",
+ "fd63b391898889f9": "{count, plural, one {{count} väntar på åtgärd} other {{count} väntar på åtgärd}}",
"cb116c139cdace98": "Inga kontroller rapporterade",
- "d84d09b4818c50b7": [
- {
- "t": "span",
- "i": 1,
- "c": [
- {
- "i": 2,
- "k": "_gt_value_2",
- "v": "v"
- },
- "/",
- {
- "i": 3,
- "k": "_gt_value_3",
- "v": "v"
- }
- ]
- },
- " ",
- "kontroller"
- ],
"60b56e201607c7ec": "Kontrolldetaljerna är inaktuella. Uppdatera pull requesten för att uppdatera dem.",
"e74cd4e960cbb5e5": "Oförändrade rader är inte tillgängliga i en fil med bortklippta rader.",
"38d6169e04a9a4ce": "Fler kommentarer kunde inte läsas in",
diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json
index 7689205ddb802..43fc4240baf4b 100644
--- a/apps/web/src/i18n/translations/zh.json
+++ b/apps/web/src/i18n/translations/zh.json
@@ -6645,28 +6645,8 @@
"a6d75a4380173c60": "打开检查:{summary}",
"be3d1766bad18693": "检查:{summary}",
"425e4a3d6c5c2867": "{count, plural, other {{count} 个失败}}",
+ "fd63b391898889f9": "{count, plural, other {{count} 个等待操作}}",
"cb116c139cdace98": "未报告任何检查",
- "d84d09b4818c50b7": [
- {
- "t": "span",
- "i": 1,
- "c": [
- {
- "i": 2,
- "k": "_gt_value_2",
- "v": "v"
- },
- "/",
- {
- "i": 3,
- "k": "_gt_value_3",
- "v": "v"
- }
- ]
- },
- " ",
- "项检查"
- ],
"60b56e201607c7ec": "检查详情已过期。刷新 pull request 以更新。",
"e74cd4e960cbb5e5": "包含截断行的文件中无法查看未更改的行。",
"38d6169e04a9a4ce": "无法加载更多评论",