feat: Add all sidebar links to homepage

This commit is contained in:
Matej Stieranka 2025-06-28 21:07:21 +02:00
parent b0f4c449ba
commit 267e82ff04

View file

@ -1,5 +1,5 @@
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { getAllLines } from "@/db"; import { getAllDays, getAllLines } from "@/db";
interface HomePageProps { interface HomePageProps {
searchParams: Promise<{ message?: string }>; searchParams: Promise<{ message?: string }>;
@ -7,6 +7,7 @@ interface HomePageProps {
export default async function Home({ searchParams }: HomePageProps) { export default async function Home({ searchParams }: HomePageProps) {
const lines = await getAllLines(); const lines = await getAllLines();
const days = await getAllDays();
const message = (await searchParams).message; const message = (await searchParams).message;
console.log("Message from searchParams:", message); console.log("Message from searchParams:", message);
@ -17,11 +18,37 @@ export default async function Home({ searchParams }: HomePageProps) {
{message && ( {message && (
<Alert variant="default"> <Alert variant="default">
<AlertTitle>Refetch all data - Response</AlertTitle> <AlertTitle>Refetch all data - Response</AlertTitle>
<AlertDescription> <AlertDescription>{message}</AlertDescription>
{message}
</AlertDescription>
</Alert> </Alert>
)} )}
<section className="w-full">
<ul className="list-disc pl-5">
<li className="mb-2">
<a href="/favorites" className="text-blue-600 hover:underline">
Oblíbené
</a>
</li>
</ul>
</section>
<section className="w-full">
<h1 className="text-3xl font-bold mb-4">Dny</h1>
<ul className="list-disc pl-5">
{days.map((day) => (
<li key={day} className="mb-2">
<a
href={`/day/${day}`}
className="text-blue-600 hover:underline"
>
{new Date(day).toLocaleDateString("cs-CZ", {
weekday: "long",
day: "numeric",
month: "numeric",
})}
</a>
</li>
))}
</ul>
</section>
<section className="w-full"> <section className="w-full">
<h1 className="text-3xl font-bold mb-4">Linie</h1> <h1 className="text-3xl font-bold mb-4">Linie</h1>
<ul className="list-disc pl-5"> <ul className="list-disc pl-5">