Skip to content

Commit

Permalink
Editor: run scenario button
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Jun 25, 2020
1 parent e7d40d7 commit 655aca0
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions client/components/Editor/index.jsx
@@ -1,6 +1,6 @@
import React, { Component, Fragment } from 'react';
import { connect } from 'react-redux';
import { Dropdown, Menu, Segment } from '@components/UI';
import { Dropdown, Icon, Menu, Segment } from '@components/UI';
import PropTypes from 'prop-types';
import Storage from '@utils/Storage';
import EditorMenu from '@components/EditorMenu';
Expand Down Expand Up @@ -325,6 +325,10 @@ class Editor extends Component {
return null;
}

const {
scenarioId
} = this.state;

const scenarioStatusMenuItem = this.props.status !== undefined && (
<ScenarioStatusMenuItem
key="scenario-status-menu-item"
Expand All @@ -334,7 +338,19 @@ class Editor extends Component {
/>
);

const editTabMenu = Object.keys(this.state.tabs).map(tabType => {
const scenarioRunMenuItem = scenarioId !== 'new' ? (
<Menu.Item
key="scenario-run-menu-item"
name="Run this scenario"
onClick={() => {
this.props.history.push(`/run/${scenarioId}/slide/0`);
}}
>
<Icon name="play" />
</Menu.Item>
) : null;

const menuBar = Object.keys(this.state.tabs).map(tabType => {
return (
<Menu.Item
key={tabType}
Expand All @@ -348,11 +364,11 @@ class Editor extends Component {
return (
<Fragment>
<Menu attached="top" tabular className="editor__tabmenu">
{editTabMenu}
{menuBar}
</Menu>

<Segment attached="bottom" className="editor__content-pane">
{this.state.scenarioId !== 'new' && (
{scenarioId !== 'new' && (
<EditorMenu
type="scenario"
items={{
Expand All @@ -363,10 +379,13 @@ class Editor extends Component {
},
delete: {
onConfirm: () => {
this.deleteScenario(this.state.scenarioId);
this.deleteScenario(scenarioId);
}
},
right: [scenarioStatusMenuItem]
right: [
scenarioRunMenuItem,
scenarioStatusMenuItem
]
}}
/>
)}
Expand Down

0 comments on commit 655aca0

Please sign in to comment.