1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { connect } from 'react-redux';
7 import { RootState } from '~/store/store';
9 export type WithProgressStateProps = {
13 export const withProgress = (id: string) =>
14 (component: React.ComponentType<WithProgressStateProps>) =>
15 connect(mapStateToProps(id))(component);
17 export const mapStateToProps = (id: string) => (state: RootState): WithProgressStateProps => {
18 const progress = state.progressIndicator.find(p => p.id === id);
19 return { working: progress ? progress.working : false };