()
| 10 | import { useOrganizationData } from '@/hooks/use-organization-data' |
| 11 | |
| 12 | export default function TeamPage() { |
| 13 | const { data: session, status } = useSession() |
| 14 | const params = useParams() ?? {} |
| 15 | const router = useRouter() |
| 16 | const orgSlug = (params.slug as string) ?? '' |
| 17 | |
| 18 | // Use the custom hook for organization data |
| 19 | const { organization, isLoading, error } = useOrganizationData(orgSlug) |
| 20 | |
| 21 | if (status === 'loading' || isLoading) { |
| 22 | return ( |
| 23 | <div className="container mx-auto py-6 px-4"> |
| 24 | <div className="max-w-6xl mx-auto"> |
| 25 | <div className="animate-pulse"> |
| 26 | <div className="h-8 bg-gray-200 rounded w-64 mb-6"></div> |
| 27 | <div className="space-y-6"> |
| 28 | <div className="h-48 bg-gray-200 rounded"></div> |
| 29 | <div className="h-48 bg-gray-200 rounded"></div> |
| 30 | </div> |
| 31 | </div> |
| 32 | </div> |
| 33 | </div> |
| 34 | ) |
| 35 | } |
| 36 | |
| 37 | if (!session) { |
| 38 | return ( |
| 39 | <div className="container mx-auto py-6 px-4"> |
| 40 | <div className="max-w-md mx-auto"> |
| 41 | <div className="text-center"> |
| 42 | <h1 className="text-2xl font-bold mb-4">Sign in Required</h1> |
| 43 | <p className="mb-4"> |
| 44 | Please sign in to manage this organization's team. |
| 45 | </p> |
| 46 | <Link href="/login"> |
| 47 | <Button>Sign In</Button> |
| 48 | </Link> |
| 49 | </div> |
| 50 | </div> |
| 51 | </div> |
| 52 | ) |
| 53 | } |
| 54 | |
| 55 | if (error || !organization) { |
| 56 | return ( |
| 57 | <div className="container mx-auto py-6 px-4"> |
| 58 | <div className="max-w-md mx-auto"> |
| 59 | <div className="text-center"> |
| 60 | <h1 className="text-2xl font-bold mb-4">Error</h1> |
| 61 | <p className="mb-4">{error || 'Organization not found'}</p> |
| 62 | <div className="flex gap-2 justify-center"> |
| 63 | <Button onClick={() => router.back()} variant="outline"> |
| 64 | Go Back |
| 65 | </Button> |
| 66 | <Button onClick={() => window.location.reload()}> |
| 67 | Try Again |
| 68 | </Button> |
| 69 | </div> |
nothing calls this directly
no test coverage detected