Simplify MainPage

Change-type: patch
This commit is contained in:
Alexis Svinartchouk 2020-08-26 00:35:41 +02:00
parent c9bfd350ed
commit 2c07538f8f

View File

@ -242,82 +242,72 @@ export class MainPage extends React.Component<
justifyContent="space-between" justifyContent="space-between"
> >
{notFlashingOrSplitView && ( {notFlashingOrSplitView && (
<SourceSelector
flashing={this.state.isFlashing}
afterSelected={(source: SourceOptions) =>
this.setState({ source })
}
/>
)}
{notFlashingOrSplitView && (
<Flex>
<StepBorder disabled={shouldDriveStepBeDisabled} left />
</Flex>
)}
{notFlashingOrSplitView && (
<DriveSelector
disabled={shouldDriveStepBeDisabled}
hasDrive={this.state.hasDrive}
flashing={this.state.isFlashing}
/>
)}
{notFlashingOrSplitView && (
<Flex>
<StepBorder disabled={shouldFlashStepBeDisabled} right />
</Flex>
)}
{this.state.isFlashing && (
<> <>
<Flex <SourceSelector
flashing={this.state.isFlashing}
afterSelected={(source: SourceOptions) =>
this.setState({ source })
}
/>
<Flex>
<StepBorder disabled={shouldDriveStepBeDisabled} left />
</Flex>
<DriveSelector
disabled={shouldDriveStepBeDisabled}
hasDrive={this.state.hasDrive}
flashing={this.state.isFlashing}
/>
<Flex>
<StepBorder disabled={shouldFlashStepBeDisabled} right />
</Flex>
</>
)}
{this.state.isFlashing && this.state.isWebviewShowing && (
<Flex
style={{
position: 'absolute',
top: 0,
left: 0,
width: '36.2vw',
height: '100vh',
zIndex: 1,
boxShadow: '0 2px 15px 0 rgba(0, 0, 0, 0.2)',
}}
>
<ReducedFlashingInfos
imageLogo={this.state.imageLogo}
imageName={this.state.imageName}
imageSize={
_.isNumber(this.state.imageSize)
? (bytesToClosestUnit(this.state.imageSize) as string)
: ''
}
driveTitle={this.state.driveTitle}
driveLabel={this.state.driveLabel}
style={{ style={{
position: 'absolute', position: 'absolute',
top: 0, color: '#fff',
left: 0, left: 35,
width: '36.2vw', top: 72,
height: '100vh',
zIndex: 1,
boxShadow: '0 2px 15px 0 rgba(0, 0, 0, 0.2)',
display: this.state.isWebviewShowing ? 'block' : 'none',
}} }}
> />
<ReducedFlashingInfos </Flex>
imageLogo={this.state.imageLogo} )}
imageName={this.state.imageName} {this.state.isFlashing && this.state.featuredProjectURL && (
imageSize={ <SafeWebview
_.isNumber(this.state.imageSize) src={this.state.featuredProjectURL}
? (bytesToClosestUnit(this.state.imageSize) as string) onWebviewShow={(isWebviewShowing: boolean) => {
: '' this.setState({ isWebviewShowing });
} }}
driveTitle={this.state.driveTitle} style={{
driveLabel={this.state.driveLabel} position: 'absolute',
style={{ right: 0,
position: 'absolute', bottom: 0,
color: '#fff', width: '63.8vw',
left: 35, height: '100vh',
top: 72, }}
}} />
/>
</Flex>
{this.state.featuredProjectURL && (
<SafeWebview
src={this.state.featuredProjectURL}
onWebviewShow={(isWebviewShowing: boolean) => {
this.setState({ isWebviewShowing });
}}
style={{
position: 'absolute',
right: 0,
bottom: 0,
width: '63.8vw',
height: '100vh',
}}
/>
)}
</>
)} )}
<FlashStep <FlashStep