"use client";
import React from "react";
import { useRouter } from "next/navigation";
import { motion, AnimatePresence } from "framer-motion";
import useUserStore from "@/stores/useUserStore";
interface ProfileModalProps {
onClose: () => void;
}
export default function ProfileModal({ onClose }: ProfileModalProps) {
const router = useRouter();
const {
name,
title,
level,
xp,
longestStreak,
coursesCompleted,
preferences,
setPreferences,
logout,
} = useUserStore();
const { soundOn, darkGlass, difficulty } = preferences;
return (
{/* Backdrop */}
{/* Modal card */}
{/* Floating avatar – overlaps top edge */}
{/* Glass card body */}
{/* Name & title */}
Level {level} {title}
{name}
{/* ── Stats Grid ── */}
{/* ── Preferences ── */}
Preferences
{/* Sound Effects */}
Sound Effects
setPreferences({ soundOn: !soundOn })} />
{/* Dark/Light Theme */}
Dark/Light Theme
Dark/Glass
setPreferences({ darkGlass: !darkGlass })} />
{/* Difficulty Scaling */}
Difficulty Scaling
setPreferences({ difficulty: Number(e.target.value) })}
className="w-full h-1.5 rounded-full appearance-none cursor-pointer accent-brand-teal bg-brand-gray-200"
/>
{/* ── Log Out ── */}
);
}
/* ── Stat box ── */
function StatBox({ label, value }: { label: string; value: string }) {
return (
);
}
/* ── Toggle switch ── */
function Toggle({ on, onChange }: { on: boolean; onChange: () => void }) {
return (
);
}
/* ── Owl avatar (large) ── */
function OwlAvatar() {
return (
);
}