Skip to content

Commit 078aa83

Browse files
committed
perf: optimize app
1 parent 6c7a501 commit 078aa83

37 files changed

+993
-1042
lines changed

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm lint:commit $1

.husky/install.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Skip Husky install in production and CI
2+
if (process.env.NODE_ENV === 'production' || process.env.CI === 'true') {
3+
process.exit(0)
4+
}
5+
const husky = (await import('husky')).default
6+
console.log(husky())

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm lint-staged

app/components/AvatarModal.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
icon="i-lucide-image"
1818
:src="current ?? undefined"
1919
class="w-28 h-28 md:w-32 md:h-32"
20-
:class="{ ' pointer-events-none': !edit }"
2120
/>
2221
<LazyUAvatar
2322
v-if="state.url && state.url !== current"
@@ -26,7 +25,6 @@
2625
:src="state.url"
2726
icon="i-lucide-image"
2827
class="w-28 h-28 md:w-32 md:h-32"
29-
:class="{ ' pointer-events-none': !edit }"
3028
/>
3129
</div>
3230
<UForm :state="state" :schema="schema" class="space-y-4" @submit="onSubmit">
@@ -41,7 +39,7 @@
4139
placeholder="https://example.com/avatar.jpg"
4240
>
4341
<template v-if="state.url?.length" #trailing>
44-
<UButton
42+
<LazyUButton
4543
size="sm"
4644
variant="link"
4745
color="neutral"

app/components/DataTable.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ import {
8888
type PaginationState,
8989
type VisibilityState
9090
} from '@tanstack/vue-table'
91-
import { upperFirst } from 'scule'
9291
9392
defineProps<{
9493
columns: TableColumn<T>[]
@@ -105,7 +104,7 @@ const table = useTemplateRef('table')
105104
const columnVisibility = ref<undefined | VisibilityState>()
106105
const pagination = ref<PaginationState>({ pageIndex: 0, pageSize: 10 })
107106
108-
const formatTableId = (id: string) => upperFirst(id.replaceAll('_', ' '))
107+
const formatTableId = (id: string) => capitalize(id.replaceAll('_', ' '))
109108
110109
defineExpose({ table })
111110
</script>

app/components/TranslateModal.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
required
1616
name="name"
1717
:description="name"
18-
:label="fields.name.label"
1918
:placeholder="fields.name.placeholder"
19+
:label="type === 'person' ? $t('person.name') : $t('event.title')"
2020
>
2121
<UInput v-model="state.name" class="w-full" />
2222
</UFormField>
@@ -110,11 +110,11 @@ async function onSubmit(event: FormSubmitEvent<Schema>) {
110110
111111
if (error) {
112112
showError({
113-
description: t('feedback.could-not-save', { item: event.data.name })
113+
description: t('feedback.could-not-save', { item: t('general.translation') })
114114
})
115115
} else {
116116
showSuccess({
117-
description: t('feedback.saved-successfully', { item: event.data.name })
117+
description: t('feedback.saved-successfully', { item: t('general.translation') })
118118
})
119119
open.value = false
120120
i18nStore.addTranslation(locale.value, props.name, event.data.name)

app/components/auth/AuthPasswordForm.vue

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,13 @@ const supabase = useSupabaseClient()
3737
const { showError, showSuccess } = useFlash()
3838
3939
async function onSubmit(payload: FormSubmitEvent<Schema>) {
40-
const { error } = await supabase.auth.updateUser({
41-
password: payload.data.password
42-
})
40+
const { error } = await supabase.auth.updateUser({ password: payload.data.password })
4341
if (error) {
4442
showError({ description: error.message })
4543
} else {
4644
if (props.onSuccess) await props.onSuccess()
4745
showSuccess({
48-
description: t('feedback.saved-successfully', {
49-
item: t('auth.password')
50-
})
46+
description: t('feedback.saved-successfully', { item: t('auth.password') })
5147
})
5248
}
5349
}

app/components/events/EventsAddModal.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
<template>
2-
<UModal
3-
v-model:open="open"
4-
:title="$t('event.new')"
5-
description="Add a new event to the database"
6-
>
2+
<UModal v-model:open="open" :title="$t('event.new')" :description="$t('event.new-description')">
73
<UButton icon="i-lucide:plus" :label="$t('event.new')" />
84

95
<template #body>

app/components/events/EventsForm.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
required
1919
name="slug"
2020
:label="$t('general.slug')"
21-
description="The unique identifier for this event in the URL."
21+
:description="$t('general.slug-description')"
2222
>
2323
<UInput
2424
v-model="state.slug"
@@ -36,7 +36,7 @@
3636
:cover="state.cover_url ? { src: state.cover_url, alt: '' } : undefined"
3737
>
3838
<template v-if="state.cover_url?.length" #trailing>
39-
<UButton
39+
<LazyUButton
4040
size="sm"
4141
variant="link"
4242
color="neutral"
@@ -51,7 +51,7 @@
5151
class="w-full"
5252
name="start_year"
5353
:label="$t('event.start-year')"
54-
:description="state.start_year ? undefined : 'A negative number means before Christ'"
54+
:description="$t('date.negative-description')"
5555
>
5656
<UInputNumber
5757
v-model="state.start_year"
@@ -75,7 +75,7 @@
7575
class="w-full"
7676
name="end_year"
7777
:label="$t('event.end-year')"
78-
:description="state.end_year ? undefined : 'A negative number means before Christ'"
78+
:description="$t('date.negative-description')"
7979
>
8080
<UInputNumber
8181
v-model="state.end_year"

app/components/events/EventsInfoCard.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ async function onSubmit(submitEvent: FormSubmitEvent<Schema>) {
8989
event.value = previousData
9090
showError({ description: error.message })
9191
} else {
92-
showSuccess({ description: t('feedback.saved-successfully', { item: t('event.noun') }) })
92+
showSuccess({
93+
description: t('feedback.saved-successfully', { item: translate(event.value.title) })
94+
})
9395
}
9496
}
9597
</script>

0 commit comments

Comments
 (0)