Skip to content

Commit

Permalink
add domains as addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
p6te committed Jan 23, 2025
1 parent 954102a commit 9992a2d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ interface LeaderboardItemDetailProps extends BaseLeaderboardItemProps {
last24hPoints?: string
rank?: number
address?: PublicKey
domain?: string
}

export type LeaderboardItemProps = LeaderboardHeaderProps | LeaderboardItemDetailProps
Expand Down Expand Up @@ -77,7 +78,8 @@ const LeaderboardItem: React.FC<LeaderboardItemProps> = props => {
address = '',
last24hPoints = 0,
positions = 0,
hideBottomLine = false
hideBottomLine = false,
domain
} = props

const getColorByPlace = (index: number) => {
Expand Down Expand Up @@ -122,8 +124,17 @@ const LeaderboardItem: React.FC<LeaderboardItemProps> = props => {
}}>
<Typography style={{ color: getColorByPlace(rank) }}>{rank}</Typography>

<Typography>
{shortenAddress(address.toString(), 4)}
<Typography style={{ paddingRight: '24px', width: 'auto' }}>
<span
style={{
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
color: colors.invariant.text
}}>
{domain ? domain : shortenAddress(address.toString(), 4)}
</span>

{isYou ? (
<Typography style={{ color: colors.invariant.pink, marginLeft: '5px' }}>
(You)
Expand Down
4 changes: 2 additions & 2 deletions src/pages/LeaderboardPage/components/LeaderboardItem/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ export const useStyles = makeStyles()(() => ({
},

[theme.breakpoints.down('md')]: {
gridTemplateColumns: '15% auto 17.5%'
gridTemplateColumns: '15% auto 22.5%'
},

[theme.breakpoints.down('sm')]: {
gridTemplateColumns: '15% auto 17.5%',
gridTemplateColumns: '15% auto 22.5%',

'& p': {
justifyContent: 'flex-start',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface LeaderboardEntry {
last24hPoints?: BN
rank?: number
address?: PublicKey
domain?: string
}

interface LeaderboardListProps {
Expand Down Expand Up @@ -99,6 +100,7 @@ const LeaderboardList: React.FC<LeaderboardListProps> = ({ data, isLoading = fal
last24hPoints={userStats.last24hPoints}
points={userStats.points ?? 0}
address={userStats.address}
domain={userStats?.domain}
/>
)}
<Box sx={{ paddingLeft: '24px', paddingRight: '24px' }}>
Expand All @@ -112,6 +114,7 @@ const LeaderboardList: React.FC<LeaderboardListProps> = ({ data, isLoading = fal
last24hPoints={element.last24hPoints}
points={element.points ?? 0}
address={element.address}
domain={element?.domain}
/>
))
) : (
Expand Down
1 change: 1 addition & 0 deletions src/store/reducers/leaderboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface UserStats {
last24hPoints: BN
rank: number
address: PublicKey
domain?: string
}

export interface LeaderboardEntry extends UserStats {}
Expand Down

0 comments on commit 9992a2d

Please sign in to comment.