You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
896 B
33 lines
896 B
4 years ago
|
import { Grid } from '@material-ui/core';
|
||
4 years ago
|
import Panel from '../Panel';
|
||
|
import PeriodicFetch from '../../lib/fetchers/periodicFetch';
|
||
4 years ago
|
import SelectedAnvil from './SelectedAnvil';
|
||
|
import AnvilList from './AnvilList';
|
||
4 years ago
|
|
||
4 years ago
|
const Anvils = ({ list }: { list: AnvilList | undefined }): JSX.Element => {
|
||
4 years ago
|
const anvils: AnvilListItem[] = [];
|
||
4 years ago
|
|
||
4 years ago
|
list?.anvils.forEach((anvil: AnvilListItem) => {
|
||
4 years ago
|
const { data } = PeriodicFetch<AnvilStatus>(
|
||
|
`${process.env.NEXT_PUBLIC_API_URL}/anvils/get_status?anvil_uuid=`,
|
||
|
anvil.anvil_uuid,
|
||
|
);
|
||
|
/* eslint-disable no-param-reassign */
|
||
4 years ago
|
anvils.push({
|
||
|
...anvil,
|
||
4 years ago
|
anvil_state: data?.anvil_state,
|
||
4 years ago
|
});
|
||
4 years ago
|
});
|
||
|
|
||
4 years ago
|
return (
|
||
|
<Panel>
|
||
|
<Grid container alignItems="center" justify="space-around">
|
||
4 years ago
|
<SelectedAnvil anvil={anvils[0]} />
|
||
|
<AnvilList list={anvils} />
|
||
4 years ago
|
</Grid>
|
||
|
</Panel>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default Anvils;
|