Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ function TournamentCreateClient({ tournamentId }: TournamentCreateClientProps) {
// ownerStarted 면 어차피 시작 흐름으로 넘어가야 하므로 마감 처리하지 않는다.
// 협업 의도가 없는 토너먼트는 만료 자체를 무시한다.
const isDepositClosed = !tournamentData.isOwner && !ownerStarted && isExpired && isCollaborative;
// 참여자는 주최자가 시작한 뒤로 담을 수 없다(서버 409). 만료 마감과 별개 사유라 따로 둔다.
const isAddItemBlocked = isDepositClosed || (!tournamentData.isOwner && ownerStarted);

const participantImageMap = new Map(
(pending?.participants ?? []).map(p => [p.userId, p.profileImage])
Expand Down Expand Up @@ -195,7 +197,7 @@ function TournamentCreateClient({ tournamentId }: TournamentCreateClientProps) {
items={pending?.items}
scrollToLast={scrollToLast}
previousItemCount={previousItemCount}
isDepositClosed={isDepositClosed}
isAddItemBlocked={isAddItemBlocked}
participantImageMap={participantImageMap}
/>
<TournamentItemBasketStatus
Expand All @@ -218,7 +220,8 @@ function TournamentCreateClient({ tournamentId }: TournamentCreateClientProps) {
/>
</div>

<Dialog open={isGetItemDialogOpen} onOpenChange={setIsGetItemDialogOpen}>
{/* 쿼리 파라미터로 직접 열 수 있어 + 버튼과 같은 조건으로 막는다 */}
<Dialog open={isGetItemDialogOpen && !isAddItemBlocked} onOpenChange={setIsGetItemDialogOpen}>
<GetItemDialogContent type="tournament" />
</Dialog>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ type TournamentItemBasketProps = {
basketIndex: number;
items: TournamentPendingItemT[];
maxHeight?: number;
isDepositClosed?: boolean;
isAddItemBlocked?: boolean;
participantImageMap?: Map<string, string>;
};

function TournamentItemBasket({
basketIndex,
items,
maxHeight,
isDepositClosed = false,
isAddItemBlocked = false,
participantImageMap,
}: TournamentItemBasketProps) {
const { id } = useParams<{ id: string }>();
Expand All @@ -41,7 +41,7 @@ function TournamentItemBasket({
};

const isFull = items.length >= ITEMS_PER_BASKET;
const showAddButton = !isDepositClosed && !isFull;
const showAddButton = !isAddItemBlocked && !isFull;

const addSlot = showAddButton ? (
<Dialog>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ type TournamentItemBasketCarouselProps = {
scrollToLast?: boolean;
/** 위시 담기 등 재진입 시점의 기존 아이템 개수 */
previousItemCount?: number | null;
isDepositClosed?: boolean;
isAddItemBlocked?: boolean;
participantImageMap?: Map<string, string>;
};

function TournamentItemBasketCarousel({
items = [],
scrollToLast = false,
previousItemCount = null,
isDepositClosed = false,
isAddItemBlocked = false,
participantImageMap,
}: TournamentItemBasketCarouselProps) {
const [carouselApi, setCarouselApi] = useState<CarouselApi>();
Expand Down Expand Up @@ -116,7 +116,7 @@ function TournamentItemBasketCarousel({
<TournamentItemBasket
basketIndex={0}
items={items}
isDepositClosed={isDepositClosed}
isAddItemBlocked={isAddItemBlocked}
maxHeight={basketMaxHeight}
participantImageMap={participantImageMap}
/>
Expand Down Expand Up @@ -145,7 +145,7 @@ function TournamentItemBasketCarousel({
<TournamentItemBasket
basketIndex={i}
items={items.slice(i * ITEMS_PER_BASKET, (i + 1) * ITEMS_PER_BASKET)}
isDepositClosed={isDepositClosed}
isAddItemBlocked={isAddItemBlocked}
maxHeight={basketMaxHeight}
participantImageMap={participantImageMap}
/>
Expand Down
Loading