forked from binary-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.
Merge pull request binary-com#56 from amina-deriv/83942/exit_traders_…
…hub_modal Amina/83942/exit traders hub modal
- Loading branch information
Showing
7 changed files
with
171 additions
and
9 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
packages/appstore/src/components/modals/exit-traders-hub-modal/exit-traders-hub-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,36 @@ | ||
.dc-modal__container_exit-traders-hub-modal { | ||
.dc-modal-header { | ||
border-bottom: 2px solid var(--general-section-2); | ||
} | ||
} | ||
|
||
.dc-mobile-dialog__exit-traders-hub-modal_mobile_content { | ||
.dc-modal-body { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
text-align: center; | ||
height: calc(100vh - 12rem); | ||
padding: 2.4rem; | ||
} | ||
|
||
.dc-modal-footer { | ||
display: flex; | ||
align-items: center; | ||
justify-content: flex-end; | ||
gap: 0.8rem; | ||
align-self: flex-end; | ||
top: initial; | ||
bottom: 0; | ||
left: 0; | ||
position: fixed; | ||
padding: 1.6rem; | ||
max-height: 70px; | ||
width: 100%; | ||
|
||
.dc-btn { | ||
margin: 0; | ||
width: 100%; | ||
} | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
packages/appstore/src/components/modals/exit-traders-hub-modal/exit-traders-hub-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,77 @@ | ||
import React from 'react'; | ||
import { useHistory, withRouter } from 'react-router-dom'; | ||
import { observer } from 'mobx-react-lite'; | ||
import { useStores } from 'Stores'; | ||
import { Button, DesktopWrapper, MobileDialog, MobileWrapper, Modal, Text, UILoader } from '@deriv/components'; | ||
import { isMobile, routes } from '@deriv/shared'; | ||
import { localize } from '@deriv/translations'; | ||
|
||
const ExitTradersHubModal = () => { | ||
const history = useHistory(); | ||
const { ui, traders_hub, client } = useStores(); | ||
const { disableApp, enableApp } = ui; | ||
const { setIsPreAppStore } = client; | ||
const { is_exit_traders_hub_modal_visible, toggleExitTradersHubModal } = traders_hub; | ||
|
||
const exit_traders_hub_modal_content = ( | ||
<Text size={isMobile() ? 'xxs' : 'xs'}> | ||
{localize(`You won’t be able to see your EU account in the traditional view. The open positions in your EU | ||
account will remain open. You can switch back to this view at any time.`)} | ||
</Text> | ||
); | ||
|
||
const ModalContent = () => { | ||
return ( | ||
<React.Fragment> | ||
<Modal.Body>{exit_traders_hub_modal_content}</Modal.Body> | ||
<Modal.Footer has_separator> | ||
<Button onClick={closeModal} has_effect text={localize('Not now')} secondary large /> | ||
<Button has_effect onClick={onClickExitButton} text={localize('Yes, exit')} primary large /> | ||
</Modal.Footer> | ||
</React.Fragment> | ||
); | ||
}; | ||
|
||
const closeModal = () => { | ||
toggleExitTradersHubModal(); | ||
}; | ||
|
||
const onClickExitButton = () => { | ||
toggleExitTradersHubModal(); | ||
setIsPreAppStore(false); | ||
history.push(routes.root); | ||
}; | ||
return ( | ||
<React.Suspense fallback={<UILoader />}> | ||
<DesktopWrapper> | ||
<Modal | ||
disableApp={disableApp} | ||
enableApp={enableApp} | ||
is_open={is_exit_traders_hub_modal_visible} | ||
title={localize('Are you sure?')} | ||
toggleModal={closeModal} | ||
type='button' | ||
height='256px' | ||
width='440px' | ||
className='exit-traders-hub-modal' | ||
> | ||
<ModalContent /> | ||
</Modal> | ||
</DesktopWrapper> | ||
<MobileWrapper> | ||
<MobileDialog | ||
portal_element_id='deriv_app' | ||
title={localize('Are you sure?')} | ||
visible={is_exit_traders_hub_modal_visible} | ||
onClose={closeModal} | ||
has_full_height | ||
wrapper_classname='exit-traders-hub-modal_mobile_content' | ||
> | ||
<ModalContent /> | ||
</MobileDialog> | ||
</MobileWrapper> | ||
</React.Suspense> | ||
); | ||
}; | ||
|
||
export default withRouter(observer(ExitTradersHubModal)); |
4 changes: 4 additions & 0 deletions
4
packages/appstore/src/components/modals/exit-traders-hub-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 ExitTradersHubModal from './exit-traders-hub-modal'; | ||
import './exit-traders-hub-modal.scss'; | ||
|
||
export default ExitTradersHubModal; |
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