-
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.
Revert "refactor(app): Standardize modals and pages (#1705)"
This reverts commit 9070b21.
- Loading branch information
Showing
21 changed files
with
221 additions
and
202 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,21 +1,60 @@ | ||
// @flow | ||
// info panel and controls for labware calibration page | ||
import * as React from 'react' | ||
import {withRouter} from 'react-router' | ||
import type {Labware} from '../../robot' | ||
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 DeckMap from '../DeckMap' | ||
import InfoBox from './InfoBox' | ||
import ConfirmModal from './ConfirmModal' | ||
|
||
type Props = { | ||
labware: ?Labware | ||
} | ||
export default withRouter(LabwareCalibration) | ||
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) | ||
) | ||
|
||
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 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,5 @@ | ||
.task { | ||
flex: 1 1; | ||
position: relative; | ||
overflow-y: scroll; | ||
} |
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,16 @@ | ||
// task component | ||
import React from 'react' | ||
|
||
import styles from './Page.css' | ||
import LostConnectionAlert from './LostConnectionAlert' | ||
import {AnalyticsSettingsModal} from './analytics-settings' | ||
|
||
export default function Page (props) { | ||
return ( | ||
<main className={styles.task}> | ||
{props.children} | ||
<LostConnectionAlert /> | ||
<AnalyticsSettingsModal /> | ||
</main> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// @flow | ||
// view info about the app and update | ||
import React from 'react' | ||
import {connect} from 'react-redux' | ||
import {Route, Switch, Redirect, type ContextRouter} from 'react-router' | ||
import {push} from 'react-router-redux' | ||
|
||
import type {State} from '../types' | ||
import type {ShellUpdate} from '../shell' | ||
import { | ||
getShellUpdate, | ||
checkForShellUpdates, | ||
downloadShellUpdate, | ||
quitAndInstallShellUpdate, | ||
setUpdateSeen | ||
} from '../shell' | ||
|
||
import Page from '../components/Page' | ||
import AppSettings, {AppUpdateModal} from '../components/AppSettings' | ||
|
||
type OP = ContextRouter | ||
|
||
type SP = { | ||
update: ShellUpdate, | ||
} | ||
|
||
type DP = { | ||
checkForUpdates: () => mixed, | ||
downloadUpdate: () => mixed, | ||
quitAndInstall: () => mixed, | ||
closeUpdateModal: () => mixed, | ||
} | ||
|
||
type Props = OP & SP & DP | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(AppSettingsPage) | ||
|
||
function AppSettingsPage (props: Props) { | ||
const {update, match: {path}} = props | ||
|
||
return ( | ||
<Page> | ||
<AppSettings {...props} /> | ||
<Switch> | ||
<Route path={`${path}/update`} render={() => ( | ||
<AppUpdateModal {...props} close={props.closeUpdateModal} /> | ||
)} /> | ||
<Route render={() => { | ||
if (update.available && !update.seen) { | ||
return (<Redirect to='/menu/app/update' />) | ||
} | ||
|
||
return null | ||
}} /> | ||
</Switch> | ||
</Page> | ||
) | ||
} | ||
|
||
function mapStateToProps (state: State): SP { | ||
return { | ||
update: getShellUpdate(state) | ||
} | ||
} | ||
|
||
function mapDispatchToProps (dispatch: Dispatch): DP { | ||
return { | ||
checkForUpdates: () => dispatch(checkForShellUpdates()), | ||
downloadUpdate: () => dispatch(downloadShellUpdate()), | ||
quitAndInstall: () => quitAndInstallShellUpdate(), | ||
closeUpdateModal: () => { | ||
dispatch(setUpdateSeen()) | ||
dispatch(push('/menu/app')) | ||
} | ||
} | ||
} |
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.