Initial commit: spreewaldzeit + Dockerfile for Coolify (Next.js + Prisma/SQLite)
This commit is contained in:
36
app/page.tsx
Normal file
36
app/page.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import { prisma } from "@/lib/db";
|
||||
import { parseJsonArray } from "@/lib/utils";
|
||||
import type { Apartment } from "@/types";
|
||||
import { Hero } from "@/components/home/Hero";
|
||||
import { About } from "@/components/home/About";
|
||||
import { ApartmentPreview } from "@/components/home/ApartmentPreview";
|
||||
import { Location } from "@/components/home/Location";
|
||||
import { PlacesToVisit } from "@/components/home/PlacesToVisit";
|
||||
|
||||
// Daten immer frisch (SQLite, lokal unproblematisch; für Produktion ggf. ISR)
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
async function getApartments(): Promise<Apartment[]> {
|
||||
const rows = await prisma.apartment.findMany({
|
||||
where: { published: true },
|
||||
orderBy: { createdAt: "asc" },
|
||||
});
|
||||
return rows.map((r) => ({
|
||||
...r,
|
||||
features: parseJsonArray<string>(r.features),
|
||||
images: parseJsonArray<string>(r.images),
|
||||
}));
|
||||
}
|
||||
|
||||
export default async function HomePage() {
|
||||
const apartments = await getApartments();
|
||||
return (
|
||||
<>
|
||||
<Hero />
|
||||
<About />
|
||||
<ApartmentPreview apartments={apartments} />
|
||||
<Location />
|
||||
<PlacesToVisit />
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user