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.
[BOT]maryia/feat: [Server Bot] - [Improvement] - Summary and Journal …
…panels (deriv-com#16809) * feat: [Server Bot] - [Improvement] - Summary and Journal panels * fix: change some logic * fix: change approach of showing pop-up dialog on Journal and Transactions tabs * refactor: solution * refactor: solution(2) * chore: remove unused prop * fix: change the variant of passing function prop to minimize re-renders
- Loading branch information
1 parent
18f8611
commit ed76221
Showing
4 changed files
with
81 additions
and
16 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
packages/bot-web-ui/src/pages/server-side-bot/bot-list/clear-journal-transactions.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,42 @@ | ||
import React from 'react'; | ||
import { Dialog, Text } from '@deriv/components'; | ||
import { Localize, localize } from '@deriv/translations'; | ||
import { useDBotStore } from 'Stores/useDBotStore'; | ||
import { observer } from '@deriv/stores'; | ||
|
||
type TDeleteServerBot = { | ||
is_open: boolean; | ||
setVisibility: (is_open: boolean) => void; | ||
}; | ||
|
||
const ClearJournalTransactions = observer(({ is_open, setVisibility }: TDeleteServerBot) => { | ||
const { server_bot } = useDBotStore(); | ||
const { resetJournal, resetTransactions } = server_bot; | ||
const onOkButtonClick = () => { | ||
resetJournal(); | ||
resetTransactions(); | ||
setVisibility(false); | ||
}; | ||
|
||
return ( | ||
<Dialog | ||
title={localize('Are you sure?')} | ||
is_visible={is_open} | ||
confirm_button_text={localize('Ok')} | ||
onConfirm={onOkButtonClick} | ||
cancel_button_text={localize('Cancel')} | ||
onCancel={() => setVisibility(false)} | ||
onClose={() => setVisibility(false)} | ||
is_mobile_full_width={false} | ||
className={'dc-dialog__wrapper--fixed'} | ||
portal_element_id='modal_root' | ||
has_close_icon | ||
> | ||
<Text color='prominent' line_height='xl' size='xs'> | ||
<Localize i18n_default_text='This will clear all data in the summary and journal panels. All counters will be reset to zero.' /> | ||
</Text> | ||
</Dialog> | ||
); | ||
}); | ||
|
||
export default ClearJournalTransactions; |
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