Skip to content

Commit

Permalink
full query and corpus everywhere closes #10
Browse files Browse the repository at this point in the history
  • Loading branch information
lmoertl committed Jan 2, 2024
1 parent 34a3623 commit 88832e1
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/components/DataDisplay/DataDisplayKeywordInContext.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { storeToRefs } from "pinia";
import Swal from "sweetalert2";
import type { Ref } from "vue";
import CorpusChip from "../Search/CorpusChip.vue";
import KWICDetailDialog from "./KWICDetailDialog.vue";
const queryStore = useQuery();
Expand Down Expand Up @@ -74,6 +75,7 @@ const selectedKWIC: Ref<KeywordInContext | null> = ref(null);
<span :style="`color: ${query.color}`">
{{ query.finalQuery }}
</span>
<CorpusChip :query="query" />
<VDataTable
v-model="selected"
density="compact"
Expand Down
2 changes: 1 addition & 1 deletion src/components/DataDisplay/DataDisplayMediaSource.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const series = computed(() => {
const allSeries = queries.value.map((query: CorpusQuery) => {
return {
color: query.color,
name: query.finalQuery,
name: `${query.finalQuery} ${query.corpus}${query.subCorpus ? ` / ${query.subCorpus}` : ""}`,
data: categories.value
.map((category) => query.data.mediaSources.find(({ media }) => category === media))
// @ts-ignore
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script lang="ts" setup>
import { storeToRefs } from "pinia";
import CorpusChip from "../Search/CorpusChip.vue";
const queryStore = useQuery();
const { queries } = storeToRefs(queryStore);
const mode = ref("relative");
Expand Down Expand Up @@ -29,13 +31,15 @@ const expand = ref(false);
<span :style="`color: ${query.color}`">
{{ query.finalQuery }}
</span>
<CorpusChip :query="query" />
</div>
</div>
<div v-for="query of queries" :key="query.id">
<div v-if="!query.loading.regionalFrequencies">
<div v-if="!query.loading.regionalFrequencies" class="mt-1">
<span :style="`color: ${query.color}`">
{{ query.finalQuery }}
</span>
<CorpusChip :query="query" />
<ClientOnly>
<MapChart :query="query" :mode="mode" />
</ClientOnly>
Expand Down
9 changes: 7 additions & 2 deletions src/components/DataDisplay/DataDisplayWordFormFrequencies.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ const expand = ref(false);
series: [
{
color: query.color,
name: 'relative value',
name: `${query.finalQuery} ${query.corpus}${
query.subCorpus ? ` / ${query.subCorpus}` : ''
}`,
data: query.data.wordFormFrequencies.map(({ relative, absolute }) =>
mode === 'relative' ? relative : absolute,
),
Expand All @@ -65,7 +67,10 @@ const expand = ref(false);
<div class="grid grid-cols-2 gap-2">
<div v-for="query of queries" :key="query.id">
<div v-if="!query.loading.wordFormFrequencies">
<span>{{ query.finalQuery }}</span>
<span :style="`color: ${query.color}`">
{{ query.finalQuery }}
</span>
<CorpusChip :query="query" />
<VDataTable :items="query.data.wordFormFrequencies" density="compact" />
</div>
<VProgressCircular v-else :color="query.color" indeterminate></VProgressCircular>
Expand Down
3 changes: 2 additions & 1 deletion src/components/DataDisplay/DataDisplayYearlyFrequencies.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const series = computed(() =>
queries.value
.filter((q: CorpusQuery) => !q.loading.yearlyFrequencies)
.map((query: CorpusQuery) => ({
name: query.userInput,
name: `${query.finalQuery} ${query.corpus}${query.subCorpus ? ` / ${query.subCorpus}` : ""}`,
data: query.data.yearlyFrequencies
.sort((a, b) => b.year - a.year)
.map((point) => [point.year, mode.value === "relative" ? point.relative : point.absolute]),
Expand Down
10 changes: 10 additions & 0 deletions src/components/Search/CorpusChip.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script setup lang="ts">
const props = defineProps<{ query: CorpusQuery }>();
</script>

<template>
<VChip>
{{ props.query.corpus }}
{{ props.query.subCorpus ? ` / ${props.query.subCorpus}` : "" }}
</VChip>
</template>
5 changes: 1 addition & 4 deletions src/components/Search/QueryItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ const storeQuery = queries.queries.find((q) => q.id === props.query.id) as unkno
</VCardTitle>

<VCardText class="flex justify-between">
<VChip>
{{ props.query.corpus }}
{{ props.query.subCorpus ? ` / ${props.query.subCorpus}` : "" }}
</VChip>
<CorpusChip :query="query"></CorpusChip>
<VChip>{{ props.query.type }}</VChip>
<!-- <p>userInput: {{ props.query.userInput }}</p> -->
</VCardText>
Expand Down
6 changes: 5 additions & 1 deletion src/composables/useYearlyFrequenciesSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ export function useYearlyFrequenciesSearch() {
});
// console.log({ freqttYear: freqttYear.value });
const freqttYear = _freqttYear.value as YearlyFrequencyData;
// console.log({ freqttYear });

/* eslint-disable-next-line */
const _yearlyData = freqttYear.Blocks ?? [];
// @ts-ignore
// console.log({ _yearlyData });

const yearlyData = _yearlyData[0]?.Items ?? [];
// console.log({ yearlyData });

// console.log({ yearlyData, blocks: freqttYear.value.Blocks, items: freqttYear.value.Blocks[0].Items });
// console.log('data', query.data);

Expand Down

0 comments on commit 88832e1

Please sign in to comment.