"use client" import ProjectCard from "@/components/dashboard/projectCard/" import { CanvasRevealEffect } from "@/components/dashboard/projectCard/revealEffect" import { Button } from "@/components/ui/button" import { Card, CardContent, CardDescription, CardTitle, } from "@/components/ui/card" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { updateSandbox } from "@/lib/actions" import { Sandbox, User } from "@/lib/types" import { PlusCircle } from "lucide-react" import Link from "next/link" import { toast } from "sonner" const colors: { [key: string]: number[][] } = { react: [ [71, 207, 237], [30, 126, 148], ], node: [ [86, 184, 72], [59, 112, 52], ], } export default function ProfilePage({ publicSandboxes, privateSandboxes, user, currentUser, }: { publicSandboxes: Sandbox[] privateSandboxes: Sandbox[] user: User currentUser: { id: string firstName: string | null lastName: string | null } | null }) { const onVisibilityChange = async (sandbox: Sandbox) => { const newVisibility = sandbox.visibility === "public" ? "private" : "public" toast(`Project ${sandbox.name} is now ${newVisibility}.`) await updateSandbox({ id: sandbox.id, visibility: newVisibility, }) } const isLoggedIn = Boolean(currentUser) const hasPublicSandboxes = publicSandboxes.length > 0 const hasPrivateSandboxes = privateSandboxes.length > 0 return ( <>
{user.name && user.name .split(" ") .slice(0, 2) .map((name) => name[0].toUpperCase())}
{user.name} @janedoe

Full-stack developer | Open source enthusiast

Joined January 2023

Sandboxes

Public {isLoggedIn && Private} {hasPublicSandboxes ? (
{publicSandboxes.map((sandbox) => { return ( {}} deletingId={"deletingId"} >
) })}
) : ( )} {isLoggedIn && ( {hasPrivateSandboxes ? (
{privateSandboxes.map((sandbox) => ( {}} deletingId={"deletingId"} >
))}
) : ( )} )}
) } function EmptyState({ title, description, }: { title: string description: string }) { return ( {title} {description} ) }