diff --git a/k-tv-frontend/app/(main)/guide/page.tsx b/k-tv-frontend/app/(main)/guide/page.tsx index ba8f5b2..c826312 100644 --- a/k-tv-frontend/app/(main)/guide/page.tsx +++ b/k-tv-frontend/app/(main)/guide/page.tsx @@ -13,7 +13,10 @@ import type { ChannelResponse, ScheduledSlotResponse } from "@/lib/types"; // --------------------------------------------------------------------------- function fmtTime(iso: string) { - return new Date(iso).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }); + return new Date(iso).toLocaleTimeString([], { + hour: "2-digit", + minute: "2-digit", + }); } function fmtDuration(secs: number) { @@ -27,7 +30,9 @@ function slotLabel(slot: ScheduledSlotResponse) { if (item.content_type === "episode" && item.series_name) { const ep = [ item.season_number != null ? `S${item.season_number}` : "", - item.episode_number != null ? `E${String(item.episode_number).padStart(2, "0")}` : "", + item.episode_number != null + ? `E${String(item.episode_number).padStart(2, "0")}` + : "", ] .filter(Boolean) .join(""); @@ -45,7 +50,13 @@ function slotLabel(slot: ScheduledSlotResponse) { function ChannelRow({ channel }: { channel: ChannelResponse }) { const { token, isLoaded } = useAuthContext(); - const { data: slots, isError, error, isPending, isFetching } = useQuery({ + const { + data: slots, + isError, + error, + isPending, + isFetching, + } = useQuery({ queryKey: ["guide-epg", channel.id, token], queryFn: () => { const now = new Date(); @@ -62,13 +73,17 @@ function ChannelRow({ channel }: { channel: ChannelResponse }) { const current = slots?.find( (s) => - new Date(s.start_at).getTime() <= now && now < new Date(s.end_at).getTime(), + new Date(s.start_at).getTime() <= now && + now < new Date(s.end_at).getTime(), ); - const upcoming = slots?.filter((s) => new Date(s.start_at).getTime() > now).slice(0, 3) ?? []; + const upcoming = + slots?.filter((s) => new Date(s.start_at).getTime() > now).slice(0, 3) ?? + []; const progress = current ? (now - new Date(current.start_at).getTime()) / - (new Date(current.end_at).getTime() - new Date(current.start_at).getTime()) + (new Date(current.end_at).getTime() - + new Date(current.start_at).getTime()) : 0; const remaining = current @@ -81,7 +96,9 @@ function ChannelRow({ channel }: { channel: ChannelResponse }) {
Loading…
- ) : isError && error instanceof ApiRequestError && error.status === 401 ? ( -Sign in to view this channel
+ ) : isError && + error instanceof ApiRequestError && + error.status === 401 ? ( ++ Sign in to view this channel +
) : ({isError || !slots?.length @@ -134,12 +157,17 @@ function ChannelRow({ channel }: { channel: ChannelResponse }) { {upcoming.length > 0 && (