frontend:

Fix undefined api call
Simplify some parts
Better theme management
Add color picker (dynamic themes wohoo)
Add missing lists keys
This commit is contained in:
Kentai Radiquum 2024-04-21 05:35:44 +05:00
parent 17b5693f34
commit 79782b4228
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
8 changed files with 157 additions and 137 deletions

View file

@ -1,5 +1,10 @@
"use client";
import { create } from "zustand";
export function setMode(mode) {
localStorage.setItem("mode", mode);
}
export function getMode() {
return localStorage.getItem("mode");
}
export function setTheme(theme) {
localStorage.setItem("theme", theme);
@ -8,13 +13,3 @@ export function getTheme() {
return localStorage.getItem("theme");
}
export const useThemeStore = create((set) => ({
theme: "light",
changeTheme: (theme) => {
set({ theme: theme });
setTheme(theme);
},
checkTheme: () => {
set({ theme: getTheme() || "light" });
}
}));