-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f28751e
commit c0c3532
Showing
12 changed files
with
96 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/components/Modals/OrderDetailsCancelModal/OrderDetailsCancelModal.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.order-details-cancel-modal { | ||
height: auto; | ||
width: 44rem; | ||
border-radius: 8px; | ||
|
||
@include mobile { | ||
width: 32.8rem; | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
src/components/Modals/OrderDetailsCancelModal/OrderDetailsCancelModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { api } from '@/hooks'; | ||
import { Button, Modal, Text, useDevice } from '@deriv-com/ui'; | ||
import './OrderDetailsCancelModal.scss'; | ||
|
||
type TOrderDetailsCancelModalProps = { | ||
id: string; | ||
isModalOpen: boolean; | ||
onRequestClose: () => void; | ||
}; | ||
|
||
const OrderDetailsCancelModal = ({ id, isModalOpen, onRequestClose }: TOrderDetailsCancelModalProps) => { | ||
const { data } = api.settings.useSettings(); | ||
const { data: advertiserInfo } = api.advertiser.useGetInfo(); | ||
const { mutate } = api.order.useCancel(); | ||
const { isMobile } = useDevice(); | ||
const textSize = isMobile ? 'md' : 'sm'; | ||
|
||
const onCancel = () => { | ||
mutate({ id }); | ||
onRequestClose(); | ||
}; | ||
|
||
return ( | ||
<Modal className='order-details-cancel-modal' isOpen={isModalOpen}> | ||
<Modal.Header className='lg:px-[2.4rem] px-[1.6rem]' hideBorder hideCloseIcon> | ||
<Text weight='bold'>Do you want to cancel this order?</Text> | ||
</Modal.Header> | ||
<Modal.Body className='flex flex-col gap-2 lg:px-[2.4rem] px-[1.6rem]'> | ||
<Text size='sm'> | ||
If you cancel your order {data?.cancellation_limit} times in {data?.cancellation_count_period}{' '} | ||
hours, you will be blocked from using Deriv P2P for {data?.cancellation_block_duration} hours. | ||
<br />({advertiserInfo.cancels_remaining} cancellations remaining) | ||
</Text> | ||
<Text color='error' size='sm'> | ||
Please do not cancel if you have already made payment. | ||
</Text> | ||
</Modal.Body> | ||
<Modal.Footer className='gap-4 lg:px-[2.4rem] px-[1.6rem]' hideBorder> | ||
<Button | ||
className='border-2' | ||
color='black' | ||
onClick={onCancel} | ||
size='lg' | ||
textSize={textSize} | ||
variant='outlined' | ||
> | ||
Cancel this order | ||
</Button> | ||
<Button onClick={onRequestClose} size='lg' textSize={textSize}> | ||
Do not cancel | ||
</Button> | ||
</Modal.Footer> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default OrderDetailsCancelModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as OrderDetailsCancelModal } from './OrderDetailsCancelModal'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ html, | |
body { | ||
font-family: 'IBM Plex Sans', sans-serif; | ||
font-size: 10px; | ||
overflow: hidden; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters