Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add people parachain #124

Merged
merged 24 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ea2abed
Add people parachain
wirednkod Sep 10, 2024
355a179
remove clients file
wirednkod Sep 10, 2024
3d73516
Fix the people chain
wirednkod Sep 11, 2024
b16d610
Merge branch 'main' of github.com:delegit-xyz/dashboard into nik-prep…
wirednkod Sep 16, 2024
8cad8a2
Merge branch 'main' of github.com:delegit-xyz/dashboard into nik-prep…
wirednkod Sep 16, 2024
9c2d118
Tmp people parachain
wirednkod Sep 16, 2024
300cff9
minor
wirednkod Sep 17, 2024
08344e8
Merge branch 'main' into nik-prepare-people-parachain
wirednkod Sep 19, 2024
8fc78e9
Merge branch 'main' into nik-prepare-people-parachain
wirednkod Sep 23, 2024
82d36e1
Fix merge
wirednkod Sep 23, 2024
748e6fc
Finalize identity integration
wirednkod Sep 23, 2024
2657f05
Merge branch 'main' into nik-prepare-people-parachain
wirednkod Sep 23, 2024
f447441
Address comments
wirednkod Sep 24, 2024
ab0bcfe
Merge branch 'nik-prepare-people-parachain' of github.com:delegit-xyz…
wirednkod Sep 24, 2024
14d26ce
Fix RPCs for people chain
wirednkod Sep 24, 2024
e808560
Remove forgotten code :)
wirednkod Sep 24, 2024
8bc86c1
Merge branch 'main' into nik-prepare-people-parachain
wirednkod Sep 24, 2024
833072a
Address comments
wirednkod Sep 24, 2024
3039a11
minor fix
wirednkod Sep 24, 2024
b61e66c
remove non-trusted endpoints
wirednkod Sep 24, 2024
40033eb
leave only 1 endpoint for people chain
wirednkod Sep 24, 2024
494b759
Merge branch 'main' into nik-prepare-people-parachain
wirednkod Sep 25, 2024
339be23
Address comments
wirednkod Sep 25, 2024
d8db388
Merge branch 'nik-prepare-people-parachain' of github.com:delegit-xyz…
wirednkod Sep 25, 2024
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 .papi/descriptors/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.1.0-autogenerated.9019692316970856612",
"version": "0.1.0-autogenerated.1693958661580142564",
"name": "@polkadot-api/descriptors",
"files": [
"dist"
Expand Down
Binary file added .papi/metadata/dotPeople.scale
Binary file not shown.
Binary file added .papi/metadata/ksmPeople.scale
Binary file not shown.
Binary file modified .papi/metadata/westend.scale
Binary file not shown.
Binary file added .papi/metadata/westendPeople.scale
Binary file not shown.
14 changes: 13 additions & 1 deletion .papi/polkadot-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@
"westend": {
"chain": "westend2",
"metadata": ".papi/metadata/westend.scale"
},
"dotPeople": {
"chain": "polkadot_people",
"metadata": ".papi/metadata/dotPeople.scale"
},
"ksmPeople": {
"chain": "ksmcc3_people",
"metadata": ".papi/metadata/ksmPeople.scale"
},
"westendPeople": {
"chain": "westend2_people",
"metadata": ".papi/metadata/westendPeople.scale"
}
}
}
}
74 changes: 74 additions & 0 deletions src/assets/peopleNetworks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"polkadotPeople": {
"nodes": [
{
"url": "wss://sys.ibp.network/people-polkadot",
"name": "IBP1"
},
{
"url": "wss://sys.dotters.network/people-polkadot",
"name": "IBP2"
},
{
"url": "wss://rpc-people-polkadot.luckyfriday.io",
"name": "LuckyFriday"
},
{
"url": "wss://polkadot-people-rpc.polkadot.io",
"name": "Parity"
},
{
"url": "wss://people-polkadot.public.curie.radiumblock.co/ws",
"name": "RadiumBlock"
}
]
},
"kusamaPeople": {
"nodes": [
{
"url": "wss://people-kusama-rpc.dwellir.com",
"name": "Dwellir"
},
{
"url": "wss://sys.ibp.network/people-kusama",
"name": "IBP1"
},
{
"url": "wss://sys.dotters.network/people-kusama",
"name": "IBP2"
},
{
"url": "wss://rpc-people-kusama.luckyfriday.io",
"name": "LuckyFriday"
},
{
"url": "wss://kusama-people-rpc.polkadot.io",
"name": "Parity"
},
{
"url": "wss://ksm-rpc.stakeworld.io/people",
"name": "Stakeworld"
}
]
},
"westendPeople": {
"nodes": [
{
"url": "wss://people-westend-rpc.dwellir.com",
"name": "Dwellir"
},
{
"url": "wss://sys.ibp.network/people-westend",
"name": "IBP1"
},
{
"url": "wss://sys.dotters.network/people-westend",
"name": "IBP2"
},
{
"url": "wss://westend-people-rpc.polkadot.io",
"name": "Parity"
}
]
}
}
24 changes: 14 additions & 10 deletions src/components/DelegateCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ import { Card } from '@/components/ui/card'
import { useLocation, useNavigate } from 'react-router-dom'
import { Delegate } from '@/contexts/DelegatesContext'
import { ContentReveal } from './ui/content-reveal'
import { cn } from '@/lib/utils'
import { sanitizeString } from '@/lib/utils'
import { useNetwork } from '@/contexts/NetworkContext'
import { cn } from '@/lib/utils'
import { toast } from 'sonner'
import { LinkIcon } from 'lucide-react'

