radio-station/app/routes/listen.home.tsx
Luke Bunselmeyer 5d0a7623e3 - UI
- Created home page to view all stations
- Model
  - Sort stations by popularity and filter stations by reliability
  - Type improvements
2023-05-07 15:19:00 -04:00

28 lines
792 B
TypeScript

import { json } from "@remix-run/node";
import { Link, Outlet, useLoaderData } from "@remix-run/react";
import { Breadcrumbs } from "~/components/breadcrumbs";
import { StationsGallery } from "~/components/stations-gallery";
import type { StationWithTags } from "~/models/station.server";
import { getStations } from "~/models/station.server";
export async function loader() {
const stations: StationWithTags[] = await getStations();
return json({ stations });
}
export default function ListenHome() {
const { stations } = useLoaderData<typeof loader>();
return (
<>
<Breadcrumbs>
<Link to="/listen">Home</Link>
</Breadcrumbs>
<StationsGallery stations={stations} />
<Outlet />
</>
);
}