Minor refactoring to breakup large components into smaller ones.
This commit is contained in:
parent
c4b1c4842a
commit
53a9fedca1
@ -3,21 +3,16 @@ import type { Tag } from "@prisma/client";
|
|||||||
import { Link } from "@remix-run/react";
|
import { Link } from "@remix-run/react";
|
||||||
import { ListenLink } from "~/components/page-layout";
|
import { ListenLink } from "~/components/page-layout";
|
||||||
import type { StationWithTagsClientSide } from "~/models/station.server";
|
import type { StationWithTagsClientSide } from "~/models/station.server";
|
||||||
import type { Channel } from "~/routes/listen.channel.$channel";
|
|
||||||
import type { ConvertDatesToStrings } from "~/utils";
|
import type { ConvertDatesToStrings } from "~/utils";
|
||||||
|
|
||||||
export type StationsGalleryProps = {
|
export type StationsGalleryProps = {
|
||||||
stations: StationWithTagsClientSide[];
|
stations: StationWithTagsClientSide[];
|
||||||
tag?: ConvertDatesToStrings<Tag>;
|
tag?: ConvertDatesToStrings<Tag>;
|
||||||
channel?: ConvertDatesToStrings<Channel>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function StationsGallery({ stations, tag, channel }: StationsGalleryProps) {
|
export function StationsGallery({ stations, tag }: StationsGalleryProps) {
|
||||||
|
|
||||||
function getStationUrl(id: string): string {
|
function getStationUrl(id: string): string {
|
||||||
if (channel) {
|
|
||||||
return `/listen/channel/${channel.slug}?station=${id}`;
|
|
||||||
}
|
|
||||||
if (tag) {
|
if (tag) {
|
||||||
return `/listen/tag/${tag?.slug}?station=${id}`;
|
return `/listen/tag/${tag?.slug}?station=${id}`;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user