Skip to content

Commit

Permalink
Revert "Revert "fix: use settings store to retrieve useColorFallback …
Browse files Browse the repository at this point in the history
…setting (#533)""

This reverts commit 6bffa65.
  • Loading branch information
ErikBjare committed Mar 26, 2024
1 parent 6bffa65 commit 8753ccf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/route.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 },
Expand Down
7 changes: 3 additions & 4 deletions src/util/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8753ccf

Please sign in to comment.