import { useState } from 'react';
import { Button } from '@/shared/components/Button';
import { Modal } from '@/shared/components/Modal';
import { useLogout } from '../hooks/useLogout';
import { useAuthStore } from '../store/authStore';
// ponytail: Gravatar's default-image endpoint seeds off whatever string sits in the
// path — no real MD5 needed for a mocked identicon. Swap in a proper md5(email) hash
// when real Gravatar photos (not just the generated identicon) are wanted.
function gravatarUrl(email: string, size: number) {
return `https://www.gravatar.com/avatar/${encodeURIComponent(email.trim().toLowerCase())}?d=identicon&s=${size}`;
}
const PLACEHOLDER = 'Not provided';
// ponytail: hardcoded until learner/progress feature exposes a real API; swap then.
const MOCK_PROGRESS = { level: 4, xp: 320, streak: 7 };
export function UserMenu() {
const user = useAuthStore((s) => s.user);
const logout = useLogout();
const [open, setOpen] = useState(false);
if (!user) return null;
const fields = [
{ label: 'Full name', value: user.name },
{ label: 'Date of birth', value: PLACEHOLDER },
{ label: 'Email', value: user.email },
{ label: 'Phone', value: PLACEHOLDER },
];
return (
<>
setOpen(false)} title="User profile">
{fields.map((f) => (
- {f.label}
- {f.value}
))}
>
);
}