Skip to content

Commit

Permalink
31 searchsettings cookie includes labels for searchkeys (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctot-nondef authored Jan 19, 2024
2 parents 2c67079 + 24d27f3 commit 73d7b04
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
15 changes: 14 additions & 1 deletion src/components/Search/SearchDimensions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,18 @@ const { selectedSearches, possibleSearchKeys } = storeToRefs(searchSettings);
clearable
chips
:items="possibleSearchKeys"
/>
>
<template v-slot:chip="{ props, item }">

Check warning on line 20 in src/components/Search/SearchDimensions.vue

View workflow job for this annotation

GitHub Actions / Validate (18.x, ubuntu-latest)

Expected '#chip' instead of 'v-slot:chip'
<VChip v-bind="props" :text="t(item.value)"></VChip>
</template>

<template v-slot:item="{ props, item }">

Check warning on line 24 in src/components/Search/SearchDimensions.vue

View workflow job for this annotation

GitHub Actions / Validate (18.x, ubuntu-latest)

Expected '#item' instead of 'v-slot:item'
<!-- @vue-ignore i18n typing doesn't seem to work for templated strings -->
<VListItem
v-bind="props"
:title="t(item.value)"
:subtitle="t(`${item.value}Desc`)"
></VListItem>
</template>
</VAutocomplete>
</template>
21 changes: 11 additions & 10 deletions src/stores/searchSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ export const useSearchSettingsStore = defineStore(
const { getRegionsFrequencies } = useRegionsSearch();
const { getKeywordInContext } = useKeywordInContextSearch();

const t = useTranslations("Corpsum");
const possibleSearchKeys: Ref<Array<{ value: SearchFunctionKey; title: string }>> = ref([
{ value: "yearlyFrequencies", title: t("yearlyFrequencies") },
{ value: "wordFormFrequencies", title: t("wordFormFrequencies") },
{ value: "regionalFrequencies", title: t("regionalFrequencies") },
{ value: "mediaSources", title: t("mediaSources") },
{ value: "keywordInContext", title: t("keywordInContext") },
const possibleSearchKeys: Ref<Array<string>> = ref([
"yearlyFrequencies",
"wordFormFrequencies",
"regionalFrequencies",
"mediaSources",
"keywordInContext",
]);

const searchFunctions: Record<SearchFunctionKey, (query: CorpusQuery) => Promise<void>> = {
Expand All @@ -40,8 +39,6 @@ export const useSearchSettingsStore = defineStore(
]);

async function doSearches(query: CorpusQuery) {
// console.log({ selsearchVal: selectedSearches.value });

return await Promise.all(
selectedSearches.value.map(
(a: SearchFunctionKey) =>
Expand Down Expand Up @@ -82,7 +79,11 @@ export const useSearchSettingsStore = defineStore(
doSearches,
};
},
{ persist: true },
{
persist: {
paths: ["selectedSearches"],
},
},
);

if (import.meta.hot) {
Expand Down

0 comments on commit 73d7b04

Please sign in to comment.