import { prisma } from "@repo/db";
import { ChangelogTimeline } from "./_components/Timeline";
import { ActivityLogIcon } from "@radix-ui/react-icons";

export default async function Page() {
	const changelog = await prisma.changelog.findMany({
		where: { showOnChangelogPage: true },
		orderBy: { createdAt: "desc" },
	});

	const entries = changelog.map((entry) => ({
		...entry,
		createdAt: entry.createdAt.toISOString(),
	}));

	return (
		<>
			<div className="w-full px-4">
				<p className="flex items-center gap-2 text-left text-2xl font-semibold">
					<ActivityLogIcon className="h-5 w-5" /> Changelog
				</p>
			</div>
			<ChangelogTimeline entries={entries} />
		</>
	);
}
