import Logbook from "./_components/Logbook";
import { ArrowRight, NotebookText } from "lucide-react";
import Link from "next/link";
import Events from "./_components/Events";
import { Stats } from "./_components/Stats";
import { Badges } from "./_components/Badges";

export default async function Home({
	searchParams,
}: {
	searchParams: Promise<{ stats?: "pilot" | "dispo" }>;
}) {
	const { stats } = await searchParams;
	const view = stats || "pilot";
	return (
		<div>
			<Stats stats={view} />

			<div className="grid grid-cols-6 gap-4">
				<div className="card bg-base-200 shadow-xl mb-4 col-span-6 xl:col-span-3">
					<div className="card-body">
						<h2 className="card-title justify-between">
							<span className="card-title">
								<NotebookText className="w-4 h-4" /> Logbook
							</span>
							<Link className="badge badge-sm badge-info badge-outline" href="/logbook">
								Zum vollständigen Logbook <ArrowRight className="w-4 h-4" />
							</Link>
						</h2>
						<Logbook />
					</div>
				</div>
				<Badges />
			</div>
			<Events />
		</div>
	);
}
