frontend: add saving of settings state. move logout button in navigation. add close button to settings dialog.

This commit is contained in:
Kentai Radiquum 2024-04-28 01:18:40 +05:00
parent 4f680ca717
commit 93982a061c
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
4 changed files with 78 additions and 23 deletions

View file

@ -0,0 +1,25 @@
"use client";
import { create } from "zustand";
import { persist, createJSONStorage } from "zustand/middleware";
function saveSettings(dict) {
localStorage.setItem("settings", JSON.stringify(dict));
}
function loadSettings() {
return JSON.parse(localStorage.getItem("settings"));
}
export const useSettingsStore = create(
persist(
(set, get) => ({
saveToHistory: true,
setSettings: (dict) => {
set(dict);
},
}),
{
name: "settings",
},
),
);