diff --git a/packages/bot-web-ui/src/components/dashboard/bot-builder/bot-builder.tsx b/packages/bot-web-ui/src/components/dashboard/bot-builder/bot-builder.tsx index f7d8b661727f..91d377c9d6aa 100644 --- a/packages/bot-web-ui/src/components/dashboard/bot-builder/bot-builder.tsx +++ b/packages/bot-web-ui/src/components/dashboard/bot-builder/bot-builder.tsx @@ -1,10 +1,11 @@ import React from 'react'; -import { connect } from 'Stores/connect'; import RootStore from 'Stores/index'; +import AppStore from 'Stores/app-store'; +import { connect } from 'Stores/connect'; import WorkspaceWrapper from './workspace-wrapper'; interface BotBuilderProps { - app: any; + app: AppStore; } const BotBuilder = ({ app }: BotBuilderProps) => { diff --git a/packages/bot-web-ui/src/components/dashboard/dashboard.scss b/packages/bot-web-ui/src/components/dashboard/dashboard.scss index 2054df3802c0..f22437bea580 100644 --- a/packages/bot-web-ui/src/components/dashboard/dashboard.scss +++ b/packages/bot-web-ui/src/components/dashboard/dashboard.scss @@ -54,4 +54,6 @@ left: 232px; background-color: var(--general-main-1); } + &__run-stretegy-wrapper { + } } diff --git a/packages/bot-web-ui/src/components/dashboard/dashboard.tsx b/packages/bot-web-ui/src/components/dashboard/dashboard.tsx index 5629be39bdc5..9c6d8490d114 100644 --- a/packages/bot-web-ui/src/components/dashboard/dashboard.tsx +++ b/packages/bot-web-ui/src/components/dashboard/dashboard.tsx @@ -1,35 +1,40 @@ import React from 'react'; -import { Tabs, Icon } from '@deriv/components'; +import { Tabs, Icon, Tab } from '@deriv/components'; import { localize } from '@deriv/translations'; import Chart from 'Components/chart'; import DashboardComponents from './dashboard-components'; import SideBar from './dashboard-components/Sidebar'; -import RunPanel from '../run-panel'; import ReactJoyride from 'react-joyride'; import JoyrideConfig from './joyrideConfig'; import BotBuilder from './bot-builder'; +import classNames from 'classnames'; +import RunPanel from './run-panel'; +import RunStretegy from '../toolbar/runStrategy'; +import { connect } from 'Stores/connect'; +import RootStore from 'Stores/index'; -interface SideBarProps { - checkIfSidebarOpen: boolean; - children: React.ReactElement; +interface DashboardProps { + active_tab: number; + setActiveTab: (active_tab: number) => void; } -const Dashboard = (props: SideBarProps) => { - const [active_index, setActiveTabIndex] = React.useState(0); +const Dashboard = ({ active_tab, setActiveTab }: DashboardProps) => { const [showSideBar, setshowSideBar] = React.useState(true); - const dashBoradClass = 'dashboard__container '; - const sidebarClasstoggle = showSideBar === false ? 'w-100' : ''; const { DashBorardSteps } = JoyrideConfig; const [tourRun, setTourRun] = React.useState(true); - const handleClick = (e: React.MouseEvent) => { + const handleClick = (e: any) => { e.preventDefault(); setTourRun(true); }; + return (
-
+
+
+ +
- + {/* [Todo] needs to update tabs comIcDashBoardComponentsTabponent children instead of using label property */}
@@ -59,4 +64,7 @@ const Dashboard = (props: SideBarProps) => { ); }; -export default Dashboard; +export default connect((store: RootStore) => ({ + active_tab: store.dashbaord.active_tab, + setActiveTab: store.dashbaord.setActiveTab, +}))(Dashboard); diff --git a/packages/bot-web-ui/src/components/dashboard/run-panel/index.ts b/packages/bot-web-ui/src/components/dashboard/run-panel/index.ts new file mode 100644 index 000000000000..3c6644d2a931 --- /dev/null +++ b/packages/bot-web-ui/src/components/dashboard/run-panel/index.ts @@ -0,0 +1,3 @@ +import RunPanel from './run-panel'; + +export default RunPanel; diff --git a/packages/bot-web-ui/src/components/dashboard/run-panel/run-panel.tsx b/packages/bot-web-ui/src/components/dashboard/run-panel/run-panel.tsx new file mode 100644 index 000000000000..4ecbb6ef5e39 --- /dev/null +++ b/packages/bot-web-ui/src/components/dashboard/run-panel/run-panel.tsx @@ -0,0 +1,7 @@ +import React from 'react'; + +const RunPanel = () => { + return
Run Panel
; +}; + +export default RunPanel; diff --git a/packages/bot-web-ui/src/stores/dashboard-store.js b/packages/bot-web-ui/src/stores/dashboard-store.js new file mode 100644 index 000000000000..86a64f1d13bd --- /dev/null +++ b/packages/bot-web-ui/src/stores/dashboard-store.js @@ -0,0 +1,18 @@ +import { makeObservable, observable, action } from 'mobx'; + +export default class DashboardStore { + constructor(root_store) { + makeObservable(this, { + active_tab: observable, + setActiveTab: action.bound, + }); + + this.root_store = root_store; + } + + active_tab = 0; + + setActiveTab(active_tab) { + this.active_tab = active_tab; + } +} diff --git a/packages/bot-web-ui/src/stores/index.js b/packages/bot-web-ui/src/stores/index.js index b521ccc6d327..51395533d9c9 100644 --- a/packages/bot-web-ui/src/stores/index.js +++ b/packages/bot-web-ui/src/stores/index.js @@ -19,6 +19,7 @@ import BlocklyStore from './blockly-store'; import SelfExclusionStore from './self-exclusion-store'; import ToolboxStore from './toolbox-store'; import AppStore from './app-store'; +import DashboardStore from './dashboard-store'; export default class RootStore { constructor(core, ws, dbot) { @@ -47,6 +48,7 @@ export default class RootStore { this.quick_strategy = new QuickStrategyStore(this); this.route_prompt_dialog = new RoutePromptDialogStore(this); this.self_exclusion = new SelfExclusionStore(this); + this.dashbaord = new DashboardStore(this); // need to be at last for dependency this.chart_store = new ChartStore(this);