Skip to content

Commit c31500d

Browse files
committed
cleanup
1 parent 946dbc2 commit c31500d

File tree

7 files changed

+41
-50
lines changed

7 files changed

+41
-50
lines changed

components/DocumentEditorInput.vue

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
<!-- Auto-grow text-input, idea taken from https://css-tricks.com/auto-growing-inputs-textareas/ -->
33
<span class="inline-block relative">
44
<t-input
5-
:value="value"
5+
v-model="value"
66
variant="plain"
77
class="absolute w-full left-0 py-1"
8-
@input="update"
98
/>
109
<span
1110
class="inline-block px-3 py-1 text-base invisible border"
@@ -16,15 +15,5 @@
1615
</template>
1716

1817
<script setup lang="ts">
19-
defineProps<{
20-
value?: string
21-
}>()
22-
23-
const emit = defineEmits<{
24-
input: [value: string]
25-
}>()
26-
27-
function update(newValue: string) {
28-
emit('input', newValue)
29-
}
18+
const value = defineModel<string | null | Date>()
3019
</script>

components/SideBar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const { result } = useQuery(
108108
}
109109
}
110110
}
111-
`) as any,
111+
`),
112112
)
113113
const groups = computed(() => result.value?.me?.groups ?? null)
114114

components/tagify.vue

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,41 @@
1313
import Tagify from '@yaireo/tagify'
1414
import '@yaireo/tagify/dist/tagify.css'
1515
16-
const props = withDefaults(defineProps<{
17-
type?: string
18-
settings?: Tagify.TagifySettings
19-
value?: Tagify.TagData[]
20-
delimiters?: string
21-
whitelist?: Tagify.TagData[]
22-
tagClass?: string
23-
}>(), {
24-
type: 'input',
25-
settings: () => ({}),
26-
value: () => [],
27-
delimiters: ',',
28-
whitelist: () => [],
29-
tagClass: '',
30-
})
16+
const props = withDefaults(
17+
defineProps<{
18+
type?: string
19+
settings?: Tagify.TagifySettings
20+
value?: Tagify.TagData[]
21+
delimiters?: string
22+
whitelist?: Tagify.TagData[]
23+
tagClass?: string
24+
}>(),
25+
{
26+
type: 'input',
27+
settings: () => ({}),
28+
value: () => [],
29+
delimiters: ',',
30+
whitelist: () => [],
31+
tagClass: '',
32+
},
33+
)
3134
3235
const emit = defineEmits<{
3336
input: [value: string | Tagify.TagData[]]
3437
}>()
3538
3639
const tagify = ref<Tagify | null>(null)
3740
38-
watch(() => props.value, (newVal) => {
39-
// Value modified externally, update tagify
40-
if (newVal) {
41-
tagify.value?.loadOriginalValues(newVal as unknown as string | string[])
42-
}
43-
})
41+
watch(
42+
() => props.value,
43+
(newVal) => {
44+
// Value modified externally, update tagify
45+
if (newVal) {
46+
// @ts-expect-error: problem in tagify types
47+
tagify.value?.loadOriginalValues(newVal)
48+
}
49+
},
50+
)
4451
4552
onMounted(() => {
4653
// Install tagify
@@ -73,10 +80,7 @@ onUnmounted(() => {
7380
7481
function onChange(event: { target: EventTarget | null }) {
7582
// Update value prop
76-
emit(
77-
'input',
78-
(event.target as HTMLInputElement | null)?.value ?? [],
79-
)
83+
emit('input', (event.target as HTMLInputElement | null)?.value ?? [])
8084
}
8185
</script>
8286

layouts/error.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
<section>
1010
<div class="text-center">
1111
<jabref-logo class="m-auto h-32" />
12-
<h1 class="text-5xl font-light pt-3">Error {{ error?.statusCode }}</h1>
12+
<h1 class="text-5xl font-light pt-3">Error {{ error.statusCode }}</h1>
1313
<h2 class="text-xl font-light text-gray-500 pt-3">
14-
{{ error?.message }}
14+
{{ error.message }}
1515
</h2>
1616
<nuxt-link
17-
v-if="error?.statusCode === 404"
17+
v-if="error.statusCode === 404"
1818
class="button"
1919
to="/"
2020
>
@@ -29,9 +29,9 @@
2929
definePageMeta({ layout: false })
3030
3131
defineProps<{
32-
error?: {
32+
error: {
3333
statusCode: number
3434
message: string
35-
} | null
35+
}
3636
}>()
3737
</script>

pages/change-password/[token].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const {
7171
}
7272
}
7373
}
74-
`) as any,
74+
`),
7575
() => ({
7676
variables: {
7777
input: {

pages/user/forgot-password.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const {
6262
result
6363
}
6464
}
65-
`) as any,
65+
`),
6666
() => ({
6767
variables: {
6868
input: {

pages/user/register.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const {
100100
}
101101
}
102102
}
103-
`) as any,
103+
`),
104104
() => ({
105105
variables: {
106106
input: {
@@ -111,9 +111,7 @@ const {
111111
update(cache, { data }) {
112112
cacheCurrentUser(
113113
cache,
114-
data?.signup?.__typename === 'UserReturned'
115-
? data.signup.user
116-
: null,
114+
data?.signup?.__typename === 'UserReturned' ? data.signup.user : null,
117115
)
118116
},
119117
}),

0 commit comments

Comments
 (0)