Skip to content

Commit a67ea61

Browse files
committed
use useRouterQuery
1 parent 361a63e commit a67ea61

18 files changed

Lines changed: 112 additions & 113 deletions

client/package-lock.json

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
},
1111
"dependencies": {
1212
"@primeuix/themes": "^1.1.1",
13+
"@vueuse/router": "^13.3.0",
1314
"axios": "^1.9.0",
1415
"content-disposition": "^0.5.4",
1516
"pinia": "^3.0.2",

client/src/App.vue

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
</template>
1010
</GTabs>
1111

12-
<GModal :show="appStore.errors.length > 0" title="Ocharme!" small @hide="appStore.resetErrors">
13-
<p>Please try again or contact
12+
<GModal :show="appStore.errors.length > 0" title="Ocharme!" @hide="appStore.resetErrors">
13+
<p>
14+
Please try again or contact
1415
<MailAddress /> for support.
1516
</p>
1617
<GInfo v-for="(error, i) in appStore.errors" :key="i" error>{{ error }}</GInfo>
1718
</GModal>
1819
</template>
1920

2021
<script setup lang="ts">
21-
// Stores
2222
import stores from "@/stores"
2323
2424
const appStore = stores.useApp()
@@ -34,25 +34,4 @@ onMounted(() => {
3434
background-color: var(--int-very-light-grey);
3535
min-height: 100vh;
3636
}
37-
38-
// @media (max-width: 800px) or (max-height: 700px) {
39-
// #app {
40-
// overflow: auto;
41-
// }
42-
43-
// .tabs.level-1 {
44-
// height: initial !important;
45-
// min-height: 100% !important;
46-
47-
// & > .header {
48-
// position: initial;
49-
// }
50-
// }
51-
// }
52-
53-
54-
// .tabs > .content {
55-
// padding: 10px 0 0 0 !important;
56-
// }
57-
// }
5837
</style>

client/src/components/input/GCheckBox.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function check(): void {
2727
-ms-user-select: none;
2828
user-select: none;
2929
width: fit-content;
30+
white-space: nowrap;
3031
3132
/* Hide the browser's default checkbox */
3233
.checkbox {

client/src/components/input/GInput.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<template>
22
<!-- with clear button-->
33
<fieldset class="clear" v-if="clearBtn">
4-
<input v-model="model" :type :placeholder :list ref="inputElement" @keyup.enter="$emit('enter')" />
5-
<input type="reset" value="&#10006;" :disabled="model === null || model.length == 0" title="Clear"
6-
@click="model = ''" />
4+
<input v-model="model" :type :placeholder :list ref="inputElement" />
5+
<input type="reset" value="&#10006;" :disabled="model?.length == 0" title="Clear" @click="model = ''" />
76
</fieldset>
87
<!-- without clear button -->
9-
<input v-else v-model="model" :type :placeholder :list ref="inputElement" @keyup.enter="$emit('enter')" />
8+
<input v-else v-model="model" :type :placeholder :list ref="inputElement" />
109
<GValidator v-if="validator && validityDescriptor" :model :validator :validityDescriptor />
1110
</template>
1211

client/src/components/input/JobSelect.vue

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,23 @@ const props = defineProps({
3535
const title = computed<string>(
3636
() => props.customTitle ?? (props.isReference ? "Reference" : "Hypothesis"),
3737
)
38-
const selectedJob = ref<string>()
38+
const selectedJob = computed({
39+
// getter
40+
get() {
41+
return props.isReference ? jobSelectionStore.referenceJobId : jobSelectionStore.hypothesisJobId
42+
},
43+
// setter
44+
set(newValue) {
45+
// Note: we are using destructuring assignment syntax here.
46+
if (props.isReference) {
47+
jobSelectionStore.referenceJobId = newValue
48+
} else {
49+
jobSelectionStore.hypothesisJobId = newValue
50+
}
51+
}
52+
})
53+
54+
3955
// Whether there are documents that have not been tagged yet.
4056
// Not relevant for source layer.
4157
const untaggedDocsExist = computed(() => {
@@ -55,27 +71,4 @@ const sourceLayerHasMissingAnnotations = computed(() => {
5571
if (job.tagger.id !== SOURCE_LAYER) return false
5672
return job.progress.finished !== documentsStore.numSourceAnnotations
5773
})
58-
59-
// Watches & mounts
60-
// watch both referenceJobId and hypothesisJobId
61-
watch(
62-
() => [jobSelectionStore.referenceJobId, jobSelectionStore.hypothesisJobId],
63-
() => {
64-
if (props.isReference)
65-
selectedJob.value = jobSelectionStore.referenceJobId
66-
else selectedJob.value = jobSelectionStore.hypothesisJobId
67-
},
68-
{ immediate: true },
69-
)
70-
// reverse
71-
watch(
72-
selectedJob,
73-
() => {
74-
if (!selectedJob.value) return
75-
if (props.isReference)
76-
jobSelectionStore.referenceJobId = selectedJob.value
77-
else jobSelectionStore.hypothesisJobId = selectedJob.value
78-
},
79-
{ immediate: true },
80-
)
8174
</script>

client/src/components/links/MailAddress.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
<script setup lang="ts">
88
const { address = "servicedesk@ivdnt.org" } = defineProps<{
9-
address: string
9+
address?: string
1010
}>()
1111
</script>

client/src/components/modals/DeleteModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<GModal small title="Are you sure?" :show @hide="$emit('hide')">
2+
<GModal title="Are you sure?" :show @hide="$emit('hide')">
33
<p>
44
You will <slot name="action">delete</slot> <b>{{ displayname }}</b>. This can not be undone.
55
</p>

client/src/components/modals/GModal.vue

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- v-if instead of v-show such that elements inside a GModal can rely on onMounted()-->
33
<dialog v-if="show" ref="modal" class="modal view" tabindex="0" @click.self="$emit('hide')"
44
@keyup.esc="$emit('hide')">
5-
<GCard class="content" :class="{ small: small }" :title>
5+
<GCard class="content" :title>
66
<template v-if="$slots.title" #title>
77
<slot name="title"></slot>
88
</template>
@@ -22,11 +22,9 @@
2222
const {
2323
show,
2424
title,
25-
small = true,
2625
} = defineProps<{
2726
show: boolean
2827
title?: string
29-
small?: boolean
3028
}>()
3129
3230
const emit = defineEmits<{
@@ -63,11 +61,7 @@ onMounted(() => {
6361
6462
.content {
6563
border: 1px solid var(--int-light-grey);
66-
width: 100%;
67-
68-
&.small {
69-
width: fit-content;
70-
}
64+
width: fit-content;
7165
}
7266
7367
.buttons {

client/src/components/modals/VariantsModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<GModal small :show @hide="$emit('hide')">
2+
<GModal :show @hide="$emit('hide')">
33
<template #title>
44
Types of lemma <i>{{ variantsToDisplay?.lemma }}</i> and part-of-speech
55
<i>{{ variantsToDisplay?.pos }}</i>

0 commit comments

Comments
 (0)