|
| 1 | +"use client"; |
| 2 | + |
| 3 | +import { FingerprintIcon } from "@phosphor-icons/react"; |
| 4 | +import { Suspense } from "react"; |
| 5 | +import { EmptyState } from "@/components/empty-state"; |
| 6 | +import { Skeleton } from "@/components/ui/skeleton"; |
| 7 | +import { useOrganizations } from "@/hooks/use-organizations"; |
| 8 | +import { SSOSettings } from "./sso-settings"; |
| 9 | + |
| 10 | +function SkeletonRow() { |
| 11 | + return ( |
| 12 | + <div className="grid grid-cols-[auto_1fr_auto] items-center gap-4 px-5 py-4"> |
| 13 | + <Skeleton className="h-10 w-10 rounded" /> |
| 14 | + <div className="space-y-2"> |
| 15 | + <Skeleton className="h-4 w-32" /> |
| 16 | + <Skeleton className="h-3 w-48" /> |
| 17 | + </div> |
| 18 | + <Skeleton className="h-6 w-16 rounded-full" /> |
| 19 | + </div> |
| 20 | + ); |
| 21 | +} |
| 22 | + |
| 23 | +function PageSkeleton() { |
| 24 | + return ( |
| 25 | + <div className="h-full lg:grid lg:grid-cols-[1fr_18rem]"> |
| 26 | + <div className="divide-y border-b lg:border-b-0"> |
| 27 | + <SkeletonRow /> |
| 28 | + <SkeletonRow /> |
| 29 | + </div> |
| 30 | + <div className="space-y-4 bg-card p-5"> |
| 31 | + <Skeleton className="h-10 w-full" /> |
| 32 | + <Skeleton className="h-18 w-full rounded" /> |
| 33 | + <Skeleton className="h-10 w-full" /> |
| 34 | + <Skeleton className="h-20 w-full rounded" /> |
| 35 | + </div> |
| 36 | + </div> |
| 37 | + ); |
| 38 | +} |
| 39 | + |
| 40 | +export default function SSOSettingsPage() { |
| 41 | + const { activeOrganization, isLoading } = useOrganizations(); |
| 42 | + |
| 43 | + if (isLoading) { |
| 44 | + return <PageSkeleton />; |
| 45 | + } |
| 46 | + |
| 47 | + if (!activeOrganization) { |
| 48 | + return ( |
| 49 | + <EmptyState |
| 50 | + description="Select or create an organization to configure SSO settings" |
| 51 | + icon={<FingerprintIcon weight="duotone" />} |
| 52 | + title="No organization selected" |
| 53 | + /> |
| 54 | + ); |
| 55 | + } |
| 56 | + |
| 57 | + return ( |
| 58 | + <Suspense fallback={<PageSkeleton />}> |
| 59 | + <SSOSettings organization={activeOrganization} /> |
| 60 | + </Suspense> |
| 61 | + ); |
| 62 | +} |
0 commit comments