Skip to content

Commit

Permalink
shows corpus in query
Browse files Browse the repository at this point in the history
  • Loading branch information
lmoertl committed Dec 14, 2023
1 parent 079c693 commit 7ee76ae
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
16 changes: 13 additions & 3 deletions src/components/Search/QueryItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const storeQuery = queries.queries.find((q) => q.id === props.query.id) as unkno
{{ props.query.finalQuery }}
</span>
<div class="flex gap-2">
<VChip>{{ props.query.type }}</VChip>
<VBtn
density="compact"
icon="mdi-palette"
Expand All @@ -27,9 +26,20 @@ const storeQuery = queries.queries.find((q) => q.id === props.query.id) as unkno
</div>
</div>
</VCardTitle>
<VCardText v-if="storeQuery.showPicker">

<VCardText class="flex justify-between">
<VChip>
{{ props.query.corpus }}
{{ props.query.subCorpus ? ` / ${props.query.subCorpus}` : "" }}
</VChip>
<VChip>{{ props.query.type }}</VChip>
<!-- <p>userInput: {{ props.query.userInput }}</p> -->
<VColorPicker v-if="storeQuery.showPicker" v-model="storeQuery.color"></VColorPicker>
</VCardText>

<VCardActions v-if="storeQuery.showPicker">
<VExpandTransition v-if="storeQuery.showPicker">
<VColorPicker v-model="storeQuery.color"></VColorPicker>
</VExpandTransition>
</VCardActions>
</VCard>
</template>
6 changes: 5 additions & 1 deletion src/stores/query.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { acceptHMRUpdate, defineStore } from "pinia";
import { type Ref, ref } from "vue";

import { useCorporaStore } from "./corpora";

export const useQuery = defineStore(
"query",
() => {
const nextQueryId = ref(0);
const queries = ref([]) as Ref<Array<CorpusQuery>>;

const corporaStore = useCorporaStore();
function addQuery(userInput: string, type: CorpusQueryType) {
let finalQuery = "";
switch (type) {
Expand Down Expand Up @@ -35,6 +37,8 @@ export const useQuery = defineStore(
type,
userInput,
finalQuery,
corpus: corporaStore.selectedCorpus?.corpname ?? "",
subCorpus: corporaStore.selectedSubCorpus?.n ?? "",
preparedQuery: `aword,${finalQuery}`, // note: this is done in the old project, so we do it here too
showPicker: false,
data: {
Expand Down
2 changes: 2 additions & 0 deletions src/types/query.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ interface CorpusQuery {
preparedQuery: string;
color: string;
showPicker: boolean;
corpus: string;
subCorpus: string;

loading: {
yearlyFrequencies: boolean;
Expand Down

0 comments on commit 7ee76ae

Please sign in to comment.