-
Notifications
You must be signed in to change notification settings - Fork 333
Expand file tree
/
Copy pathCombined.js
More file actions
61 lines (57 loc) · 2.59 KB
/
Copy pathCombined.js
File metadata and controls
61 lines (57 loc) · 2.59 KB
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
import ProgressBar from './ProgressBar';
import useHIDBoot from '../logic/useHIDBoot';
import useUSBFlash from '../logic/useUSBFlash'
import imgSrc from '../images/imx8qxp_mek_bootmode.png'
import "./Combined.css"
const Combined = ({bootFile, flashFile}) => {
const [{ requestHIDDevice, HIDdevice, bootProgress, bootTotal }] = useHIDBoot(bootFile);
const [{ requestUSBDevice, USBDevice, flashProgress, flashTotal}] = useUSBFlash(flashFile);
return(
<div>
<ul className="Popup-list">
<li>
<span>1. Switch Boot Mode to "SERIAL"</span>
<div className="u-flex u-center">
<div className="image-container">
{imgSrc? <img className="boot-image" src={imgSrc} alt="boot mode switches"/>: ""}
</div>
</div>
</li>
<li>
<div className="u-flex">
<div className="checkbox-container">
{bootProgress&&(bootProgress===bootTotal)?<p className="checkbox">✔</p>:""}
</div>
<div>
<span>2. </span>
<button className="Popup-button" onClick={requestHIDDevice}> Pair HIDdevice </button>
<span>{bootProgress? `${bootProgress} bytes out of ${bootTotal} downloaded`: ""}</span>
<div className="Popup-empty">
{bootProgress&&(bootProgress===bootTotal)?`connected: ${HIDdevice.productName}`: (bootProgress?`Pairing`:"")}
</div>
</div>
</div>
</li>
<li >
<div className="u-flex">
<div className="checkbox-container">
{USBDevice?<p className="checkbox">✔</p>:""}
</div>
<div>
<span>3. </span>
<button onClick={requestUSBDevice}>Pair USBDevice </button>
<div className="Popup-empty">
+ {USBDevice? `connected: ${USBDevice.productName}`: ""}
+ </div>
</div>
</div>
</li>
</ul>
<ProgressBar
soFar = {flashProgress}
total = {flashTotal}
/>
</div>
)
}
export default Combined