diff --git a/app/bounty/create/page.tsx b/app/bounty/create/page.tsx new file mode 100644 index 0000000..70e0063 --- /dev/null +++ b/app/bounty/create/page.tsx @@ -0,0 +1,53 @@ +"use client"; + +import { useEffect } from "react"; +import { useRouter } from "next/navigation"; +import { authClient } from "@/lib/auth-client"; +import { useUserRole } from "@/hooks/use-user-role"; +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@/components/ui/card"; +import { AlertCircle } from "lucide-react"; + +export default function CreateBountyPage() { + const router = useRouter(); + const { isPending } = authClient.useSession(); + const userRole = useUserRole(); + + useEffect(() => { + // Redirect to /bounty if the user is not a sponsor + if (!isPending && userRole !== "sponsor") { + router.push("/bounty"); + } + }, [userRole, isPending, router]); + + // Show nothing while checking auth or redirecting + if (isPending || userRole !== "sponsor") { + return null; + } + + return ( +