41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import Header from "@/components/header";
|
|
import Footer from "@/components/footer";
|
|
import ReviewPageClient from "./client";
|
|
import { getCurrentUser } from "@/lib/user";
|
|
import { redirect } from "next/navigation";
|
|
import { AccountMenu } from "../../account-menu";
|
|
import { getPendingApplications } from "@/lib/citizenship/repository";
|
|
import { getImageUrl } from "@/lib/image";
|
|
|
|
export default async function ReviewPage() {
|
|
const user = await getCurrentUser();
|
|
if (!user?.isAdmin) redirect("/account/citizenship");
|
|
|
|
const applications = await getPendingApplications();
|
|
|
|
const applicationsWithWarning = await Promise.all(
|
|
applications.map(async (application) => ({
|
|
...application,
|
|
profileUrl: await getImageUrl(application.profileKey),
|
|
signatureUrl: await getImageUrl(application.signatureKey),
|
|
|
|
nameMismatch:
|
|
application.givenNames !== application.user.firstName ||
|
|
application.surname !== application.user.secondName,
|
|
|
|
previousCitizenship:
|
|
application.user._count.citizenships > 0,
|
|
}))
|
|
);
|
|
|
|
return (
|
|
<>
|
|
<Header />
|
|
<div className="flex flex-row py-16 gap-8">
|
|
<AccountMenu />
|
|
<ReviewPageClient applications={applicationsWithWarning} />
|
|
</div>
|
|
<Footer />
|
|
</>
|
|
);
|
|
} |