import Logo from "@/assets/logo.svg" import ProfilePage from "@/components/profile" import { ThemeSwitcher } from "@/components/ui/theme-switcher" import UserButton from "@/components/ui/userButton" import { Sandbox, User } from "@/lib/types" import { currentUser } from "@clerk/nextjs" import Image from "next/image" import Link from "next/link" export default async function Page({ params: { userId }, }: { params: { userId: string } }) { const [userRes, user] = await Promise.all([ fetch( `${process.env.NEXT_PUBLIC_DATABASE_WORKER_URL}/api/user?id=${userId}`, { headers: { Authorization: `${process.env.NEXT_PUBLIC_WORKERS_KEY}`, }, } ), currentUser(), ]) const userData = (await userRes.json()) as User const publicSandboxes: Sandbox[] = [] const privateSandboxes: Sandbox[] = [] userData.sandbox.forEach((sandbox) => { if (sandbox.visibility === "public") { publicSandboxes.push(sandbox) } else if (sandbox.visibility === "private") { privateSandboxes.push(sandbox) } }) return (
Logo
Sandbox
{Boolean(userData) ? : null}
) }