Merge pull request 'Правка отображение идущих игр в группе (#26)' (#27) from issue-26-drop-live-badge into dev

Reviewed-on: #27
This commit was merged in pull request #27.
This commit is contained in:
2026-09-09 15:02:51 +03:00
2 changed files with 7 additions and 12 deletions
@@ -29,10 +29,7 @@ export function InProgressMatches({
style={{ margin: 0, width: "100%", textAlign: "left" }} style={{ margin: 0, width: "100%", textAlign: "left" }}
> >
<div style={{ minWidth: 0 }}> <div style={{ minWidth: 0 }}>
<div className="row" style={{ gap: 8 }}> {showGroupName && <b>{m.group_name}</b>}
{showGroupName && <b>{m.group_name}</b>}
<span className="badge badge-live">идёт</span>
</div>
<div className="muted small"> <div className="muted small">
{formatTime(m.started_at)} · {m.player_count}{" "} {formatTime(m.started_at)} · {m.player_count}{" "}
{plural(m.player_count, "игрок", "игрока", "игроков")} {plural(m.player_count, "игрок", "игрока", "игроков")}
+6 -8
View File
@@ -4,6 +4,9 @@ import { formatDate, formatDuration } from "../domain/format";
import { winReasonLabel } from "../domain/winReasons"; import { winReasonLabel } from "../domain/winReasons";
import type { MatchListItem } from "../domain/types"; import type { MatchListItem } from "../domain/types";
/** Список ЗАВЕРШЁННЫХ партий. Незавершённые сюда не попадают: группа отдаёт их
* отдельным блоком (InProgressMatches), а история профиля приходит с бэкенда уже
* отфильтрованной по status="finished". */
export function MatchListView({ items }: { items: MatchListItem[] }) { export function MatchListView({ items }: { items: MatchListItem[] }) {
const navigate = useNavigate(); const navigate = useNavigate();
if (items.length === 0) return <div className="muted small">Партий пока нет.</div>; if (items.length === 0) return <div className="muted small">Партий пока нет.</div>;
@@ -11,7 +14,6 @@ export function MatchListView({ items }: { items: MatchListItem[] }) {
return ( return (
<div className="stack"> <div className="stack">
{items.map((m) => { {items.map((m) => {
const inProgress = m.status === "in_progress";
const sorted = [...m.participants].sort((a, b) => (a.place ?? 99) - (b.place ?? 99)); const sorted = [...m.participants].sort((a, b) => (a.place ?? 99) - (b.place ?? 99));
return ( return (
<button <button
@@ -22,13 +24,9 @@ export function MatchListView({ items }: { items: MatchListItem[] }) {
> >
<div className="row-between"> <div className="row-between">
<span className="muted small">{formatDate(m.played_at)}</span> <span className="muted small">{formatDate(m.played_at)}</span>
{inProgress ? ( <span className="muted small">
<span className="badge badge-live">идёт</span> {formatDuration(m.duration_minutes)} · {winReasonLabel(m.win_reason)}
) : ( </span>
<span className="muted small">
{formatDuration(m.duration_minutes)} · {winReasonLabel(m.win_reason)}
</span>
)}
</div> </div>
<div className="stack" style={{ marginTop: 6, gap: 4 }}> <div className="stack" style={{ marginTop: 6, gap: 4 }}>
{/* Ники здесь — просто текст: карточка целиком ведёт в партию, {/* Ники здесь — просто текст: карточка целиком ведёт в партию,