.
This commit is contained in:
1 parent
3607e3a99c
commit
905e72fbed
13 files changed
+389
-40
No files matched your search
@@ -55,6 +55,9 @@ export class AuctionController {
|
|||||||
initialPoints: body.initialPoints ?? 1000,
|
initialPoints: body.initialPoints ?? 1000,
|
||||||
maxTimerSeconds: body.maxTimerSeconds ?? 30,
|
maxTimerSeconds: body.maxTimerSeconds ?? 30,
|
||||||
topTierThreshold: body.topTierThreshold ?? 'NONE',
|
topTierThreshold: body.topTierThreshold ?? 'NONE',
|
||||||
|
manualTopTierUserIds: (body.manualTopTierUserIds ?? []).map(
|
||||||
|
(userId) => new mongoose.Types.ObjectId(userId),
|
||||||
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ interface StartAuctionParams {
|
|||||||
initialPoints: number;
|
initialPoints: number;
|
||||||
maxTimerSeconds: number;
|
maxTimerSeconds: number;
|
||||||
topTierThreshold: AuctionTopTierThreshold;
|
topTierThreshold: AuctionTopTierThreshold;
|
||||||
|
manualTopTierUserIds: mongoose.Types.ObjectId[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PlaceBidParams {
|
interface PlaceBidParams {
|
||||||
@@ -168,6 +169,7 @@ export class AuctionService {
|
|||||||
const prioritizedOrder = this.applyTopTierPriority(
|
const prioritizedOrder = this.applyTopTierPriority(
|
||||||
order,
|
order,
|
||||||
params.topTierThreshold,
|
params.topTierThreshold,
|
||||||
|
params.manualTopTierUserIds,
|
||||||
);
|
);
|
||||||
|
|
||||||
const auction = await AuctionModel.create({
|
const auction = await AuctionModel.create({
|
||||||
@@ -188,6 +190,8 @@ export class AuctionService {
|
|||||||
maxTimerSeconds: params.maxTimerSeconds,
|
maxTimerSeconds: params.maxTimerSeconds,
|
||||||
initialPoints: params.initialPoints,
|
initialPoints: params.initialPoints,
|
||||||
topTierThreshold: params.topTierThreshold,
|
topTierThreshold: params.topTierThreshold,
|
||||||
|
manualTopTierUserIds:
|
||||||
|
params.topTierThreshold === 'MANUAL' ? params.manualTopTierUserIds : [],
|
||||||
startedAt: new Date(),
|
startedAt: new Date(),
|
||||||
});
|
});
|
||||||
await this.recordSnapshot(auction, 'start');
|
await this.recordSnapshot(auction, 'start');
|
||||||
@@ -532,8 +536,22 @@ export class AuctionService {
|
|||||||
private applyTopTierPriority(
|
private applyTopTierPriority(
|
||||||
order: AuctionPlayerSnapshot[],
|
order: AuctionPlayerSnapshot[],
|
||||||
threshold: AuctionTopTierThreshold,
|
threshold: AuctionTopTierThreshold,
|
||||||
|
manualTopTierUserIds: mongoose.Types.ObjectId[],
|
||||||
): AuctionPlayerSnapshot[] {
|
): AuctionPlayerSnapshot[] {
|
||||||
if (threshold === 'NONE') return order;
|
if (threshold === 'NONE') return order;
|
||||||
|
if (threshold === 'MANUAL') {
|
||||||
|
const manualIds = new Set(
|
||||||
|
manualTopTierUserIds.map((userId) => userId.toString()),
|
||||||
|
);
|
||||||
|
if (manualIds.size === 0) return order;
|
||||||
|
const selected = order.filter((snap) =>
|
||||||
|
manualIds.has(snap.userId.toString()),
|
||||||
|
);
|
||||||
|
const rest = order.filter(
|
||||||
|
(snap) => !manualIds.has(snap.userId.toString()),
|
||||||
|
);
|
||||||
|
return [...selected, ...rest];
|
||||||
|
}
|
||||||
|
|
||||||
const ranks = [
|
const ranks = [
|
||||||
'IRON',
|
'IRON',
|
||||||
|
|||||||
@@ -49,6 +49,12 @@ export class StartAuctionDto {
|
|||||||
@IsEnum(AUCTION_TOP_TIER_THRESHOLDS)
|
@IsEnum(AUCTION_TOP_TIER_THRESHOLDS)
|
||||||
topTierThreshold?: AuctionTopTierThreshold;
|
topTierThreshold?: AuctionTopTierThreshold;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsArray()
|
||||||
|
@ArrayMaxSize(100)
|
||||||
|
@IsMongoId({ each: true })
|
||||||
|
manualTopTierUserIds?: string[];
|
||||||
|
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@Min(5)
|
@Min(5)
|
||||||
|
|||||||
@@ -62,6 +62,10 @@ export async function migrateAuctionPassHistory(
|
|||||||
set.topTierThreshold = 'NONE';
|
set.topTierThreshold = 'NONE';
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
if (!Array.isArray(doc.manualTopTierUserIds)) {
|
||||||
|
set.manualTopTierUserIds = [];
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
const order = Array.isArray(doc.order)
|
const order = Array.isArray(doc.order)
|
||||||
? doc.order.map((player) => {
|
? doc.order.map((player) => {
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ export const AUCTION_TOP_TIER_THRESHOLDS = [
|
|||||||
'EMERALD',
|
'EMERALD',
|
||||||
'DIAMOND',
|
'DIAMOND',
|
||||||
'MASTER',
|
'MASTER',
|
||||||
|
'MANUAL',
|
||||||
] as const;
|
] as const;
|
||||||
export type AuctionTopTierThreshold =
|
export type AuctionTopTierThreshold =
|
||||||
(typeof AUCTION_TOP_TIER_THRESHOLDS)[number];
|
(typeof AUCTION_TOP_TIER_THRESHOLDS)[number];
|
||||||
@@ -535,6 +536,7 @@ export interface Auction extends MongooseTimestamps {
|
|||||||
currentDeadline?: Date;
|
currentDeadline?: Date;
|
||||||
initialPoints: number;
|
initialPoints: number;
|
||||||
topTierThreshold: AuctionTopTierThreshold;
|
topTierThreshold: AuctionTopTierThreshold;
|
||||||
|
manualTopTierUserIds: mongoose.Types.ObjectId[];
|
||||||
startedAt?: Date;
|
startedAt?: Date;
|
||||||
completedAt?: Date;
|
completedAt?: Date;
|
||||||
}
|
}
|
||||||
@@ -1306,6 +1308,12 @@ export const AuctionSchema = new Schema<Auction>(
|
|||||||
required: true,
|
required: true,
|
||||||
default: 'NONE',
|
default: 'NONE',
|
||||||
},
|
},
|
||||||
|
manualTopTierUserIds: {
|
||||||
|
type: [Schema.Types.ObjectId],
|
||||||
|
ref: 'user',
|
||||||
|
required: true,
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
startedAt: { type: Date, required: false },
|
startedAt: { type: Date, required: false },
|
||||||
completedAt: { type: Date, required: false },
|
completedAt: { type: Date, required: false },
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ export type AuctionTopTierThreshold =
|
|||||||
| 'NONE'
|
| 'NONE'
|
||||||
| 'EMERALD'
|
| 'EMERALD'
|
||||||
| 'DIAMOND'
|
| 'DIAMOND'
|
||||||
| 'MASTER';
|
| 'MASTER'
|
||||||
|
| 'MANUAL';
|
||||||
export type CommunityRole = 'owner' | 'admin' | 'member';
|
export type CommunityRole = 'owner' | 'admin' | 'member';
|
||||||
|
|
||||||
export interface ApiPositionPreference {
|
export interface ApiPositionPreference {
|
||||||
@@ -271,6 +272,7 @@ export interface ApiAuction {
|
|||||||
currentDeadline?: string;
|
currentDeadline?: string;
|
||||||
initialPoints: number;
|
initialPoints: number;
|
||||||
topTierThreshold: AuctionTopTierThreshold;
|
topTierThreshold: AuctionTopTierThreshold;
|
||||||
|
manualTopTierUserIds: string[];
|
||||||
startedAt?: string;
|
startedAt?: string;
|
||||||
completedAt?: string;
|
completedAt?: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<svg width="271" height="266" viewBox="0 0 271 266" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M99.7239 97.3495H170.955V168.581H99.7239V97.3495Z" fill="white" fill-opacity="0.15"/>
|
||||||
|
<path d="M30.7359 265.93H270.679V25.9871L218.443 78.2234V216.068H80.5978L30.7359 265.93Z" fill="white" fill-opacity="0.15"/>
|
||||||
|
<path d="M186.362 49.8619H52.2363V183.988L0 236.224V0H236.224L186.362 49.8619Z" fill="white" fill-opacity="0.15"/>
|
||||||
|
<path d="M30.7359 265.93H270.679V25.9871L218.443 78.2234V216.068H80.5978L30.7359 265.93Z" fill="#C89B3C"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 549 B |
@@ -0,0 +1,5 @@
|
|||||||
|
<svg width="265" height="297" viewBox="0 0 265 297" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M153.147 142.463C158.846 153.86 161.853 169.372 162.645 175.704L175.704 144.837C174.912 142.463 173.804 132.965 175.704 113.97C177.603 94.9751 201.031 31.6584 212.507 2.37438C202.614 15.8292 180.453 46.3004 170.955 60.5466C161.458 74.7929 145.628 104.473 138.901 117.532C141.275 121.093 147.449 131.066 153.147 142.463Z" fill="#C89B3C"/>
|
||||||
|
<path d="M192.325 231.502C185.676 237.2 176.891 247.331 173.33 251.684L172.142 217.256C173.33 212.507 176.416 200.635 179.266 191.137C182.115 181.64 189.95 161.458 205.384 134.152C209.341 128.216 220.58 113.258 229.127 105.66C237.675 98.0618 251.684 89.0392 264.743 81.916C246.935 102.098 249.31 99.7239 232.689 129.404C219.16 153.563 216.86 191.533 217.256 213.694C211.715 217.256 198.973 225.803 192.325 231.502Z" fill="#C89B3C"/>
|
||||||
|
<path d="M144.837 211.32C144.837 256.908 136.922 287.3 132.965 296.797C102.573 251.209 63.3167 220.817 47.4875 211.32C46.3004 197.073 42.7388 164.069 37.99 146.024C33.2413 127.979 10.6847 95.7666 0 81.916C10.6847 86.6648 36.5654 100.199 54.6107 116.344C72.656 132.49 85.0819 157.896 89.0392 168.581C89.0392 157.5 88.3268 129.166 85.4776 104.473C82.6283 79.7791 61.3381 24.5352 51.0491 0C60.1509 13.8505 78.3545 35.6157 92.6007 60.5466C102.404 77.702 144.837 154.335 144.837 211.32Z" fill="#C89B3C"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,5 @@
|
|||||||
|
<svg width="271" height="266" viewBox="0 0 271 266" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M0 0H201.227L151.365 49.8619H52.2363V148.991L0 201.227V0Z" fill="white" fill-opacity="0.15"/>
|
||||||
|
<path d="M69.5978 265.93H270.679V64.8484L218.443 117.085V216.068H119.46L69.5978 265.93Z" fill="white" fill-opacity="0.15"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M270.679 43.2903L48.0391 265.93H0V222.785L222.785 0H270.679V43.2903Z" fill="#C89B3C"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 470 B |
@@ -0,0 +1,6 @@
|
|||||||
|
<svg width="323" height="271" viewBox="0 0 323 271" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M149.586 93.7879L160.27 108.034L172.142 93.7879L200.635 238.625L160.27 270.679L122.28 238.625L149.586 93.7879Z" fill="#C89B3C"/>
|
||||||
|
<path d="M207.758 154.335L186.389 85.4776L218.443 53.4235L322.915 56.9851C318.167 62.1295 306.057 72.8934 295.61 79.5416C285.163 86.1899 270.679 93.7879 257.62 94.9751H230.315L257.62 134.152L207.758 154.335Z" fill="#C89B3C"/>
|
||||||
|
<path d="M160.27 77.1673L111.596 21.3694L122.28 0H200.635L210.132 21.3694L160.27 77.1673Z" fill="#C89B3C"/>
|
||||||
|
<path d="M132.965 85.4776L104.473 56.9851H0C3.9573 60.1509 7.12313 70.0441 30.8669 81.916C49.244 91.1046 64.5039 95.3708 67.6698 94.9751H91.4135L64.1082 134.152L115.157 154.335L132.965 85.4776Z" fill="#C89B3C"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 791 B |
@@ -0,0 +1,6 @@
|
|||||||
|
<svg width="114" height="112" viewBox="0 0 114 112" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M72 71L42 71L42 41L72 41L72 71Z" fill="white" fill-opacity="0.15"/>
|
||||||
|
<path d="M101.055 1.13167e-06L-9.79135e-06 9.9662e-06L-9.56827e-07 101.055L22 79.0552L22 21L80.0552 21L101.055 1.13167e-06Z" fill="white" fill-opacity="0.15"/>
|
||||||
|
<path d="M35.5112 91L92 91L92 34.5112L114 12.5112L114 112L14.5112 112L35.5112 91Z" fill="white" fill-opacity="0.15"/>
|
||||||
|
<path d="M101.055 1.13167e-06L-9.79135e-06 9.9662e-06L-9.56827e-07 101.055L22 79.0552L22 21L80.0552 21L101.055 1.13167e-06Z" fill="#C89B3C"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 604 B |
@@ -8,11 +8,11 @@ import {
|
|||||||
useMe,
|
useMe,
|
||||||
usePollTournamentResult,
|
usePollTournamentResult,
|
||||||
useTournamentCodeStats,
|
useTournamentCodeStats,
|
||||||
|
useUserHistoryProfile,
|
||||||
} from '../api/hooks';
|
} from '../api/hooks';
|
||||||
import {
|
import {
|
||||||
buildDefaultPreferredPositions,
|
buildDefaultPreferredPositions,
|
||||||
formatTierLabel,
|
formatTierLabel,
|
||||||
getTierColorToken,
|
|
||||||
mapApiMatchToMatchDetail,
|
mapApiMatchToMatchDetail,
|
||||||
type MatchDetailView,
|
type MatchDetailView,
|
||||||
type ParticipantView,
|
type ParticipantView,
|
||||||
@@ -31,6 +31,7 @@ import {
|
|||||||
import type {
|
import type {
|
||||||
AuctionTopTierThreshold,
|
AuctionTopTierThreshold,
|
||||||
ApiMatchParticipant,
|
ApiMatchParticipant,
|
||||||
|
ApiTierInfo,
|
||||||
Position,
|
Position,
|
||||||
TeamSide,
|
TeamSide,
|
||||||
TournamentCodeSlotView,
|
TournamentCodeSlotView,
|
||||||
@@ -40,10 +41,24 @@ type CaptainSelectionSlot = {
|
|||||||
teamIndex: number;
|
teamIndex: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type CaptainSelection = {
|
||||||
|
userId: string;
|
||||||
|
initialPoints: string;
|
||||||
|
};
|
||||||
|
|
||||||
function captainSlotKey(slot: CaptainSelectionSlot) {
|
function captainSlotKey(slot: CaptainSelectionSlot) {
|
||||||
return String(slot.teamIndex);
|
return String(slot.teamIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseInitialPointsInput(value: string) {
|
||||||
|
if (!value.trim()) return null;
|
||||||
|
const points = Number(value);
|
||||||
|
if (!Number.isInteger(points) || points < 100 || points > 100000) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
function buildAuctionParticipantPool(participants: ApiMatchParticipant[]) {
|
function buildAuctionParticipantPool(participants: ApiMatchParticipant[]) {
|
||||||
const ordered = [...participants].sort(
|
const ordered = [...participants].sort(
|
||||||
(left, right) =>
|
(left, right) =>
|
||||||
@@ -81,25 +96,120 @@ function PosBadge({ pos, sub }: { pos: Position; sub?: boolean }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TierCell({ participant }: { participant: ParticipantView }) {
|
function tierByQueue(tiers: ApiTierInfo[], queueType: string) {
|
||||||
if (!participant.tier) {
|
return tiers.find((tier) => tier.queueType === queueType);
|
||||||
return (
|
}
|
||||||
<div className="text-[11px] text-base-content/25 whitespace-nowrap">
|
|
||||||
티어 정보 없음
|
function normalizeRank(rank: string | undefined) {
|
||||||
</div>
|
switch (rank) {
|
||||||
);
|
case 'I':
|
||||||
|
return '1';
|
||||||
|
case 'II':
|
||||||
|
return '2';
|
||||||
|
case 'III':
|
||||||
|
return '3';
|
||||||
|
case 'IV':
|
||||||
|
return '4';
|
||||||
|
default:
|
||||||
|
return rank;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatRankTooltip(tier: ApiTierInfo | undefined) {
|
||||||
|
if (!tier) return '언랭크';
|
||||||
|
const highTier = ['MASTER', 'GRANDMASTER', 'CHALLENGER'].includes(tier.tier);
|
||||||
|
const normalizedTier = {
|
||||||
|
...tier,
|
||||||
|
rank: normalizeRank(tier.rank) ?? tier.rank,
|
||||||
|
};
|
||||||
|
const label = highTier
|
||||||
|
? formatTierLabel({ ...normalizedTier, leaguePoints: 0 })
|
||||||
|
: formatTierLabel(normalizedTier);
|
||||||
|
return `${label} - ${tier.leaguePoints}LP`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatRankBadge(tier: ApiTierInfo | undefined) {
|
||||||
|
if (!tier) return 'U';
|
||||||
|
const tierInitial =
|
||||||
|
tier.tier === 'GRANDMASTER' ? 'GM' : tier.tier.slice(0, 1);
|
||||||
|
const rank = normalizeRank(tier.rank);
|
||||||
|
return rank ? `${tierInitial}${rank}` : tierInitial;
|
||||||
|
}
|
||||||
|
|
||||||
|
function rankBadgeClass(tier: ApiTierInfo | undefined) {
|
||||||
|
switch (tier?.tier) {
|
||||||
|
case 'CHALLENGER':
|
||||||
|
return 'border-amber-500/60 bg-amber-100 text-amber-900 dark:border-amber-400/40 dark:bg-amber-400/20 dark:text-amber-200';
|
||||||
|
case 'GRANDMASTER':
|
||||||
|
return 'border-red-500/60 bg-red-100 text-red-800 dark:border-red-400/40 dark:bg-red-400/20 dark:text-red-200';
|
||||||
|
case 'MASTER':
|
||||||
|
return 'border-fuchsia-500/60 bg-fuchsia-100 text-fuchsia-800 dark:border-fuchsia-400/40 dark:bg-fuchsia-400/20 dark:text-fuchsia-200';
|
||||||
|
case 'DIAMOND':
|
||||||
|
return 'border-cyan-500/60 bg-cyan-100 text-cyan-800 dark:border-cyan-400/40 dark:bg-cyan-400/20 dark:text-cyan-200';
|
||||||
|
case 'EMERALD':
|
||||||
|
return 'border-emerald-500/60 bg-emerald-100 text-emerald-800 dark:border-emerald-400/40 dark:bg-emerald-400/20 dark:text-emerald-200';
|
||||||
|
case 'PLATINUM':
|
||||||
|
return 'border-teal-500/60 bg-teal-100 text-teal-800 dark:border-teal-400/40 dark:bg-teal-400/20 dark:text-teal-200';
|
||||||
|
case 'GOLD':
|
||||||
|
return 'border-amber-500/70 bg-amber-100 text-amber-900 dark:border-yellow-400/40 dark:bg-yellow-400/20 dark:text-yellow-200';
|
||||||
|
case 'SILVER':
|
||||||
|
return 'border-slate-400/60 bg-slate-100 text-slate-700 dark:border-slate-300/40 dark:bg-slate-300/15 dark:text-slate-200';
|
||||||
|
case 'BRONZE':
|
||||||
|
return 'border-orange-600/60 bg-orange-100 text-orange-800 dark:border-orange-500/40 dark:bg-orange-500/20 dark:text-orange-200';
|
||||||
|
case 'IRON':
|
||||||
|
return 'border-stone-500/60 bg-stone-100 text-stone-700 dark:border-stone-400/40 dark:bg-stone-400/15 dark:text-stone-300';
|
||||||
|
default:
|
||||||
|
return 'border-base-content/30 bg-transparent text-base-content/50';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function RankBadge({ tier }: { tier?: ApiTierInfo }) {
|
||||||
|
const tooltip = formatRankTooltip(tier);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center gap-1.5 text-[11px] whitespace-nowrap">
|
<span className="tooltip tooltip-left" data-tip={tooltip}>
|
||||||
<span className={`font-bold ${getTierColorToken(participant.tier)}`}>
|
<span
|
||||||
{formatTierLabel(participant.tier)}
|
className={`inline-flex h-[17px] min-w-[18px] shrink-0 items-center justify-center whitespace-nowrap rounded-[3px] border px-1 text-[10px] font-black leading-none ${rankBadgeClass(tier)}`}
|
||||||
|
aria-label={tooltip}
|
||||||
|
>
|
||||||
|
{formatRankBadge(tier)}
|
||||||
</span>
|
</span>
|
||||||
{participant.tier.leaguePoints > 0 && (
|
</span>
|
||||||
<span className="text-base-content/25">
|
);
|
||||||
{participant.tier.leaguePoints}LP
|
}
|
||||||
</span>
|
|
||||||
)}
|
function QueueRankCell({
|
||||||
|
label,
|
||||||
|
tier,
|
||||||
|
}: {
|
||||||
|
label: 'SOLO' | 'FLEX';
|
||||||
|
tier?: ApiTierInfo;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<span className="inline-flex items-center gap-1">
|
||||||
|
<span>{label}</span>
|
||||||
|
<RankBadge tier={tier} />
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function TierCell({ participant }: { participant: ParticipantView }) {
|
||||||
|
const profileQuery = useUserHistoryProfile(
|
||||||
|
participant.userId,
|
||||||
|
DEFAULT_COMMUNITY_ID,
|
||||||
|
);
|
||||||
|
const tiers = profileQuery.data?.tiers ?? [];
|
||||||
|
const soloTier =
|
||||||
|
tierByQueue(tiers, 'RANKED_SOLO_5x5') ??
|
||||||
|
(participant.tier?.queueType === 'RANKED_SOLO_5x5'
|
||||||
|
? participant.tier
|
||||||
|
: undefined);
|
||||||
|
const flexTier = tierByQueue(tiers, 'RANKED_FLEX_SR');
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex items-center gap-2 text-[10px] font-black text-base-content/35 whitespace-nowrap">
|
||||||
|
<QueueRankCell label="SOLO" tier={soloTier} />
|
||||||
|
<QueueRankCell label="FLEX" tier={flexTier} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -841,10 +951,11 @@ export default function MatchDetailPage() {
|
|||||||
const canUseMemberActions = Boolean(currentUser || authUserId);
|
const canUseMemberActions = Boolean(currentUser || authUserId);
|
||||||
const auctionQuery = useAuction(id, DEFAULT_COMMUNITY_ID);
|
const auctionQuery = useAuction(id, DEFAULT_COMMUNITY_ID);
|
||||||
const [captainSelections, setCaptainSelections] = useState<
|
const [captainSelections, setCaptainSelections] = useState<
|
||||||
Record<string, { userId: string; initialPoints: number }>
|
Record<string, CaptainSelection>
|
||||||
>({});
|
>({});
|
||||||
const [topTierThreshold, setTopTierThreshold] =
|
const [topTierThreshold, setTopTierThreshold] =
|
||||||
useState<AuctionTopTierThreshold>('NONE');
|
useState<AuctionTopTierThreshold>('NONE');
|
||||||
|
const [manualTopTierUserIds, setManualTopTierUserIds] = useState<string[]>([]);
|
||||||
const pollTournamentResultMutation = usePollTournamentResult(
|
const pollTournamentResultMutation = usePollTournamentResult(
|
||||||
DEFAULT_COMMUNITY_ID,
|
DEFAULT_COMMUNITY_ID,
|
||||||
);
|
);
|
||||||
@@ -882,11 +993,15 @@ export default function MatchDetailPage() {
|
|||||||
teamIndex: slot.teamIndex,
|
teamIndex: slot.teamIndex,
|
||||||
userId: captainSelections[captainSlotKey(slot)]?.userId,
|
userId: captainSelections[captainSlotKey(slot)]?.userId,
|
||||||
initialPoints:
|
initialPoints:
|
||||||
captainSelections[captainSlotKey(slot)]?.initialPoints ?? 1000,
|
parseInitialPointsInput(
|
||||||
|
captainSelections[captainSlotKey(slot)]?.initialPoints ?? '',
|
||||||
|
) ?? 1000,
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
initialPoints: 1000,
|
initialPoints: 1000,
|
||||||
topTierThreshold,
|
topTierThreshold,
|
||||||
|
manualTopTierUserIds:
|
||||||
|
topTierThreshold === 'MANUAL' ? selectedManualTopTierUserIds : [],
|
||||||
maxTimerSeconds: 30,
|
maxTimerSeconds: 30,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
@@ -925,7 +1040,7 @@ export default function MatchDetailPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setCaptainSelections((current) => {
|
setCaptainSelections((current) => {
|
||||||
const next: Record<string, { userId: string; initialPoints: number }> = {};
|
const next: Record<string, CaptainSelection> = {};
|
||||||
const usedUserIds = new Set<string>();
|
const usedUserIds = new Set<string>();
|
||||||
|
|
||||||
for (const slot of slots) {
|
for (const slot of slots) {
|
||||||
@@ -940,7 +1055,7 @@ export default function MatchDetailPage() {
|
|||||||
if (currentIsValid) {
|
if (currentIsValid) {
|
||||||
next[key] = {
|
next[key] = {
|
||||||
userId: currentUserId,
|
userId: currentUserId,
|
||||||
initialPoints: currentSelection?.initialPoints ?? 1000,
|
initialPoints: currentSelection?.initialPoints ?? '1000',
|
||||||
};
|
};
|
||||||
usedUserIds.add(currentUserId);
|
usedUserIds.add(currentUserId);
|
||||||
continue;
|
continue;
|
||||||
@@ -951,7 +1066,7 @@ export default function MatchDetailPage() {
|
|||||||
);
|
);
|
||||||
next[key] = {
|
next[key] = {
|
||||||
userId: fallback?.userId ?? '',
|
userId: fallback?.userId ?? '',
|
||||||
initialPoints: currentSelection?.initialPoints ?? 1000,
|
initialPoints: currentSelection?.initialPoints ?? '1000',
|
||||||
};
|
};
|
||||||
if (fallback) usedUserIds.add(fallback.userId);
|
if (fallback) usedUserIds.add(fallback.userId);
|
||||||
}
|
}
|
||||||
@@ -1008,6 +1123,22 @@ export default function MatchDetailPage() {
|
|||||||
const hasUniqueCaptainSelections =
|
const hasUniqueCaptainSelections =
|
||||||
selectedCaptainIds.length === captainSlots.length &&
|
selectedCaptainIds.length === captainSlots.length &&
|
||||||
new Set(selectedCaptainIds).size === selectedCaptainIds.length;
|
new Set(selectedCaptainIds).size === selectedCaptainIds.length;
|
||||||
|
const hasValidCaptainInitialPoints = captainSlots.every((slot) =>
|
||||||
|
Boolean(
|
||||||
|
parseInitialPointsInput(
|
||||||
|
captainSelections[captainSlotKey(slot)]?.initialPoints ?? '',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
const manualPriorityCandidates = auctionParticipantPool.filter(
|
||||||
|
(participant) => !selectedCaptainIds.includes(participant.userId),
|
||||||
|
);
|
||||||
|
const manualPriorityCandidateIds = new Set(
|
||||||
|
manualPriorityCandidates.map((participant) => participant.userId),
|
||||||
|
);
|
||||||
|
const selectedManualTopTierUserIds = manualTopTierUserIds.filter((userId) =>
|
||||||
|
manualPriorityCandidateIds.has(userId),
|
||||||
|
);
|
||||||
const waitingParticipantCount =
|
const waitingParticipantCount =
|
||||||
matchQuery.data.participants.length - auctionParticipantPool.length;
|
matchQuery.data.participants.length - auctionParticipantPool.length;
|
||||||
const canStartAuction =
|
const canStartAuction =
|
||||||
@@ -1015,7 +1146,8 @@ export default function MatchDetailPage() {
|
|||||||
match.status === 'recruiting' &&
|
match.status === 'recruiting' &&
|
||||||
auctionParticipantPool.length >= 10 &&
|
auctionParticipantPool.length >= 10 &&
|
||||||
auctionNotStarted &&
|
auctionNotStarted &&
|
||||||
hasUniqueCaptainSelections;
|
hasUniqueCaptainSelections &&
|
||||||
|
hasValidCaptainInitialPoints;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="max-w-5xl mx-auto px-4 sm:px-6 py-6">
|
<main className="max-w-5xl mx-auto px-4 sm:px-6 py-6">
|
||||||
@@ -1151,7 +1283,7 @@ export default function MatchDetailPage() {
|
|||||||
[key]: {
|
[key]: {
|
||||||
userId: event.target.value,
|
userId: event.target.value,
|
||||||
initialPoints:
|
initialPoints:
|
||||||
current[key]?.initialPoints ?? 1000,
|
current[key]?.initialPoints ?? '1000',
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
@@ -1180,22 +1312,31 @@ export default function MatchDetailPage() {
|
|||||||
max={100000}
|
max={100000}
|
||||||
step={50}
|
step={50}
|
||||||
className="w-full border border-base-content/10 bg-transparent px-2 py-2 text-sm tabular-nums"
|
className="w-full border border-base-content/10 bg-transparent px-2 py-2 text-sm tabular-nums"
|
||||||
value={currentSelection?.initialPoints ?? 1000}
|
value={currentSelection?.initialPoints ?? '1000'}
|
||||||
onChange={(event) =>
|
onChange={(event) =>
|
||||||
setCaptainSelections((current) => ({
|
setCaptainSelections((current) => ({
|
||||||
...current,
|
...current,
|
||||||
[key]: {
|
[key]: {
|
||||||
userId: current[key]?.userId ?? '',
|
userId: current[key]?.userId ?? '',
|
||||||
initialPoints: Math.min(
|
initialPoints: event.target.value,
|
||||||
100000,
|
|
||||||
Math.max(
|
|
||||||
100,
|
|
||||||
Number(event.target.value) || 100,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
onBlur={() =>
|
||||||
|
setCaptainSelections((current) => {
|
||||||
|
const points = parseInitialPointsInput(
|
||||||
|
current[key]?.initialPoints ?? '',
|
||||||
|
);
|
||||||
|
if (points !== null) return current;
|
||||||
|
return {
|
||||||
|
...current,
|
||||||
|
[key]: {
|
||||||
|
userId: current[key]?.userId ?? '',
|
||||||
|
initialPoints: '1000',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
@@ -1222,8 +1363,56 @@ export default function MatchDetailPage() {
|
|||||||
<option value="EMERALD">EMERALD+</option>
|
<option value="EMERALD">EMERALD+</option>
|
||||||
<option value="DIAMOND">DIAMOND+</option>
|
<option value="DIAMOND">DIAMOND+</option>
|
||||||
<option value="MASTER">MASTER+</option>
|
<option value="MASTER">MASTER+</option>
|
||||||
|
<option value="MANUAL">수동 선택</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
{topTierThreshold === 'MANUAL' && (
|
||||||
|
<div className="border border-base-content/10 bg-base-200/20 p-3">
|
||||||
|
<div className="mb-2 text-[11px] font-bold uppercase tracking-wider text-base-content/35">
|
||||||
|
우선 등장 선수
|
||||||
|
</div>
|
||||||
|
<div className="max-h-48 overflow-y-auto space-y-1">
|
||||||
|
{manualPriorityCandidates.map((participant) => {
|
||||||
|
const checked = selectedManualTopTierUserIds.includes(
|
||||||
|
participant.userId,
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<label
|
||||||
|
key={participant.userId}
|
||||||
|
className="flex cursor-pointer items-center justify-between gap-3 border border-base-content/8 px-2 py-1.5 text-xs text-base-content/55 transition-colors hover:border-primary/25 hover:bg-primary/5"
|
||||||
|
>
|
||||||
|
<span className="min-w-0 truncate">
|
||||||
|
{participant.gameName ?? participant.userId}
|
||||||
|
<span className="ml-1 text-base-content/25">
|
||||||
|
#{participant.tagLine ?? '----'}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
className="checkbox checkbox-primary checkbox-xs"
|
||||||
|
checked={checked}
|
||||||
|
onChange={(event) =>
|
||||||
|
setManualTopTierUserIds((current) =>
|
||||||
|
event.target.checked
|
||||||
|
? [...new Set([...current, participant.userId])]
|
||||||
|
: current.filter(
|
||||||
|
(userId) =>
|
||||||
|
userId !== participant.userId,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
{manualPriorityCandidates.length === 0 && (
|
||||||
|
<div className="border border-dashed border-base-content/10 px-3 py-4 text-xs text-base-content/35">
|
||||||
|
팀장을 제외한 우선 등장 후보가 없습니다.
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<div className="sm:col-span-2 flex items-center gap-3">
|
<div className="sm:col-span-2 flex items-center gap-3">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ import {
|
|||||||
type UserHistoryFilters,
|
type UserHistoryFilters,
|
||||||
} from "../api/hooks";
|
} from "../api/hooks";
|
||||||
import { useRiotRefreshSocket } from "../api/useRiotRefreshSocket";
|
import { useRiotRefreshSocket } from "../api/useRiotRefreshSocket";
|
||||||
import { formatTierLabel, getTierColorToken } from "../api/mappers";
|
|
||||||
import type {
|
import type {
|
||||||
ApiChampionStatsRow,
|
ApiChampionStatsRow,
|
||||||
ApiEnqueueRefreshResult,
|
ApiEnqueueRefreshResult,
|
||||||
|
ApiTierInfo,
|
||||||
ApiRiotRefreshEvent,
|
ApiRiotRefreshEvent,
|
||||||
ApiRecentMatchView,
|
ApiRecentMatchView,
|
||||||
DdragonManifest,
|
DdragonManifest,
|
||||||
@@ -47,6 +47,103 @@ const SORT_LABELS: Record<ChampionSortKey, string> = {
|
|||||||
avgCsPerMin: "분당 CS",
|
avgCsPerMin: "분당 CS",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const TIER_NAMES: Record<string, string> = {
|
||||||
|
IRON: "아이언",
|
||||||
|
BRONZE: "브론즈",
|
||||||
|
SILVER: "실버",
|
||||||
|
GOLD: "골드",
|
||||||
|
PLATINUM: "플래티넘",
|
||||||
|
EMERALD: "에메랄드",
|
||||||
|
DIAMOND: "다이아몬드",
|
||||||
|
MASTER: "마스터",
|
||||||
|
GRANDMASTER: "그랜드마스터",
|
||||||
|
CHALLENGER: "챌린저",
|
||||||
|
};
|
||||||
|
|
||||||
|
function normalizeRank(rank: string | undefined) {
|
||||||
|
switch (rank) {
|
||||||
|
case "I":
|
||||||
|
return "1";
|
||||||
|
case "II":
|
||||||
|
return "2";
|
||||||
|
case "III":
|
||||||
|
return "3";
|
||||||
|
case "IV":
|
||||||
|
return "4";
|
||||||
|
default:
|
||||||
|
return rank;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatRankBadge(tier: ApiTierInfo | undefined) {
|
||||||
|
if (!tier) return "U";
|
||||||
|
const tierInitial =
|
||||||
|
tier.tier === "GRANDMASTER" ? "GM" : tier.tier.slice(0, 1);
|
||||||
|
const rank = normalizeRank(tier.rank);
|
||||||
|
return rank ? `${tierInitial}${rank}` : tierInitial;
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatRankDetail(tier: ApiTierInfo | undefined) {
|
||||||
|
if (!tier) return "랭크 정보 없음";
|
||||||
|
const tierName = TIER_NAMES[tier.tier] ?? tier.tier;
|
||||||
|
const rank = normalizeRank(tier.rank);
|
||||||
|
const label = rank ? `${tierName} ${rank}` : tierName;
|
||||||
|
return `${label} - ${tier.leaguePoints} LP`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function rankBadgeClass(tier: ApiTierInfo | undefined) {
|
||||||
|
switch (tier?.tier) {
|
||||||
|
case "CHALLENGER":
|
||||||
|
return "border-amber-500/60 bg-amber-100 text-amber-900 dark:border-amber-400/40 dark:bg-amber-400/20 dark:text-amber-200";
|
||||||
|
case "GRANDMASTER":
|
||||||
|
return "border-red-500/60 bg-red-100 text-red-800 dark:border-red-400/40 dark:bg-red-400/20 dark:text-red-200";
|
||||||
|
case "MASTER":
|
||||||
|
return "border-fuchsia-500/60 bg-fuchsia-100 text-fuchsia-800 dark:border-fuchsia-400/40 dark:bg-fuchsia-400/20 dark:text-fuchsia-200";
|
||||||
|
case "DIAMOND":
|
||||||
|
return "border-cyan-500/60 bg-cyan-100 text-cyan-800 dark:border-cyan-400/40 dark:bg-cyan-400/20 dark:text-cyan-200";
|
||||||
|
case "EMERALD":
|
||||||
|
return "border-emerald-500/60 bg-emerald-100 text-emerald-800 dark:border-emerald-400/40 dark:bg-emerald-400/20 dark:text-emerald-200";
|
||||||
|
case "PLATINUM":
|
||||||
|
return "border-teal-500/60 bg-teal-100 text-teal-800 dark:border-teal-400/40 dark:bg-teal-400/20 dark:text-teal-200";
|
||||||
|
case "GOLD":
|
||||||
|
return "border-amber-500/70 bg-amber-100 text-amber-900 dark:border-yellow-400/40 dark:bg-yellow-400/20 dark:text-yellow-200";
|
||||||
|
case "SILVER":
|
||||||
|
return "border-slate-400/60 bg-slate-100 text-slate-700 dark:border-slate-300/40 dark:bg-slate-300/15 dark:text-slate-200";
|
||||||
|
case "BRONZE":
|
||||||
|
return "border-orange-600/60 bg-orange-100 text-orange-800 dark:border-orange-500/40 dark:bg-orange-500/20 dark:text-orange-200";
|
||||||
|
case "IRON":
|
||||||
|
return "border-stone-500/60 bg-stone-100 text-stone-700 dark:border-stone-400/40 dark:bg-stone-400/15 dark:text-stone-300";
|
||||||
|
default:
|
||||||
|
return "border-base-content/30 bg-transparent text-base-content/50";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function RankBadge({ tier }: { tier?: ApiTierInfo }) {
|
||||||
|
const tooltip = formatRankDetail(tier);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span className="tooltip tooltip-bottom" data-tip={tooltip}>
|
||||||
|
<span
|
||||||
|
className={`inline-flex h-[18px] min-w-[20px] shrink-0 items-center justify-center whitespace-nowrap rounded-[3px] border px-1 text-[10px] font-black leading-none ${rankBadgeClass(tier)}`}
|
||||||
|
aria-label={tooltip}
|
||||||
|
>
|
||||||
|
{formatRankBadge(tier)}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ResponsiveTierLabel({ tier }: { tier?: ApiTierInfo }) {
|
||||||
|
return (
|
||||||
|
<span className="inline-flex items-center gap-1.5 whitespace-nowrap">
|
||||||
|
<RankBadge tier={tier} />
|
||||||
|
<span className="hidden font-bold text-base-content/55 sm:inline">
|
||||||
|
{formatRankDetail(tier)}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function formatDuration(seconds: number) {
|
function formatDuration(seconds: number) {
|
||||||
const minutes = Math.floor(seconds / 60);
|
const minutes = Math.floor(seconds / 60);
|
||||||
const rest = seconds % 60;
|
const rest = seconds % 60;
|
||||||
@@ -749,13 +846,7 @@ export default function UserHistoryPage() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="mt-2 flex flex-wrap items-center gap-3 text-xs text-base-content/40">
|
<div className="mt-2 flex flex-wrap items-center gap-3 text-xs text-base-content/40">
|
||||||
<span>Lv.{profile.summonerLevel}</span>
|
<span>Lv.{profile.summonerLevel}</span>
|
||||||
{primaryTier ? (
|
<ResponsiveTierLabel tier={primaryTier} />
|
||||||
<span className={`font-bold ${getTierColorToken(primaryTier)}`}>
|
|
||||||
{formatTierLabel(primaryTier)} {primaryTier.leaguePoints}LP
|
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<span>랭크 정보 없음</span>
|
|
||||||
)}
|
|
||||||
<span>시즌: {profile.season.label}</span>
|
<span>시즌: {profile.season.label}</span>
|
||||||
<span>최근 저장: {formatLastFetched(profile.lastFetchedAt)}</span>
|
<span>최근 저장: {formatLastFetched(profile.lastFetchedAt)}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user