Skip to content
Open
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
2 changes: 1 addition & 1 deletion packages/web/components/Player/PlayerList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const PlayerList: React.FC<Props> = ({
{players.map((player, idx) => (
<PlayerTile
key={player.profile?.username ?? idx}
{...{ player, showSeasonalXP }}
{...{ player, showSeasonalXP, index: idx }}
/>
))}
</SimpleGrid>
Expand Down
13 changes: 13 additions & 0 deletions packages/web/components/Player/PlayerRank.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ import { convertToRoman } from '#utils/formatHelpers';
type PlayerRankProps = {
player: Player;
showSeasonalXP?: boolean;
/** Optional numeric rank position (#1, #2, #3…) displayed on leaderboard cards */
index?: number;
};

export const PlayerRank: React.FC<PlayerRankProps> = ({
player,
showSeasonalXP,
index,
}) => (
<Flex
direction="column"
Expand All @@ -26,6 +29,16 @@ export const PlayerRank: React.FC<PlayerRankProps> = ({
zIndex={1}
>
<Flex flexDir="column" gap={2} zIndex={2}>
{index != null && (
<MetaTag
size="md"
color="white"
backgroundColor="purple.500"
justifyContent="center"
>
<TagLabel fontWeight="bold">#{index + 1}</TagLabel>
</MetaTag>
)}
{player.rank && (
<MetaTag
backgroundColor={player.rank.toLowerCase()}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/components/Player/PlayerTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const PlayerTile: React.FC<Props> = ({
{isPatron && typeof index === 'number' && pSeedPrice ? (
<PatronRank patron={player as Patron} {...{ pSeedPrice, index }} />
) : (
<PlayerRank {...{ player, showSeasonalXP }} />
<PlayerRank {...{ player, showSeasonalXP, index }} />
)}
<PlayerProfilePicture {...{ player }} size="xl" />
<Flex px={3} w="full" pos="absolute" bottom={-6} zIndex={1}>
Expand Down