Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { redirect } from 'next/navigation'
|
|
import { createClient } from '@/lib/supabase/server'
|
|
import InviteForm from './InviteForm'
|
|
|
|
export default async function AdminInvitePage() {
|
|
const supabase = await createClient()
|
|
|
|
const { data: { user } } = await supabase.auth.getUser()
|
|
|
|
if (!user) {
|
|
redirect('/login')
|
|
}
|
|
|
|
// Check if user is admin
|
|
const { data: profile } = await supabase
|
|
.from('profiles')
|
|
.select('is_admin')
|
|
.eq('id', user.id)
|
|
.single()
|
|
|
|
if (!profile?.is_admin) {
|
|
redirect('/dashboard')
|
|
}
|
|
|
|
return (
|
|
<div className="min-h-screen bg-zinc-50 dark:bg-zinc-950">
|
|
<div className="mx-auto max-w-2xl px-4 py-8 sm:px-6 lg:px-8">
|
|
<div className="mb-8">
|
|
<h1 className="text-2xl font-bold text-zinc-900 dark:text-zinc-50">
|
|
Invite New User
|
|
</h1>
|
|
<p className="mt-2 text-sm text-zinc-600 dark:text-zinc-400">
|
|
Send an invitation email to a new user to give them access to WebVNWrite.
|
|
</p>
|
|
</div>
|
|
|
|
<InviteForm />
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|