-
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 GEN2 images to change pipette #3734
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
3191e23
feat(shared-data): add displayCategory to pipetteNameSpecs and schema
b-cooper 26b685a
make it an enum
b-cooper ad9f143
same case name identifier
b-cooper 1abf574
instrument diagram handle gen2
b-cooper 2a5c862
get pipette thumb switch
b-cooper 4065a9b
lower cyclomatic complexity
b-cooper b29bf34
attach detach diagrams for gen2
b-cooper ab973bb
feat(app): add GEN2 images to change pipette
b-cooper e8c161c
update some test
b-cooper 099897e
feat(shared-data): add displayCategory to pipetteNameSpecs and schema
b-cooper f3630c6
make it an enum
b-cooper 4830964
same case name identifier
b-cooper 89ac54a
Merge branch 'sd_add-display-cat-to-pipettes' into app_display-pipett…
b-cooper e5c663f
displayCategory > generation
b-cooper b9bb430
clean up some lint
b-cooper fbafce4
update snaps
b-cooper 55520d2
merge in new edge changes
b-cooper 7ee39aa
update cl examples
b-cooper 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
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,7 +1,10 @@ | ||
// @flow | ||
import * as React from 'react' | ||
|
||
import type { PipetteChannels } from '@opentrons/shared-data' | ||
import type { | ||
PipetteChannels, | ||
PipetteDisplayCategory, | ||
} from '@opentrons/shared-data' | ||
import type { Mount } from '../../robot' | ||
import type { Direction } from './types' | ||
|
||
|
@@ -15,85 +18,36 @@ type DiagramProps = { | |
mount: Mount, | ||
channels: PipetteChannels, | ||
diagram: Diagram, | ||
displayCategory: PipetteDisplayCategory, | ||
} | ||
|
||
type Props = DiagramProps & { | ||
step: 'one' | 'two', | ||
children: React.Node, | ||
} | ||
|
||
type Channels = 'single' | 'multi' | ||
export function getDiagramsSrc(props: DiagramProps) { | ||
const { channels, displayCategory, direction, mount, diagram } = props | ||
const channelsKey = channels === 8 ? 'multi' : 'single' | ||
|
||
// TODO(mc, 2018-04-06): there must be a better way... | ||
// this object is way nicer than a giant if/else ladder though | ||
const DIAGRAMS: { | ||
[Direction]: { [Mount]: { [Channels]: { [Diagram]: string } } }, | ||
} = { | ||
attach: { | ||
left: { | ||
single: { | ||
screws: require('./images/[email protected]'), | ||
tab: require('./images/[email protected]'), | ||
}, | ||
multi: { | ||
screws: require('./images/[email protected]'), | ||
tab: require('./images/[email protected]'), | ||
}, | ||
}, | ||
right: { | ||
single: { | ||
screws: require('./images/[email protected]'), | ||
tab: require('./images/[email protected]'), | ||
}, | ||
multi: { | ||
screws: require('./images/[email protected]'), | ||
tab: require('./images/[email protected]'), | ||
}, | ||
}, | ||
}, | ||
detach: { | ||
left: { | ||
single: { | ||
screws: require('./images/[email protected]'), | ||
tab: require('./images/[email protected]'), | ||
}, | ||
multi: { | ||
screws: require('./images/[email protected]'), | ||
tab: require('./images/[email protected]'), | ||
}, | ||
}, | ||
right: { | ||
single: { | ||
screws: require('./images/[email protected]'), | ||
tab: require('./images/[email protected]'), | ||
}, | ||
multi: { | ||
screws: require('./images/[email protected]'), | ||
tab: require('./images/[email protected]'), | ||
}, | ||
}, | ||
}, | ||
switch (displayCategory) { | ||
case 'GEN2': | ||
return require(`./images/${direction}-${mount}-${channelsKey}-GEN2-${diagram}@3x.png`) | ||
case 'OG': | ||
default: | ||
return require(`./images/${direction}-${mount}-${channelsKey}-${diagram}@3x.png`) | ||
} | ||
} | ||
|
||
export default function InstructionStep(props: Props) { | ||
const { diagram } = props | ||
const diagramSrc = getDiagramSrc(props) | ||
|
||
return ( | ||
<fieldset className={styles.step}> | ||
<legend className={styles.step_legend}>Step {props.step}</legend> | ||
<div>{props.children}</div> | ||
{diagram === 'screws' && ( | ||
{props.diagram === 'screws' && ( | ||
<img src={screwdriverSrc} className={styles.screwdriver} /> | ||
)} | ||
<img src={diagramSrc} className={styles.diagram} /> | ||
<img src={getDiagramsSrc(props)} className={styles.diagram} /> | ||
</fieldset> | ||
) | ||
} | ||
|
||
export function getDiagramSrc(props: DiagramProps): string { | ||
const { direction, mount, channels, diagram } = props | ||
const channelsKey = channels === 8 ? 'multi' : 'single' | ||
|
||
return DIAGRAMS[direction][mount][channelsKey][diagram] | ||
} |
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
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.
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.
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.
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.
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.
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.
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.
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
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,12 +1,11 @@ | ||
@import '@opentrons/components'; | ||
|
||
:root { | ||
|
||
--bg-modal-transparent: { | ||
max-width: 30rem; | ||
padding-top: 3rem; | ||
background-color: transparent; | ||
}; | ||
} | ||
} | ||
|
||
.modal { | ||
|
@@ -143,3 +142,8 @@ | |
padding-left: 2.5rem; | ||
padding-right: 2.5rem; | ||
} | ||
|
||
.flipped_image { | ||
transform: scaleX(-1); | ||
filter: FlipH; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at caniuse I think |
||
} |
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
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
Oops, something went wrong.
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.
❓🌮 🌮
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.
🤕