feat: show tier history in auction spotlight

This commit is contained in:
dahyeon committed 2026-06-08 00:34:04 -07:00
1 parent de8bc87940
commit ebca348723
8 files changed
+160 -3

No files matched your search

+2 -1
View File
@@ -225,6 +225,7 @@ function createUserHistoryPath(
export function useUserHistoryProfile(
userId: string | undefined,
communityId = DEFAULT_COMMUNITY_ID,
enabled = true,
) {
return useQuery({
queryKey: ['user-history-profile', communityId, userId ?? null],
@@ -233,7 +234,7 @@ export function useUserHistoryProfile(
`/communities/${communityId}/users/${userId}/history-profile`,
{ auth: 'none' },
),
enabled: Boolean(communityId && userId),
enabled: enabled && Boolean(communityId && userId),
retry: false,
});
}
+5
View File
@@ -7,6 +7,7 @@ import type {
ApiPositionPreference,
ApiRiotLaneStats,
ApiRiotRecentStatsSummary,
ApiTierHistoryEntry,
ApiTierInfo,
MatchStatus,
Position,
@@ -91,6 +92,7 @@ export interface AuctionPlayerView extends ParticipantView {
level: number;
points: number;
}[];
tierHistory: ApiTierHistoryEntry[];
recentStats: {
overall: ApiRiotLaneStats;
byLane: Partial<Record<RiotLane, ApiRiotLaneStats>>;
@@ -236,6 +238,7 @@ function mapAuctionPlayerToView(
summonerName: player.gameName,
tag: player.tagLine,
tier: selectPrimaryTier(player.tiers),
tierHistory: player.tierHistory ?? [],
mainPosition,
subPosition,
profileIconId: player.profileIconId,
@@ -288,12 +291,14 @@ function mapAuctionTeamToView(
...participant,
passCount: 0,
masteries: [],
tierHistory: [],
recentStats: createEmptyRecentStatsView(),
}
: {
...createFallbackParticipant(member.userId),
passCount: 0,
masteries: [],
tierHistory: [],
recentStats: createEmptyRecentStatsView(),
});
+2 -1
View File
@@ -78,7 +78,7 @@ export interface ApiRiotAccount {
summonerLevel: number;
isPrimary: boolean;
tiers: ApiTierInfo[];
tierHistory: unknown[];
tierHistory: ApiTierHistoryEntry[];
matchIds: string[];
championMasteries: ApiChampionMasteryEntry[];
championRecords: Record<string, Record<string, unknown>>;
@@ -247,6 +247,7 @@ export interface ApiAuctionPlayerSnapshot {
profileIconId: number;
preferredPositions: ApiPositionPreference[];
tiers: ApiTierInfo[];
tierHistory: ApiTierHistoryEntry[];
masteries: ApiChampionMasteryEntry[];
recentStatsSummary?: ApiRiotRecentStatsSummary;
passCount: number;
+3 -1
View File
@@ -159,8 +159,10 @@ function TierTooltip({
export default function TierHistoryChart({
entries,
className = "border border-base-content/10 bg-base-100 mb-5 overflow-hidden",
}: {
entries: ApiTierHistoryEntry[];
className?: string;
}) {
// 데이터에 존재하는 큐 목록 (솔로 우선)
const availableQueues = useMemo(() => {
@@ -264,7 +266,7 @@ export default function TierHistoryChart({
);
return (
<section className="border border-base-content/10 bg-base-100 mb-5 overflow-hidden">
<section className={className}>
{header}
{points.length < 2 ? (
<div className="px-4 py-10 text-center text-xs text-base-content/35">
+27
View File
@@ -1,4 +1,6 @@
import {
lazy,
Suspense,
useEffect,
useMemo,
useRef,
@@ -17,6 +19,7 @@ import {
useMe,
useResetAuction,
useUndoAuction,
useUserHistoryProfile,
} from '../api/hooks';
import {
mapApiAuctionToAuctionState,
@@ -50,6 +53,8 @@ import type {
Position,
} from '../api/types';
const TierHistoryChart = lazy(() => import('../components/TierHistoryChart'));
type CaptainRole = {
teamIndex: number;
};
@@ -481,7 +486,16 @@ function PlayerSpotlight({
}) {
const { data: ddragon } = useDdragonManifest();
const player = state.currentPlayer;
const historyProfileQuery = useUserHistoryProfile(
player?.userId,
DEFAULT_COMMUNITY_ID,
Boolean(player && player.tierHistory.length === 0),
);
if (!player) return null;
const tierHistory =
player.tierHistory.length > 0
? player.tierHistory
: (historyProfileQuery.data?.tierHistory ?? []);
return (
<div className="border border-base-content/10 bg-base-100">
@@ -575,6 +589,19 @@ function PlayerSpotlight({
<RecentSoloStats player={player} />
</div>
{tierHistory.length > 0 && (
<Suspense
fallback={
<div className="h-[180px] border-t border-base-content/8 bg-base-100" />
}
>
<TierHistoryChart
entries={tierHistory}
className="border-t border-base-content/8 bg-base-100 overflow-hidden"
/>
</Suspense>
)}
{(state.phase === 'bidding' || state.phase === 'sold') && (
<div className="border-t border-base-content/8 px-4 py-3 bg-base-content/[0.02]">
<div className="flex items-center justify-between">