-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(app): Standardize modals and pages (#1705)
* refactor(app): Standardize modals and pages
- Loading branch information
Showing
21 changed files
with
202 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,21 @@ | ||
// @flow | ||
// info panel and controls for labware calibration page | ||
import * as React from 'react' | ||
import {connect} from 'react-redux' | ||
import {Redirect, Route, withRouter} from 'react-router' | ||
import {push} from 'react-router-redux' | ||
|
||
import { | ||
selectors as robotSelectors, | ||
type Labware | ||
} from '../../robot' | ||
|
||
import {withRouter} from 'react-router' | ||
import type {Labware} from '../../robot' | ||
import DeckMap from '../DeckMap' | ||
import InfoBox from './InfoBox' | ||
import ConfirmModal from './ConfirmModal' | ||
|
||
type OwnProps = {slot: ?string, url: string} | ||
type StateProps = {labware: ?Labware} | ||
type DispatchProps = {onBackClick: () => void} | ||
type Props = StateProps & DispatchProps & OwnProps | ||
|
||
export default withRouter( | ||
connect(mapStateToProps, mapDispatchToProps)(LabwareCalibration) | ||
) | ||
type Props = { | ||
labware: ?Labware | ||
} | ||
export default withRouter(LabwareCalibration) | ||
|
||
function LabwareCalibration (props: Props) { | ||
const {url, labware, onBackClick} = props | ||
|
||
return ( | ||
<div> | ||
<InfoBox {...props} /> | ||
<DeckMap /> | ||
<Route path={`${url}/confirm`} render={() => { | ||
if (!labware || labware.calibration === 'confirmed') { | ||
return ( | ||
<Redirect to={url} /> | ||
) | ||
} | ||
|
||
return ( | ||
<ConfirmModal labware={labware} onBackClick={onBackClick} /> | ||
) | ||
}} /> | ||
</div> | ||
) | ||
} | ||
|
||
function mapStateToProps (state, ownProps: OwnProps): StateProps { | ||
// TODO(mc, 2018-02-05): getCurrentLabware selector | ||
const labware = robotSelectors.getLabware(state) | ||
const currentLabware = labware.find((lw) => lw.slot === ownProps.slot) | ||
|
||
return {labware: currentLabware} | ||
} | ||
|
||
function mapDispatchToProps (dispatch, ownProps: OwnProps): DispatchProps { | ||
return { | ||
onBackClick: () => { dispatch(push(ownProps.url)) } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// @flow | ||
import * as React from 'react' | ||
|
||
import LostConnectionAlert from '../LostConnectionAlert' | ||
import {AnalyticsSettingsModal} from '../analytics-settings' | ||
|
||
import styles from './styles.css' | ||
|
||
type Props = { | ||
children: React.Node | ||
} | ||
export default function PageWrapper (props: Props) { | ||
return ( | ||
<div className={styles.relative}> | ||
{props.children} | ||
<LostConnectionAlert /> | ||
<AnalyticsSettingsModal /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// @flow | ||
import * as React from 'react' | ||
|
||
import styles from './styles.css' | ||
import {TitleBar, type TitleBarProps} from '@opentrons/components' | ||
import PageWrapper from './PageWrapper' | ||
|
||
type Props = { | ||
titleBarProps?: TitleBarProps, | ||
children: React.Node, | ||
} | ||
|
||
export default function Page (props: Props) { | ||
const {titleBarProps, children} = props | ||
return ( | ||
<main className={styles.task}> | ||
{titleBarProps && ( | ||
<TitleBar {...titleBarProps} /> | ||
)} | ||
{children} | ||
</main> | ||
) | ||
} | ||
|
||
export {PageWrapper} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
:root { | ||
--relative-fill: { | ||
width: 100%; | ||
height: 100%; | ||
position: relative; | ||
} | ||
} | ||
|
||
.relative { | ||
@apply --relative-fill; | ||
} | ||
|
||
.task { | ||
@apply --relative-fill; | ||
|
||
overflow-y: auto; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.