Skip to content

Commit

Permalink
add network icon
Browse files Browse the repository at this point in the history
  • Loading branch information
TopETH committed Apr 19, 2024
1 parent 31e6357 commit 5b88d2a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 5 deletions.
Binary file added src/assets/networks/coretime.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/networks/kusama.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/networks/regionx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 45 additions & 4 deletions src/components/Elements/Selectors/ChainSelector/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,41 @@
import { FormControl, InputLabel, MenuItem, Select } from '@mui/material';
import {
Box,
FormControl,
InputLabel,
MenuItem,
Select,
Typography,
} from '@mui/material';
import Image from 'next/image';

import CoretimeIcon from '@/assets/networks/coretime.png';
import KusamaIcon from '@/assets/networks/kusama.png';
import RegionXIcon from '@/assets/networks/regionx.png';

interface ChainSelectorProps {
chain: string;
setChain: (_: string) => void;
}

export const ChainSelector = ({ chain, setChain }: ChainSelectorProps) => {
const menuItems = [
{
icon: KusamaIcon,
label: 'Relay Chain',
value: 'RelayChain',
},
{
icon: CoretimeIcon,
label: 'Coretime Chain',
value: 'CoretimeChain',
},

{
icon: RegionXIcon,
label: 'RegionX Chain',
value: 'RegionXChain',
},
];
return (
<FormControl fullWidth>
<InputLabel id='origin-selector-label'>Chain</InputLabel>
Expand All @@ -16,9 +46,20 @@ export const ChainSelector = ({ chain, setChain }: ChainSelectorProps) => {
label='Origin'
onChange={(e) => setChain(e.target.value)}
>
<MenuItem value='RelayChain'>Relay Chain</MenuItem>
<MenuItem value='CoretimeChain'>Coretime Chain</MenuItem>
<MenuItem value='RegionXChain'>RegionX Chain</MenuItem>
{menuItems.map(({ icon, label, value }, index) => (
<MenuItem value={value} key={index}>
<Box sx={{ display: 'flex', gap: '0.5rem' }}>
<Image
src={icon}
alt='icon'
style={{ width: '2rem', height: '2rem' }}
/>
<Typography sx={{ lineHeight: 1.5, fontSize: '1.25rem' }}>
{label}
</Typography>
</Box>
</MenuItem>
))}
</Select>
</FormControl>
);
Expand Down
4 changes: 3 additions & 1 deletion src/pages/transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ const TransferPage = () => {
);
} else {
const receiverKeypair = new Keyring();
receiverKeypair.addFromAddress(newOwner ? newOwner : activeAccount.address);
receiverKeypair.addFromAddress(
newOwner ? newOwner : activeAccount.address
);

(originChain === 'CoretimeChain'
? transferTokensFromCoretimeToRelay
Expand Down

0 comments on commit 5b88d2a

Please sign in to comment.