import Link from 'next/link' import { createAdminClient } from '@/lib/supabase/admin' export const dynamic = 'force-dynamic' // Friendly, space-scoped landing for an invite link // (/join/?code=CODE). Purely presentational: it resolves the // space name for context and hands off to the existing, battle-tested // /signup?invite=CODE join flow rather than reimplementing auth. export default async function JoinPage({ params, searchParams, }: { params: Promise<{ space: string }> searchParams: Promise<{ code?: string }> }) { const { space } = await params const { code } = await searchParams const admin = createAdminClient() const { data: spaceRow } = await admin .from('spaces') .select('name') .eq('slug', space) .maybeSingle() if (!spaceRow) { return (

Invite link not valid

This space could not be found. Check the link or ask whoever invited you for a new one.

) } const signupHref = code ? `/signup?invite=${encodeURIComponent(code)}` : '/signup' return (

Join {spaceRow.name}

You have been invited to join {spaceRow.name} {code ? ' with an invite code' : ''}. Create an account or sign in to continue.

Continue
) }