UI: в списке партий группы ники снова некликабельны
Карточка партии целиком ведёт на страницу партии — вложенные ссылки на профили мешали выбору партии (легко промахнуться в профиль). Ссылки на профили остаются на странице партии, в топах и списке участников. Карточка возвращена к семантичному <button>. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,6 @@ import { useNavigate } from "react-router-dom";
|
|||||||
import { formatDate, formatDuration } from "../domain/format";
|
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";
|
||||||
import { PlayerLink } from "./PlayerLink";
|
|
||||||
|
|
||||||
export function MatchListView({ items }: { items: MatchListItem[] }) {
|
export function MatchListView({ items }: { items: MatchListItem[] }) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -15,12 +14,10 @@ export function MatchListView({ items }: { items: MatchListItem[] }) {
|
|||||||
const inProgress = m.status === "in_progress";
|
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 (
|
||||||
// div, а не button: внутри карточки лежат ссылки на профили игроков,
|
<button
|
||||||
// а интерактивные элементы внутри <button> — невалидная разметка.
|
|
||||||
<div
|
|
||||||
key={m.id}
|
key={m.id}
|
||||||
className="card"
|
className="card"
|
||||||
style={{ textAlign: "left", width: "100%", margin: 0, cursor: "pointer" }}
|
style={{ textAlign: "left", width: "100%", margin: 0 }}
|
||||||
onClick={() => navigate(`/match/${m.id}`)}
|
onClick={() => navigate(`/match/${m.id}`)}
|
||||||
>
|
>
|
||||||
<div className="row-between">
|
<div className="row-between">
|
||||||
@@ -34,8 +31,10 @@ export function MatchListView({ items }: { items: MatchListItem[] }) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="stack" style={{ marginTop: 6, gap: 4 }}>
|
<div className="stack" style={{ marginTop: 6, gap: 4 }}>
|
||||||
|
{/* Ники здесь — просто текст: карточка целиком ведёт в партию,
|
||||||
|
вложенные ссылки на профили мешали бы выбору партии. */}
|
||||||
{sorted.map((p) => (
|
{sorted.map((p) => (
|
||||||
<PlayerLink key={p.user_id} userId={p.user_id} className="row" style={{ gap: 8 }}>
|
<div key={p.user_id} className="row" style={{ gap: 8 }}>
|
||||||
<span
|
<span
|
||||||
className={
|
className={
|
||||||
"place-badge" +
|
"place-badge" +
|
||||||
@@ -48,10 +47,10 @@ export function MatchListView({ items }: { items: MatchListItem[] }) {
|
|||||||
<span>{p.nickname}</span>
|
<span>{p.nickname}</span>
|
||||||
<span className="muted small">· {p.faction_name}</span>
|
<span className="muted small">· {p.faction_name}</span>
|
||||||
{p.was_random && <span className="badge">🎲</span>}
|
{p.was_random && <span className="badge">🎲</span>}
|
||||||
</PlayerLink>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</button>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user