diff options
| author | Ariel Costas Guerrero <94913521+arielcostas@users.noreply.github.com> | 2024-09-09 18:56:46 +0200 |
|---|---|---|
| committer | Ariel Costas Guerrero <94913521+arielcostas@users.noreply.github.com> | 2024-09-09 18:56:46 +0200 |
| commit | f942f8df78a97d302d4ccca8a87e8a410f845dbe (patch) | |
| tree | 1de4a26cc9ce71f79de054f6b3ec875be487f8bb /src/pages/Home.tsx | |
| parent | 9925249bf489ae960189f6daabe59263d1620c89 (diff) | |
Add recent stop list
Diffstat (limited to 'src/pages/Home.tsx')
| -rw-r--r-- | src/pages/Home.tsx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index 1f5c319..568b2f0 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -28,6 +28,14 @@ export function Home() { return data?.filter(stop => stop.favourite) ?? [] }, [data]) + const recentStops = useMemo(() => { + const recent = sdp.getRecent(); + + if (recent.length === 0) return null; + + return recent.map(stopId => data?.find(stop => stop.stopId === stopId) as Stop).reverse(); + }, [data]) + if (data === null) return <h1>Loading...</h1> return ( @@ -63,6 +71,18 @@ export function Home() { ))} </ul> + <h2>Recientes</h2> + + <ul> + {recentStops?.map((stop: Stop) => ( + <li key={stop.stopId}> + <Link to={`/${stop.stopId}`}> + ({stop.stopId}) {stop.name} - {stop.lines?.join(', ')} + </Link> + </li> + ))} + </ul> + <h2>Paradas</h2> <ul> |
