forked from deriv-com/deriv-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bahar/Account transfer modal diel (#70)
* feat: account-transfer-modal-diel * feat: add-modal-and-cashier-changes * feat: add-appstore-modal-and-cashier-changes-continued * fix: pretifiying
- Loading branch information
Bahar
authored
Jan 3, 2023
1 parent
ba5d895
commit 79440d7
Showing
47 changed files
with
780 additions
and
546 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
11 changes: 11 additions & 0 deletions
11
packages/appstore/src/components/account-transfer-modal/account-transfer-modal.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,11 @@ | ||
.dc-modal__container_account-transfer-modal { | ||
display: none; | ||
} | ||
|
||
.dc-modal-header--account-transfer-modal-header { | ||
border-bottom: 1px solid var(--general-section-1); | ||
} | ||
|
||
.cashier__no-balance { | ||
text-align: center; | ||
} |
61 changes: 61 additions & 0 deletions
61
packages/appstore/src/components/account-transfer-modal/account-transfer-modal.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,61 @@ | ||
import React from 'react'; | ||
import { useHistory } from 'react-router-dom'; | ||
import { Modal } from '@deriv/components'; | ||
import { routes } from '@deriv/shared'; | ||
import { useStore, observer } from '@deriv/stores'; | ||
import { Localize } from '@deriv/translations'; | ||
import AccountTransfer from '@deriv/cashier/src/pages/account-transfer'; | ||
|
||
type TAccountTransferModal = { | ||
is_modal_open: boolean; | ||
toggleModal: (e?: boolean) => void; | ||
}; | ||
|
||
const AccountTransferModal = ({ is_modal_open, toggleModal }: TAccountTransferModal) => { | ||
const [is_open, setIsOpen] = React.useState<boolean>(is_modal_open); | ||
|
||
const { | ||
modules: { | ||
cashier: { | ||
account_transfer: { is_transfer_confirm, should_switch_account }, | ||
}, | ||
}, | ||
} = useStore(); | ||
|
||
const history = useHistory(); | ||
|
||
const modal_title = !is_transfer_confirm && <Localize i18n_default_text={'Transfer funds to your account'} />; | ||
|
||
const onClickDeposit = () => { | ||
setIsOpen(false); | ||
history.push(routes.cashier_deposit); | ||
}; | ||
|
||
const onClickNotes = () => { | ||
setIsOpen(false); | ||
history.push(routes.cashier_acc_transfer); | ||
}; | ||
|
||
return ( | ||
<Modal | ||
className={should_switch_account ? 'account-transfer-modal' : ''} | ||
has_close_icon={!is_transfer_confirm} | ||
is_open={is_open && is_modal_open} | ||
is_title_centered={is_transfer_confirm} | ||
small | ||
title={modal_title} | ||
toggleModal={toggleModal} | ||
should_header_stick_body={false} | ||
> | ||
<Modal.Body> | ||
<AccountTransfer | ||
onClickDeposit={onClickDeposit} | ||
onClickNotes={onClickNotes} | ||
onClose={() => setIsOpen(false)} | ||
/> | ||
</Modal.Body> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default observer(AccountTransferModal); |
4 changes: 4 additions & 0 deletions
4
packages/appstore/src/components/account-transfer-modal/index.ts
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,4 @@ | ||
import AccountTransferModal from './account-transfer-modal'; | ||
import './account-transfer-modal.scss'; | ||
|
||
export default AccountTransferModal; |
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
2 changes: 1 addition & 1 deletion
2
packages/cashier/src/components/cashier-locked/cashier-locked-provider.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
2 changes: 1 addition & 1 deletion
2
packages/cashier/src/components/cashier-locked/cashier-locked.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
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
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
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
Oops, something went wrong.