feat(web): show participant position counts
This commit is contained in:
1 parent
b711c63dcd
commit
ad84bf1f89
1 file changed
+18
-6
@@ -471,9 +471,9 @@ function ParticipantRow({
|
||||
onChange={handleSubChange}
|
||||
/>
|
||||
</td>
|
||||
<td className="py-2 px-3 text-right">
|
||||
<td className="py-2 px-3 w-20 min-w-[5rem] whitespace-nowrap text-right">
|
||||
{confirmingRemove ? (
|
||||
<span className="inline-flex items-center gap-1.5">
|
||||
<span className="inline-flex items-center gap-1.5 whitespace-nowrap">
|
||||
<button
|
||||
type="button"
|
||||
disabled={admin.isRemoving}
|
||||
@@ -599,6 +599,14 @@ function ParticipantTable({
|
||||
).length,
|
||||
]),
|
||||
);
|
||||
const positionCounts = new Map<Position, number>(
|
||||
POSITION_ORDER.map((position) => [
|
||||
position,
|
||||
participants.filter(
|
||||
(participant) => participant.mainPosition === position,
|
||||
).length,
|
||||
]),
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="border border-base-content/10 bg-base-100 overflow-hidden">
|
||||
@@ -627,16 +635,17 @@ function ParticipantTable({
|
||||
: "border-base-content/10 text-base-content/40 hover:text-base-content/70"
|
||||
}`}
|
||||
>
|
||||
전체
|
||||
전체 ({participants.length})
|
||||
</button>
|
||||
{POSITION_ORDER.map((position) => {
|
||||
const active = positionFilter === position;
|
||||
const count = positionCounts.get(position) ?? 0;
|
||||
return (
|
||||
<button
|
||||
key={position}
|
||||
type="button"
|
||||
title={positionLabel[position]}
|
||||
aria-label={positionLabel[position]}
|
||||
title={`${positionLabel[position]} (${count}명)`}
|
||||
aria-label={`${positionLabel[position]} (${count}명)`}
|
||||
aria-pressed={active}
|
||||
onClick={() =>
|
||||
setPositionFilter(
|
||||
@@ -657,6 +666,7 @@ function ParticipantTable({
|
||||
<span className="hidden sm:inline">
|
||||
{positionLabel[position]}
|
||||
</span>
|
||||
<span className="tabular-nums">({count})</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
@@ -703,7 +713,9 @@ function ParticipantTable({
|
||||
<th className="py-2 px-3">주 포지션</th>
|
||||
<th className="py-2 px-3">부 포지션</th>
|
||||
{canManage && (
|
||||
<th className="py-2 px-3 w-10 text-right">관리</th>
|
||||
<th className="py-2 px-3 w-20 min-w-[5rem] whitespace-nowrap text-right">
|
||||
관리
|
||||
</th>
|
||||
)}
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
Reference in new issue
Block a user