feat(nav): simplify navigation and terms (#57)
Build, Test & Push Frontend / quality-check (push) Successful in 40s
Build, Test & Push Frontend / docker (push) Successful in 29s

One glossary (docs/GLOSSARY.md) for all de and en texts.
Five nav items; phones get a bottom bar with labels.
Community page with following, followers, player search and stats.
The bell is the one place for notes, news and open questions.
Settings in tabs; auto-save is silent and rolls back on error.
Questions page explains itself; removed games are a library filter.
Own profile: menu link, public chip, copy link, private hint.
Points page starts with a short summary; stats use status colors.
This commit is contained in:
lobo committed 2026-10-21 14:54:48 +02:00
1 parent 45f5087227
commit 3712e3905f
80 files changed
+2237 -1189

No files matched your search

+9 -19
View File
@@ -1,17 +1,15 @@
import {useTranslation} from 'react-i18next';
import {SlidersHorizontal} from 'lucide-react';
import {toast} from 'sonner';
import {Card, CardContent, CardHeader, CardTitle} from '@/components/ui/card';
import {Label} from '@/components/ui/label';
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from '@/components/ui/select';
import {Switch} from '@/components/ui/switch';
import {useCurrentUserContext} from '../context/CurrentUserContext.jsx';
import {usePreferences} from '../context/PreferencesContext.jsx';
import usePersistSettings from '../hooks/usePersistSettings.js';
import useSaveResponse from '../hooks/useSaveResponse.js';
import {FAVORITE_PLATFORMS, saveFavoritePlatform} from '../utils/platforms.js';
import {LANGUAGES, saveSettings} from '../utils/settings.js';
import {LANGUAGES} from '../utils/settings.js';
// Radix Select has no empty value.
const NO_FAVORITE = 'NONE';
@@ -19,26 +17,22 @@ const NO_FAVORITE = 'NONE';
export default function PreferencesCard() {
const {t, i18n} = useTranslation();
const {user: profile, updateUser: updateProfile} = useCurrentUserContext();
const {isDarkMode, setDarkMode, setLanguage} = usePreferences();
const {setLanguage} = usePreferences();
const persistSettings = usePersistSettings();
const runSave = useSaveResponse();
const handleDarkThemeToggle = async () => {
const next = !isDarkMode;
setDarkMode(next); // apply on the fly
await persistSettings(() => saveSettings({useDarkTheme: next}));
};
const handleLanguageChange = async (next) => {
await persistSettings(() => setLanguage(next));
const previous = i18n.language;
const {ok} = await persistSettings(() => setLanguage(next), {silent: true});
if (!ok) i18n.changeLanguage(previous);
};
const handleFavoritePlatformChange = async (value) => {
const platform = value === NO_FAVORITE ? null : value;
if (await runSave(() => saveFavoritePlatform(platform))) {
updateProfile((p) => ({...p, settings: {...p.settings, favoritePlatform: platform}}));
toast.success(t('SETTINGS.SAVED'));
}
const previous = profile?.settings?.favoritePlatform ?? null;
const setPlatform = (next) => updateProfile((p) => ({...p, settings: {...p.settings, favoritePlatform: next}}));
setPlatform(platform);
if (!await runSave(() => saveFavoritePlatform(platform))) setPlatform(previous);
};
return (
@@ -47,10 +41,6 @@ export default function PreferencesCard() {
<CardTitle className="flex items-center gap-2"><SlidersHorizontal className="size-4 text-primary"/>{t('SETTINGS.PREFERENCES')}</CardTitle>
</CardHeader>
<CardContent className="space-y-6">
<div className="flex items-center justify-between gap-4">
<Label htmlFor="useDarkTheme">{t('SETTINGS.DARK_THEME')}</Label>
<Switch id="useDarkTheme" checked={isDarkMode} onCheckedChange={handleDarkThemeToggle}/>
</div>
<div className="flex items-center justify-between gap-4">
<Label htmlFor="language">{t('SETTINGS.LANGUAGE')}</Label>
<Select value={i18n.language} onValueChange={handleLanguageChange}>