From e763e3adf0a4fc04ff82b65b2d1af440a0071cab Mon Sep 17 00:00:00 2001 From: Pascal Syma Date: Sat, 30 Aug 2025 17:31:19 +0200 Subject: [PATCH] Translate invite code and start help page --- app/lang/de.json | 10 ++- app/lang/en.json | 10 ++- app/layouts/default.vue | 10 +++ app/pages/help.vue | 90 +++++++++++++++++++ app/pages/hunt/[huntSlug]/index.vue | 132 ++++++++++++++++------------ 5 files changed, 195 insertions(+), 57 deletions(-) create mode 100644 app/pages/help.vue diff --git a/app/lang/de.json b/app/lang/de.json index e175ee5..afa32be 100644 --- a/app/lang/de.json +++ b/app/lang/de.json @@ -132,7 +132,15 @@ "no_picture_uploaded": "Kein Bild hochgeladen", "admin_unreviewed": "Admin ({count} unbewertet)", "quest_not_revealed": "Quests wurden noch nicht aufgedeckt!", - "quest_soon_reveal": "Bald werden alle {count} Quests aufgedeckt!" + "quest_soon_reveal": "Bald werden alle {count} Quests aufgedeckt!", + "invite_toast_title": "Einladungscode", + "invite_toast_message": "Einladungscode wurde in deine Zwischenablage kopiert! Teile ihn mit deinen neuen Teammitgliedern.", + "invite_toast_text": "Trete dem Team {team} mit dem Code \"{code}\" im Hunt \"{hunt}\" bei!" + }, + "help": { + "title": "Hilfe", + "subtitle": "Hier sind einige Themen und Wörter erklärt. Wenn du weiterhin Fragen hast, wende dich bitte ans Admin Team!", + "head": "PicHunt Hilfe" } }, "validation": { diff --git a/app/lang/en.json b/app/lang/en.json index cb8a7b6..e1e4e2e 100644 --- a/app/lang/en.json +++ b/app/lang/en.json @@ -132,7 +132,15 @@ "no_picture_uploaded": "No picture uploaded", "admin_unreviewed": "Admin ({count} unreviewed)", "quest_not_revealed": "Quests not revealed yet!", - "quest_soon_reveal": "Soon all {count} quests will be revealed!" + "quest_soon_reveal": "Soon all {count} quests will be revealed!", + "invite_toast_title": "Invite code", + "invite_toast_message": "Invite code was copied to your clipboard! Share it with your next team mates.", + "invite_toast_text": "Join team {team} with code \"{code}\" on hunt \"{hunt}\"!" + }, + "help": { + "title": "Help", + "subtitle": "Here are some topics and words explained. If you still have questions, please contact the Admin Team!", + "head": "PicHunt Help" } }, "validation": { diff --git a/app/layouts/default.vue b/app/layouts/default.vue index 37b150c..fafc457 100644 --- a/app/layouts/default.vue +++ b/app/layouts/default.vue @@ -35,6 +35,16 @@ const slugs = computed(() => checkSlug(route.params)); + diff --git a/app/pages/help.vue b/app/pages/help.vue new file mode 100644 index 0000000..95fd42e --- /dev/null +++ b/app/pages/help.vue @@ -0,0 +1,90 @@ + + + diff --git a/app/pages/hunt/[huntSlug]/index.vue b/app/pages/hunt/[huntSlug]/index.vue index c862cc0..7b208d3 100644 --- a/app/pages/hunt/[huntSlug]/index.vue +++ b/app/pages/hunt/[huntSlug]/index.vue @@ -7,6 +7,7 @@ const app = useNuxtApp(); const { loggedIn } = useUserSession(); const { t, d } = useI18n(); const { tKey, hasKey, tSluggy } = useI18nKey(); +const { init } = useToast(); const { name, id } = app.$slugData.huntSlug!; @@ -30,14 +31,26 @@ async function invite() { if (!data.value?.ownTeam) { return; } - const clipboardItemData = { // TODO: add invite link // 'text/plain': `https://pichunt.syma.dev/hunt/${id}/join?id=${data.value.ownTeam.id}&pw=${data.value.ownTeam.password}` - 'text/plain': `Join team ${data.value.ownTeam.name} with code "${data.value.ownTeam.password}" on hunt "${data.value ? tKey(data.value, 'name').value : name}"!` + 'text/plain': `${t('page.hunt.invite_toast_text', { + team: data.value.ownTeam.name, + code: data.value.ownTeam.password, + hunt: data.value ? tKey(data.value, 'name').value : name + })} + +${document.location.href}` }; const clipboardItem = new ClipboardItem(clipboardItemData); await navigator.clipboard.write([clipboardItem]); + + init({ + title: t('page.hunt.invite_toast_title'), + message: t('page.hunt.invite_toast_message'), + color: 'success', + duration: 2000 + }); } @@ -47,7 +60,7 @@ async function invite() { {{ data ? tKey(data, 'name') : name }} {{ - t('page.hunt.total_points', data!!.totalScore) + t('page.hunt.total_points', { score: data!!.totalScore }) }}
@@ -95,56 +108,66 @@ async function invite() { >
-
-

- {{ line }} -

-
- -

- {{ - t('page.home.start', { - start: d(data.start, fullDate) - }) - }} -

-

- {{ - t('page.home.end', { - start: d(data.end, fullDate) - }) - }} -

-

- {{ - t( - data.ownTeam !== null - ? 'page.hunt.team_count_joined' - : 'page.hunt.team_count', - data._count.teams - ) - }} -

-

- {{ t('page.hunt.your_team') }} - {{ data.ownTeam.name }} - {{ t('page.hunt.invite') }} - - {{ data.ownTeam.password }} -

+ + + {{ data ? tKey(data, 'name') : name }} + + + +
+

+ {{ line }} +

+
+

+ {{ + t('page.home.start', { + start: d(data.start, fullDate) + }) + }} +

+

+ {{ + t('page.home.end', { + start: d(data.end, fullDate) + }) + }} +

+

+ {{ + t( + data.ownTeam !== null + ? 'page.hunt.team_count_joined' + : 'page.hunt.team_count', + data._count.teams + ) + }} +

+
+

+ {{ t('page.hunt.your_team') }} + {{ data.ownTeam.name }} +

+ {{ t('page.hunt.invite') }} + + {{ data.ownTeam.password }} +
+
+
+ -
+
{{ t('page.hunt.hide_answers') }}
-