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 {
|
import type {
|
||||||
ApiAuction,
|
ApiAuction,
|
||||||
ApiAuctionChatMessage,
|
ApiAuctionChatMessage,
|
||||||
|
ApiTierHistoryEntry,
|
||||||
ApiRiotLaneStats,
|
ApiRiotLaneStats,
|
||||||
ApiUser,
|
ApiUser,
|
||||||
Position,
|
Position,
|
||||||
@@ -153,6 +154,10 @@ function getMaxBidForTeam(team: AuctionStateView['teams'][number]) {
|
|||||||
return Math.max(0, team.points - getReservedPointsAfterCurrentBid(team));
|
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 }) {
|
function PosBadge({ pos }: { pos: Position }) {
|
||||||
return (
|
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">
|
<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 { data: ddragon } = useDdragonManifest();
|
||||||
const player = state.currentPlayer;
|
const player = state.currentPlayer;
|
||||||
|
const snapshotSoloTierHistory = player
|
||||||
|
? getSoloTierHistory(player.tierHistory)
|
||||||
|
: [];
|
||||||
const historyProfileQuery = useUserHistoryProfile(
|
const historyProfileQuery = useUserHistoryProfile(
|
||||||
player?.userId,
|
player?.userId,
|
||||||
DEFAULT_COMMUNITY_ID,
|
DEFAULT_COMMUNITY_ID,
|
||||||
Boolean(player && player.tierHistory.length === 0),
|
Boolean(player && snapshotSoloTierHistory.length === 0),
|
||||||
);
|
);
|
||||||
if (!player) return null;
|
if (!player) return null;
|
||||||
const tierHistory =
|
const tierHistory =
|
||||||
player.tierHistory.length > 0
|
snapshotSoloTierHistory.length > 0
|
||||||
? player.tierHistory
|
? snapshotSoloTierHistory
|
||||||
: (historyProfileQuery.data?.tierHistory ?? []);
|
: getSoloTierHistory(historyProfileQuery.data?.tierHistory ?? []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="border border-base-content/10 bg-base-100">
|
<div className="border border-base-content/10 bg-base-100">
|
||||||
@@ -472,6 +480,7 @@ function PlayerSpotlight({
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<TierHistoryChart
|
<TierHistoryChart
|
||||||
|
key={`${player.userId}-solo-tier-history`}
|
||||||
entries={tierHistory}
|
entries={tierHistory}
|
||||||
className="border-b border-base-content/8 bg-base-100 overflow-hidden"
|
className="border-b border-base-content/8 bg-base-100 overflow-hidden"
|
||||||
summaryVariant="inline"
|
summaryVariant="inline"
|
||||||
|
|||||||
Reference in new issue
Block a user