"use client"; import { redirect } from "next/navigation"; import { PasswordChangeForm } from "~/components/profile/password-change-form"; import { ProfileEditForm } from "~/components/profile/profile-edit-form"; import { Badge } from "~/components/ui/badge"; import { Button } from "~/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "~/components/ui/card"; import { Separator } from "~/components/ui/separator"; import { PageHeader } from "~/components/ui/page-header"; import { useBreadcrumbsEffect } from "~/components/ui/breadcrumb-provider"; import { formatRole, getRoleDescription } from "~/lib/auth-client"; import { User, Shield, Download, Trash2, ExternalLink } from "lucide-react"; import { useSession } from "next-auth/react"; interface ProfileUser { id: string; name: string | null; email: string; image: string | null; roles?: Array<{ role: "administrator" | "researcher" | "wizard" | "observer"; grantedAt: string | Date; }>; } function ProfileContent({ user }: { user: ProfileUser }) { return (
{/* Profile Information */}
{/* Basic Information */} Basic Information Your personal account information {/* Password Change */} Password Change your account password {/* Account Actions */} Account Actions Manage your account settings

Export Data

Download all your research data and account information

Delete Account

Permanently delete your account and all associated data

{/* Sidebar */}
{/* User Summary */} Account Summary
{(user.name ?? user.email ?? "U").charAt(0).toUpperCase()}

{user.name ?? "Unnamed User"}

{user.email}

User ID

{user.id}

{/* System Roles */} System Roles Your current system permissions {user.roles && user.roles.length > 0 ? (
{user.roles.map((roleInfo, index: number) => (
{formatRole(roleInfo.role)}

{getRoleDescription(roleInfo.role)}

Granted{" "} {new Date(roleInfo.grantedAt).toLocaleDateString()}

))}

Need additional permissions?{" "}

) : (

No Roles Assigned

You don't have any system roles yet. Contact an administrator to get access to HRIStudio features.

)}
); } export default function ProfilePage() { const { data: session } = useSession(); useBreadcrumbsEffect([ { label: "Dashboard", href: "/dashboard" }, { label: "Profile" }, ]); if (!session?.user) { redirect("/auth/signin"); } const user = session.user; return ; }