import Markdown from 'react-markdown'
import { H, H2, H3, Hr, P } from './ui/md'
import { AnchorLink } from './ui/anchorLink'
import { useCallback, useMemo } from 'react'
import { IdentityInfo } from './IdentityInfo'

interface Props {
delegate: Delegate
Expand Down Expand Up @@ -63,16 +65,18 @@ export const DelegateCard = ({

return (
<Card className={cn('flex flex-col p-4', className)}>
<div className="flex flex-col gap-4 md:flex-row">
<div className="flex columns-3">
<DelegateAvatar />
<div className="w-full">
<div className="flex items-center gap-1 py-2 text-xl font-semibold">
{name}
{hasShareButton && (
<Button variant="ghost" onClick={onCopy} size="icon">
<LinkIcon className="h-4 w-4 text-accent-foreground" />
</Button>
)}
<div className="w-full p-2">
<div className="flex items-center justify-between">
<div className="flex items-center gap-1 py-2 text-xl font-semibold">
<IdentityInfo address={address} name={name} />
{hasShareButton && (
<Button variant="ghost" onClick={onCopy} size="icon">
<LinkIcon className="h-4 w-4 text-accent-foreground" />
</Button>
)}
</div>
</div>
<div className="text-accent-foreground">
<div className="break-words text-lg">{shortDescription}</div>
Expand Down
68 changes: 68 additions & 0 deletions src/components/IdentityInfo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { BsTwitterX } from 'react-icons/bs'
import { IoCheckmarkCircle, IoMail } from 'react-icons/io5'
import { TbWorld } from 'react-icons/tb'
import { Button } from './ui/button'
import { useIdentity } from '@/hooks/useIdentity'
import { TbCircleDashedMinus } from 'react-icons/tb'

interface Props {
name: string
address: string
}

export const IdentityInfo = ({ name, address }: Props) => {
const identity = useIdentity(address)

return (
<>
{identity?.display ? (
<div className="flex items-center">
{identity?.display}
{identity?.judgement ? (
<IoCheckmarkCircle className="ml-4 text-green-500" />
) : (
<TbCircleDashedMinus className="ml-4 text-gray-500" />
)}
</div>
) : (
name
)}
{identity && (
<div
className={`flex items-center justify-around text-${identity?.judgement ? 'green' : 'gray'}-500`}
>
{identity?.web && (
<Button
variant="ghost"
onClick={() => window.open(identity?.web as string, '_blank')}
size="icon"
>
<TbWorld />
</Button>
)}
{identity?.twitter && (
<Button
variant="ghost"
onClick={() =>
window.open(
`https://twitter.com/@${identity?.twitter}`,
'_blank',
)
}
size="icon"
>
<BsTwitterX />
</Button>
)}
{identity?.email && (
<Button variant="ghost" size="icon">
<a href={`mailto:${identity?.email}`}>
<IoMail />
</a>
</Button>
)}
</div>
)}
</>
)
}
5 changes: 4 additions & 1 deletion src/components/ui/address-display.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useIdentity } from '@/hooks/useIdentity'
import { cn } from '@/lib/utils'
import { Polkicon } from '@polkadot-ui/react'

Expand All @@ -8,11 +9,13 @@ type Props = {
}

export const AddressDisplay = ({ address, size, className = '' }: Props) => {
const identity = useIdentity(address)

return (
<div className={cn('flex items-center gap-2', className)}>
<Polkicon address={address} size={size} copy outerColor="transparent" />
<span className="text-gray-500">
{address.slice(0, 6) + '...' + address.slice(-6)}
{identity?.display || address.slice(0, 6) + '...' + address.slice(-6)}
</span>
</div>
)
Expand Down
6 changes: 5 additions & 1 deletion src/contexts/AccountsContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export interface IAccountContext {
selectAccount: (account: InjectedPolkadotAccount | undefined) => void
}

type AccountAddressType = {
address: string
}

Comment on lines +24 to +27
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fix this in a subsequent PR

const AccountContext = createContext<IAccountContext | undefined>(undefined)

const AccountContextProvider = ({ children }: AccountContextProps) => {
Expand Down Expand Up @@ -50,7 +54,7 @@ const AccountContextProvider = ({ children }: AccountContextProps) => {
useEffect(() => {
if (localStorageAccount) {
const account = accounts.find(
(account) => account.address === localStorageAccount,
({ address }: AccountAddressType) => address === localStorageAccount,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accounts is of type PolkadotAccount[] so the type is inferred. You don't need to declare anything.

Suggested change
({ address }: AccountAddressType) => address === localStorageAccount,
({ address }) => address === localStorageAccount,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this

)
if (account) {
selectAccount(account)
Expand Down
Loading