feat(appearance): accent color, corners, wide layout and game art background

This commit is contained in:
lobo committed 2026-09-24 15:06:16 +02:00
1 parent 91d5672421
commit 2c360c9421
28 files changed
+934 -46

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
import {useCallback} from 'react';
import {useTranslation} from 'react-i18next';
import {toast} from 'sonner';
import {usePreferences} from '../context/PreferencesContext.jsx';
import useSessionExpired from './useSessionExpired.js';
/**
* Returns `save(changes)`: changeAppearance plus the error messages and the session end on a 401. Resolves to
* true when saved.
*/
export default function useSaveAppearance() {
const {t} = useTranslation();
const {changeAppearance} = usePreferences();
const expireSession = useSessionExpired();
return useCallback(async (changes) => {
try {
const response = await changeAppearance(changes);
if (!response) return false;
if (response.status === 401) {
expireSession();
return false;
}
if (!response.ok) {
toast.error(t('SETTINGS.ERROR_SAVE'));
return false;
}
return true;
} catch (err) {
console.error('Appearance save error:', err);
toast.error(t('INFO.ERROR.NETWORK_FAILURE'));
return false;
}
}, [changeAppearance, expireSession, t]);
}