|
|
@ -1,13 +1,11 @@ |
|
|
|
import { useContext } from 'react'; |
|
|
|
|
|
|
|
import Panel from '../Panel'; |
|
|
|
import Panel from '../Panel'; |
|
|
|
import PeriodicFetch from '../../lib/fetchers/periodicFetch'; |
|
|
|
import PeriodicFetch from '../../lib/fetchers/periodicFetch'; |
|
|
|
import SelectedAnvil from './SelectedAnvil'; |
|
|
|
import SelectedAnvil from './SelectedAnvil'; |
|
|
|
import AnvilList from './AnvilList'; |
|
|
|
import AnvilList from './AnvilList'; |
|
|
|
|
|
|
|
|
|
|
|
import { AnvilContext } from '../AnvilContext'; |
|
|
|
import sortAnvils from './sortAnvils'; |
|
|
|
|
|
|
|
|
|
|
|
const Anvils = ({ list }: { list: AnvilList | undefined }): JSX.Element => { |
|
|
|
const Anvils = ({ list }: { list: AnvilList | undefined }): JSX.Element => { |
|
|
|
const { uuid } = useContext(AnvilContext); |
|
|
|
|
|
|
|
const anvils: AnvilListItem[] = []; |
|
|
|
const anvils: AnvilListItem[] = []; |
|
|
|
|
|
|
|
|
|
|
|
list?.anvils.forEach((anvil: AnvilListItem) => { |
|
|
|
list?.anvils.forEach((anvil: AnvilListItem) => { |
|
|
@ -21,14 +19,11 @@ const Anvils = ({ list }: { list: AnvilList | undefined }): JSX.Element => { |
|
|
|
anvil_state: data?.anvil_state, |
|
|
|
anvil_state: data?.anvil_state, |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<Panel> |
|
|
|
<Panel> |
|
|
|
{uuid !== '' && ( |
|
|
|
<SelectedAnvil list={anvils} /> |
|
|
|
<SelectedAnvil |
|
|
|
<AnvilList list={sortAnvils(anvils)} /> |
|
|
|
anvil={anvils[anvils.findIndex((anvil) => anvil.anvil_uuid === uuid)]} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
<AnvilList list={anvils} /> |
|
|
|
|
|
|
|
</Panel> |
|
|
|
</Panel> |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|