radio-station/app/routes/listen.channel.$channel.$station.tsx
Luke Bunselmeyer 40ceb32da0 - UI
- Created <StationPlayer>
  - Minor responsive styling tweaks
2023-05-07 14:46:30 -04:00

28 lines
727 B
TypeScript

import type { LoaderArgs } from "@remix-run/node";
import { json } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { StationPlayer } from "~/components/station-player";
import { getStationById } from "~/models/station.server";
import { notFound } from "~/utils";
export async function loader({ params }: LoaderArgs) {
if (!params.station) {
throw notFound();
}
const station = await getStationById(params.station);
if (!station) {
throw notFound();
}
return json({ station });
}
export default function ListenChanelStation() {
const { station } = useLoaderData<typeof loader>();
return (
<StationPlayer station={station} />
);
}