diff --git a/src/components/ManagerPage/Workflow.js b/src/components/ManagerPage/Workflow.js index f2eea510..1b42771f 100644 --- a/src/components/ManagerPage/Workflow.js +++ b/src/components/ManagerPage/Workflow.js @@ -25,13 +25,16 @@ type Props = { renderDefault: ( device: ?Device, deviceInfo: ?DeviceInfo, - dashboardError: ?Error, isGenuine: ?boolean, + error: { + dashboardError: ?Error, + genuineError: ?Error, + }, ) => Node, renderMcuUpdate: (deviceInfo: DeviceInfo) => Node, renderFinalUpdate: (deviceInfo: DeviceInfo) => Node, renderDashboard: (device: Device, deviceInfo: DeviceInfo) => Node, - renderError: (dashboardError: ?Error, genuineError: ?Error) => Node, + renderError?: (dashboardError: ?Error, genuineError: ?Error) => Node, } type State = {} @@ -52,14 +55,12 @@ class Workflow extends PureComponent { {(isGenuine: ?boolean, genuineError: ?Error) => { if (dashboardError || genuineError) { - return renderError ? ( - renderError(dashboardError, genuineError) - ) : ( -
- {dashboardError && {dashboardError.message}} - {genuineError && {genuineError.message}} -
- ) + return renderError + ? renderError(dashboardError, genuineError) + : renderDefault(device, deviceInfo, isGenuine, { + genuineError, + dashboardError, + }) } if (deviceInfo && deviceInfo.mcu) { @@ -74,7 +75,10 @@ class Workflow extends PureComponent { return renderDashboard(device, deviceInfo) } - return renderDefault(device, deviceInfo, dashboardError, isGenuine) + return renderDefault(device, deviceInfo, isGenuine, { + genuineError, + dashboardError, + }) }}
)} diff --git a/src/components/ManagerPage/WorkflowDefault.js b/src/components/ManagerPage/WorkflowDefault.js index 3dea16b3..57be9a21 100644 --- a/src/components/ManagerPage/WorkflowDefault.js +++ b/src/components/ManagerPage/WorkflowDefault.js @@ -8,7 +8,6 @@ import type { Device, T } from 'types/common' import { i } from 'helpers/staticPath' import Box from 'components/base/Box' -import Space from 'components/base/Space' import Text from 'components/base/Text' import Spinner from 'components/base/Spinner' @@ -97,13 +96,15 @@ type Props = { t: T, device: ?Device, deviceInfo: ?DeviceInfo, - dashboardError: ?Error, + errors: { + dashboardError: ?Error, + genuineError: ?Error, + }, isGenuine: boolean, } -const WorkflowDefault = ({ device, deviceInfo, dashboardError, isGenuine, t }: Props) => ( - - +const WorkflowDefault = ({ device, deviceInfo, errors, isGenuine, t }: Props) => ( + {/* DASHBOARD CHECK */} - + @@ -152,14 +153,21 @@ const WorkflowDefault = ({ device, deviceInfo, dashboardError, isGenuine, t }: P {' on your device'} - + {/* GENUINE CHECK */} diff --git a/src/components/ManagerPage/index.js b/src/components/ManagerPage/index.js index ce8ce62e..67b400ab 100644 --- a/src/components/ManagerPage/index.js +++ b/src/components/ManagerPage/index.js @@ -24,11 +24,6 @@ type Error = { function ManagerPage(): Node { return ( { - if (dashboardError) return Dashboard Error: {dashboardError.message} - if (genuineError) return Genuine Error: {genuineError.message} - return Error - }} renderFinalUpdate={(deviceInfo: DeviceInfo) => (

UPDATE FINAL FIRMARE (TEMPLATE + ACTION WIP) {deviceInfo.final}

)} @@ -41,13 +36,16 @@ function ManagerPage(): Node { renderDefault={( device: ?Device, deviceInfo: ?DeviceInfo, - dashboardError: ?Error, isGenuine: ?boolean, + errors: { + dashboardError: ?Error, + genuineError: ?Error, + }, ) => ( )}