"use client"; import { createApiClient } from "@app/lib/api"; import { Button } from "@app/components/ui/button"; import { Card, CardContent, CardFooter, CardHeader, CardTitle, } from "@app/components/ui/card"; import { useEnvContext } from "@app/hooks/useEnvContext"; import { XCircle } from "lucide-react"; import { useRouter } from "next/navigation"; type InviteStatusCardProps = { type: "rejected" | "wrong_user" | "user_does_not_exist" | "not_logged_in"; token: string; }; export default function InviteStatusCard({ type, token, }: InviteStatusCardProps) { const router = useRouter(); const api = createApiClient(useEnvContext()); async function goToLogin() { await api.post("/auth/logout", {}); router.push(`/auth/login?redirect=/invite?token=${token}`); } async function goToSignup() { await api.post("/auth/logout", {}); router.push(`/auth/signup?redirect=/invite?token=${token}`); } function renderBody() { if (type === "rejected") { return (
We're sorry, but it looks like the invite you're trying to access has not been accepted or is no longer valid.
We're sorry, but it looks like the invite you're trying to access is not for this user.
Please make sure you're logged in as the correct user.
We're sorry, but it looks like the invite you're trying to access is not for a user that exists.
Please create an account first.