import { notFound, redirect } from "next/navigation"; import { api } from "@/server/api/client"; import { TRPCError } from "@trpc/server"; import DayView from "@/components/dashboard/days/DayView"; import { getServerAuthSession } from "@/server/auth"; import LoadingSpinner from "@/components/ui/spinner"; export default async function DayPage({ params }: { params: { dateQuery: string }; }) { const session = await getServerAuthSession(); if (!session) { redirect("/"); } let day; const { dateQuery } = await params; const timezone = await api.users.getTimezone(); try { day = await api.days.get({ dateQuery: dateQuery, timezone: timezone, }); } catch (e) { if (e instanceof TRPCError) { if (e.code == "NOT_FOUND") { notFound(); } } throw e; } return (