diff --git a/package.json b/package.json index 08d57126..c1d1b7a2 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@polkadot/ui-keyring": "3.6.6", "@polkadot/util": "12.6.2", "@polkadot/util-crypto": "^12.6.2", - "@region-x/components": "^0.1.4", + "@region-x/components": "^0.1.5", "@types/humanize-duration": "^3.27.3", "@vercel/analytics": "^1.2.2", "apexcharts": "^3.49.1", diff --git a/src/components/Layout/Header/index.tsx b/src/components/Layout/Header/index.tsx index 2df4e957..1e57a1ba 100644 --- a/src/components/Layout/Header/index.tsx +++ b/src/components/Layout/Header/index.tsx @@ -77,12 +77,14 @@ export const Header = () => { - onAccountChange(acc)} + selectedValue={activeAccount as any} + /> + ) : ( ); diff --git a/src/components/Renew/info.tsx b/src/components/Renew/info.tsx index 55545200..5a14a6ca 100644 --- a/src/components/Renew/info.tsx +++ b/src/components/Renew/info.tsx @@ -146,7 +146,7 @@ const ParachainInfo = ({ parachain, expiryTimestamp, expiryLoading }: ParachainI mt={'1rem'} gap='0.5rem' border='1px solid' - borderColor={theme.palette.grey[400]} + borderColor={theme.palette.grey[100]} borderRadius='1rem' > diff --git a/src/components/Renew/select.tsx b/src/components/Renew/select.tsx index f252e294..6e913f95 100644 --- a/src/components/Renew/select.tsx +++ b/src/components/Renew/select.tsx @@ -1,20 +1,15 @@ -import { - FormControl, - InputLabel, - MenuItem, - Select, - SelectChangeEvent, - Stack, - Typography, -} from '@mui/material'; +import { Stack } from '@mui/material'; import { useRouter } from 'next/router'; import { RenewableParachain } from '@/hooks'; -import theme from '@/utils/muiTheme'; - -import { ParaDisplay } from '@/components'; import { useNetwork } from '@/contexts/network'; +import { Select } from '@region-x/components'; +import { SelectOption } from '@region-x/components/dist/types/types'; +import { chainData } from '@/chaindata'; +import Image from 'next/image'; + +import Unknown from '@/assets/unknown.svg'; interface SelectParachainProps { parachains: RenewableParachain[]; @@ -28,11 +23,10 @@ export const SelectParachain = ({ parachains }: SelectParachainProps) => { const core = router.query.core ? Number(router.query.core) : null; const paraId = router.query.paraId ? Number(router.query.paraId) : null; - const onParaChange = (e: SelectChangeEvent) => { - const selectedCoreId = core ? parachains[Number(e.target.value)].core : parachains[0].core; - const selectedParaId = paraId - ? parachains[Number(e.target.value)].paraId - : parachains[0].paraId; + const onParaChange = (_index: number | null) => { + const index = _index ?? 0; + const selectedCoreId = core ? parachains[index].core : parachains[0].core; + const selectedParaId = paraId ? parachains[index].paraId : parachains[0].paraId; // Update the URL with the new `core` query param router.push({ @@ -41,31 +35,58 @@ export const SelectParachain = ({ parachains }: SelectParachainProps) => { }); }; + const selectOptions: SelectOption[] = parachains.map((p, i) => { + const data = chainData[network][p.paraId]; + + if (data === undefined) { + return { + label: `#${p.paraId} | Core ${p.core}`, + value: i, + icon: ( + + ), + }; + } + + return { + label: `${data.name} #${p.paraId} | Core ${p.core}`, + value: i, + icon: + data.logo === undefined ? ( + + ) : ( + + ), + }; + }); + return ( - - Select a parachain to renew - - - Parachain - - +