feat(web): add pool sidebar and chat skeleton to auction page
Surface the remaining player pool (waiting + passed) on a left sidebar so captains can see who still needs a team without revealing the auction order — entries are sorted by summoner name. Reserve a right sidebar for the upcoming chat integration. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
1 parent
e306d696a9
commit
85ba8044da
1 file changed
+197
-2
@@ -11,6 +11,7 @@ import {
|
||||
} from '../api/hooks';
|
||||
import {
|
||||
mapApiAuctionToAuctionState,
|
||||
type AuctionPlayerView,
|
||||
type AuctionStateView,
|
||||
} from '../api/mappers';
|
||||
import { useAuctionSocket } from '../api/useAuctionSocket';
|
||||
@@ -859,7 +860,7 @@ export default function AuctionPage() {
|
||||
) : null;
|
||||
|
||||
return (
|
||||
<main className="max-w-5xl mx-auto px-4 sm:px-6 py-6">
|
||||
<main className="max-w-[1600px] mx-auto px-4 sm:px-6 py-6">
|
||||
<Link
|
||||
to={`/match/${id}`}
|
||||
className="inline-flex items-center gap-1 text-xs text-base-content/40 hover:text-base-content transition-colors mb-4"
|
||||
@@ -955,7 +956,11 @@ export default function AuctionPage() {
|
||||
<TimerBar timer={auctionState.timer} maxTimer={auctionState.maxTimer} />
|
||||
)}
|
||||
|
||||
<div className="grid grid-cols-1 xl:grid-cols-[minmax(0,1fr)_minmax(340px,440px)] gap-4 mt-4">
|
||||
<div className="grid grid-cols-1 xl:grid-cols-[260px_minmax(0,1fr)_minmax(340px,440px)_320px] gap-4 mt-4">
|
||||
<aside className="hidden xl:block">
|
||||
<PoolPanel state={auctionState} />
|
||||
</aside>
|
||||
|
||||
<div className="grid sm:grid-cols-2 gap-4 content-start">
|
||||
{auctionState.teams.map((team) => (
|
||||
<TeamPanel
|
||||
@@ -1066,7 +1071,197 @@ export default function AuctionPage() {
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<aside className="hidden xl:block">
|
||||
<ChatPanel matchId={auctionState.matchId} />
|
||||
</aside>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
type PoolTab = 'waiting' | 'passed';
|
||||
|
||||
// 풀 리스트는 경매 등장 순서를 노출하면 안 되므로 게임명 알파벳 순으로 독립 정렬한다.
|
||||
const POOL_COLLATOR = new Intl.Collator(['ko', 'en'], { sensitivity: 'base' });
|
||||
|
||||
function comparePoolPlayers(a: AuctionPlayerView, b: AuctionPlayerView) {
|
||||
return POOL_COLLATOR.compare(a.summonerName, b.summonerName);
|
||||
}
|
||||
|
||||
function PoolPanel({ state }: { state: AuctionStateView }) {
|
||||
const { data: ddragon } = useDdragonManifest();
|
||||
const [tab, setTab] = useState<PoolTab>('waiting');
|
||||
|
||||
const { waitingPool, passedPool } = useMemo(() => {
|
||||
const captainIds = new Set(state.teams.map((team) => team.captainUserId));
|
||||
const memberIds = new Set(
|
||||
state.teams.flatMap((team) =>
|
||||
team.members.map((member) => member.userId),
|
||||
),
|
||||
);
|
||||
const passedIds = new Set(
|
||||
state.passedQueue.map((player) => player.userId),
|
||||
);
|
||||
const currentId = state.currentPlayer?.userId;
|
||||
|
||||
const startIndex =
|
||||
state.phase === 'complete' ? state.totalPlayers : state.currentPlayerIndex + 1;
|
||||
|
||||
const waiting = state.auctionOrder
|
||||
.slice(startIndex)
|
||||
.filter(
|
||||
(player) =>
|
||||
!captainIds.has(player.userId) &&
|
||||
!memberIds.has(player.userId) &&
|
||||
!passedIds.has(player.userId) &&
|
||||
player.userId !== currentId,
|
||||
)
|
||||
.sort(comparePoolPlayers);
|
||||
|
||||
const passed = [...state.passedQueue].sort(comparePoolPlayers);
|
||||
|
||||
return { waitingPool: waiting, passedPool: passed };
|
||||
}, [state]);
|
||||
|
||||
const activePool = tab === 'waiting' ? waitingPool : passedPool;
|
||||
|
||||
return (
|
||||
<div className="border border-base-content/10 bg-base-100 sticky top-4 max-h-[calc(100vh-2rem)] flex flex-col">
|
||||
<div role="tablist" className="flex border-b border-base-content/10 px-3">
|
||||
<PoolTabButton
|
||||
label="대기"
|
||||
count={waitingPool.length}
|
||||
active={tab === 'waiting'}
|
||||
onClick={() => setTab('waiting')}
|
||||
/>
|
||||
<PoolTabButton
|
||||
label="유찰"
|
||||
count={passedPool.length}
|
||||
active={tab === 'passed'}
|
||||
onClick={() => setTab('passed')}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex-1 overflow-y-auto">
|
||||
{activePool.length === 0 ? (
|
||||
<div className="px-3 py-8 text-center text-[11px] text-base-content/30">
|
||||
{tab === 'waiting'
|
||||
? '대기 중인 유저가 없습니다'
|
||||
: '유찰된 유저가 없습니다'}
|
||||
</div>
|
||||
) : (
|
||||
<ul className="divide-y divide-base-content/5">
|
||||
{activePool.map((player) => (
|
||||
<PoolListItem
|
||||
key={player.userId}
|
||||
player={player}
|
||||
ddragon={ddragon}
|
||||
showPassCount={tab === 'passed'}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function PoolTabButton({
|
||||
label,
|
||||
count,
|
||||
active,
|
||||
onClick,
|
||||
}: {
|
||||
label: string;
|
||||
count: number;
|
||||
active: boolean;
|
||||
onClick: () => void;
|
||||
}) {
|
||||
return (
|
||||
<button
|
||||
role="tab"
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
className={`relative px-1 pt-3 pb-2.5 mr-5 text-[12px] font-semibold transition-colors ${
|
||||
active
|
||||
? 'text-base-content'
|
||||
: 'text-base-content/40 hover:text-base-content/70'
|
||||
}`}
|
||||
>
|
||||
{label}
|
||||
<span className="ml-1 text-[10px] tabular-nums text-base-content/30">
|
||||
{count}
|
||||
</span>
|
||||
{active ? (
|
||||
<span className="absolute -bottom-px left-0 right-0 h-px bg-primary" />
|
||||
) : null}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
function PoolListItem({
|
||||
player,
|
||||
ddragon,
|
||||
showPassCount,
|
||||
}: {
|
||||
player: AuctionPlayerView;
|
||||
ddragon: ReturnType<typeof useDdragonManifest>['data'];
|
||||
showPassCount: boolean;
|
||||
}) {
|
||||
return (
|
||||
<li className="flex items-center gap-2 px-3 py-2">
|
||||
<img
|
||||
src={profileIconUrl(ddragon, player.profileIconId)}
|
||||
alt=""
|
||||
className="w-7 h-7 shrink-0 rounded-sm border border-base-content/10 object-cover"
|
||||
/>
|
||||
<div className="min-w-0 flex-1 flex items-center gap-1.5">
|
||||
<span className="truncate text-[12px] font-semibold text-base-content">
|
||||
{player.summonerName}
|
||||
</span>
|
||||
<RankBadge tier={player.tier} />
|
||||
{showPassCount && player.passCount > 0 ? (
|
||||
<span className="inline-flex items-center text-[10px] font-medium px-1.5 py-0.5 border border-amber-500/30 text-amber-500 bg-amber-500/5">
|
||||
{player.passCount}회 유찰
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
function ChatPanel({ matchId: _matchId }: { matchId: string }) {
|
||||
return (
|
||||
<div className="border border-base-content/10 bg-base-100 sticky top-4 h-[calc(100vh-2rem)] flex flex-col">
|
||||
<div className="border-b border-base-content/10 px-3 py-2.5 flex items-center justify-between">
|
||||
<div className="text-[10px] font-bold uppercase tracking-wider text-base-content/35">
|
||||
채팅
|
||||
</div>
|
||||
<span className="text-[10px] text-base-content/30">
|
||||
곧 활성화됩니다
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="flex-1 overflow-y-auto px-3 py-8 text-center text-[11px] text-base-content/25">
|
||||
아직 메시지가 없습니다
|
||||
</div>
|
||||
|
||||
<div className="border-t border-base-content/10 p-2 space-y-2">
|
||||
<textarea
|
||||
disabled
|
||||
placeholder="메시지를 입력하세요"
|
||||
className="w-full resize-none border border-base-content/10 bg-base-content/5 px-2 py-1.5 text-[12px] text-base-content/40 placeholder:text-base-content/25 focus:outline-none"
|
||||
rows={2}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
disabled
|
||||
className="btn btn-primary btn-sm w-full text-[11px] opacity-50"
|
||||
>
|
||||
전송
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user