-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(app): Add attached modules card UI to instrument settings page #1854
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ca9cf85
feat(app): Add attached modules card UI to instrument settings page
Kadee80 3b06a75
Reverse disabled update button logic, add key to module list
Kadee80 426c645
Add module name field and actual images
Kadee80 9698504
Refactor: more specfic props and names
Kadee80 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
24 changes: 14 additions & 10 deletions
24
app/src/components/InstrumentSettings/ModulesCardContents.js
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,18 +1,22 @@ | ||
// @flow | ||
import * as React from 'react' | ||
import styles from './styles.css' | ||
import type {Module} from '../../http-api-client' | ||
import ModuleItem, {NoModulesMessage} from '../ModuleItem' | ||
|
||
type Props = { | ||
modules?: any | ||
modules: Array<Module>, | ||
} | ||
|
||
export default function ModulesCardContents (props: Props) { | ||
return ( | ||
<React.Fragment> | ||
<p className={styles.modules_description}>No modules detected.</p> | ||
|
||
<p className={styles.modules_description}>Connect a module to your robot via USB, then power it on. | ||
Press the refresh icon to the top to detect your module.</p> | ||
</React.Fragment> | ||
) | ||
const modulesFound = props.modules[0] | ||
if (modulesFound) { | ||
return ( | ||
<React.Fragment> | ||
{props.modules.map((mod, index) => ( | ||
<ModuleItem {...mod} key={index}/> | ||
))} | ||
</React.Fragment> | ||
) | ||
} | ||
return (<NoModulesMessage />) | ||
} |
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 |
---|---|---|
|
@@ -47,9 +47,3 @@ | |
order: 3; | ||
} | ||
} | ||
|
||
.modules_description { | ||
@apply --font-body-2-dark; | ||
|
||
margin: 0.5rem 0; | ||
} |
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,27 @@ | ||
// @flow | ||
import * as React from 'react' | ||
|
||
import styles from './styles.css' | ||
|
||
type Props = { | ||
name: string | ||
} | ||
|
||
export default function ModuleImage (props: Props) { | ||
const imgSrc = getModuleImg(props.name) | ||
return ( | ||
<div className={styles.module_image_wrapper}> | ||
<img src={imgSrc} className={styles.module_image}/> | ||
</div> | ||
) | ||
} | ||
|
||
function getModuleImg (name: string) { | ||
return MODULE_IMGS[name] | ||
} | ||
|
||
// TODO (ka 2018-7-10): replace with design assets onces available | ||
const MODULE_IMGS = { | ||
'temp_deck': require('./images/[email protected]'), | ||
'mag_deck': require('./images/[email protected]') | ||
} |
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,23 @@ | ||
// @flow | ||
import * as React from 'react' | ||
|
||
import type {Module} from '../../http-api-client' | ||
|
||
import {LabeledValue} from '@opentrons/components' | ||
|
||
import styles from './styles.css' | ||
|
||
export default function ModuleInfo (props: Module) { | ||
return ( | ||
<div className={styles.module_info}> | ||
<div className={styles.grid_50} > | ||
<LabeledValue label='Name' value={props.displayName} /> | ||
<LabeledValue label='Serial' value={props.serial} /> | ||
</div> | ||
<div className={styles.grid_50} > | ||
<LabeledValue label='Status' value={props.status} /> | ||
<LabeledValue label='Firmware Version' value={props.fwVersion} /> | ||
</div> | ||
</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,26 @@ | ||
// @flow | ||
import * as React from 'react' | ||
|
||
import {OutlineButton} from '@opentrons/components' | ||
|
||
import styles from './styles.css' | ||
|
||
type Props = { | ||
availableUpdate?: ?string | ||
} | ||
|
||
export default function ModuleUpdate (props: Props) { | ||
const {availableUpdate} = props | ||
const buttonText = availableUpdate | ||
? 'update' | ||
: 'updated' | ||
return ( | ||
<div className={styles.module_update}> | ||
<OutlineButton | ||
disabled={!availableUpdate} | ||
> | ||
{buttonText} | ||
</OutlineButton> | ||
</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,14 @@ | ||
// @flow | ||
import * as React from 'react' | ||
import styles from './styles.css' | ||
|
||
export default function NoModulesMessage () { | ||
return ( | ||
<React.Fragment> | ||
<p className={styles.modules_description}>No modules detected.</p> | ||
|
||
<p className={styles.modules_description}>Connect a module to your robot via USB, then power it on. | ||
Press the refresh icon to the top to detect your module.</p> | ||
</React.Fragment> | ||
) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,27 @@ | ||
// @flow | ||
import * as React from 'react' | ||
|
||
import type {Module} from '../../http-api-client' | ||
|
||
import ModuleImage from './ModuleImage' | ||
import ModuleInfo from './ModuleInfo' | ||
import ModuleUpdate from './ModuleUpdate' | ||
import NoModulesMessage from './NoModulesMessage' | ||
|
||
import styles from './styles.css' | ||
|
||
type Props = Module & { | ||
availableUpdate?: ?string | ||
} | ||
|
||
export default function ModuleItem (props: Props) { | ||
return ( | ||
<div className={styles.module_item}> | ||
<ModuleImage name={props.name}/> | ||
<ModuleInfo {...props}/> | ||
<ModuleUpdate availableUpdate={props.availableUpdate}/> | ||
</div> | ||
) | ||
} | ||
|
||
export {NoModulesMessage} |
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,48 @@ | ||
/* style sheet for module settings card on instrument settings page */ | ||
@import '@opentrons/components'; | ||
|
||
.modules_description { | ||
@apply --font-body-2-dark; | ||
|
||
margin: 0.5rem 0; | ||
} | ||
|
||
.module_item { | ||
width: 100%; | ||
margin-bottom: 1rem; | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
.module_image_wrapper { | ||
flex-basis: 25%; | ||
padding-right: 1rem; | ||
} | ||
|
||
.module_image { | ||
width: 100%; | ||
} | ||
|
||
.module_info { | ||
flex-basis: 55%; | ||
} | ||
|
||
.grid_50 { | ||
display: inline-block; | ||
vertical-align: top; | ||
width: calc(50% - 2rem); | ||
margin: 0 1rem; | ||
|
||
& > div { | ||
margin-bottom: 2rem; | ||
} | ||
} | ||
|
||
.module_update { | ||
flex-basis: 20%; | ||
padding-top: 4.5rem; | ||
|
||
& > button { | ||
width: 8rem; | ||
} | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see
availableUpdate
in the stubbed modules. Is it a version string in the case that there is an available update and undefined if not? If that's the case, could it be calledavailableUpdateVersion
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, everything is just stubbed out. Not sure where the firmware update will come from yet. In robot it was a ?string with the version if a new one is available
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
availableUpdate
will likely come from a selector based on whatever firmware files we have bundled in that version of the app