Группа: текущая игра — тем же блоком, что на главной
На странице группы идущая партия лежала в общем списке «Партии» и отличалась от завершённых только бейджем «идёт». Теперь она выносится блоком InProgressMatches — тем же компонентом, что на главной. MatchListItem уже содержит всё, что нужно HomeInProgressMatch (started_at, player_count и тот же MatchListParticipant), поэтому бэкенд не тронут: недостающие group_id и group_name берутся из useMe/useGroup. Из списка «Партии» идущие партии исключены, иначе одна партия показывалась бы на странице дважды. #2 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ps52xzuUXnWrJ5SRnEeaLk
This commit is contained in:
@@ -6,6 +6,7 @@ import { ApiError } from "../api/client";
|
||||
import { CreateGroupForm } from "../components/CreateGroupForm";
|
||||
import { GroupInvitations } from "../components/GroupInvitations";
|
||||
import { GroupSwitcher } from "../components/GroupSwitcher";
|
||||
import { InProgressMatches } from "../components/InProgressMatches";
|
||||
import { Leaderboard } from "../components/Leaderboard";
|
||||
import { MatchListView } from "../components/MatchList";
|
||||
import { PlayerSuggestions } from "../components/PlayerSuggestions";
|
||||
@@ -83,6 +84,14 @@ export function GroupPage() {
|
||||
);
|
||||
}
|
||||
|
||||
// Идущие партии выносим тем же блоком, что и на главной; из списка «Партии»
|
||||
// их исключаем, иначе одна партия показалась бы на странице дважды.
|
||||
const allMatches = matches?.items ?? [];
|
||||
const inProgress = allMatches
|
||||
.filter((m) => m.status === "in_progress")
|
||||
.map((m) => ({ ...m, group_id: groupId, group_name: group?.name ?? "" }));
|
||||
const finishedMatches = allMatches.filter((m) => m.status !== "in_progress");
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="card">
|
||||
@@ -152,8 +161,10 @@ export function GroupPage() {
|
||||
|
||||
<GroupSwitcher />
|
||||
|
||||
<InProgressMatches items={inProgress} />
|
||||
|
||||
<h3 style={{ marginTop: 8 }}>Партии</h3>
|
||||
{matches && <MatchListView items={matches.items} />}
|
||||
{matches && <MatchListView items={finishedMatches} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user