Centralize fade out

This commit is contained in:
binwiederhier
2026-06-25 22:33:25 -04:00
parent 0ac7cbd4fe
commit a47eef5006
5 changed files with 31 additions and 24 deletions
+1 -1
View File
@@ -1396,7 +1396,7 @@ const DeleteAccountDialog = (props) => {
await accountApi.delete(password);
await db().delete();
console.debug(`[Account] Account deleted`);
await session.resetAndRedirect(routes.app);
await session.resetAndRedirect(routes.app, { fade: true });
} catch (e) {
console.log(`[Account] Error deleting account`, e);
if (e instanceof IncorrectPasswordError) {
+1 -1
View File
@@ -173,7 +173,7 @@ const ProfileIcon = () => {
await accountApi.logout();
await db().delete();
} finally {
await session.resetAndRedirect(routes.app);
await session.resetAndRedirect(routes.app, { fade: true });
}
};
+5 -2
View File
@@ -43,7 +43,7 @@ import accountApi, { Permission, Role } from "../app/AccountApi";
import { Pref, PrefGroup } from "./Pref";
import AccountContext from "./AccountContext";
import { Paragraph } from "./styles";
import prefs, { THEME } from "../app/Prefs";
import prefs, { THEME, THEME_LOCALSTORAGE_KEY } from "../app/Prefs";
import { PermissionDenyAll, PermissionRead, PermissionReadWrite, PermissionWrite } from "./ReserveIcons";
import { ReserveAddDialog, ReserveDeleteDialog, ReserveEditDialog } from "./ReserveDialogs";
import { UnauthorizedError } from "../app/errors";
@@ -230,7 +230,10 @@ const DeleteAfter = () => {
const Theme = () => {
const { t } = useTranslation();
const labelId = "prefTheme";
const theme = useCachedPref(() => prefs.theme(), "pref.theme", THEME.SYSTEM);
// Reuse the same localStorage key Prefs already mirrors for the splash (THEME_LOCALSTORAGE_KEY),
// rather than a second cache key, so the value isn't stored twice. The cached value renders the
// dropdown instantly; the live query then confirms it from IndexedDB.
const theme = useLiveQuery(() => prefs.theme()) ?? localStorage.getItem(THEME_LOCALSTORAGE_KEY) ?? THEME.SYSTEM;
const handleChange = async (ev) => {
await prefs.setTheme(ev.target.value);
};