| 1 | import type { Metadata } from "next"; |
| 2 | import { notFound } |
| 3 | import { Suspense } |
| 4 | |
| 5 | import { AppHeader } |
| 6 | import { createServerClient, getServerSession |
| 7 | import { plural } |
| 8 | |
| 9 | import { Profile, ProfileSkeleton |
| 10 | |
| 11 | export async function generateMetadata |
| 12 | params, |
| 13 | }: PageProps< |
| 14 | const { username |
| 15 | |
| 16 | const client = |
| 17 | const [{ data, |
| 18 | client.GET("/api/users/{username} |
| 19 | client.GET("/api/organizations/{slug} |
| 20 | params: { path: { |
| 21 | }), |
| 22 | ]); |
| 23 | if (organization.data |
| 24 | const title = |
| 25 | const description = |
| 26 | organization.data.repositoryCount |
| 27 | "public repository", |
| 28 | "public repositories", |
| 29 | ); |
| 30 | return { |
| 31 | title, |
| 32 | description, |
| 33 | openGraph: { title, |
| 34 | }; |
| 35 | } |
| 36 | if (response.status |
| 37 | if (!data) |
| 38 | |
| 39 | const title = |
| 40 | const description = |
| 41 | |
| 42 | return { |
| 43 | title, |
| 44 | description, |
| 45 | openGraph: { title, |
| 46 | }; |
| 47 | } |
| 48 | |
| 49 | export default async function |
| 50 | params, |
| 51 | searchParams, |
| 52 | }: PageProps< |
| 53 | const { username |
| 54 | const { tab, |
| 55 | const viewer = |
| 56 | |
| 57 | return ( |
| 58 | <div className="flex min-h-full flex-col |
| 59 | <AppHeader username={ |
| 60 | |
| 61 | <Suspense fallback={ |
| 62 | <Profile |
| 63 | username={username} |
| 64 | viewer={viewer} |
| 65 | tab={tab} |
| 66 | query={typeof q |
| 67 | cursor={typeof cursor |
| 68 | /> |
| 69 | </Suspense> |
| 70 | </div> |
| 71 | ); |
| 72 | } |