Switch to translatable data
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import superjson, { type SuperJSONResult } from 'superjson';
|
||||
import { useI18nKey } from '~/composables/useI18nKey';
|
||||
import { useTitleStore } from '~/stores/title';
|
||||
import { fullDate } from '~~/server/utils/date';
|
||||
|
||||
@@ -11,6 +12,7 @@ const app = useNuxtApp();
|
||||
const { loggedIn } = useUserSession();
|
||||
const localePath = useLocalePath();
|
||||
const { t, d } = useI18n();
|
||||
const { tKey, hasKey } = useI18nKey();
|
||||
const router = useRouter();
|
||||
|
||||
const { confirm } = useModal();
|
||||
@@ -36,7 +38,7 @@ const formData = useCloned(data, {
|
||||
|
||||
useHead({
|
||||
title: t('layouts.title', {
|
||||
title: data.value?.name || name
|
||||
title: hasKey(data.value, 'name') ? tKey(data.value!, 'name').value : name
|
||||
})
|
||||
});
|
||||
|
||||
@@ -46,7 +48,7 @@ watch(loggedIn, (isLoggedIn) => {
|
||||
}
|
||||
});
|
||||
|
||||
titleStore.title = data.value?.name;
|
||||
titleStore.title = data.value ? tKey(data.value, 'name').value : undefined;
|
||||
|
||||
const loading = ref(false);
|
||||
|
||||
@@ -114,6 +116,7 @@ async function kick(member: {
|
||||
init({
|
||||
title: 'Error while kicking',
|
||||
color: 'danger',
|
||||
// @ts-expect-error weird error stuff
|
||||
message: e?.message || e?.statusMessage || t(parseError(e))
|
||||
});
|
||||
}
|
||||
@@ -143,6 +146,7 @@ async function addUser() {
|
||||
init({
|
||||
title: 'Error while adding',
|
||||
color: 'danger',
|
||||
// @ts-expect-error weird error stuff
|
||||
message: e?.message || e?.statusMessage || t(parseError(e))
|
||||
});
|
||||
}
|
||||
@@ -157,17 +161,31 @@ async function addUser() {
|
||||
<h1>admin</h1>
|
||||
<VaForm v-if="formData.cloned.value && data" class="flex flex-col gap-4">
|
||||
<VaInput
|
||||
label="Name"
|
||||
v-model="formData.cloned.value.name"
|
||||
label="Name DE"
|
||||
v-model="formData.cloned.value.name_de"
|
||||
clearable
|
||||
:clear-value="data.name"
|
||||
:clear-value="data.name_de"
|
||||
clearable-icon="replay"
|
||||
/>
|
||||
<VaInput
|
||||
label="Name EN"
|
||||
v-model="formData.cloned.value.name_en"
|
||||
clearable
|
||||
:clear-value="data.name_en"
|
||||
clearable-icon="replay"
|
||||
/>
|
||||
<VaTextarea
|
||||
label="Description"
|
||||
v-model="formData.cloned.value.description"
|
||||
label="Description DE"
|
||||
v-model="formData.cloned.value.description_de"
|
||||
clearable
|
||||
:clear-value="data.description"
|
||||
:clear-value="data.description_de"
|
||||
clearable-icon="replay"
|
||||
/>
|
||||
<VaTextarea
|
||||
label="Description EN"
|
||||
v-model="formData.cloned.value.description_en"
|
||||
clearable
|
||||
:clear-value="data.description_en"
|
||||
clearable-icon="replay"
|
||||
/>
|
||||
<VaCheckbox label="Virtual" v-model="formData.cloned.value.virtual" />
|
||||
|
||||
Reference in New Issue
Block a user