From 002c65785564f3239164991e75bc78a1d8d79a58 Mon Sep 17 00:00:00 2001 From: NotBigGhost Date: Mon, 13 Jul 2026 17:42:05 +0300 Subject: [PATCH] =?UTF-8?q?UI:=20=D0=B4=D0=B0=D1=82=D1=8B=20=D0=B8=D0=B3?= =?UTF-8?q?=D1=80=20=D0=B2=20=D0=B5=D0=B4=D0=B8=D0=BD=D0=BE=D0=BC=20=D1=84?= =?UTF-8?q?=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D0=B5=20=D0=94=D0=94.=D0=9C?= =?UTF-8?q?=D0=9C.=D0=93=D0=93=D0=93=D0=93=20=D0=B2=D0=BC=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=BE=20=D1=81=D1=8B=D1=80=D1=8B=D1=85=20ISO-=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Новый formatDate в domain/format.ts для date-only строк (played_at, last_match_at). Применён: список партий, заголовок страницы партии (раньше там было «2026-07-13»), записи в админке, «последняя партия» на странице группы. Co-Authored-By: Claude Fable 5 --- frontend/src/components/MatchList.tsx | 4 ++-- frontend/src/domain/format.ts | 8 ++++++++ frontend/src/pages/GroupPage.tsx | 3 ++- frontend/src/pages/MatchDetailPage.tsx | 4 ++-- frontend/src/pages/admin/AdminRecordsPage.tsx | 3 ++- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/MatchList.tsx b/frontend/src/components/MatchList.tsx index f55a90b..1e86f14 100644 --- a/frontend/src/components/MatchList.tsx +++ b/frontend/src/components/MatchList.tsx @@ -1,6 +1,6 @@ import { useNavigate } from "react-router-dom"; -import { formatDuration } from "../domain/format"; +import { formatDate, formatDuration } from "../domain/format"; import { winReasonLabel } from "../domain/winReasons"; import type { MatchListItem } from "../domain/types"; import { PlayerLink } from "./PlayerLink"; @@ -24,7 +24,7 @@ export function MatchListView({ items }: { items: MatchListItem[] }) { onClick={() => navigate(`/match/${m.id}`)} >
- {m.played_at} + {formatDate(m.played_at)} {inProgress ? ( идёт ) : ( diff --git a/frontend/src/domain/format.ts b/frontend/src/domain/format.ts index a9f93b8..8a4b6cd 100644 --- a/frontend/src/domain/format.ts +++ b/frontend/src/domain/format.ts @@ -28,6 +28,14 @@ export function formatTime(iso: string | null | undefined): string { } } +// «Дата игры» приходит date-only строкой (YYYY-MM-DD) — просто переставляем части, +// без сдвига пояса (бэкенд уже посчитал дату в поясе приложения). +export function formatDate(iso: string | null | undefined): string { + if (!iso) return "—"; + const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(iso); + return m ? `${m[3]}.${m[2]}.${m[1]}` : iso; +} + export function formatDateTime(iso: string | null | undefined): string { if (!iso) return "—"; try { diff --git a/frontend/src/pages/GroupPage.tsx b/frontend/src/pages/GroupPage.tsx index bb01393..8ef89ad 100644 --- a/frontend/src/pages/GroupPage.tsx +++ b/frontend/src/pages/GroupPage.tsx @@ -6,6 +6,7 @@ import { GroupSwitcher } from "../components/GroupSwitcher"; import { Leaderboard } from "../components/Leaderboard"; import { MatchListView } from "../components/MatchList"; import { Spinner } from "../components/Spinner"; +import { formatDate } from "../domain/format"; import { useMe } from "../hooks/auth"; import { useGroup, useGroupMatches, useGroupStats } from "../hooks/groups"; @@ -49,7 +50,7 @@ export function GroupPage() {

Партий: {stats?.total_matches ?? 0} - {stats?.last_match_at ? ` · последняя: ${stats.last_match_at}` : ""} + {stats?.last_match_at ? ` · последняя: ${formatDate(stats.last_match_at)}` : ""}

diff --git a/frontend/src/pages/MatchDetailPage.tsx b/frontend/src/pages/MatchDetailPage.tsx index 6e13008..d8ebc67 100644 --- a/frontend/src/pages/MatchDetailPage.tsx +++ b/frontend/src/pages/MatchDetailPage.tsx @@ -6,7 +6,7 @@ import { ConfirmDialog } from "../components/ConfirmDialog"; import { MatchMedia } from "../components/MatchMedia"; import { PlayerLink } from "../components/PlayerLink"; import { Spinner } from "../components/Spinner"; -import { formatDuration, formatTime } from "../domain/format"; +import { formatDate, formatDuration, formatTime } from "../domain/format"; import { WIN_REASONS, type WinReason, winReasonLabel } from "../domain/winReasons"; import { useToast } from "../context/ToastContext"; import { @@ -120,7 +120,7 @@ export function MatchDetailPage() {
-

{match.played_at}

+

{formatDate(match.played_at)}

{inProgress ? ( идёт ) : ( diff --git a/frontend/src/pages/admin/AdminRecordsPage.tsx b/frontend/src/pages/admin/AdminRecordsPage.tsx index 8bbab19..e4de2f4 100644 --- a/frontend/src/pages/admin/AdminRecordsPage.tsx +++ b/frontend/src/pages/admin/AdminRecordsPage.tsx @@ -3,6 +3,7 @@ import { useMemo, useState } from "react"; import { ApiError } from "../../api/client"; import { ConfirmDialog } from "../../components/ConfirmDialog"; +import { formatDate } from "../../domain/format"; import { Spinner } from "../../components/Spinner"; import { Switch } from "../../components/Switch"; import { useToast } from "../../context/ToastContext"; @@ -54,7 +55,7 @@ export function AdminRecordsPage() {
- #{m.id} · {m.played_at} + #{m.id} · {formatDate(m.played_at)} {!grouped && · {m.group_name}}
{m.player_count} игр. · автор {m.created_by}