🎨 Replace for loop with a <For/> control flow for StopsManager

This commit is contained in:
2023-01-30 22:47:12 +01:00
parent bd8ccc5978
commit aaab0a933b

View File

@@ -205,25 +205,19 @@ export const StopsManager: VoidComponent = () => {
</Progress> </Progress>
<Box w="100%" h="40%" borderWidth="1px" borderColor="var(--idfm-black)" borderRadius="$lg" overflow="scroll" marginBottom="2px"> <Box w="100%" h="40%" borderWidth="1px" borderColor="var(--idfm-black)" borderRadius="$lg" overflow="scroll" marginBottom="2px">
<List width="100%" height="100%"> <List width="100%" height="100%">
{() => { <For each={foundStops().sort((x, y) => x.name.localeCompare(y.name))}>
const items = []; {(stop) =>
for (const stop of foundStops().sort((x, y) => x.name.localeCompare(y.name))) { <ListItem borderWidth="1px" mb="0px" color="var(--idfm-black)" borderRadius="$lg">
items.push( <Button fullWidth="true" color="var(--idfm-black)" bg="white" onClick={() => setDisplayedStops([stop])}>
<ListItem borderWidth="1px" mb="0px" color="var(--idfm-black)" borderRadius="$lg"> <Box w="100%" h="100%">
<Button fullWidth="true" color="var(--idfm-black)" bg="white" onClick={() => { <Show when={stop.stops !== undefined} fallback={<StopRepr stop={stop} />}>
console.log(`${stop.id} clicked !!!`); <StopAreaRepr stop={stop} />
setDisplayedStops([stop]); </Show>
}}> </Box>
<Box w="100%" h="100%"> </Button>
<Show when={stop.stops !== undefined} fallback={<StopRepr stop={stop} />}> </ListItem>
<StopAreaRepr stop={stop} />
</Show>
</Box>
</Button>
</ListItem>);
} }
return items; </For>
}}
</List> </List>
</Box> </Box>
<Box borderWidth="1px" borderColor="var(--idfm-black)" borderRadius="$lg" h="55%" w="100%" overflow="scroll"> <Box borderWidth="1px" borderColor="var(--idfm-black)" borderRadius="$lg" h="55%" w="100%" overflow="scroll">