feat: basic pages system

This commit is contained in:
Ivan Rezchikov
2026-06-20 00:02:12 +03:00
parent dc8a41087c
commit 674fd11aa9
19 changed files with 1473 additions and 32 deletions
+22 -23
View File
@@ -1,9 +1,13 @@
import Footer from "@/components/footer";
import Header from "@/components/header";
import { Badge } from "@/components/ui/badge"
import { getPages } from "@/lib/pages/repository";
import { PageMeta } from "@/lib/pages/types";
import { ArrowRight, Calendar, Globe2 } from "lucide-react";
export default function Home() {
export default async function Home() {
const news = await getPages("NEWS", "PUBLISHED", 5);
return (
<>
<Header />
@@ -32,29 +36,24 @@ export default function Home() {
</div>
<div className="flex flex-col gap-8 mt-8">
<h1 className="underline underline-offset-8 decoration-2">Recent news</h1>
<div className="flex flex-col gap-2">
<h2 className="w-max hover:underline underline-offset-8 decoration-2 duration-200 cursor-pointer">Construction of the White House has started</h2>
<div className="flex flex-row gap-8 items-center">
<h3 className="flex gap-2 items-baseline"><Calendar size={18} />16 June, 2026</h3>
<h3 className="flex gap-2 items-baseline"><Globe2 size={18} />Liberty City</h3>
<div className="flex flex-row gap-4">
<Badge>Liberty City</Badge>
{
news.length > 0 ? news.map((n) => (
<div className="flex flex-col gap-2" key={n.id}>
<h2 className="w-max hover:underline underline-offset-8 decoration-2 duration-200 cursor-pointer">{n.title}</h2>
<div className="flex flex-row gap-8 items-center">
<h3 className="flex gap-2 items-baseline"><Calendar size={18} />{(n.publishedAt)?.toString()}</h3>
<h3 className="flex gap-2 items-baseline"><Globe2 size={18} />{(n.meta as PageMeta)?.location}</h3>
<div className="flex flex-row gap-4">
{((n.meta as PageMeta)?.tags)?.map((i, tag) => (
<Badge key={i}>{tag}</Badge>
))}
</div>
</div>
</div>
</div>
</div>
<div className="flex flex-col gap-2">
<h2 className="w-max hover:underline underline-offset-8 decoration-2 duration-200 cursor-pointer">President Volokhov has visited the Liberty City Trainbuilding Plant</h2>
<div className="flex flex-row gap-8 items-center">
<h3 className="flex gap-2 items-baseline"><Calendar size={18} />16 June, 2026</h3>
<h3 className="flex gap-2 items-baseline"><Globe2 size={18} />Liberty City</h3>
<div className="flex flex-row gap-4">
<Badge>President</Badge>
<Badge>Liberty City</Badge>
<Badge>Industry</Badge>
</div>
</div>
</div>
<h2 className="w-max flex flex-row items-center gap-2 hover:gap-4 hover:underline underline-offset-8 decoration-2 duration-200 cursor-pointer">See all news<ArrowRight size={32} /></h2>
), (
<h2 className="w-max flex flex-row items-center gap-2 hover:gap-4 hover:underline underline-offset-8 decoration-2 duration-200 cursor-pointer">See all news<ArrowRight size={32} /></h2>
)) : <h2>There are no news yet...</h2>
}
</div>
</div>
<Footer />