import { prisma } from '@ketopath/db'; import { redirect } from 'next/navigation'; import { useTranslations } from 'next-intl'; import { setRequestLocale } from 'next-intl/server'; import { CursorGlow } from '@/components/cursor-glow'; import { Masthead } from '@/components/masthead'; import { getServerSession } from '@/lib/auth'; import { fetchAchievements } from './achievements-actions'; import { AchievementsPanel } from './achievements-panel'; import { fetchProfile } from './actions'; import { DataPanel } from './data-panel'; import { fetchNotificationConfig } from './notifications-actions'; import { NotificationsPanel } from './notifications-panel'; import { fetchPreferences } from './preferences-actions'; import { PreferencesSection } from './preferences-section'; import { ProfileForm } from './profile-form'; export default async function ProfilePage({ params: { locale } }: { params: { locale: string } }) { setRequestLocale(locale); const session = await getServerSession(); if (!session?.user) redirect('/sign-in'); const user = await prisma.user.findUnique({ where: { id: session.user.id }, select: { disclaimerAcceptedAt: true }, }); if (!user?.disclaimerAcceptedAt) redirect('/welcome'); const profile = (await fetchProfile()) as Parameters[0]['initial']; const notifications = await fetchNotificationConfig(); const preferences = await fetchPreferences(); const achievements = await fetchAchievements(); return ( ); } function ProfilePageContent({ initial, notifications, preferences, achievements, }: { initial: Parameters[0]['initial']; notifications: Awaited>; preferences: Awaited>; achievements: Awaited>; }) { const t = useTranslations('Profile'); return (
IV

Capitolo IV — Profilo

{t('title')} .

{t('subtitle')}

); }