Skip to content

Commit

Permalink
add warning based on region location
Browse files Browse the repository at this point in the history
  • Loading branch information
Szegoo committed Aug 18, 2024
1 parent 345c6c2 commit 8988fb8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
20 changes: 14 additions & 6 deletions src/components/Orders/Modals/OrderProcessor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { useRegionXApi, useRelayApi } from '@/contexts/apis';
import { ApiState } from '@/contexts/apis/types';
import { useOrders } from '@/contexts/orders';
import { useToast } from '@/contexts/toast';
import { Order, RegionMetadata } from '@/models';
import { Order, RegionLocation, RegionMetadata } from '@/models';

import styles from './index.module.scss';
import { OrderCard } from '../../OrderCard';
Expand Down Expand Up @@ -187,11 +187,19 @@ export const OrderProcessorModal = ({
{regions.length === 0 ? (
<Alert severity='error'>No region avilable</Alert>
) : (
!checkRequirements(order, regionSelected) && (
<Alert severity='error'>
The selected region does not match requirements
</Alert>
)
<>
{!checkRequirements(order, regionSelected) && (
<Alert severity='error'>
The selected region does not match requirements
</Alert>
)}
{regionSelected?.location !==
RegionLocation.REGIONX_CHAIN && (
<Alert severity='warning'>
The selected region must first be transferred to RegionX
</Alert>
)}
</>
)}
</Stack>
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/orders/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const OrderDashboard = () => {

const { network } = useNetwork();
const { orders, status } = useOrders();
const { regions: regionData } = useRegions();
const { regions } = useRegions();
const {
state: { activeAccount },
} = useAccounts();
Expand Down Expand Up @@ -176,7 +176,7 @@ const OrderDashboard = () => {
open={processorModal}
onClose={() => openProcessorModal(false)}
order={orderSelected}
regions={regionData}
regions={regions}
/>
</>
)}
Expand Down

0 comments on commit 8988fb8

Please sign in to comment.