Группа: не дублировать название группы в блоке текущей игры
На главной партии приходят из разных групп, поэтому название нужно; на странице самой группы оно повторяет заголовок страницы. Блок получил проп showGroupName (по умолчанию true) — главная не меняется. #2 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ps52xzuUXnWrJ5SRnEeaLk
This commit is contained in:
@@ -4,7 +4,16 @@ import { useNavigate } from "react-router-dom";
|
|||||||
import { formatTime, plural } from "../domain/format";
|
import { formatTime, plural } from "../domain/format";
|
||||||
import type { HomeInProgressMatch } from "../domain/types";
|
import type { HomeInProgressMatch } from "../domain/types";
|
||||||
|
|
||||||
export function InProgressMatches({ items }: { items: HomeInProgressMatch[] }) {
|
/** Блок незавершённых партий. На главной партии приходят из разных групп, поэтому
|
||||||
|
* название группы нужно; на странице самой группы оно дублирует заголовок — там
|
||||||
|
* блок вызывается с showGroupName={false}. */
|
||||||
|
export function InProgressMatches({
|
||||||
|
items,
|
||||||
|
showGroupName = true,
|
||||||
|
}: {
|
||||||
|
items: HomeInProgressMatch[];
|
||||||
|
showGroupName?: boolean;
|
||||||
|
}) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
if (items.length === 0) return null;
|
if (items.length === 0) return null;
|
||||||
|
|
||||||
@@ -21,7 +30,7 @@ export function InProgressMatches({ items }: { items: HomeInProgressMatch[] }) {
|
|||||||
>
|
>
|
||||||
<div style={{ minWidth: 0 }}>
|
<div style={{ minWidth: 0 }}>
|
||||||
<div className="row" style={{ gap: 8 }}>
|
<div className="row" style={{ gap: 8 }}>
|
||||||
<b>{m.group_name}</b>
|
{showGroupName && <b>{m.group_name}</b>}
|
||||||
<span className="badge badge-live">идёт</span>
|
<span className="badge badge-live">идёт</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="muted small">
|
<div className="muted small">
|
||||||
|
|||||||
@@ -161,7 +161,8 @@ export function GroupPage() {
|
|||||||
|
|
||||||
<GroupSwitcher />
|
<GroupSwitcher />
|
||||||
|
|
||||||
<InProgressMatches items={inProgress} />
|
{/* Название группы не показываем: оно уже есть в заголовке страницы. */}
|
||||||
|
<InProgressMatches items={inProgress} showGroupName={false} />
|
||||||
|
|
||||||
<h3 style={{ marginTop: 8 }}>Партии</h3>
|
<h3 style={{ marginTop: 8 }}>Партии</h3>
|
||||||
{matches && <MatchListView items={finishedMatches} />}
|
{matches && <MatchListView items={finishedMatches} />}
|
||||||
|
|||||||
Reference in New Issue
Block a user