Disable flash button when hub is connected.

Fixes: https://github.com/pybricks/support/issues/299
This commit is contained in:
David Lechner
2021-04-12 10:34:59 -05:00
parent 90e04916bc
commit 0d89f8daad
+4 -1
View File
@@ -2,6 +2,7 @@
// Copyright (c) 2020-2021 The Pybricks Authors
import { connect } from 'react-redux';
import { HubRuntimeState } from '../hub/reducers';
import { BootloaderConnectionState } from '../lwp3-bootloader/reducers';
import * as notification from '../notifications/actions';
import { RootState } from '../reducers';
@@ -19,7 +20,9 @@ type OwnProps = Pick<OpenFileButtonProps, 'id'>;
const mapStateToProps = (state: RootState): StateProps => ({
tooltip: state.firmware.flashing ? TooltipId.FlashProgress : TooltipId.Flash,
enabled: state.bootloader.connection === BootloaderConnectionState.Disconnected,
enabled:
state.bootloader.connection === BootloaderConnectionState.Disconnected &&
state.hub.runtime === HubRuntimeState.Disconnected,
showProgress: state.firmware.flashing,
progress: state.firmware.progress === null ? undefined : state.firmware.progress,
});