80 lines
2.9 KiB
TypeScript
80 lines
2.9 KiB
TypeScript
import { redirect } from "next/navigation";
|
|
import Link from "next/link";
|
|
import { getServerSession } from "next-auth";
|
|
import { authOptions } from "@/lib/auth";
|
|
import { organizerService } from "@/server/services/organizer.service";
|
|
import { VerifyForm } from "@/features/organizer/components/verify-form";
|
|
import { VerifiedBadge } from "@/components/shared/verified-badge";
|
|
|
|
export default async function VerifyPage() {
|
|
const session = await getServerSession(authOptions);
|
|
if (!session?.user) {
|
|
redirect("/login?callbackUrl=/verify");
|
|
}
|
|
|
|
const verification = await organizerService.getStatusForUser(session.user.id);
|
|
|
|
return (
|
|
<div className="mx-auto max-w-2xl px-4 py-8 sm:py-12">
|
|
<div className="mb-6">
|
|
<h1 className="text-2xl font-bold text-neutral-900 sm:text-3xl">
|
|
Verifikasi Organizer
|
|
</h1>
|
|
<p className="mt-2 text-sm text-neutral-600">
|
|
Lengkapi data berikut untuk mengaktifkan kemampuan membuat trip berbayar.
|
|
</p>
|
|
</div>
|
|
|
|
{verification?.status === "APPROVED" && (
|
|
<div className="mb-6 rounded-2xl border border-primary-200 bg-primary-50 p-5">
|
|
<div className="mb-2 flex items-center gap-2">
|
|
<VerifiedBadge size="md" />
|
|
<span className="text-sm font-semibold text-primary-800">
|
|
Akun terverifikasi
|
|
</span>
|
|
</div>
|
|
<p className="text-sm text-neutral-700">
|
|
Selamat! Kamu sudah bisa membuat trip berbayar.
|
|
</p>
|
|
</div>
|
|
)}
|
|
|
|
{verification?.status === "PENDING" && (
|
|
<div className="mb-6 rounded-2xl border border-amber-200 bg-amber-50 p-5">
|
|
<p className="mb-1 text-sm font-bold text-amber-800">
|
|
⏳ Menunggu review admin
|
|
</p>
|
|
<p className="text-sm text-neutral-700">
|
|
Pengajuanmu sedang diproses. Kami akan memberitahu via email setelah selesai.
|
|
</p>
|
|
</div>
|
|
)}
|
|
|
|
{verification?.status === "REJECTED" && (
|
|
<div className="mb-6 rounded-2xl border border-red-200 bg-red-50 p-5">
|
|
<p className="mb-1 text-sm font-bold text-red-800">❌ Pengajuan ditolak</p>
|
|
{verification.rejectionReason && (
|
|
<p className="text-sm text-neutral-700">
|
|
<span className="font-semibold">Alasan:</span>{" "}
|
|
{verification.rejectionReason}
|
|
</p>
|
|
)}
|
|
<p className="mt-2 text-sm text-neutral-700">
|
|
Kamu bisa memperbaiki data dan mengajukan ulang di bawah.
|
|
</p>
|
|
</div>
|
|
)}
|
|
|
|
{verification?.status !== "APPROVED" && verification?.status !== "PENDING" && (
|
|
<VerifyForm initial={verification ?? null} />
|
|
)}
|
|
|
|
<p className="mt-6 text-center text-sm text-neutral-500">
|
|
<Link href="/profile" className="hover:text-primary-600">
|
|
← Kembali ke profil
|
|
</Link>
|
|
</p>
|
|
</div>
|
|
);
|
|
}
|