add off-balance alert treshold to settings

This commit is contained in:
calli
2025-04-22 18:08:53 +03:00
parent ac56adbcbe
commit 00a06a9681
4 changed files with 54 additions and 7 deletions

View File

@@ -29,6 +29,7 @@ const Home = () => {
const [piPrices, setPiPrices] = useState<EvePraisalResult | undefined>(
undefined,
);
const [balanceThreshold, setBalanceThreshold] = useState(1000);
const [colors, setColors] = useState<ColorSelectionType>(defaultColors);
const [alertMode, setAlertMode] = useState(false);
@@ -199,6 +200,17 @@ const Home = () => {
setAlertMode(JSON.parse(storedAlertMode));
}, []);
useEffect(() => {
const storedBalanceThreshold = localStorage.getItem("balanceThreshold");
if (storedBalanceThreshold) {
setBalanceThreshold(parseInt(storedBalanceThreshold));
}
}, []);
useEffect(() => {
localStorage.setItem("balanceThreshold", balanceThreshold.toString());
}, [balanceThreshold]);
useEffect(() => {
localStorage.setItem("compactMode", compactMode ? "true" : "false");
}, [compactMode]);
@@ -264,6 +276,8 @@ const Home = () => {
toggleAlertMode,
updatePlanetConfig,
readPlanetConfig,
balanceThreshold,
setBalanceThreshold,
}}
>
<CharacterContext.Provider