From 8f893c36d7fb1415bdd4329cbc3dc909239cc0e6 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 14 Aug 2022 20:32:23 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Removed=20config=20dependency=20fro?= =?UTF-8?q?m=20searchbar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Settings/SearchBar.vue | 3 ++- src/utils/ConfigHelpers.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/Settings/SearchBar.vue b/src/components/Settings/SearchBar.vue index 22654b2a..42d7cc77 100644 --- a/src/components/Settings/SearchBar.vue +++ b/src/components/Settings/SearchBar.vue @@ -95,7 +95,8 @@ export default { }, /* If configured, launch specific app when hotkey pressed */ handleHotKey(key) { - const usersHotKeys = this.getCustomKeyShortcuts(); + const sections = this.$store.getters.sections || []; + const usersHotKeys = this.getCustomKeyShortcuts(sections); usersHotKeys.forEach((hotkey) => { if (hotkey.hotkey === parseInt(key, 10)) { if (hotkey.url) window.open(hotkey.url, '_blank'); diff --git a/src/utils/ConfigHelpers.js b/src/utils/ConfigHelpers.js index 544fd8e1..a2944bf1 100644 --- a/src/utils/ConfigHelpers.js +++ b/src/utils/ConfigHelpers.js @@ -1,4 +1,5 @@ import ConfigAccumulator from '@/utils/ConfigAccumalator'; +// import $store from '@/store'; import filterUserSections from '@/utils/CheckSectionVisibility'; import { languages } from '@/utils/languages'; import { @@ -77,9 +78,8 @@ export const componentVisibility = (appConfig) => { * Returns a list of items which the user has assigned a hotkey to * So that when the hotkey is pressed, the app/ service can be launched */ -export const getCustomKeyShortcuts = () => { +export const getCustomKeyShortcuts = (sections) => { const results = []; - const sections = config.sections || []; sections.forEach((section) => { const itemsWithHotKeys = section.items.filter(item => item.hotkey); results.push(itemsWithHotKeys.map(item => ({ hotkey: item.hotkey, url: item.url })));