fix(web): stabilize recruiting mobile participant list
This commit is contained in:
1 parent
5ba68ea134
commit
ee3e5935d6
1 file changed
+145
-2
@@ -503,6 +503,120 @@ function TeamParticipantMobileRow({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ParticipantMobileRow({
|
||||||
|
participant,
|
||||||
|
admin,
|
||||||
|
}: {
|
||||||
|
participant: ParticipantView;
|
||||||
|
admin?: ParticipantRowAdmin;
|
||||||
|
}) {
|
||||||
|
const { data: ddragon } = useDdragonManifest();
|
||||||
|
const location = useLocation();
|
||||||
|
const historyBackTo = `${location.pathname}${location.search}${location.hash}`;
|
||||||
|
const [confirmingRemove, setConfirmingRemove] = useState(false);
|
||||||
|
|
||||||
|
const handleMainChange = (next: Position) => {
|
||||||
|
if (!admin) return;
|
||||||
|
const sub =
|
||||||
|
next === participant.subPosition
|
||||||
|
? participant.mainPosition
|
||||||
|
: participant.subPosition;
|
||||||
|
admin.onChangePositions(participant.userId, next, sub);
|
||||||
|
};
|
||||||
|
const handleSubChange = (next: Position) => {
|
||||||
|
if (!admin) return;
|
||||||
|
const main =
|
||||||
|
next === participant.mainPosition
|
||||||
|
? participant.subPosition
|
||||||
|
: participant.mainPosition;
|
||||||
|
admin.onChangePositions(participant.userId, main, next);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="border-b border-base-content/5 px-3 py-2 last:border-b-0">
|
||||||
|
<div className="grid grid-cols-[minmax(0,1fr)_64px_58px] items-center gap-x-2">
|
||||||
|
<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-sm 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-xs leading-tight text-base-content/25">
|
||||||
|
#{participant.tag}
|
||||||
|
{participant.excluded && (
|
||||||
|
<span className="border border-amber-500/20 bg-amber-500/10 px-1 text-xs font-bold text-amber-500">
|
||||||
|
제외
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
<TierCell participant={participant} />
|
||||||
|
<PreferredPositionText
|
||||||
|
mainPosition={participant.mainPosition}
|
||||||
|
subPosition={participant.subPosition}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{admin && (
|
||||||
|
<div className="mt-2 flex flex-wrap items-center justify-between gap-x-3 gap-y-2 border-t border-base-content/5 pt-2">
|
||||||
|
<span className="inline-flex items-center gap-1 whitespace-nowrap">
|
||||||
|
<PositionSelect
|
||||||
|
value={participant.mainPosition}
|
||||||
|
disabled={admin.isUpdating}
|
||||||
|
onChange={handleMainChange}
|
||||||
|
/>
|
||||||
|
<span className="text-xs text-base-content/35">/</span>
|
||||||
|
<PositionSelect
|
||||||
|
value={participant.subPosition}
|
||||||
|
sub
|
||||||
|
disabled={admin.isUpdating}
|
||||||
|
onChange={handleSubChange}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
{confirmingRemove ? (
|
||||||
|
<span className="inline-flex items-center gap-2 whitespace-nowrap">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
disabled={admin.isRemoving}
|
||||||
|
onClick={() => admin.onRemove(participant.userId)}
|
||||||
|
className="text-xs font-bold text-red-400 hover:text-red-300 disabled:opacity-50"
|
||||||
|
>
|
||||||
|
{admin.isRemoving ? "제외 중..." : "확인"}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setConfirmingRemove(false)}
|
||||||
|
className="text-xs text-base-content/35 hover:text-base-content/60"
|
||||||
|
>
|
||||||
|
취소
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setConfirmingRemove(true)}
|
||||||
|
className="text-xs font-bold text-base-content/35 hover:text-red-400"
|
||||||
|
>
|
||||||
|
제외
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function ParticipantTable({
|
function ParticipantTable({
|
||||||
participants,
|
participants,
|
||||||
maxParticipants,
|
maxParticipants,
|
||||||
@@ -669,7 +783,36 @@ function ParticipantTable({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="overflow-x-auto">
|
<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-xs font-semibold uppercase tracking-wider text-base-content/35">
|
||||||
|
<span>소환사</span>
|
||||||
|
<span>현재 티어</span>
|
||||||
|
<span>포지션</span>
|
||||||
|
</div>
|
||||||
|
{filteredParticipants.length > 0 ? (
|
||||||
|
filteredParticipants.map((participant) => (
|
||||||
|
<ParticipantMobileRow
|
||||||
|
key={participant.id}
|
||||||
|
participant={participant}
|
||||||
|
admin={
|
||||||
|
canManage
|
||||||
|
? {
|
||||||
|
onRemove: onRemoveParticipant,
|
||||||
|
onChangePositions: onUpdatePositions,
|
||||||
|
isRemoving: removingUserId === participant.userId,
|
||||||
|
isUpdating: updatingUserId === participant.userId,
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<div className="px-3 py-8 text-center text-sm text-base-content/35">
|
||||||
|
조건에 맞는 참가자가 없습니다.
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="hidden overflow-x-auto sm:block">
|
||||||
<table className="w-full min-w-[40rem] table-fixed text-left">
|
<table className="w-full min-w-[40rem] table-fixed text-left">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col className="w-0 sm:w-[5%]" />
|
<col className="w-0 sm:w-[5%]" />
|
||||||
@@ -733,7 +876,7 @@ function ParticipantTable({
|
|||||||
) : (
|
) : (
|
||||||
<tr>
|
<tr>
|
||||||
<td
|
<td
|
||||||
colSpan={canManage ? 6 : 5}
|
colSpan={canManage ? 5 : 4}
|
||||||
className="px-3 py-8 text-center text-sm text-base-content/35"
|
className="px-3 py-8 text-center text-sm text-base-content/35"
|
||||||
>
|
>
|
||||||
조건에 맞는 참가자가 없습니다.
|
조건에 맞는 참가자가 없습니다.
|
||||||
|
|||||||
Reference in new issue
Block a user