diff --git a/src/components/connection-modal/update-peripheral-step.jsx b/src/components/connection-modal/update-peripheral-step.jsx index 8f2b21069..934e84dc7 100644 --- a/src/components/connection-modal/update-peripheral-step.jsx +++ b/src/components/connection-modal/update-peripheral-step.jsx @@ -19,6 +19,8 @@ const UPDATE_ACTIVITY = keyMirror({ results: null }); +const microBitFirmwareUrl = 'https://microbit.org/get-started/user-guide/firmware/'; + class UpdatePeripheralStep extends React.Component { constructor (props) { super(props); @@ -26,12 +28,16 @@ class UpdatePeripheralStep extends React.Component { 'handleSendUpdate' ]); this.state = { - /** - * @type {UPDATE_ACTIVITY} - */ + /** @type {UPDATE_ACTIVITY} */ activity: UPDATE_ACTIVITY.getReady, + + /** @type {number} */ progress: 0, + + /** @type {Error?} */ err: null, + + /** @type {any} */ res: null }; } @@ -109,8 +115,41 @@ class UpdatePeripheralStep extends React.Component { } renderResults () { + let resultsContent; + if (this.state.err === null) { + resultsContent = (); + } else if (this.state.err.message === 'No valid interfaces found.') { + // this is a special case where the micro:bit's communication firmware is too old to support WebUSB + resultsContent = ( + {microBitFirmwareUrl} + + }} + />); + } else { + resultsContent = (); + } return ( -

{'Results'}

+ {resultsContent}
); }