43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
|
import IdentityCard from "@/components/identity-card";
|
|
import { getIdentityCardData } from "@/lib/id/repository";
|
|
import { TriangleAlertIcon } from "lucide-react";
|
|
import { RenunciationDialog } from "./renunciation-dialog";
|
|
import { getActiveCitizenship } from "@/lib/citizenship/repository";
|
|
|
|
export async function HasCitizenship({ userId }: { userId: string }) {
|
|
const identityDocument = await getIdentityCardData(userId);
|
|
const citizenship = await getActiveCitizenship(userId);
|
|
|
|
if (!identityDocument) {
|
|
return (
|
|
<Alert variant="warning">
|
|
<TriangleAlertIcon />
|
|
<AlertTitle>Identity document unavailable</AlertTitle>
|
|
<AlertDescription>
|
|
Your citizenship record exists, but no identity document was found. Contact the competent authority.
|
|
</AlertDescription>
|
|
</Alert>
|
|
);
|
|
}
|
|
|
|
if (!citizenship) {
|
|
return (
|
|
<Alert variant="warning">
|
|
<TriangleAlertIcon />
|
|
<AlertTitle>Citizenship record unavailable</AlertTitle>
|
|
<AlertDescription>
|
|
We couldn't verify your active citizenship record. Contact the competent authority.
|
|
</AlertDescription>
|
|
</Alert>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className="flex flex-col gap-6 md:gap-8">
|
|
<IdentityCard data={identityDocument} />
|
|
<RenunciationDialog citizenship={citizenship} />
|
|
</div>
|
|
);
|
|
}
|