From 965a50ddf50f40fb43653a4d4b08ae316b0bb956 Mon Sep 17 00:00:00 2001 From: Josue Date: Wed, 28 Apr 2021 18:52:16 -0400 Subject: [PATCH] refactor: move setting selected anvil to child components --- striker-ui/components/Anvils/index.tsx | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/striker-ui/components/Anvils/index.tsx b/striker-ui/components/Anvils/index.tsx index c0eec318..e149019f 100644 --- a/striker-ui/components/Anvils/index.tsx +++ b/striker-ui/components/Anvils/index.tsx @@ -1,13 +1,11 @@ -import { useContext } from 'react'; import Panel from '../Panel'; import PeriodicFetch from '../../lib/fetchers/periodicFetch'; import SelectedAnvil from './SelectedAnvil'; import AnvilList from './AnvilList'; -import { AnvilContext } from '../AnvilContext'; +import sortAnvils from './sortAnvils'; const Anvils = ({ list }: { list: AnvilList | undefined }): JSX.Element => { - const { uuid } = useContext(AnvilContext); const anvils: AnvilListItem[] = []; list?.anvils.forEach((anvil: AnvilListItem) => { @@ -21,14 +19,11 @@ const Anvils = ({ list }: { list: AnvilList | undefined }): JSX.Element => { anvil_state: data?.anvil_state, }); }); + return ( - {uuid !== '' && ( - anvil.anvil_uuid === uuid)]} - /> - )} - + + ); };