import { createClient } from "@/lib/supabase/server"; import { inviteUser, revokeInvitation } from "./actions"; import { Suspense } from "react"; import { Skeleton } from "@/components/ui/skeleton"; import { Trash2 } from "lucide-react"; async function TeamSettingsContent() { const supabase = await createClient(); const { data: userData } = await supabase.auth.getUser(); const userId = userData?.user?.id; if (!userId) return null; // Get profile const { data: profile } = await supabase .from("profiles") .select("organization_id, role") .eq("id", userId) .single(); if (!profile?.organization_id) return null; // Get organization members const { data: members } = await supabase .from("profiles") .select("id, email, role") .eq("organization_id", profile.organization_id); // Get pending invitations const { data: invitations } = await supabase .from("invitations") .select("id, email, token, status, expires_at") .eq("organization_id", profile.organization_id) .eq("status", "pending") .gt("expires_at", new Date().toISOString()); return (

Team Management

Manage your organization's members and invitations.

Members

    {members?.map((m) => (
  • {m.email}
    {m.role}
  • ))}
{profile.role === "owner" && (

Invite New Member

)} {profile.role === "owner" && invitations && invitations.length > 0 && (

Pending Invitations

    {invitations.map((inv) => (
  • {inv.email}
    Pending
  • ))}
)}
); } function TeamSettingsSkeleton() { return (
); } export default function TeamSettingsPage() { return ( }> ); }