fix: show solo queue tier graph in auction
This commit is contained in:
1 parent
b0dc857463
commit
d2fe4604dd
1 file changed
+13
-4
@@ -48,6 +48,7 @@ import { RankBadge, ResponsiveTierLabel } from '../components/RankBadge';
|
||||
import type {
|
||||
ApiAuction,
|
||||
ApiAuctionChatMessage,
|
||||
ApiTierHistoryEntry,
|
||||
ApiRiotLaneStats,
|
||||
ApiUser,
|
||||
Position,
|
||||
@@ -153,6 +154,10 @@ function getMaxBidForTeam(team: AuctionStateView['teams'][number]) {
|
||||
return Math.max(0, team.points - getReservedPointsAfterCurrentBid(team));
|
||||
}
|
||||
|
||||
function getSoloTierHistory(entries: ApiTierHistoryEntry[]) {
|
||||
return entries.filter((entry) => entry.queueType === 'RANKED_SOLO_5x5');
|
||||
}
|
||||
|
||||
function PosBadge({ pos }: { pos: Position }) {
|
||||
return (
|
||||
<span className="inline-flex items-center gap-1.5 text-xs font-medium px-1.5 py-0.5 border border-primary/20 text-primary bg-primary/5">
|
||||
@@ -408,16 +413,19 @@ function PlayerSpotlight({
|
||||
}) {
|
||||
const { data: ddragon } = useDdragonManifest();
|
||||
const player = state.currentPlayer;
|
||||
const snapshotSoloTierHistory = player
|
||||
? getSoloTierHistory(player.tierHistory)
|
||||
: [];
|
||||
const historyProfileQuery = useUserHistoryProfile(
|
||||
player?.userId,
|
||||
DEFAULT_COMMUNITY_ID,
|
||||
Boolean(player && player.tierHistory.length === 0),
|
||||
Boolean(player && snapshotSoloTierHistory.length === 0),
|
||||
);
|
||||
if (!player) return null;
|
||||
const tierHistory =
|
||||
player.tierHistory.length > 0
|
||||
? player.tierHistory
|
||||
: (historyProfileQuery.data?.tierHistory ?? []);
|
||||
snapshotSoloTierHistory.length > 0
|
||||
? snapshotSoloTierHistory
|
||||
: getSoloTierHistory(historyProfileQuery.data?.tierHistory ?? []);
|
||||
|
||||
return (
|
||||
<div className="border border-base-content/10 bg-base-100">
|
||||
@@ -472,6 +480,7 @@ function PlayerSpotlight({
|
||||
}
|
||||
>
|
||||
<TierHistoryChart
|
||||
key={`${player.userId}-solo-tier-history`}
|
||||
entries={tierHistory}
|
||||
className="border-b border-base-content/8 bg-base-100 overflow-hidden"
|
||||
summaryVariant="inline"
|
||||
|
||||
Reference in new issue
Block a user