From f107929a1464f70d43233d63ae521fd9bbf291fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=81=D0=B5=D0=BB=D1=8C?= Date: Sun, 15 Nov 2026 15:23:19 +0500 Subject: [PATCH] PEP-98: relative times in the interface language everywhere Co-Authored-By: Claude Opus 5.5 --- apps/web/app/(app)/chats/[chat]/page.tsx | 4 ++-- apps/web/app/(app)/t/[key]/page.tsx | 2 +- apps/web/app/(app)/t/[key]/tabs.tsx | 8 ++++---- apps/web/components/Incidents.tsx | 2 +- apps/web/components/RunnerConsole.tsx | 10 +++++----- apps/web/components/common.tsx | 7 +++---- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/apps/web/app/(app)/chats/[chat]/page.tsx b/apps/web/app/(app)/chats/[chat]/page.tsx index cf067537..2fb4e7b4 100644 --- a/apps/web/app/(app)/chats/[chat]/page.tsx +++ b/apps/web/app/(app)/chats/[chat]/page.tsx @@ -149,7 +149,7 @@ export default async function ChatPage({ params, searchParams }: { params: Promi {threads.length > 0 &&
} {threads.map((th) => ( - + ))} {threads.length === 0 &&

{t("Тредов пока нет.")}

} @@ -232,7 +232,7 @@ async function MessageItem({ m, q, back, showThread, masterView }: { m: ChatMess 🧵 {label} )} - {ago(m.createdAt)} + {ago(m.createdAt, t)}
); if (q) { diff --git a/apps/web/app/(app)/t/[key]/page.tsx b/apps/web/app/(app)/t/[key]/page.tsx index e45f27e4..1b2e578d 100644 --- a/apps/web/app/(app)/t/[key]/page.tsx +++ b/apps/web/app/(app)/t/[key]/page.tsx @@ -180,7 +180,7 @@ export default async function StoryPage({ params, searchParams }: { params: Prom

{t.text(reviewLabel(review))}

- {review.sha.slice(0, 7)} · {ago(review.updatedAt)} + {review.sha.slice(0, 7)} · {ago(review.updatedAt, t)}

)} diff --git a/apps/web/app/(app)/t/[key]/tabs.tsx b/apps/web/app/(app)/t/[key]/tabs.tsx index 58e4cd63..c4890d66 100644 --- a/apps/web/app/(app)/t/[key]/tabs.tsx +++ b/apps/web/app/(app)/t/[key]/tabs.tsx @@ -158,7 +158,7 @@ export async function CommentsTab({ taskKey, taskStatus, questions, comments, ba
{x.c.role ? : } - {x.c.role ? (x.c.role === "product" ? t("зачем и что берём") : t("что должно получиться")) : <>{x.c.login} {t("комментарий PM")}} · {ago(x.c.createdAt)} + {x.c.role ? (x.c.role === "product" ? t("зачем и что берём") : t("что должно получиться")) : <>{x.c.login} {t("комментарий PM")}} · {ago(x.c.createdAt, t)}

{x.c.text}

@@ -244,7 +244,7 @@ export async function TestsTab({ ci, runs, review }: { ci: CiSummary; runs: Chec {review.verdict === "ok" ? STATE_ICON.success : review.verdict === "changes" || review.state === "error" ? STATE_ICON.failure : STATE_ICON.pending} {t.text(reviewLabel(review))} - {review.sha.slice(0, 7)} · {ago(review.updatedAt)} + {review.sha.slice(0, 7)} · {ago(review.updatedAt, t)}

{review.summary && } @@ -274,7 +274,7 @@ async function CheckLine({ r }: { r: CheckRunRow }) { {STATE_ICON[r.state]} {r.check} {r.durationSec != null && {t("{n} с", { n: r.durationSec })}} - {ago(r.updatedAt)} + {ago(r.updatedAt, t)} {r.runUrl && ( {t("лог")} @@ -415,7 +415,7 @@ export async function ActivityTab({ events, authors }: { events: ActivityEvent[] return (
  • - {ago(e.createdAt)} {a.label}{" "} + {ago(e.createdAt, t)} {a.label}{" "} {EVENT_RU[e.type] ? t(EVENT_RU[e.type]) : e.type} {changeLine(e, t)}
  • ); diff --git a/apps/web/components/Incidents.tsx b/apps/web/components/Incidents.tsx index 9b0da37b..908686c3 100644 --- a/apps/web/components/Incidents.tsx +++ b/apps/web/components/Incidents.tsx @@ -146,7 +146,7 @@ async function IncidentCard({ i, back, projectId, taskKeys }: { i: Incident; bac
    {t(INCIDENT_STATUS_RU[i.status])} {i.title} - {ago(i.lastSeen)} + {ago(i.lastSeen, t)}
    {i.source} · {i.environment ?? "—"} · {t("релиз {release}", { release: i.lastRelease ?? "—" })} · {t("событий {n}", { n: i.events })} diff --git a/apps/web/components/RunnerConsole.tsx b/apps/web/components/RunnerConsole.tsx index abe21e8a..d6f088fa 100644 --- a/apps/web/components/RunnerConsole.tsx +++ b/apps/web/components/RunnerConsole.tsx @@ -94,7 +94,7 @@ export async function RunnerRow({ s, href, selected, needsPm }: { s: SessionView {s.name && s.taskTitle ? `${s.name} · ` : ""}{s.projectKey} · {s.provider}{s.subscriptionName ? ` · ${s.subscriptionName}` : ""}{s.subscriptionSwitches > 0 ? ` (↻${s.subscriptionSwitches})` : ""} · #{s.id} · {s.tmuxName} - {ago(s.lastActivityAt)} + {ago(s.lastActivityAt, t)} {limited && ( @@ -159,9 +159,9 @@ export async function RunnerDetails({ s, questions, events, steps, stories, back {s.container ? · {t("контейнер {name}", { name: s.container })} : · {t("без изоляции")}}
    {t("Запущен")}
    -
    {ago(s.startedAt)}
    +
    {ago(s.startedAt, t)}
    {t("Активность")}
    -
    {ago(s.lastActivityAt)}
    +
    {ago(s.lastActivityAt, t)}
    @@ -198,7 +198,7 @@ export async function RunnerDetails({ s, questions, events, steps, stories, back .filter((e) => e.type === "subscription_switched") .map((e) => (
  • - {ago(e.createdAt)} {switchText(e.payload, t)} + {ago(e.createdAt, t)} {switchText(e.payload, t)}
  • ))} @@ -210,7 +210,7 @@ export async function RunnerDetails({ s, questions, events, steps, stories, back
      {events.map((e) => (
    1. - {ago(e.createdAt)} {e.type}{" "} + {ago(e.createdAt, t)} {e.type}{" "} {eventLine(e, t)}
    2. ))} diff --git a/apps/web/components/common.tsx b/apps/web/components/common.tsx index fd4f0d1f..03408510 100644 --- a/apps/web/components/common.tsx +++ b/apps/web/components/common.tsx @@ -6,7 +6,7 @@ import { Badge } from "@/components/ui/badge"; import { SESSION_STATUS, TASK_STATUS, TONE_BG } from "@/lib/status"; import { cn } from "@/lib/utils"; import { getT } from "@/lib/i18n"; -import { intlLocale, translator, type Translator } from "@peppa/shared/i18n"; +import { intlLocale, type Translator } from "@peppa/shared/i18n"; export function PageHeader({ title, crumbs, actions, children }: { title: ReactNode; crumbs?: ReactNode; actions?: ReactNode; children?: ReactNode }) { return ( @@ -96,10 +96,9 @@ export function Disclosure({ summary, children, open, className }: { summary: Re ); } -const ruT = translator("ru"); -/** «5 мин назад»; pass the page's translator for its language (Russian without one). */ -export function ago(d: Date | null | undefined, t: Translator = ruT): string { +/** «5 мин назад» in the page's language. */ +export function ago(d: Date | null | undefined, t: Translator): string { if (!d) return "—"; const s = Math.round((Date.now() - d.getTime()) / 1000); if (s < 60) return t("{n} с назад", { n: s });