154 lines
6.8 KiB
TypeScript
154 lines
6.8 KiB
TypeScript
import Footer from "@/components/footer";
|
|
import Header from "@/components/header";
|
|
import { getCurrentUser } from "@/lib/user";
|
|
import { redirect } from "next/navigation";
|
|
import { AccountMenu } from "../account-menu";
|
|
import { InfoIcon } from "lucide-react";
|
|
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
|
import { Button } from "@/components/ui/button";
|
|
import Link from "next/link";
|
|
import {
|
|
Accordion,
|
|
AccordionContent,
|
|
AccordionItem,
|
|
AccordionTrigger,
|
|
} from "@/components/ui/accordion";
|
|
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 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 (
|
|
<>
|
|
<Header />
|
|
<div className="flex flex-row py-16 gap-8">
|
|
<AccountMenu />
|
|
<div className="flex flex-col gap-8 max-w-lg">
|
|
<div className="flex flex-col gap-6 w-min">
|
|
<h2>Citizenship</h2>
|
|
{citizenship ? (
|
|
<div className="flex flex-col gap-8">
|
|
<IdCard data={identityDocument} />
|
|
</div>
|
|
) : (
|
|
<div className="flex flex-col gap-6 w-min">
|
|
<Alert variant="warning">
|
|
<InfoIcon />
|
|
<AlertTitle>You are not a citizen of the European Federation</AlertTitle>
|
|
<AlertDescription>
|
|
You currently hold non-citizen status. Certain civic services and
|
|
identity documents are available only to citizens of the European Federation.
|
|
</AlertDescription>
|
|
</Alert>
|
|
<div className="flex flex-col gap-3">
|
|
<div className="flex flex-row gap-3 w-max">
|
|
<Link href="/page/citizenship">
|
|
<Button variant="secondary">Learn more about citizenship</Button>
|
|
</Link>
|
|
<Link href="/account/citizenship/apply">
|
|
<Button>Apply for citizenship</Button>
|
|
</Link>
|
|
</div>
|
|
{applications.length > 0 && (
|
|
<ApplicationsDialog applications={applications} />
|
|
)}
|
|
{user.isAdmin && (
|
|
<Link href="/account/citizenship/review">
|
|
<Button variant="secondary" className="w-full">
|
|
Review citizenship applications
|
|
<div className="flex items-center justify-center bg-black/50 text-white w-3.5 h-3.5 text-xs rounded-full">
|
|
{pendingCount}
|
|
</div>
|
|
</Button>
|
|
</Link>
|
|
)}
|
|
</div>
|
|
<Accordion type="single" collapsible>
|
|
<AccordionItem value="eligibility">
|
|
<AccordionTrigger>
|
|
<h4>Who is eligible for citizenship?</h4>
|
|
</AccordionTrigger>
|
|
<AccordionContent>
|
|
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.
|
|
<br />
|
|
<br />
|
|
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.
|
|
</AccordionContent>
|
|
</AccordionItem>
|
|
<AccordionItem value="rights">
|
|
<AccordionTrigger>
|
|
<h4>What rights does citizenship provide?</h4>
|
|
</AccordionTrigger>
|
|
<AccordionContent>
|
|
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.
|
|
</AccordionContent>
|
|
</AccordionItem>
|
|
<AccordionItem value="documents">
|
|
<AccordionTrigger>
|
|
<h4>What documents are required?</h4>
|
|
</AccordionTrigger>
|
|
<AccordionContent>
|
|
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.
|
|
</AccordionContent>
|
|
</AccordionItem>
|
|
<AccordionItem value="processing">
|
|
<AccordionTrigger>
|
|
<h4>How long does the application process take?</h4>
|
|
</AccordionTrigger>
|
|
<AccordionContent>
|
|
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.
|
|
</AccordionContent>
|
|
</AccordionItem>
|
|
<AccordionItem value="dual">
|
|
<AccordionTrigger>
|
|
<h4>Is dual citizenship permitted?</h4>
|
|
</AccordionTrigger>
|
|
<AccordionContent>
|
|
The European Federation generally permits dual citizenship unless
|
|
otherwise restricted by federal law or international agreements.
|
|
</AccordionContent>
|
|
</AccordionItem>
|
|
</Accordion>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<Footer />
|
|
</>
|
|
)
|
|
} |