From 23df3fba023b0386749ca9518d8518d2878e31ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Mon, 8 Jan 2024 12:32:08 +0100 Subject: [PATCH] fix: use settings store to retrieve useColorFallback setting (#533) * fix: respect landingpage settings (use settings/server store, not localStore) * fix: use settings store to retrieve useColorFallback setting * fix: fixed imports --- src/route.js | 5 ++++- src/util/color.ts | 7 +++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/route.js b/src/route.js index 9f41c203..4330c6b6 100644 --- a/src/route.js +++ b/src/route.js @@ -1,6 +1,8 @@ import Vue from 'vue'; import VueRouter from 'vue-router'; +import { useSettingsStore } from '~/stores/settings'; + const Home = () => import('./views/Home.vue'); // Activity views for desktop @@ -30,7 +32,8 @@ const router = new VueRouter({ { path: '/', redirect: _to => { - return localStorage.landingpage || '/home'; + const settings = useSettingsStore(); + return settings.landingpage || '/home'; }, }, { path: '/home', component: Home }, diff --git a/src/util/color.ts b/src/util/color.ts index f5357572..7c1fe1cb 100644 --- a/src/util/color.ts +++ b/src/util/color.ts @@ -3,6 +3,7 @@ import { Category, matchString, loadClasses } from './classes'; import Color from 'color'; import * as d3 from 'd3'; import { IEvent, IBucket } from './interfaces'; +import { useSettingsStore } from '~/stores/settings'; // See here for examples: // https://bl.ocks.org/pstuffa/3393ff2711a53975040077b7453781a9 @@ -99,10 +100,8 @@ export function getCategoryColorFromString(str: string): string { function fallbackColor(str: string): string { // Get fallback color - // TODO: Fetch setting from somewhere better, where defaults are respected - const useColorFallback = - localStorage !== undefined ? localStorage.useColorFallback === 'true' : true; - if (useColorFallback) { + const settings = useSettingsStore(); + if (settings.useColorFallback) { return getColorFromString(str); } else { return COLOR_UNCAT;