diff --git a/package.json b/package.json
index 4e8c0f3a..3f038749 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.9",
+ "@region-x/components": "^0.1.10",
"@types/humanize-duration": "^3.27.3",
"@vercel/analytics": "^1.2.2",
"apexcharts": "^3.49.1",
diff --git a/src/components/Elements/Selectors/ChainSelector/index.tsx b/src/components/Elements/Selectors/ChainSelector/index.tsx
index fe2e4750..7475c2ab 100644
--- a/src/components/Elements/Selectors/ChainSelector/index.tsx
+++ b/src/components/Elements/Selectors/ChainSelector/index.tsx
@@ -1,19 +1,10 @@
-import {
- Box,
- CircularProgress,
- FormControl,
- InputLabel,
- MenuItem,
- Select,
- Typography,
-} from '@mui/material';
+import { FormControl } from '@mui/material';
+import { Select } from '@region-x/components';
import Image from 'next/image';
import { useCoretimeApi, useRegionXApi, useRelayApi } from '@/contexts/apis';
import { ChainType, NetworkType } from '@/models';
-import styles from './index.module.scss';
-
interface ChainSelectorProps {
chain: ChainType;
setChain: (_: ChainType) => void;
@@ -52,65 +43,68 @@ const relayIcons = {
export const ChainSelector = ({ chain, setChain }: ChainSelectorProps) => {
const { network } = useNetwork();
+
const {
- state: { name: coretimeChain, isApiReady: isCoretimeReady },
+ state: { name: coretimeChain },
} = useCoretimeApi();
const {
- state: { name: relayChain, isApiReady: isRelayReady },
+ state: { name: relayChain },
} = useRelayApi();
-
const {
- state: { name: regionXChain, isApiReady: isRegionXReady },
+ state: { name: regionXChain },
} = useRegionXApi();
const menuItems = [
{
- icon: relayIcons[network],
+ icon: (
+
+ ),
label: relayChain,
value: ChainType.RELAY,
- loading: !isRelayReady,
},
{
- icon: coretimeIcons[network],
+ icon: (
+
+ ),
label: coretimeChain,
value: ChainType.CORETIME,
- loading: !isCoretimeReady,
},
...(enableRegionX(network)
? [
- {
- icon: RegionX,
- label: regionXChain,
- value: ChainType.REGIONX,
- loading: isRegionXReady,
- },
- ]
+ {
+ icon: (
+
+ ),
+ label: regionXChain,
+ value: ChainType.REGIONX,
+ },
+ ]
: []),
];
return (
- Chain
+ options={menuItems}
+ selectedValue={chain}
+ onChange={(c) => setChain(c || ChainType.RELAY)}
+ />
);
};
diff --git a/src/components/Regions/RegionMetaCard/index.module.scss b/src/components/Regions/RegionMetaCard/index.module.scss
deleted file mode 100644
index 3844ef84..00000000
--- a/src/components/Regions/RegionMetaCard/index.module.scss
+++ /dev/null
@@ -1,41 +0,0 @@
-.container {
- display: flex;
- gap: 1.5rem;
- border-radius: 0.5rem;
- max-width: 50rem;
- padding: 1.5rem 2rem;
-}
-
-// .container:hover {
-// border: 1px dashed;
-// transition-duration: 300ms;
-// }
-
-.active {
- border: 1px solid;
- transition-duration: 300ms;
-}
-
-.active:hover {
- border: 1px solid;
-}
-
-.duration {
- border-width: 1px;
- border-style: solid;
- border-radius: 2px;
- padding: 0.5rem;
- display: flex;
- align-items: center;
- gap: 0.5rem;
- font-size: 0.75rem;
- line-height: 1;
- width: fit-content;
-}
-
-.regionInfo {
- display: flex;
- flex-direction: column;
- gap: 0.5rem;
- min-width: 16rem;
-}
diff --git a/src/components/Regions/RegionMetaCard/index.tsx b/src/components/Regions/RegionMetaCard/index.tsx
index 5d099813..db2fb914 100644
--- a/src/components/Regions/RegionMetaCard/index.tsx
+++ b/src/components/Regions/RegionMetaCard/index.tsx
@@ -26,8 +26,8 @@ import { useNetwork } from '@/contexts/network';
import { useTasks } from '@/contexts/tasks';
import { POOLING_TASK_ID, RegionLocation, RegionMetadata } from '@/models';
-import styles from './index.module.scss';
import { Label } from '../..';
+import { RegionCard } from '@region-x/components';
interface RegionMetaCardProps {
regionMetadata: RegionMetadata;
@@ -37,43 +37,13 @@ interface RegionMetaCardProps {
updateName?: (_newName: string) => void;
}
-export const RegionMetaCard = ({
- regionMetadata,
- active = false,
- editable = false,
- bordered = true,
- updateName,
-}: RegionMetaCardProps) => {
- return (
- <>
- {bordered ? (
-
-
-
- ) : (
-
-
-
- )}
- >
- );
-};
-
interface RegionCardInnerProps {
regionMetadata: RegionMetadata;
editable?: boolean;
updateName?: (_newName: string) => void;
}
-const RegionCardInner = ({
+export const RegionMetaCard = ({
regionMetadata,
editable = false,
updateName,
@@ -81,17 +51,11 @@ const RegionCardInner = ({
const { tasks } = useTasks();
const formatDuration = humanizer({ units: ['w', 'd', 'h'], round: true });
- const { region, taskId, location, currentUsage, consumed, coreOccupancy } = regionMetadata;
- const theme = useTheme();
-
- const [isEdit, setEdit] = useState(false);
- const [name, setName] = useState('');
+ const { region, taskId, location } = regionMetadata;
const [beginTimestamp, setBeginTimestamp] = useState(0);
const [endTimestamp, setEndTimestamp] = useState(0);
- const { network } = useNetwork();
-
const {
state: { api, apiState },
} = useRelayApi();
@@ -113,40 +77,6 @@ const RegionCardInner = ({
fetchTimestamps();
}, [api, apiState, region, timeslicePeriod]);
- const progress = [
- {
- label: 'Core Occupancy',
- value: coreOccupancy ?? 0,
- color: 'success',
- },
- {
- label: 'Consumed',
- value: consumed ?? 0,
- color: 'warning',
- },
- {
- label: 'Current Usage',
- value: currentUsage,
- color: 'primary',
- },
- ];
-
- const onEdit = () => {
- setEdit(true);
- setName(regionMetadata.name ?? '');
- };
-
- const onSave = () => {
- setEdit(false);
- setName('');
- updateName && updateName(name);
- };
-
- const onCancel = () => {
- setEdit(false);
- setName('');
- };
-
const locationToLabel = (location: RegionLocation): string => {
if (location === RegionLocation.REGIONX_CHAIN) {
return 'RegionX Chain';
@@ -168,121 +98,21 @@ const RegionCardInner = ({
};
return (
- <>
-
-
-
- {`Duration: ${formatDuration(endTimestamp - beginTimestamp)}`}
-
-
- {editable && isEdit ? (
- setName(e.target.value)} size='small' />
- ) : (
- {regionMetadata.name}
- )}
- {isEdit ? (
-
-
-
-
-
-
-
-
- ) : editable ? (
-
-
-
-
-
- ) : (
- <>>
- )}
-
-
- {`Core Index: #${region.getCore()}`}
- Begin: {getRelativeTimeString(beginTimestamp)}
- End: {getRelativeTimeString(endTimestamp)}
-
-
-
-
-
-
-
-
- !taskId && e.preventDefault()}
- href={`${SUSBCAN_RELAY_URL[network]}/parachain/${taskId}`}
- >
-
- {`Task: ${getTask(taskId)} ${taskId ? '#' + taskId : ''}`}
-
-
-
- {progress.map(({ label, value, color }, index) => (
-
-
-
- {`${(value * 100).toFixed(2)}%`}
-
-
- {label}
-
-
- ))}
-
-
- >
+
+
+
);
};
diff --git a/src/components/Transfer/transferActions.tsx b/src/components/Transfer/transferActions.tsx
index 9c6cca38..4c0833cd 100644
--- a/src/components/Transfer/transferActions.tsx
+++ b/src/components/Transfer/transferActions.tsx
@@ -1,13 +1,7 @@
import ArrowDownward from '@mui/icons-material/ArrowDownwardOutlined';
-import { Box, Button, Paper, Stack } from '@mui/material';
+import { Box, Paper, Stack } from '@mui/material';
import { useRouter } from 'next/router';
-import theme from '@/utils/muiTheme';
-
-import { ProgressButton } from '@/components/Elements/Buttons/ProgressButton';
-import { AddressInput } from '@/components/Elements/Inputs/AddressInput';
-import { AmountInput } from '@/components/Elements/Inputs/AmountInput';
-
import { useCoretimeApi, useRegionXApi, useRelayApi } from '@/contexts/apis';
import { useBalances } from '@/contexts/balance';
import { useNetwork } from '@/contexts/network';
@@ -18,6 +12,9 @@ import { assetType } from './common';
import { useTransferState } from './contexts/transferState';
import { useTransferHandlers } from './hooks/useTransferHandlers';
+import { AmountInput, Button } from '@region-x/components';
+import { AddressInput } from '../Elements';
+
const TransferActions = () => {
const { transferAmount, handleTransfer, working, newOwner, setNewOwner, setTransferAmount } =
useTransferHandlers();
@@ -82,7 +79,7 @@ const TransferActions = () => {
{
destinationChain !== ChainType.NONE && (
}]}
+ label='Transfer amount'
/>
)}
@@ -112,17 +109,14 @@ const TransferActions = () => {
}}
>
+
-
);
diff --git a/src/components/Transfer/transferForm.tsx b/src/components/Transfer/transferForm.tsx
index 2da8d073..ef7add51 100644
--- a/src/components/Transfer/transferForm.tsx
+++ b/src/components/Transfer/transferForm.tsx
@@ -33,7 +33,7 @@ const TransferForm = () => {