fix(web): stabilize participant filter table
This commit is contained in:
1 parent
d10e2ab011
commit
12869a7e9e
1 file changed
+43
-27
@@ -88,6 +88,9 @@ const PARTICIPANT_TIER_LABELS: Record<string, string> = {
|
||||
UNRANKED: "언랭크",
|
||||
};
|
||||
|
||||
const PARTICIPANT_TABLE_ROW_CLASS =
|
||||
"h-12 border-b border-base-content/5 last:border-b-0";
|
||||
|
||||
function captainSlotKey(slot: CaptainSelectionSlot) {
|
||||
return String(slot.teamIndex);
|
||||
}
|
||||
@@ -302,7 +305,7 @@ function PositionSelect({
|
||||
value={value}
|
||||
disabled={disabled}
|
||||
onChange={(event) => onChange(event.target.value as Position)}
|
||||
className={`h-7 border bg-base-100 pl-1.5 pr-1 text-[11px] font-medium focus:border-primary/30 focus:outline-none disabled:opacity-50 ${
|
||||
className={`h-7 w-16 border bg-base-100 pl-1.5 pr-1 text-[11px] font-medium focus:border-primary/30 focus:outline-none disabled:opacity-50 ${
|
||||
sub
|
||||
? "border-base-content/10 text-base-content/45"
|
||||
: "border-primary/20 text-primary"
|
||||
@@ -351,7 +354,9 @@ function ParticipantRow({
|
||||
admin.onChangePositions(participant.userId, main, next);
|
||||
};
|
||||
return (
|
||||
<tr className="border-b border-base-content/5 last:border-b-0 hover:bg-base-content/[0.02] transition-colors">
|
||||
<tr
|
||||
className={`${PARTICIPANT_TABLE_ROW_CLASS} hover:bg-base-content/[0.02] transition-colors`}
|
||||
>
|
||||
<td className="hidden py-2 px-3 text-center text-[11px] text-base-content/30 w-8 sm:table-cell">
|
||||
{index + 1}
|
||||
</td>
|
||||
@@ -611,18 +616,18 @@ function ParticipantTable({
|
||||
</button>
|
||||
</div>
|
||||
<div className="border-b border-base-content/10 bg-base-100 px-4 py-2.5">
|
||||
<div className="flex flex-wrap items-center gap-x-3 gap-y-2">
|
||||
<div className="flex flex-wrap items-center gap-x-2 gap-y-2">
|
||||
<div className="inline-flex items-center gap-1">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setPositionFilter(ALL_PARTICIPANT_FILTER)}
|
||||
className={`inline-flex h-8 items-center px-2.5 text-[11px] font-semibold border transition-colors ${
|
||||
className={`inline-flex h-8 w-[3.75rem] items-center justify-center px-1 text-[10px] font-semibold border transition-colors ${
|
||||
positionFilter === ALL_PARTICIPANT_FILTER
|
||||
? "border-primary/30 bg-primary/5 text-primary"
|
||||
: "border-base-content/10 text-base-content/40 hover:text-base-content/70"
|
||||
}`}
|
||||
>
|
||||
전체 ({participants.length})
|
||||
전체<span className="tabular-nums">({participants.length})</span>
|
||||
</button>
|
||||
{POSITION_ORDER.map((position) => {
|
||||
const active = positionFilter === position;
|
||||
@@ -639,27 +644,20 @@ function ParticipantTable({
|
||||
active ? ALL_PARTICIPANT_FILTER : position,
|
||||
)
|
||||
}
|
||||
className={`inline-flex h-8 items-center gap-1 px-2 text-[11px] font-semibold border transition-colors ${
|
||||
className={`inline-flex h-8 w-[3.75rem] items-center justify-center px-1 text-[10px] font-semibold border transition-colors ${
|
||||
active
|
||||
? "border-primary/30 bg-primary/5 text-primary"
|
||||
: "border-base-content/10 text-base-content/40 hover:text-base-content/70"
|
||||
}`}
|
||||
>
|
||||
<img
|
||||
src={positionIcon[position]}
|
||||
alt=""
|
||||
className="h-3.5 w-3.5 object-contain"
|
||||
/>
|
||||
<span className="hidden sm:inline">
|
||||
{positionLabel[position]}
|
||||
</span>
|
||||
{positionLabel[position]}
|
||||
<span className="tabular-nums">({count})</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<select
|
||||
className="h-8 border border-base-content/10 bg-base-100 px-2 text-xs text-base-content focus:border-primary/30 focus:outline-none"
|
||||
className="h-8 w-32 shrink-0 border border-base-content/10 bg-base-100 px-2 text-xs text-base-content focus:border-primary/30 focus:outline-none"
|
||||
value={tierFilter}
|
||||
onChange={(event) => setTierFilter(event.target.value)}
|
||||
>
|
||||
@@ -671,14 +669,11 @@ function ParticipantTable({
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<div className="ml-auto flex items-center gap-2 text-[11px] text-base-content/35">
|
||||
<span>
|
||||
{filteredParticipants.length}/{participants.length}명
|
||||
</span>
|
||||
<div className="ml-auto flex min-w-[6.5rem] shrink-0 items-center justify-end gap-1 whitespace-nowrap text-[11px] text-base-content/35">
|
||||
{isFiltered && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-ghost btn-xs h-8 min-h-8 px-2 text-[11px] text-base-content/40"
|
||||
className="btn btn-ghost btn-xs h-8 min-h-8 shrink-0 px-1 text-[11px] text-base-content/40"
|
||||
onClick={() => {
|
||||
setPositionFilter(ALL_PARTICIPANT_FILTER);
|
||||
setTierFilter(ALL_PARTICIPANT_FILTER);
|
||||
@@ -687,20 +682,41 @@ function ParticipantTable({
|
||||
초기화
|
||||
</button>
|
||||
)}
|
||||
<span className="w-10 shrink-0 text-right tabular-nums">
|
||||
{filteredParticipants.length}/{participants.length}명
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full text-left">
|
||||
<table className="w-full min-w-[40rem] table-fixed text-left">
|
||||
<colgroup>
|
||||
<col className="w-0 sm:w-[5%]" />
|
||||
<col className={canManage ? "w-[25%]" : "w-[37%]"} />
|
||||
<col className={canManage ? "w-[30%]" : "w-[30%]"} />
|
||||
<col className={canManage ? "w-[14%]" : "w-[14%]"} />
|
||||
<col className={canManage ? "w-[14%]" : "w-[14%]"} />
|
||||
{canManage && <col className="w-[12%]" />}
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr className="border-b border-base-content/10 bg-base-200/40 text-[11px] uppercase tracking-wider text-base-content/35 font-semibold">
|
||||
<th className="hidden py-2 px-3 w-8 sm:table-cell">#</th>
|
||||
<th className="py-2 px-3">소환사</th>
|
||||
<th className="py-2 px-3">현재 티어</th>
|
||||
<th className="py-2 px-3">주 포지션</th>
|
||||
<th className="py-2 px-3">부 포지션</th>
|
||||
<th className="hidden py-2 px-3 w-0 sm:table-cell sm:w-[5%]">
|
||||
#
|
||||
</th>
|
||||
<th className={canManage ? "py-2 px-3 w-[25%]" : "py-2 px-3 w-[37%]"}>
|
||||
소환사
|
||||
</th>
|
||||
<th className={canManage ? "py-2 px-3 w-[30%]" : "py-2 px-3 w-[30%]"}>
|
||||
현재 티어
|
||||
</th>
|
||||
<th className={canManage ? "py-2 px-3 w-[14%]" : "py-2 px-3 w-[14%]"}>
|
||||
주 포지션
|
||||
</th>
|
||||
<th className={canManage ? "py-2 px-3 w-[14%]" : "py-2 px-3 w-[14%]"}>
|
||||
부 포지션
|
||||
</th>
|
||||
{canManage && (
|
||||
<th className="py-2 px-3 w-20 min-w-[5rem] whitespace-nowrap text-right">
|
||||
<th className="py-2 px-3 w-[12%] min-w-[5rem] whitespace-nowrap text-right">
|
||||
관리
|
||||
</th>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user