Files
pybricks-code/src/reducers/status.ts
T
David Lechner c975613e1c rename bootloader to lwp3-bootloader
we will probably have DFU bootloader in the future
2020-06-04 11:28:13 -05:00

22 lines
613 B
TypeScript

// SPDX-License-Identifier: MIT
// Copyright (c) 2020 The Pybricks Authors
import { Reducer } from 'react';
import { combineReducers } from 'redux';
import { BootloaderAction, BootloaderActionType } from '../actions/lwp3-bootloader';
const progress: Reducer<number, BootloaderAction> = (state = -1, action) => {
switch (action.type) {
case BootloaderActionType.FlashProgress:
return (action.complete / action.total) * 100;
default:
return state;
}
};
export interface StatusState {
readonly progress: number;
}
export default combineReducers({ progress });