-
Notifications
You must be signed in to change notification settings - Fork 171
/
Instructions.js
72 lines (62 loc) · 1.94 KB
/
Instructions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// @flow
import * as React from 'react'
import { InstructionStep } from '../InstructionStep'
import styles from '../InstructionStep/styles.css'
import calibrationTipSrc from './images/initial-calib-tip.svg'
import type { CalibrationStep } from './types'
export type InstructionsProps = {|
calibrationStep: CalibrationStep,
|}
const DIAGRAMS: { [step: CalibrationStep]: ?string } = {
'2': require('./images/initial-calib-z-5@3x.png'),
'3': require('./images/initial-calib-xy-1@3x.png'),
'4': require('./images/initial-calib-xy-3@3x.png'),
'5': require('./images/initial-calib-xy-7@3x.png'),
}
const INSTRUCTIONS: { [step: CalibrationStep]: ?React.Node } = {
'2':
'Jog robot until tip is positioned over a flat area in slot 5 (shown in blue).',
'3': (
<p>
Jog the robot until tip is centered above the <strong>+</strong>{' '}
impression in slot 1.
</p>
),
'4': (
<p>
Jog the robot until tip is centered above the <strong>+</strong>{' '}
impression in slot 3.
</p>
),
'5': (
<p>
Jog the robot until tip is centered above the <strong>+</strong>{' '}
impression in slot 7.
</p>
),
}
export function Instructions(props: InstructionsProps): React.Node {
const { calibrationStep } = props
const diagram = getDiagramSrc(calibrationStep)
const instructions = getInstructionsByStep(calibrationStep)
if (!diagram || !instructions) return null
return (
<div className={styles.instructions}>
<InstructionStep step={'one'} diagram={diagram}>
{instructions}
</InstructionStep>
<InstructionStep step={'two'} diagram={calibrationTipSrc}>
<p>
Jog the robot until tip is <strong>just barely</strong> touching the
deck.
</p>
</InstructionStep>
</div>
)
}
function getDiagramSrc(calibrationStep) {
return DIAGRAMS[calibrationStep]
}
function getInstructionsByStep(calibrationStep) {
return INSTRUCTIONS[calibrationStep]
}