11import React , { Component } from 'react'
22
3- import { withStyles } from '@material-ui/core/styles'
4- import Button from '@material-ui/core/Button'
5- import Icon from '../general/NetPyNEIcons'
6- import { TOPBAR_CONSTANTS , MODEL_STATE } from '../../constants'
7-
3+ import { withStyles } from '@material-ui/core/styles' ;
4+ import Button from '@material-ui/core/Button' ;
5+ import IconButton from '@material-ui/core/IconButton' ;
6+ import Icon from '../general/NetPyNEIcons' ;
7+ import { TOPBAR_CONSTANTS , MODEL_STATE } from '../../constants' ;
8+ import { Tooltip } from 'netpyne/components' ;
89
910const styles = ( { palette, shape, spacing, typography } ) => ( {
1011 container : { } ,
@@ -14,6 +15,7 @@ const styles = ({ palette, shape, spacing, typography }) => ({
1415 fontSize : '1rem' ,
1516 borderRadius : 0
1617 } ,
18+ rocket : { marginRight : spacing ( 1 ) } ,
1719 icon : { color : palette . common . white } ,
1820} )
1921
@@ -36,9 +38,32 @@ class SwitchPageButton extends Component {
3638 } ;
3739
3840 render ( ) {
39- const { classes } = this . props
41+ const { classes, modelState, editModelPage } = this . props ;
42+ const disableSimulate = modelState === MODEL_STATE . SIMULATED ;
4043 return (
4144 < div className = { classes . container } >
45+ {
46+ editModelPage ? null
47+
48+ : < Tooltip
49+ title = { disableSimulate ? "You have already simulated the network" : "Simulate the network" }
50+ placement = "left"
51+ > < span >
52+ < IconButton
53+ color = { 'default' }
54+ id = { "launchSimulationButton" }
55+ className = { classes . rocket }
56+ size = "small"
57+ onClick = { ( ) => this . props . simulateNetwork ( ) }
58+ disabled = { disableSimulate }
59+ style = { { opacity : disableSimulate ? 0.5 : 1 } }
60+ >
61+ < Icon name = { "rocket" } />
62+
63+ </ IconButton >
64+ </ span >
65+ </ Tooltip >
66+ }
4267 < Button
4368 variant = "contained"
4469 size = "small"
0 commit comments