import { db } from '@/lib/db' import { invites } from '@/lib/db/schema' import { eq } from 'drizzle-orm' import InviteForm from './invite-form' import { Monitor, XCircle } from 'lucide-react' import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from '@/components/ui/card' import { Button } from '@/components/ui/button' import Link from 'next/link' interface InvitePageProps { params: Promise<{ token: string }> } export default async function InvitePage({ params }: InvitePageProps) { const { token } = await params const result = await db .select() .from(invites) .where(eq(invites.token, token)) .limit(1) const invite = result[0] const isExpired = invite && new Date(invite.expiresAt) < new Date() const isUsed = !!invite?.usedAt const isValid = invite && !isExpired && !isUsed return (
RemoteLink

{isValid ? "You've been invited" : 'RemoteLink'}

{isValid ? 'Set up your account to start managing remote machines securely.' : 'Secure, low-latency remote desktop access for IT professionals.'}

RemoteLink
{isValid ? ( ) : (
{!invite ? 'Invalid invite' : isUsed ? 'Already used' : 'Invite expired'} {!invite ? 'This invite link is invalid or does not exist.' : isUsed ? 'This invite link has already been used to create an account.' : 'This invite link has expired. Please contact your administrator for a new one.'}
)}
) }