Public Access
Get started links to registration and says an admin approves accounts. Back navigation restores the library scroll; search no longer fills history. Steam and PSN unlink ask first. Any close marks news as seen. Confetti plays only when the level rises on the page. Count-ups respect reduced motion. Html lang follows the UI language. Add a 404 page, translated role and dialog close label.
50 lines
2.0 KiB
React
50 lines
2.0 KiB
React
import {Link} from 'react-router-dom';
|
|
import {useTranslation} from 'react-i18next';
|
|
import {Rocket, UserRound} from 'lucide-react';
|
|
|
|
import {Button} from '@/components/ui/button';
|
|
import {Card, CardContent, CardHeader, CardTitle} from '@/components/ui/card';
|
|
import {useCurrentUserContext} from '../context/CurrentUserContext.jsx';
|
|
import {formatDateTime} from '../utils/format.js';
|
|
|
|
const formatDate = (value, locale) => {
|
|
if (!value) return '—';
|
|
try {
|
|
return formatDateTime(value, locale);
|
|
} catch {
|
|
return value;
|
|
}
|
|
};
|
|
|
|
export default function AccountInfoCard() {
|
|
const {t, i18n} = useTranslation();
|
|
const {user: profile} = useCurrentUserContext();
|
|
const accountRows = [
|
|
[t('SETTINGS.EMAIL'), profile?.email],
|
|
[t('SETTINGS.ROLE'), profile?.role && t(`ROLES.${profile.role}`)],
|
|
[t('SETTINGS.CREATED_DATE'), formatDate(profile?.createdDate, i18n.language)],
|
|
[t('SETTINGS.LAST_LOGIN'), formatDate(profile?.lastLogin, i18n.language)],
|
|
];
|
|
|
|
return (
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle className="flex items-center gap-2"><UserRound className="size-4 text-primary"/>{t('SETTINGS.ACCOUNT')}</CardTitle>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<dl className="divide-y">
|
|
{accountRows.map(([label, value]) => (
|
|
<div key={label} className="flex flex-col gap-1 py-3 first:pt-0 last:pb-0 sm:flex-row sm:items-center sm:justify-between">
|
|
<dt className="text-sm text-muted-foreground">{label}</dt>
|
|
<dd className="text-sm font-medium break-all">{value || '—'}</dd>
|
|
</div>
|
|
))}
|
|
</dl>
|
|
<Button asChild variant="link" className="mt-3 h-auto max-w-full whitespace-normal p-0 text-left">
|
|
<Link to="/welcome"><Rocket/>{t('SETTINGS.OPEN_WELCOME')}</Link>
|
|
</Button>
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
}
|