From 6599faf443bdb1497f9759fb4eaade689a06a7ff Mon Sep 17 00:00:00 2001 From: Ozgun Bal Date: Fri, 6 Oct 2023 22:22:32 +0300 Subject: [PATCH] Add taskbar alignment to local storage --- src/reducers/taskbar.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/reducers/taskbar.js b/src/reducers/taskbar.js index c11633b90..8acd80228 100644 --- a/src/reducers/taskbar.js +++ b/src/reducers/taskbar.js @@ -1,11 +1,13 @@ import { taskApps } from "../utils"; +const alignment = localStorage.getItem("taskbar-align") || "center"; + const defState = { apps: taskApps, prev: false, prevApp: "", prevPos: 0, - align: "center", + align: alignment, search: true, widgets: true, audio: 3, @@ -23,14 +25,17 @@ const taskReducer = (state = defState, action) => { align: "center", }; case "TASKLEF": + localStorage.setItem("taskbar-align", "left"); return { ...state, align: "left", }; case "TASKTOG": + const alignment = state.align == "left" ? "center" : "left"; + localStorage.setItem("taskbar-align", alignment); return { ...state, - align: state.align == "left" ? "center" : "left", + align: alignment, }; case "TASKPSHOW": return {