diff options
Diffstat (limited to 'app/assets/javascripts/search/store/getters.js')
-rw-r--r-- | app/assets/javascripts/search/store/getters.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/assets/javascripts/search/store/getters.js b/app/assets/javascripts/search/store/getters.js index 0278239c144..36d98233e28 100644 --- a/app/assets/javascripts/search/store/getters.js +++ b/app/assets/javascripts/search/store/getters.js @@ -1,4 +1,6 @@ +import { findKey, has } from 'lodash'; import { languageFilterData } from '~/search/sidebar/constants/language_filter_data'; + import { GROUPS_LOCAL_STORAGE_KEY, PROJECTS_LOCAL_STORAGE_KEY } from './constants'; export const frequentGroups = (state) => { @@ -9,10 +11,18 @@ export const frequentProjects = (state) => { return state.frequentItems[PROJECTS_LOCAL_STORAGE_KEY]; }; -export const langugageAggregationBuckets = (state) => { +export const languageAggregationBuckets = (state) => { return ( state.aggregations.data.find( (aggregation) => aggregation.name === languageFilterData.filterParam, )?.buckets || [] ); }; + +export const currentScope = (state) => findKey(state.navigation, { active: true }); + +export const queryLanguageFilters = (state) => state.query[languageFilterData.filterParam] || []; + +export const currentUrlQueryHasLanguageFilters = (state) => + has(state.urlQuery, languageFilterData.filterParam) && + state.urlQuery[languageFilterData.filterParam]?.length > 0; |