Skip to content

Commit

Permalink
feat(app): Show connect alert banner on successful connection (#1700)
Browse files Browse the repository at this point in the history
closes #1314
  • Loading branch information
Kadee80 authored Jun 15, 2018
1 parent 96c6b3c commit 70cd8b2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
33 changes: 33 additions & 0 deletions app/src/components/RobotSettings/ConnectBanner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// @flow
import * as React from 'react'
import {type Robot} from '../../robot'
import {AlertItem} from '@opentrons/components'

type State = {
dismissed: boolean
}

export default class ConnectBanner extends React.Component <Robot, State> {
constructor (props: Robot) {
super(props)

this.state = {
dismissed: false
}
}

render () {
const {isConnected, name} = this.props
const isVisible = isConnected && !this.state.dismissed
const TITLE = `${name} successfully connected`
if (!isVisible) {
return null
}
return (
<AlertItem
type='success'
onCloseClick={() => this.setState({dismissed: true})}
title={TITLE} />
)
}
}
2 changes: 2 additions & 0 deletions app/src/pages/Robots.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Page from '../components/Page'
import RobotSettings, {ConnectAlertModal} from '../components/RobotSettings'
import ChangePipette from '../components/ChangePipette'
import CalibrateDeck from '../components/CalibrateDeck'
import ConnectBanner from '../components/RobotSettings/ConnectBanner'

type StateProps = {
robot: ?Robot,
Expand Down Expand Up @@ -58,6 +59,7 @@ function RobotSettingsPage (props: Props) {
return (
<Page>
<TitleBar title={robot.name} />
<ConnectBanner {...robot} key={Number(robot.isConnected)}/>
<RobotSettings {...robot} />

<Route path={`${path}/pipettes`} render={(props) => (
Expand Down

0 comments on commit 70cd8b2

Please sign in to comment.