Skip to content

Commit 23df3fb

Browse files
authored
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
1 parent 845b12f commit 23df3fb

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/route.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import Vue from 'vue';
22
import VueRouter from 'vue-router';
33

4+
import { useSettingsStore } from '~/stores/settings';
5+
46
const Home = () => import('./views/Home.vue');
57

68
// Activity views for desktop
@@ -30,7 +32,8 @@ const router = new VueRouter({
3032
{
3133
path: '/',
3234
redirect: _to => {
33-
return localStorage.landingpage || '/home';
35+
const settings = useSettingsStore();
36+
return settings.landingpage || '/home';
3437
},
3538
},
3639
{ path: '/home', component: Home },

src/util/color.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Category, matchString, loadClasses } from './classes';
33
import Color from 'color';
44
import * as d3 from 'd3';
55
import { IEvent, IBucket } from './interfaces';
6+
import { useSettingsStore } from '~/stores/settings';
67

78
// See here for examples:
89
// https://bl.ocks.org/pstuffa/3393ff2711a53975040077b7453781a9
@@ -99,10 +100,8 @@ export function getCategoryColorFromString(str: string): string {
99100

100101
function fallbackColor(str: string): string {
101102
// Get fallback color
102-
// TODO: Fetch setting from somewhere better, where defaults are respected
103-
const useColorFallback =
104-
localStorage !== undefined ? localStorage.useColorFallback === 'true' : true;
105-
if (useColorFallback) {
103+
const settings = useSettingsStore();
104+
if (settings.useColorFallback) {
106105
return getColorFromString(str);
107106
} else {
108107
return COLOR_UNCAT;

0 commit comments

Comments
 (0)