Start i18n on static texts
This commit is contained in:
@@ -45,7 +45,7 @@ titleStore.title = data.value ? tKey(data.value, 'title').value : undefined;
|
||||
`/hunt/${data ? tSluggy(data.hunt).value : sluggy(huntSlug!)}`
|
||||
)
|
||||
"
|
||||
>Back to Hunt</VaButton
|
||||
>{{ t('pages.common.back_to_hunt') }}</VaButton
|
||||
>
|
||||
<VaButton icon="replay" color="success" @click="refresh"
|
||||
>Refresh</VaButton
|
||||
|
||||
@@ -85,14 +85,14 @@ async function submit() {
|
||||
newImage.value = undefined;
|
||||
} catch (e) {
|
||||
if (e instanceof Error && 'statusCode' in e && e.statusCode === 418) {
|
||||
submitError.value = 'Answer is already finalized, no update allowed!';
|
||||
submitError.value = t('page.quest.already_finalized');
|
||||
await refresh();
|
||||
} else if (
|
||||
e instanceof Error &&
|
||||
'statusCode' in e &&
|
||||
e.statusCode === 409
|
||||
) {
|
||||
submitError.value = 'Conflict: Please refresh';
|
||||
submitError.value = t('page.quest.conflict');
|
||||
} else {
|
||||
submitError.value = parseError(e);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ const createImageURL = (file: File) => URL.createObjectURL(file);
|
||||
`/hunt/${data ? tSluggy(data.hunt).value : sluggy(huntSlug!)}`
|
||||
)
|
||||
"
|
||||
>Back to Hunt</VaButton
|
||||
>{{ t('pages.common.back_to_hunt') }}</VaButton
|
||||
>
|
||||
<VaButton
|
||||
icon="refresh"
|
||||
@@ -134,7 +134,7 @@ const createImageURL = (file: File) => URL.createObjectURL(file);
|
||||
`/hunt/${data?.hunt ? tSluggy(data.hunt).value : sluggy(huntSlug!)}/${data ? tSluggy(data).value : sluggy(questSlug!)}}/admin`
|
||||
)
|
||||
"
|
||||
>Admin</VaButton
|
||||
>{{ t('pages.common.admin') }}</VaButton
|
||||
></VaButtonGroup
|
||||
>
|
||||
<div v-if="data">
|
||||
@@ -164,21 +164,27 @@ const createImageURL = (file: File) => URL.createObjectURL(file);
|
||||
🖋: {{ t(`enums.text_type.${data.textType}`) }}
|
||||
</p>
|
||||
<p v-if="hasKey(data, 'extraText')">
|
||||
<span class="uppercase">Extra points:</span>
|
||||
<span class="uppercase">{{
|
||||
t('page.quest.extra_points')
|
||||
}}</span>
|
||||
{{ tKey(data, 'extraText') }}
|
||||
</p>
|
||||
</div>
|
||||
</VaCardContent>
|
||||
</VaCard>
|
||||
<VaCard v-if="data.answer?.review" color="info">
|
||||
<VaCardTitle>Review</VaCardTitle>
|
||||
<VaCardTitle>{{ t('page.quest.review') }}</VaCardTitle>
|
||||
<VaCardContent>
|
||||
<p v-if="data.answer.review?.score" class="mb-2">
|
||||
Score:
|
||||
{{ t('page.quest.score') }}
|
||||
<VaChip color="success">{{ data.answer.review.score }}</VaChip>
|
||||
<span v-if="data.answer.review.reviewer" class="text-sm">
|
||||
by {{ data.answer.review.reviewer.name }} at
|
||||
{{ d(data.answer.review.updatedAt, fullDate) }}</span
|
||||
{{
|
||||
t('page.quest.reviewed_by', {
|
||||
name: data.answer.review.reviewer.name,
|
||||
date: d(data.answer.review.updatedAt, fullDate)
|
||||
})
|
||||
}}</span
|
||||
>
|
||||
</p>
|
||||
<div
|
||||
@@ -200,7 +206,7 @@ const createImageURL = (file: File) => URL.createObjectURL(file);
|
||||
stripe
|
||||
:stripe-color="data.answer?.final ? 'success' : 'primary'"
|
||||
>
|
||||
<VaCardTitle>Submission</VaCardTitle>
|
||||
<VaCardTitle>{{ t('page.quest.submission') }}</VaCardTitle>
|
||||
<VaCardContent>
|
||||
<div class="flex flex-col gap-4">
|
||||
<VaInput
|
||||
@@ -208,7 +214,7 @@ const createImageURL = (file: File) => URL.createObjectURL(file);
|
||||
v-model="answer"
|
||||
:label="tKey(data, 'question').value"
|
||||
:disabled="uploading || data.answer?.final"
|
||||
placeholder="Your answer"
|
||||
:placeholder="t('page.quest.your_answer')"
|
||||
:required-mark="data.textRequired"
|
||||
:clearable="!!data.answer?.text"
|
||||
:clear-value="data.answer?.text || ''"
|
||||
@@ -216,7 +222,7 @@ const createImageURL = (file: File) => URL.createObjectURL(file);
|
||||
:type="textType[data.textType]"
|
||||
:messages="[
|
||||
t(`enums.text_type.${data.textType}`),
|
||||
data.textRequired ? 'Required Answer' : ''
|
||||
data.textRequired ? t('page.quest.required_answer') : ''
|
||||
]"
|
||||
>
|
||||
<template v-if="data.textUnit" #appendInner>
|
||||
@@ -247,15 +253,18 @@ const createImageURL = (file: File) => URL.createObjectURL(file);
|
||||
file-types="jpg,png,jpeg"
|
||||
/>
|
||||
<p v-if="data.answer?.updatedAt">
|
||||
Last update:
|
||||
{{ d(data.answer.updatedAt, fullDate) }}
|
||||
by {{ data.answer.member.name }}
|
||||
{{
|
||||
t('page.quest.last_update', {
|
||||
date: d(data.answer.updatedAt, fullDate),
|
||||
name: data.answer.member.name
|
||||
})
|
||||
}}
|
||||
</p>
|
||||
<VaCheckbox
|
||||
v-model="final"
|
||||
:disabled="data.answer?.final"
|
||||
label="Finalize answer"
|
||||
messages="This allows the admins to review your answer and give you points. You cannot change your answer afterwards!"
|
||||
:label="t('page.quest.finalize')"
|
||||
:messages="t('page.quest.already_finalized')"
|
||||
/>
|
||||
|
||||
<VaAlert
|
||||
@@ -275,10 +284,10 @@ const createImageURL = (file: File) => URL.createObjectURL(file);
|
||||
"
|
||||
:loading="uploading"
|
||||
@click="submit"
|
||||
>Update</VaButton
|
||||
>{{ t('page.common.update_btn') }}</VaButton
|
||||
>
|
||||
<p v-else class="font-bold">
|
||||
Your final answer has already been submitted!
|
||||
{{ t('page.quest.already_submitted') }}
|
||||
</p>
|
||||
</div>
|
||||
</VaCardContent>
|
||||
|
||||
@@ -54,7 +54,7 @@ const { data, refresh, error } = await useFetch(`/api/hunt/${id}/diashow`, {
|
||||
useHead({
|
||||
title: t('layouts.two_title', {
|
||||
title: data.value?.name || name,
|
||||
subtitle: 'Diashow'
|
||||
subtitle: t('pages.diashow.head')
|
||||
})
|
||||
});
|
||||
|
||||
@@ -92,28 +92,29 @@ titleStore.title = data.value?.name;
|
||||
v-else-if="error"
|
||||
class="flex h-full w-full flex-col items-center justify-center text-center text-2xl"
|
||||
>
|
||||
<VaAlert color="danger" class="w-[90%]"
|
||||
>Answers are not revealed yet, please wait until the end!</VaAlert
|
||||
>
|
||||
<VaAlert color="danger" class="w-[90%]">{{
|
||||
t('pages.common.not_revealed')
|
||||
}}</VaAlert>
|
||||
<VaAlert v-if="error.statusCode !== 403" color="danger" class="w-[90%]">{{
|
||||
error
|
||||
}}</VaAlert
|
||||
><VaButton
|
||||
icon="arrow_back"
|
||||
:to="$localePath(`/hunt/${sluggy($nuxt.$slugData.huntSlug!)}`)"
|
||||
>Back to Hunt</VaButton
|
||||
>{{ t('pages.common.back_to_hunt') }}</VaButton
|
||||
>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="flex h-full w-full flex-col items-center justify-center text-center text-2xl"
|
||||
>
|
||||
<VaAlert color="danger" class="w-[90%]"
|
||||
>Answers are not revealed yet, please wait until the end!</VaAlert
|
||||
<VaAlert color="danger" class="w-[90%]">{{
|
||||
t('pages.common.not_revealed')
|
||||
}}</VaAlert
|
||||
><VaButton
|
||||
icon="arrow_back"
|
||||
:to="$localePath(`/hunt/${sluggy($nuxt.$slugData.huntSlug!)}`)"
|
||||
>Back to Hunt</VaButton
|
||||
>{{ t('pages.common.back_to_hunt') }}</VaButton
|
||||
>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
@@ -46,9 +46,9 @@ async function invite() {
|
||||
<h1 class="text-2xl">
|
||||
{{ data ? tKey(data, 'name') : name }}
|
||||
|
||||
<VaChip v-if="data?.totalScore" class="float-right" color="success"
|
||||
>Total points: {{ data!!.totalScore }}</VaChip
|
||||
>
|
||||
<VaChip v-if="data?.totalScore" class="float-right" color="success">{{
|
||||
t('page.hunt.total_points', data!!.totalScore)
|
||||
}}</VaChip>
|
||||
</h1>
|
||||
<div class="grid w-full grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-6">
|
||||
<VaButton
|
||||
@@ -56,7 +56,7 @@ async function invite() {
|
||||
:disabled="pending"
|
||||
title="Refresh"
|
||||
@click="refresh"
|
||||
>Refresh</VaButton
|
||||
>{{ t('page.common.refresh') }}</VaButton
|
||||
>
|
||||
|
||||
<VaButton
|
||||
@@ -64,34 +64,34 @@ async function invite() {
|
||||
color="success"
|
||||
icon="leaderboard"
|
||||
:to="$localePath(`/hunt/${tSluggy(data).value}/showcase`)"
|
||||
>Showcase</VaButton
|
||||
>{{ t('page.hunt.showcase') }}</VaButton
|
||||
>
|
||||
<VaButton
|
||||
v-if="(data?.revealAnswers && data?.revealQuests) || data?.isMember"
|
||||
color="success"
|
||||
icon="collections"
|
||||
:to="$localePath(`/hunt/${tSluggy(data).value}/diashow`)"
|
||||
>Diashow</VaButton
|
||||
>{{ t('page.hunt.diashow') }}</VaButton
|
||||
>
|
||||
<VaButton
|
||||
v-if="(data?.revealAnswers && data?.revealQuests) || data?.isMember"
|
||||
color="success"
|
||||
icon="auto_awesome_mosaic"
|
||||
:to="$localePath(`/hunt/${tSluggy(data).value}/pictures`)"
|
||||
>All pictures</VaButton
|
||||
>{{ t('page.hunt.all_pictures') }}</VaButton
|
||||
>
|
||||
<VaButton
|
||||
v-if="data?.isMember"
|
||||
color="danger"
|
||||
icon="edit"
|
||||
:to="$localePath(`/hunt/${tSluggy(data).value}/admin`)"
|
||||
>Admin</VaButton
|
||||
>{{ t('page.common.admin') }}</VaButton
|
||||
><VaButton
|
||||
v-if="data?.isMember"
|
||||
color="danger"
|
||||
icon="groups"
|
||||
:to="$localePath(`/hunt/${tSluggy(data).value}/teams`)"
|
||||
>Teams</VaButton
|
||||
>{{ t('page.hunt.teams') }}</VaButton
|
||||
>
|
||||
</div>
|
||||
<div v-if="data">
|
||||
@@ -110,22 +110,34 @@ async function invite() {
|
||||
:title="data ? tKey(data, 'name').value : name"
|
||||
/>
|
||||
<p v-if="data.start">
|
||||
Start:
|
||||
{{ d(data.start, fullDate) }}
|
||||
{{
|
||||
t('page.home.start', {
|
||||
start: d(data.start, fullDate)
|
||||
})
|
||||
}}
|
||||
</p>
|
||||
<p v-if="data.end">
|
||||
End:
|
||||
{{ d(data.end, fullDate) }}
|
||||
{{
|
||||
t('page.home.end', {
|
||||
start: d(data.end, fullDate)
|
||||
})
|
||||
}}
|
||||
</p>
|
||||
<p>
|
||||
{{ data._count.teams }} teams joined{{
|
||||
data.ownTeam !== null ? ', just like you' : ', unlike you'
|
||||
}}!
|
||||
{{
|
||||
t(
|
||||
data.ownTeam !== null
|
||||
? 'page.hunt.team_count_joined'
|
||||
: 'page.hunt.team_count',
|
||||
data._count.teams
|
||||
)
|
||||
}}
|
||||
</p>
|
||||
<p v-if="data.ownTeam">
|
||||
Your team: <span class="font-bold">{{ data.ownTeam.name }}</span>
|
||||
{{ t('page.hunt.your_team') }}
|
||||
<span class="font-bold">{{ data.ownTeam.name }}</span>
|
||||
<VaButton size="small" class="ml-2" @click="invite"
|
||||
>Invite:
|
||||
>{{ t('page.hunt.invite') }}
|
||||
<span
|
||||
class="font-mono font-bold text-white blur transition hover:blur-none active:blur-none"
|
||||
>
|
||||
@@ -138,10 +150,10 @@ async function invite() {
|
||||
color="primary"
|
||||
class="mb-16 mt-8"
|
||||
>
|
||||
<VaCardTitle>Join this hunt!</VaCardTitle>
|
||||
<VaCardContent class="text-2xl"
|
||||
>To join this hunt you need to join or create a team:</VaCardContent
|
||||
>
|
||||
<VaCardTitle>{{ t('page.hunt.join_this_hunt') }}</VaCardTitle>
|
||||
<VaCardContent class="text-2xl">{{
|
||||
t('page.hunt.login_to_join')
|
||||
}}</VaCardContent>
|
||||
<VaCardActions v-if="data.loggedIn">
|
||||
<TeamJoinModal :hunt-id="data.id" @update="refresh" />
|
||||
<TeamAddModal :hunt-id="data.id" @update="refresh" />
|
||||
@@ -151,12 +163,14 @@ async function invite() {
|
||||
color="info"
|
||||
icon="login"
|
||||
:to="$localePath(`/login?to=/hunt/${tSluggy(data).value}`)"
|
||||
>Login first</VaButton
|
||||
>{{ t('page.common.login_first') }}</VaButton
|
||||
>
|
||||
</VaCardActions>
|
||||
</VaCard>
|
||||
<div v-else-if="!data.isMember" class="flex flex-row gap-2">
|
||||
<VaSwitch v-model="hideAnswers" icon="image">Hide answers</VaSwitch>
|
||||
<VaSwitch v-model="hideAnswers" icon="image">{{
|
||||
t('page.hunt.hide_answers')
|
||||
}}</VaSwitch>
|
||||
</div>
|
||||
<VaDivider />
|
||||
<div
|
||||
@@ -180,7 +194,7 @@ async function invite() {
|
||||
<VaImage
|
||||
v-if="!hideAnswers"
|
||||
:src="quest?.answer?.picture?.url ?? ''"
|
||||
fallback-text="No picture uploaded"
|
||||
:fallback-text="t('page.hunt.no_picture_uploaded')"
|
||||
class="h-32"
|
||||
fit="cover"
|
||||
lazy
|
||||
@@ -205,7 +219,7 @@ async function invite() {
|
||||
color="primary"
|
||||
icon="rate_review"
|
||||
class="flex-grow"
|
||||
>Open</VaButton
|
||||
>{{ t('page.common.open') }}</VaButton
|
||||
>
|
||||
<VaButton
|
||||
v-if="data.isMember"
|
||||
@@ -216,23 +230,26 @@ async function invite() {
|
||||
`/hunt/${tSluggy(data).value}/${tSluggy(quest).value}/admin`
|
||||
)
|
||||
"
|
||||
>Admin ({{ quest.unreviewed || 0 }} unreviewed)</VaButton
|
||||
>{{
|
||||
t('page.hunt.admin_unreviewed', quest.unreviewed || 0)
|
||||
}}</VaButton
|
||||
>
|
||||
</VaCardActions>
|
||||
</VaCard>
|
||||
</div>
|
||||
<VaCard v-else color="warning" class="mt-4"
|
||||
><VaCardTitle>Quests not revealed yet!</VaCardTitle>
|
||||
<VaCardContent
|
||||
>Soon all {{ data._count.quests }} quests will be
|
||||
revealed!</VaCardContent
|
||||
>
|
||||
><VaCardTitle>{{ t('page.hunt.quest_not_revealed') }}</VaCardTitle>
|
||||
<VaCardContent>{{
|
||||
t('page.hunt.quest_soon_reveal', data._count.quests)
|
||||
}}</VaCardContent>
|
||||
</VaCard>
|
||||
</div>
|
||||
|
||||
<div v-if="error">
|
||||
<h1 class="mt-8 text-3xl">{{ t(parseError(error)) }}</h1>
|
||||
<VaButton icon="arrow_back" :to="$localePath(`/`)">Back home</VaButton>
|
||||
<VaButton icon="arrow_back" :to="$localePath(`/`)">{{
|
||||
t('page.common.back_home')
|
||||
}}</VaButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -67,7 +67,7 @@ const { data, refresh, error } = await useFetch(`/api/hunt/${id}/diashow`, {
|
||||
useHead({
|
||||
title: t('layouts.two_title', {
|
||||
title: hasKey(data.value, 'name') ? tKey(data.value!, 'name').value : name,
|
||||
subtitle: 'Diashow'
|
||||
subtitle: t('pages.pictures.head')
|
||||
})
|
||||
});
|
||||
|
||||
@@ -95,35 +95,36 @@ titleStore.title = data.value ? tKey(data.value, 'name').value : undefined;
|
||||
v-if="data.count <= 0"
|
||||
color="warning"
|
||||
class="sm:col-span-2 md:col-span-3 lg:col-span-4"
|
||||
>No pictures has been submitted yet :(</VaAlert
|
||||
>{{ t('pages.common.no_pictures') }}</VaAlert
|
||||
>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="error"
|
||||
class="flex h-full w-full flex-col items-center justify-center text-center text-2xl"
|
||||
>
|
||||
<VaAlert color="danger" class="w-[90%]"
|
||||
>Answers are not revealed yet, please wait until the end!</VaAlert
|
||||
>
|
||||
<VaAlert color="danger" class="w-[90%]">{{
|
||||
t('pages.common.not_revealed')
|
||||
}}</VaAlert>
|
||||
<VaAlert v-if="error.statusCode !== 403" color="danger" class="w-[90%]">{{
|
||||
error
|
||||
}}</VaAlert
|
||||
><VaButton
|
||||
icon="arrow_back"
|
||||
:to="$localePath(`/hunt/${sluggy($nuxt.$slugData.huntSlug!)}`)"
|
||||
>Back to Hunt</VaButton
|
||||
>{{ t('pages.common.back_to_hunt') }}</VaButton
|
||||
>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="flex h-full w-full flex-col items-center justify-center text-center text-2xl"
|
||||
>
|
||||
<VaAlert color="danger" class="w-[90%]"
|
||||
>Answers are not revealed yet, please wait until the end!</VaAlert
|
||||
<VaAlert color="danger" class="w-[90%]">{{
|
||||
t('pages.common.not_revealed')
|
||||
}}</VaAlert
|
||||
><VaButton
|
||||
icon="arrow_back"
|
||||
:to="$localePath(`/hunt/${sluggy($nuxt.$slugData.huntSlug!)}`)"
|
||||
>Back to Hunt</VaButton
|
||||
>{{ t('pages.common.back_to_hunt') }}</VaButton
|
||||
>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
@@ -265,7 +265,7 @@ const columns = leaderboardColumns.map((c) =>
|
||||
><VaButton
|
||||
icon="arrow_back"
|
||||
:to="$localePath(`/hunt/${sluggy($nuxt.$slugData.huntSlug!)}`)"
|
||||
>Back to Hunt</VaButton
|
||||
>{{ t('pages.common.back_to_hunt') }}</VaButton
|
||||
>
|
||||
</article>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user