fix(web): improve mobile team layout
This commit is contained in:
1 parent
6fc58fec1d
commit
7a62e52d60
1 file changed
+88
-10
@@ -184,13 +184,29 @@ function QueueRankCell({
|
|||||||
tier?: ApiTierInfo;
|
tier?: ApiTierInfo;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<span className="inline-flex w-[54px] items-center gap-1">
|
<span className="grid grid-cols-[24px_auto] items-center gap-1">
|
||||||
<span>{label}</span>
|
<span>{label}</span>
|
||||||
<RankBadge tier={tier} size="sm" tooltipPlacement="left" />
|
<RankBadge tier={tier} size="sm" tooltipPlacement="left" />
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function PreferredPositionText({
|
||||||
|
mainPosition,
|
||||||
|
subPosition,
|
||||||
|
}: {
|
||||||
|
mainPosition: Position;
|
||||||
|
subPosition: Position;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<span className="inline-flex flex-col gap-0.5 text-[11px] font-medium leading-tight text-base-content/55 whitespace-nowrap sm:flex-row sm:items-center sm:gap-1 sm:leading-normal">
|
||||||
|
<span>주 {positionLabel[mainPosition]}</span>
|
||||||
|
<span className="hidden sm:inline">/</span>
|
||||||
|
<span>부 {positionLabel[subPosition]}</span>
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function SoloRankPrefix({ tier }: { tier?: ApiTierInfo }) {
|
function SoloRankPrefix({ tier }: { tier?: ApiTierInfo }) {
|
||||||
return (
|
return (
|
||||||
<span className="inline-flex shrink-0 items-center gap-1 text-[10px] font-black text-base-content/35">
|
<span className="inline-flex shrink-0 items-center gap-1 text-[10px] font-black text-base-content/35">
|
||||||
@@ -214,7 +230,7 @@ function TierCell({ participant }: { participant: ParticipantView }) {
|
|||||||
const flexTier = tierByQueue(tiers, "RANKED_FLEX_SR");
|
const flexTier = tierByQueue(tiers, "RANKED_FLEX_SR");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center gap-2 text-[10px] font-black text-base-content/35 whitespace-nowrap">
|
<div className="flex flex-col items-start gap-1 text-[10px] font-black text-base-content/35 whitespace-nowrap sm:flex-row sm:items-center sm:gap-3">
|
||||||
<QueueRankCell label="SOLO" tier={soloTier} />
|
<QueueRankCell label="SOLO" tier={soloTier} />
|
||||||
<QueueRankCell label="FLEX" tier={flexTier} />
|
<QueueRankCell label="FLEX" tier={flexTier} />
|
||||||
</div>
|
</div>
|
||||||
@@ -334,17 +350,16 @@ function ParticipantRow({
|
|||||||
: participant.mainPosition;
|
: participant.mainPosition;
|
||||||
admin.onChangePositions(participant.userId, main, next);
|
admin.onChangePositions(participant.userId, main, next);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<tr className="border-b border-base-content/5 last:border-b-0 hover:bg-base-content/[0.02] transition-colors">
|
<tr className="border-b border-base-content/5 last:border-b-0 hover:bg-base-content/[0.02] transition-colors">
|
||||||
<td className="py-2 px-3 text-center text-[11px] text-base-content/30 w-8">
|
<td className="hidden py-2 px-3 text-center text-[11px] text-base-content/30 w-8 sm:table-cell">
|
||||||
{index + 1}
|
{index + 1}
|
||||||
</td>
|
</td>
|
||||||
<td className="py-2 px-3">
|
<td className="py-2 px-3">
|
||||||
<Link
|
<Link
|
||||||
to={`/users/${participant.userId}/history`}
|
to={`/users/${participant.userId}/history`}
|
||||||
state={{ backTo: historyBackTo }}
|
state={{ backTo: historyBackTo }}
|
||||||
className="flex items-center gap-2 group"
|
className="flex min-w-0 items-center gap-2 group"
|
||||||
>
|
>
|
||||||
<div className="w-7 h-7 bg-base-content/10 overflow-hidden shrink-0">
|
<div className="w-7 h-7 bg-base-content/10 overflow-hidden shrink-0">
|
||||||
<img
|
<img
|
||||||
@@ -355,7 +370,7 @@ function ParticipantRow({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="min-w-0">
|
<div className="min-w-0">
|
||||||
<span className="font-medium text-[13px] text-base-content truncate block leading-tight group-hover:text-primary transition-colors">
|
<span className="font-medium text-[13px] text-base-content block leading-tight break-words group-hover:text-primary transition-colors sm:truncate">
|
||||||
{participant.summonerName}
|
{participant.summonerName}
|
||||||
</span>
|
</span>
|
||||||
<span className="inline-flex items-center gap-1 text-[10px] text-base-content/25 leading-tight">
|
<span className="inline-flex items-center gap-1 text-[10px] text-base-content/25 leading-tight">
|
||||||
@@ -374,7 +389,10 @@ function ParticipantRow({
|
|||||||
</td>
|
</td>
|
||||||
{assignedPos ? (
|
{assignedPos ? (
|
||||||
<td className="py-2 px-3">
|
<td className="py-2 px-3">
|
||||||
<PosBadge pos={assignedPos} />
|
<PreferredPositionText
|
||||||
|
mainPosition={participant.mainPosition}
|
||||||
|
subPosition={participant.subPosition}
|
||||||
|
/>
|
||||||
</td>
|
</td>
|
||||||
) : admin ? (
|
) : admin ? (
|
||||||
<>
|
<>
|
||||||
@@ -452,6 +470,53 @@ function ParticipantRow({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function TeamParticipantMobileRow({
|
||||||
|
participant,
|
||||||
|
}: {
|
||||||
|
participant: ParticipantView;
|
||||||
|
}) {
|
||||||
|
const { data: ddragon } = useDdragonManifest();
|
||||||
|
const location = useLocation();
|
||||||
|
const historyBackTo = `${location.pathname}${location.search}${location.hash}`;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="grid grid-cols-[minmax(0,1fr)_64px_58px] items-center gap-x-2 border-b border-base-content/5 px-3 py-2 last:border-b-0">
|
||||||
|
<Link
|
||||||
|
to={`/users/${participant.userId}/history`}
|
||||||
|
state={{ backTo: historyBackTo }}
|
||||||
|
className="flex min-w-0 items-center gap-2 group"
|
||||||
|
>
|
||||||
|
<div className="h-7 w-7 shrink-0 overflow-hidden bg-base-content/10">
|
||||||
|
<img
|
||||||
|
src={profileIconUrl(ddragon, participant.profileIconId)}
|
||||||
|
alt=""
|
||||||
|
className="h-full w-full object-cover"
|
||||||
|
loading="lazy"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="min-w-0">
|
||||||
|
<span className="block break-words text-[13px] font-medium leading-tight text-base-content transition-colors group-hover:text-primary">
|
||||||
|
{participant.summonerName}
|
||||||
|
</span>
|
||||||
|
<span className="inline-flex items-center gap-1 text-[10px] leading-tight text-base-content/25">
|
||||||
|
#{participant.tag}
|
||||||
|
{participant.excluded && (
|
||||||
|
<span className="border border-amber-500/20 bg-amber-500/10 px-1 text-[9px] font-bold text-amber-500">
|
||||||
|
제외
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
<TierCell participant={participant} />
|
||||||
|
<PreferredPositionText
|
||||||
|
mainPosition={participant.mainPosition}
|
||||||
|
subPosition={participant.subPosition}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function ParticipantTable({
|
function ParticipantTable({
|
||||||
participants,
|
participants,
|
||||||
maxParticipants,
|
maxParticipants,
|
||||||
@@ -629,7 +694,7 @@ function ParticipantTable({
|
|||||||
<table className="w-full text-left">
|
<table className="w-full text-left">
|
||||||
<thead>
|
<thead>
|
||||||
<tr className="border-b border-base-content/10 bg-base-200/40 text-[11px] uppercase tracking-wider text-base-content/35 font-semibold">
|
<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="py-2 px-3 w-8">#</th>
|
<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="py-2 px-3">주 포지션</th>
|
<th className="py-2 px-3">주 포지션</th>
|
||||||
@@ -722,7 +787,20 @@ function TeamCard({
|
|||||||
진행 페이지
|
진행 페이지
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<table className="w-full table-fixed text-left">
|
<div className="sm:hidden">
|
||||||
|
<div className="grid grid-cols-[minmax(0,1fr)_64px_58px] gap-x-2 border-b border-base-content/8 bg-base-200/30 px-3 py-2 text-[11px] font-semibold uppercase tracking-wider text-base-content/35">
|
||||||
|
<span>소환사</span>
|
||||||
|
<span>현재 티어</span>
|
||||||
|
<span>포지션</span>
|
||||||
|
</div>
|
||||||
|
{team.participants.map((participant) => (
|
||||||
|
<TeamParticipantMobileRow
|
||||||
|
key={participant.id}
|
||||||
|
participant={participant}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<table className="hidden w-full table-fixed text-left sm:table">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col className="w-11" />
|
<col className="w-11" />
|
||||||
<col />
|
<col />
|
||||||
@@ -731,7 +809,7 @@ function TeamCard({
|
|||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<tr className="border-b border-base-content/8 bg-base-200/30 text-[11px] uppercase tracking-wider text-base-content/35 font-semibold">
|
<tr className="border-b border-base-content/8 bg-base-200/30 text-[11px] uppercase tracking-wider text-base-content/35 font-semibold">
|
||||||
<th className="py-2 px-3 w-8">#</th>
|
<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="py-2 px-3">포지션</th>
|
<th className="py-2 px-3">포지션</th>
|
||||||
|
|||||||
Reference in new issue
Block a user