0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-29 14:43:04 +00:00
VueTube/NUXT/store/tweaks/index.js

70 lines
2.2 KiB
JavaScript
Raw Normal View History

2022-03-21 05:13:21 +00:00
export const state = () => ({
2022-12-27 01:16:06 +00:00
roundTweak: null,
roundThumb: null,
roundWatch: null,
launchTheme: null,
launchIconTheme: null,
2022-12-27 01:16:06 +00:00
navigationText: null,
navigationShift: null,
navigationIcons: null,
2022-03-21 23:47:11 +00:00
});
2022-03-21 05:13:21 +00:00
export const mutations = {
2022-03-21 23:47:11 +00:00
initTweaks(state) {
if (process.client) {
state.roundTweak = JSON.parse(localStorage.getItem("roundTweak")) || 0; // defaults to 0
2022-05-18 03:19:22 +00:00
state.roundThumb =
JSON.parse(localStorage.getItem("roundThumb")) === true; // defaults to false
2022-05-18 03:19:22 +00:00
state.roundWatch =
JSON.parse(localStorage.getItem("roundWatch")) === true; // defaults to false
2022-03-21 05:13:21 +00:00
}
state.launchTheme = JSON.parse(localStorage.getItem("launchTheme")) || 0; // defaults to 0
state.launchIconTheme =
JSON.parse(localStorage.getItem("launchIconTheme")) === true; // defaults to false
2022-12-27 01:16:06 +00:00
state.navigationText = !(
// false if false, defaults to true
(JSON.parse(localStorage.getItem("navigationText")) === false)
);
state.navigationShift = !(
// false if false, defaults to true
(JSON.parse(localStorage.getItem("navigationShift")) === false)
);
state.navigationIcons =
JSON.parse(localStorage.getItem("navigationIcons")) || 0; // defaults to 0
2022-03-21 23:47:11 +00:00
},
setRoundTweak(state, payload) {
if (!isNaN(payload)) {
state.roundTweak = payload;
localStorage.setItem("roundTweak", payload);
}
},
setRoundThumb(state, payload) {
state.roundThumb = payload;
localStorage.setItem("roundThumb", payload);
},
setRoundWatch(state, payload) {
state.roundWatch = payload;
localStorage.setItem("roundWatch", payload);
},
setLaunchTheme(state, payload) {
state.launchTheme = payload;
localStorage.setItem("launchTheme", payload);
},
setLaunchIconTheme(state, payload) {
state.launchIconTheme = payload;
localStorage.setItem("launchIconTheme", payload);
},
2022-12-27 01:16:06 +00:00
setNavigationText(state, payload) {
state.navigationText = payload;
localStorage.setItem("navigationText", payload);
},
setNavigationShift(state, payload) {
state.navigationShift = payload;
localStorage.setItem("navigationShift", payload);
},
setNavigationIcons(state, payload) {
state.navigationIcons = payload;
localStorage.setItem("navigationIcons", payload);
},
2022-03-21 23:47:11 +00:00
};