diff --git a/src/components/BacktestOptionsPanel/BacktestOptionsPanel.js b/src/components/BacktestOptionsPanel/BacktestOptionsPanel.js
index eb0dfa629..f3408f059 100644
--- a/src/components/BacktestOptionsPanel/BacktestOptionsPanel.js
+++ b/src/components/BacktestOptionsPanel/BacktestOptionsPanel.js
@@ -3,20 +3,25 @@ import { useTranslation } from 'react-i18next'
import PropTypes from 'prop-types'
import _toUpper from 'lodash/toUpper'
import { Icon } from 'react-fa'
+import { useDispatch, useSelector } from 'react-redux'
import BacktestOptionsNewTest from './tabs/NewTest'
import HistoryButton from '../../ui/HistoryButton/HistoryButton'
import BacktestHistoryList from './tabs/BacktestHistoryList'
import PanelButton from '../../ui/Panel/Panel.Button'
import BacktestDetails from './tabs/BacktestDetails'
-import { BACKTEST_TAB_SECTIONS } from '../StrategyEditor/tabs/BacktestTab'
+import { BACKTEST_TAB_SECTIONS } from '../../redux/reducers/ui'
+import UIActions from '../../redux/actions/ui'
+import WSActions from '../../redux/actions/ws'
+import { getBacktestActiveSection } from '../../redux/selectors/ui'
import './style.css'
const BacktestOptionsPanel = (props) => {
- const { setActiveSection, activeSection, setBtHistoryId } = props
-
const { t } = useTranslation()
+ const dispatch = useDispatch()
+ const activeSection = useSelector(getBacktestActiveSection)
+ const setActiveSection = (section) => dispatch(UIActions.setBacktestActiveSection(section))
const onNewTestTabClick = () => setActiveSection(BACKTEST_TAB_SECTIONS.NEW_BT)
const onHistoryTabClick = () => {
if (activeSection !== BACKTEST_TAB_SECTIONS.NEW_BT) {
@@ -27,7 +32,7 @@ const BacktestOptionsPanel = (props) => {
const onBackButtonClick = () => setActiveSection(BACKTEST_TAB_SECTIONS.HISTORY_BT_LIST)
const onBacktestRowClick = ({ rowData }) => {
- setBtHistoryId(rowData.executionId)
+ dispatch(WSActions.setHistoryBacktestId(rowData.executionId))
setActiveSection(BACKTEST_TAB_SECTIONS.HISTORY_BT_DETAILS)
}
@@ -63,16 +68,10 @@ const BacktestOptionsPanel = (props) => {
)}
{activeSection === BACKTEST_TAB_SECTIONS.HISTORY_BT_DETAILS && (
-
+
)}
)
}
-BacktestOptionsPanel.propTypes = {
- activeSection: PropTypes.string.isRequired,
- setActiveSection: PropTypes.func.isRequired,
- setBtHistoryId: PropTypes.func.isRequired,
-}
-
export default BacktestOptionsPanel
diff --git a/src/components/BacktestOptionsPanel/BacktestResultsOptionsPanel.js b/src/components/BacktestOptionsPanel/BacktestResultsOptionsPanel.js
index fc98906e0..1d290f4c1 100644
--- a/src/components/BacktestOptionsPanel/BacktestResultsOptionsPanel.js
+++ b/src/components/BacktestOptionsPanel/BacktestResultsOptionsPanel.js
@@ -1,27 +1,32 @@
import React from 'react'
import _toUpper from 'lodash/toUpper'
+import _get from 'lodash/get'
import PropTypes from 'prop-types'
import { useTranslation } from 'react-i18next'
import { useDispatch, useSelector } from 'react-redux'
import { Icon } from 'react-fa'
import Button from '../../ui/Button'
-import { getFormatTimeFn } from '../../redux/selectors/ui'
+import {
+ getBacktestActiveSection,
+ getFormatTimeFn,
+} from '../../redux/selectors/ui'
import { renderDate } from '../../util/ui'
import PanelButton from '../../ui/Panel/Panel.Button'
-import { BACKTEST_TAB_SECTIONS } from '../StrategyEditor/tabs/BacktestTab'
+
+import UIActions from '../../redux/actions/ui'
import WSActions from '../../redux/actions/ws'
+import { BACKTEST_TAB_SECTIONS } from '../../redux/reducers/ui'
+import { getCurrentHistoryBacktest } from '../../redux/selectors/ws'
-const BacktestResultsOptionsPanel = ({
- showFullscreenChart,
- backtestTimestamp,
- activeSection,
- setActiveSection,
-}) => {
+const BacktestResultsOptionsPanel = ({ showFullscreenChart }) => {
const formatTime = useSelector(getFormatTimeFn)
+ const backtest = useSelector(getCurrentHistoryBacktest)
+ const activeSection = useSelector(getBacktestActiveSection)
const { t } = useTranslation()
const dispatch = useDispatch()
+ const setActiveSection = (section) => dispatch(UIActions.setBacktestActiveSection(section))
const onBackButtonClick = () => setActiveSection(BACKTEST_TAB_SECTIONS.HISTORY_BT_DETAILS)
const onNewTestButtonClick = () => {
dispatch(WSActions.purgeBacktestData())
@@ -43,7 +48,9 @@ const BacktestResultsOptionsPanel = ({
{t('strategyEditor.backtestHistoryResults')}
- {renderDate(backtestTimestamp, formatTime, false)}
+
+ {renderDate(_get(backtest, 'timestamp', 0), formatTime, false)}
+