.
This commit is contained in:
1 parent
5af2c80cd1
commit
f7ee34da4f
78 files changed
+9016
-150
No files matched your search
@@ -281,6 +281,11 @@ export default function MatchDetailPage() {
|
||||
const authUserId = useAuthUserId();
|
||||
const matchQuery = useMatch(id, DEFAULT_COMMUNITY_ID);
|
||||
const meQuery = useMe();
|
||||
const currentUser =
|
||||
meQuery.data?.memberships.find(
|
||||
(membership) => membership.community?._id === DEFAULT_COMMUNITY_ID,
|
||||
)?.user ?? null;
|
||||
const canUseMemberActions = Boolean(currentUser || authUserId);
|
||||
const auctionQuery = useAuction(id, DEFAULT_COMMUNITY_ID);
|
||||
const [blueCaptainUserId, setBlueCaptainUserId] = useState('');
|
||||
const [redCaptainUserId, setRedCaptainUserId] = useState('');
|
||||
@@ -291,8 +296,8 @@ export default function MatchDetailPage() {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
preferredPositions:
|
||||
meQuery.data?.user?.preferredPositions.length
|
||||
? meQuery.data.user.preferredPositions.slice(0, 5)
|
||||
currentUser?.preferredPositions.length
|
||||
? currentUser.preferredPositions.slice(0, 5)
|
||||
: buildDefaultPreferredPositions(),
|
||||
}),
|
||||
}),
|
||||
@@ -376,7 +381,7 @@ export default function MatchDetailPage() {
|
||||
const match = mapApiMatchToMatchDetail(matchQuery.data);
|
||||
const si = statusBadge(match.status);
|
||||
const canManageAuction =
|
||||
meQuery.data?.user?.role === 'owner' || meQuery.data?.user?.role === 'admin';
|
||||
currentUser?.role === 'owner' || currentUser?.role === 'admin';
|
||||
const auctionNotStarted =
|
||||
auctionQuery.error instanceof ApiError && auctionQuery.error.status === 404;
|
||||
const showAuctionLink = Boolean(auctionQuery.data);
|
||||
@@ -490,7 +495,7 @@ export default function MatchDetailPage() {
|
||||
participants={match.participants}
|
||||
maxParticipants={match.maxParticipants}
|
||||
joined={match.joined}
|
||||
canJoin={Boolean(authUserId)}
|
||||
canJoin={canUseMemberActions}
|
||||
onJoin={() => joinMatchMutation.mutate()}
|
||||
isJoining={joinMatchMutation.isPending}
|
||||
/>
|
||||
@@ -551,9 +556,9 @@ export default function MatchDetailPage() {
|
||||
>
|
||||
{startAuctionMutation.isPending ? '시작 중...' : '경매 시작'}
|
||||
</button>
|
||||
{!authUserId && (
|
||||
{!canUseMemberActions && (
|
||||
<span className="text-xs text-amber-600">
|
||||
Dev Auth에 owner/admin User ID를 먼저 입력해주세요.
|
||||
로그인 또는 Dev Auth에 owner/admin User ID를 먼저 입력해주세요.
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user