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#11 from sandeep-deriv/sandeep/73382/dbo…
…t-add-charts Sandeep/73382/dbot add charts
- Loading branch information
Showing
14 changed files
with
323 additions
and
75,845 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
packages/bot-web-ui/src/components/dashboard/bot-builder/toolbar/toolbar-button.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,28 @@ | ||
import React from 'react'; | ||
import { Button, Popover } from '@deriv/components'; | ||
|
||
type TToolbarButton = { | ||
popover_message?: string; | ||
button_id: string; | ||
button_classname: string; | ||
buttonOnClick: () => void; | ||
icon: React.ReactElement; | ||
button_text: string; | ||
}; | ||
|
||
const ToolbarButton = ({ | ||
popover_message, | ||
button_id, | ||
button_classname, | ||
buttonOnClick, | ||
icon, | ||
button_text, | ||
}: TToolbarButton) => ( | ||
<Popover alignment='bottom' message={popover_message} should_disable_pointer_events> | ||
<Button id={button_id} className={button_classname} has_effect onClick={buttonOnClick} icon={icon} green> | ||
{button_text} | ||
</Button> | ||
</Popover> | ||
); | ||
|
||
export default ToolbarButton; |
25 changes: 25 additions & 0 deletions
25
packages/bot-web-ui/src/components/dashboard/bot-builder/toolbar/toolbar-icon.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,25 @@ | ||
import React from 'react'; | ||
import { popover_zindex } from 'Constants/z-indexes'; | ||
import { Icon, Popover } from '@deriv/components'; | ||
|
||
type TToolbarIcon = { | ||
popover_message: string; | ||
icon: string; | ||
icon_id: string; | ||
iconOnClick: () => void; | ||
icon_color?: string; | ||
}; | ||
|
||
const ToolbarIcon = ({ popover_message, icon, icon_id, icon_color, iconOnClick }: TToolbarIcon) => ( | ||
<Popover alignment='bottom' message={popover_message} zIndex={popover_zindex.TOOLBAR} should_disable_pointer_events> | ||
<Icon | ||
icon={icon} | ||
id={icon_id} | ||
className='toolbar__icon' | ||
onClick={iconOnClick} | ||
{...(icon_color ? { color: icon_color } : null)} | ||
/> | ||
</Popover> | ||
); | ||
|
||
export default ToolbarIcon; |
127 changes: 4 additions & 123 deletions
127
packages/bot-web-ui/src/components/dashboard/bot-builder/toolbar/toolbar.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
81 changes: 81 additions & 0 deletions
81
packages/bot-web-ui/src/components/dashboard/bot-builder/toolbar/workspace-group.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,81 @@ | ||
import React from 'react'; | ||
import { localize } from '@deriv/translations'; | ||
import ToolbarIcon from './toolbar-icon'; | ||
|
||
type TWorkspaceGroup = { | ||
has_redo_stack: boolean; | ||
has_undo_stack: boolean; | ||
onResetClick: () => void; | ||
onSortClick: () => void; | ||
onUndoClick: (param?: boolean) => void; | ||
onZoomInOutClick: (param?: boolean) => void; | ||
toggleLoadModal: () => void; | ||
toggleSaveModal: () => void; | ||
}; | ||
|
||
const WorkspaceGroup = ({ | ||
has_redo_stack, | ||
has_undo_stack, | ||
onResetClick, | ||
onSortClick, | ||
onUndoClick, | ||
onZoomInOutClick, | ||
toggleLoadModal, | ||
toggleSaveModal, | ||
}: TWorkspaceGroup) => ( | ||
<div className='toolbar__group toolbar__group-btn'> | ||
<ToolbarIcon | ||
popover_message={localize('Reset')} | ||
icon='IcReset' | ||
icon_id='db-toolbar__reset-button' | ||
iconOnClick={onResetClick} | ||
/> | ||
<ToolbarIcon | ||
popover_message={localize('Import')} | ||
icon='IcFolderOpen' | ||
icon_id='db-toolbar__import-button' | ||
iconOnClick={toggleLoadModal} | ||
/> | ||
<ToolbarIcon | ||
popover_message={localize('Save')} | ||
icon='IcSave' | ||
icon_id='db-toolbar__save-button' | ||
iconOnClick={toggleSaveModal} | ||
/> | ||
<div className='vertical-divider' /> | ||
<ToolbarIcon | ||
popover_message={localize('Undo')} | ||
icon='IcUndo' | ||
icon_id='db-toolbar__undo-button' | ||
icon_color={has_undo_stack ? undefined : 'disabled'} | ||
iconOnClick={() => onUndoClick(/* redo */ false)} | ||
/> | ||
<ToolbarIcon | ||
popover_message={localize('Redo')} | ||
icon='IcRedo' | ||
icon_id='db-toolbar__redo-button' | ||
icon_color={has_redo_stack ? undefined : 'disabled'} | ||
iconOnClick={() => onUndoClick(/* redo */ true)} | ||
/> | ||
<ToolbarIcon | ||
popover_message={localize('Sort')} | ||
icon='IcSort' | ||
icon_id='db-toolbar__sort-button' | ||
iconOnClick={onSortClick} | ||
/> | ||
<ToolbarIcon | ||
popover_message={localize('Zoom in')} | ||
icon='IcZoomIn' | ||
icon_id='db-toolbar__zoom-in-button' | ||
iconOnClick={() => onZoomInOutClick(/* in */ true)} | ||
/> | ||
<ToolbarIcon | ||
popover_message={localize('Zoom out')} | ||
icon='IcZoomOut' | ||
icon_id='db-toolbar__zoom-out' | ||
iconOnClick={() => onZoomInOutClick(/* in */ false)} | ||
/> | ||
</div> | ||
); | ||
|
||
export default WorkspaceGroup; |
56 changes: 56 additions & 0 deletions
56
packages/bot-web-ui/src/components/dashboard/bot-builder/toolbox/search-box.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,56 @@ | ||
import React from 'react'; | ||
import { Field as FormField, Formik, Form, FieldProps } from 'formik'; | ||
import { Input, Icon } from '@deriv/components'; | ||
import { localize } from '@deriv/translations'; | ||
|
||
type TSearchBox = { | ||
is_search_loading: boolean; | ||
onSearch: () => void; | ||
onSearchBlur: () => void; | ||
onSearchClear: ( | ||
param: (field: string, value: number | string, shouldValidate?: boolean | undefined) => void | ||
) => void; | ||
onSearchKeyUp: (param: () => void) => void; | ||
}; | ||
|
||
type TFormValues = { [key: string]: string }; | ||
|
||
const SearchBox = ({ is_search_loading, onSearch, onSearchBlur, onSearchClear, onSearchKeyUp }: TSearchBox) => ( | ||
<div className='db-toolbox__search'> | ||
<Formik initialValues={{ search: '' }} onSubmit={onSearch}> | ||
{({ submitForm, values: { search }, setFieldValue }) => ( | ||
<Form> | ||
<FormField name='search'> | ||
{({ field }: FieldProps<string, TFormValues>) => ( | ||
<Input | ||
{...field} | ||
className='db-toolbox__search-field' | ||
type='text' | ||
name='search' | ||
placeholder={localize('Search')} | ||
onKeyUp={() => onSearchKeyUp(submitForm)} | ||
onFocus={submitForm} | ||
onBlur={onSearchBlur} | ||
leading_icon={ | ||
(search && | ||
(is_search_loading ? ( | ||
<div className='loader' /> | ||
) : ( | ||
<Icon | ||
icon='IcCloseCircle' | ||
onClick={() => onSearchClear(setFieldValue)} | ||
color='secondary' | ||
/> | ||
))) || | ||
(!search && <Icon icon='IcSearch' />) | ||
} | ||
/> | ||
)} | ||
</FormField> | ||
</Form> | ||
)} | ||
</Formik> | ||
</div> | ||
); | ||
|
||
export default SearchBox; |
Oops, something went wrong.