-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Leaderboard - Adding Sessions and Identity Info, Support Search Funct…
…ionality (#1864) Co-authored-by: Pavan Soratur <[email protected]>
- Loading branch information
1 parent
e8445e2
commit b6211a0
Showing
18 changed files
with
968 additions
and
565 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
apps/testnet-leaderboard/components/RankingTableSection/AddressCell.tsx
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
apps/testnet-leaderboard/components/RankingTableSection/BadgeWithTooltip.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { | ||
Tooltip, | ||
TooltipBody, | ||
TooltipTrigger, | ||
} from '@webb-tools/webb-ui-components/components/Tooltip'; | ||
import { Typography } from '@webb-tools/webb-ui-components/typography/Typography'; | ||
import cx from 'classnames'; | ||
import capitalize from 'lodash/capitalize'; | ||
import { FC } from 'react'; | ||
|
||
type Props = { | ||
badge: string; | ||
emoji: string; | ||
}; | ||
|
||
const BadgeWithTooltip: FC<Props> = ({ badge, emoji }) => { | ||
return ( | ||
<Tooltip> | ||
<TooltipTrigger asChild> | ||
<div | ||
className={cx( | ||
'w-2 md:w-6 aspect-square rounded-full', | ||
'flex items-center justify-center', | ||
'bg-[rgba(31,29,43,0.1)] cursor-pointer' | ||
)} | ||
> | ||
<Typography variant="mkt-caption">{emoji}</Typography> | ||
</div> | ||
</TooltipTrigger> | ||
|
||
<TooltipBody>{badge.split('_').map(capitalize).join(' ')}</TooltipBody> | ||
</Tooltip> | ||
); | ||
}; | ||
|
||
export default BadgeWithTooltip; |
31 changes: 6 additions & 25 deletions
31
apps/testnet-leaderboard/components/RankingTableSection/BadgesCell.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
apps/testnet-leaderboard/components/RankingTableSection/IdentityCell.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
'use client'; | ||
|
||
import { isEthereumAddress } from '@polkadot/util-crypto'; | ||
import { FileCopyLine } from '@webb-tools/icons'; | ||
import { Avatar } from '@webb-tools/webb-ui-components/components/Avatar'; | ||
import { | ||
Tooltip, | ||
TooltipBody, | ||
TooltipTrigger, | ||
} from '@webb-tools/webb-ui-components/components/Tooltip'; | ||
import { useCopyable } from '@webb-tools/webb-ui-components/hooks/useCopyable'; | ||
import { Typography } from '@webb-tools/webb-ui-components/typography/Typography'; | ||
import { shortenString } from '@webb-tools/webb-ui-components/utils/shortenString'; | ||
import cx from 'classnames'; | ||
import { type FC, useEffect, useState } from 'react'; | ||
|
||
import { IdentityType } from './types'; | ||
|
||
function handleClick() { | ||
console.log('click'); | ||
} | ||
|
||
const IdentityCell: FC<{ address: string; identity: IdentityType }> = ({ | ||
address, | ||
identity, | ||
}) => { | ||
const { isCopied, copy } = useCopyable(); | ||
|
||
return ( | ||
<div className="flex items-center gap-2"> | ||
<Avatar | ||
value={address} | ||
theme={isEthereumAddress(address) ? 'ethereum' : 'substrate'} | ||
className="[&_*]:!cursor-copy" | ||
size="sm" | ||
/> | ||
|
||
<Typography | ||
variant="mkt-small-caps" | ||
fw="semibold" | ||
className="!normal-case" | ||
> | ||
{identity?.info.display || shortenString(address)} | ||
</Typography> | ||
|
||
<Tooltip> | ||
<TooltipTrigger asChild> | ||
<button | ||
onClick={() => copy(address)} | ||
disabled={isCopied} | ||
className="disabled:cursor-not-allowed" | ||
> | ||
<FileCopyLine className="!fill-current" /> | ||
</button> | ||
</TooltipTrigger> | ||
|
||
<TooltipBody className="font-semibold"> | ||
{isCopied ? 'Copied' : address} | ||
</TooltipBody> | ||
</Tooltip> | ||
</div> | ||
); | ||
}; | ||
|
||
export default IdentityCell; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.