diff --git a/app/[type]/[slug]/archiveButton.tsx b/app/[type]/[slug]/archive-button.tsx similarity index 100% rename from app/[type]/[slug]/archiveButton.tsx rename to app/[type]/[slug]/archive-button.tsx diff --git a/app/[type]/[slug]/edit/client.tsx b/app/[type]/[slug]/edit/client.tsx index b8e571b..66632f4 100644 --- a/app/[type]/[slug]/edit/client.tsx +++ b/app/[type]/[slug]/edit/client.tsx @@ -73,7 +73,7 @@ export default function EditPageClient({ page, pageType, initialBlocks = [] }: P return (
-

Edit page

+

Edit page

+ diff --git a/app/account/citizenship/apply/page.tsx b/app/account/citizenship/apply/page.tsx index 36d6f52..bf14b87 100644 --- a/app/account/citizenship/apply/page.tsx +++ b/app/account/citizenship/apply/page.tsx @@ -2,9 +2,10 @@ import Footer from "@/components/footer"; import Header from "@/components/header"; import { getCurrentUser } from "@/lib/user"; import { redirect } from "next/navigation"; -import { AccountMenu } from "../../menu"; +import { AccountMenu } from "../../account-menu"; import { CitizenshipApplicationForm } from "./form"; import { getUserApplications } from "@/lib/citizenship/repository"; +import { prisma } from "@/lib/prisma"; export default async function CitizenshipApplication() { const user = await getCurrentUser(); @@ -14,6 +15,8 @@ export default async function CitizenshipApplication() { const canApply = applications.length === 0 || applications.every((a) => a.status === "REJECTED"); if (!canApply) redirect("/account/citizenship"); + const regions = await prisma.region.findMany({ orderBy: { name: "asc" } }); + return ( <>
@@ -28,6 +31,7 @@ export default async function CitizenshipApplication() { secondName={user.secondName} sex={user.sex} birthDate={user.birthDate} + regions={regions} />
diff --git a/app/account/citizenship/page.tsx b/app/account/citizenship/page.tsx index 5b65b21..6f9caaf 100644 --- a/app/account/citizenship/page.tsx +++ b/app/account/citizenship/page.tsx @@ -2,7 +2,7 @@ import Footer from "@/components/footer"; import Header from "@/components/header"; import { getCurrentUser } from "@/lib/user"; import { redirect } from "next/navigation"; -import { AccountMenu } from "../menu"; +import { AccountMenu } from "../account-menu"; import { InfoIcon } from "lucide-react"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { Button } from "@/components/ui/button"; @@ -13,14 +13,31 @@ import { AccordionItem, AccordionTrigger, } from "@/components/ui/accordion"; -import { ApplicationsDialog } from "./applicationsDialog"; -import { getUserApplications } from "@/lib/citizenship/repository"; +import { ApplicationsDialog } from "./applications-dialog"; +import { getPendingApplicationsCount, getUserApplications } from "@/lib/citizenship/repository"; +import { prisma } from "@/lib/prisma"; +import { CitizenshipApplication } from "@/lib/citizenship/types"; +import { getIdentityCardData, IdentityCardData } from "@/lib/id/repository"; +import IdCard from "@/components/id-card"; export default async function Citizenship() { - const user = await getCurrentUser(); - if (!user) redirect("/"); + const user = await getCurrentUser() + if (!user) redirect("/") - const applications = await getUserApplications(user.id); + const citizenship = await prisma.citizenship.findUnique({ where: { userId: user.id } }) + + let applications: CitizenshipApplication[] = [] + let pendingCount = 0 + let identityDocument: IdentityCardData | null = null + + if (citizenship) { + identityDocument = await getIdentityCardData(user.id) + } else { + applications = await getUserApplications(user.id) + if (user.isAdmin) { + pendingCount = await getPendingApplicationsCount() + } + } return ( <> @@ -30,85 +47,108 @@ export default async function Citizenship() {

Citizenship

- - - You are not a citizen of the European Federation - - You currently hold non-citizen status. Certain civic services and - identity documents are available only to - citizens of the European Federation. - - -
-
- - + {citizenship ? ( +
+
- {applications.length > 0 && } -
- - - -

Who is eligible for citizenship?

-
- - Citizenship may be granted to persons born in the European - Federation, the former Duspean Republic, or the Country of Reality, - as well as to individuals who held citizenship of the Duspean - Republic or the Country of Reality on 31 March 2026. -
-
- Foreign nationals who demonstrate a commitment to the development, - prosperity, and values of the European Federation may also be - eligible for naturalisation under federal law. -
-
- - -

What rights does citizenship provide?

-
- - Citizens enjoy all rights and protections guaranteed by the - Constitution and laws of the European Federation, including the - right to obtain federal identity documents, participate in federal - elections, and receive protection from federal authorities. - -
- - -

What documents are required?

-
- - Applicants may be asked to provide proof of - residence in the European Federation, evidence of eligibility, and any additional documents - required by the competent authority. - -
- - -

How long does the application process take?

-
- - Processing times vary depending on the complexity of the - application and the volume of requests currently under review. - Applicants can track the status of their application through their - account. - -
- - -

Is dual citizenship permitted?

-
- - The European Federation generally permits dual citizenship unless - otherwise restricted by federal law or international agreements. - -
-
+ ) : ( +
+ + + You are not a citizen of the European Federation + + You currently hold non-citizen status. Certain civic services and + identity documents are available only to citizens of the European Federation. + + +
+
+ + + + + + +
+ {applications.length > 0 && ( + + )} + {user.isAdmin && ( + + + + )} +
+ + + +

Who is eligible for citizenship?

+
+ + Citizenship may be granted to persons born in the European + Federation, the former Duspean Republic, or the Country of Reality, + as well as to individuals who held citizenship of the Duspean + Republic or the Country of Reality on 31 March 2026. +
+
+ Foreign nationals who demonstrate a commitment to the development, + prosperity, and values of the European Federation may also be + eligible for naturalisation under federal law. +
+
+ + +

What rights does citizenship provide?

+
+ + Citizens enjoy all rights and protections guaranteed by the + Constitution and laws of the European Federation, including the + right to obtain federal identity documents, participate in federal + elections, and receive protection from federal authorities. + +
+ + +

What documents are required?

+
+ + Applicants may be asked to provide proof of + residence in the European Federation, evidence of eligibility, and any additional documents + required by the competent authority. + +
+ + +

How long does the application process take?

+
+ + Processing times vary depending on the complexity of the + application and the volume of requests currently under review. + Applicants can track the status of their application through their + account. + +
+ + +

Is dual citizenship permitted?

+
+ + The European Federation generally permits dual citizenship unless + otherwise restricted by federal law or international agreements. + +
+
+
+ )}