Skip to content

Commit 4e4ee98

Browse files
committed
feat: text and image achievements
1 parent e6e6493 commit 4e4ee98

File tree

6 files changed

+121
-57
lines changed

6 files changed

+121
-57
lines changed

frontend/app/api/generated.ts

Lines changed: 79 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ export type Scalars = {
2626
export type Achievement = {
2727
achievedAt?: Maybe<Scalars['DateTime']['output']>;
2828
challenge?: Maybe<Challenge>;
29-
description: Scalars['String']['output'];
29+
descriptionCompleted: Scalars['String']['output'];
30+
descriptionPending: Scalars['String']['output'];
3031
event?: Maybe<Event>;
3132
hidden: Scalars['Boolean']['output'];
3233
id: Scalars['ID']['output'];
33-
image?: Maybe<Scalars['String']['output']>;
34+
imageCompleted: Scalars['String']['output'];
35+
imagePending: Scalars['String']['output'];
3436
name: Scalars['String']['output'];
3537
points: Scalars['Int']['output'];
3638
project: Project;
@@ -220,6 +222,7 @@ export type Consent = {
220222
managedBy?: Maybe<Scalars['String']['output']>;
221223
managementType: ConsentManagementType;
222224
publishedAt?: Maybe<Scalars['DateTime']['output']>;
225+
shortText: Scalars['String']['output'];
223226
title: Scalars['String']['output'];
224227
url?: Maybe<Scalars['String']['output']>;
225228
userHistory: Array<UserConsentHistoryEntry>;
@@ -248,11 +251,13 @@ export type ContentAchievement = Achievement & {
248251
achievedAt?: Maybe<Scalars['DateTime']['output']>;
249252
challenge?: Maybe<Challenge>;
250253
completedItemCount: Scalars['Int']['output'];
251-
description: Scalars['String']['output'];
254+
descriptionCompleted: Scalars['String']['output'];
255+
descriptionPending: Scalars['String']['output'];
252256
event?: Maybe<Event>;
253257
hidden: Scalars['Boolean']['output'];
254258
id: Scalars['ID']['output'];
255-
image?: Maybe<Scalars['String']['output']>;
259+
imageCompleted: Scalars['String']['output'];
260+
imagePending: Scalars['String']['output'];
256261
items: Array<ContentItem>;
257262
name: Scalars['String']['output'];
258263
nextItem?: Maybe<ContentItem>;
@@ -295,22 +300,26 @@ export type CreateChurchInput = {
295300

296301
export type CreateContentAchievementFromExternalContentInput = {
297302
challengeId?: InputMaybe<Scalars['ID']['input']>;
298-
description: Scalars['String']['input'];
303+
descriptionCompleted: Scalars['String']['input'];
304+
descriptionPending: Scalars['String']['input'];
299305
eventId?: InputMaybe<Scalars['ID']['input']>;
300306
externalContentIds: Array<Scalars['ID']['input']>;
301307
hidden: Scalars['Boolean']['input'];
302-
image?: InputMaybe<Scalars['String']['input']>;
308+
imageCompleted: Scalars['String']['input'];
309+
imagePending: Scalars['String']['input'];
303310
name: Scalars['String']['input'];
304311
points: Scalars['Int']['input'];
305312
projectId: Scalars['ID']['input'];
306313
};
307314

308315
export type CreateContentAchievementInput = {
309316
challengeId?: InputMaybe<Scalars['ID']['input']>;
310-
description: Scalars['String']['input'];
317+
descriptionCompleted: Scalars['String']['input'];
318+
descriptionPending: Scalars['String']['input'];
311319
eventId?: InputMaybe<Scalars['ID']['input']>;
312320
hidden: Scalars['Boolean']['input'];
313-
image?: InputMaybe<Scalars['String']['input']>;
321+
imageCompleted: Scalars['String']['input'];
322+
imagePending: Scalars['String']['input'];
314323
items: Array<ContentItemInput>;
315324
name: Scalars['String']['input'];
316325
points: Scalars['Int']['input'];
@@ -341,9 +350,11 @@ export type CreateProjectInput = {
341350

342351
export type CreateQuizAchievementInput = {
343352
challengeId?: InputMaybe<Scalars['ID']['input']>;
344-
description: Scalars['String']['input'];
353+
descriptionCompleted: Scalars['String']['input'];
354+
descriptionPending: Scalars['String']['input'];
345355
hidden: Scalars['Boolean']['input'];
346-
image?: InputMaybe<Scalars['String']['input']>;
356+
imageCompleted: Scalars['String']['input'];
357+
imagePending: Scalars['String']['input'];
347358
minScorePercentage?: InputMaybe<Scalars['Int']['input']>;
348359
name: Scalars['String']['input'];
349360
points: Scalars['Int']['input'];
@@ -390,21 +401,25 @@ export type CreateScoreAdjustmentInput = {
390401

391402
export type CreateSimpleAchievementInput = {
392403
challengeId?: InputMaybe<Scalars['ID']['input']>;
393-
description: Scalars['String']['input'];
404+
descriptionCompleted: Scalars['String']['input'];
405+
descriptionPending: Scalars['String']['input'];
394406
eventId?: InputMaybe<Scalars['ID']['input']>;
395407
hidden: Scalars['Boolean']['input'];
396-
image?: InputMaybe<Scalars['String']['input']>;
408+
imageCompleted: Scalars['String']['input'];
409+
imagePending: Scalars['String']['input'];
397410
name: Scalars['String']['input'];
398411
points: Scalars['Int']['input'];
399412
projectId: Scalars['ID']['input'];
400413
};
401414

402415
export type CreateStreakAchievementInput = {
403416
challengeId?: InputMaybe<Scalars['ID']['input']>;
404-
description: Scalars['String']['input'];
417+
descriptionCompleted: Scalars['String']['input'];
418+
descriptionPending: Scalars['String']['input'];
405419
eventId?: InputMaybe<Scalars['ID']['input']>;
406420
hidden: Scalars['Boolean']['input'];
407-
image?: InputMaybe<Scalars['String']['input']>;
421+
imageCompleted: Scalars['String']['input'];
422+
imagePending: Scalars['String']['input'];
408423
name: Scalars['String']['input'];
409424
neededStreak: Scalars['Int']['input'];
410425
points: Scalars['Int']['input'];
@@ -908,6 +923,7 @@ export type MutationCreateConsentArgs = {
908923
key: Scalars['String']['input'];
909924
managedBy?: InputMaybe<Scalars['String']['input']>;
910925
publishedAt?: InputMaybe<Scalars['DateTime']['input']>;
926+
shortText?: InputMaybe<Scalars['String']['input']>;
911927
title: Scalars['String']['input'];
912928
url?: InputMaybe<Scalars['String']['input']>;
913929
};
@@ -1222,6 +1238,7 @@ export type MutationUpdateConsentArgs = {
12221238
body?: InputMaybe<Scalars['String']['input']>;
12231239
id: Scalars['ID']['input'];
12241240
publishedAt?: InputMaybe<Scalars['DateTime']['input']>;
1241+
shortText?: InputMaybe<Scalars['String']['input']>;
12251242
title?: InputMaybe<Scalars['String']['input']>;
12261243
url?: InputMaybe<Scalars['String']['input']>;
12271244
};
@@ -1663,11 +1680,13 @@ export type QuizAchievement = Achievement & {
16631680
__typename?: 'QuizAchievement';
16641681
achievedAt?: Maybe<Scalars['DateTime']['output']>;
16651682
challenge?: Maybe<Challenge>;
1666-
description: Scalars['String']['output'];
1683+
descriptionCompleted: Scalars['String']['output'];
1684+
descriptionPending: Scalars['String']['output'];
16671685
event?: Maybe<Event>;
16681686
hidden: Scalars['Boolean']['output'];
16691687
id: Scalars['ID']['output'];
1670-
image?: Maybe<Scalars['String']['output']>;
1688+
imageCompleted: Scalars['String']['output'];
1689+
imagePending: Scalars['String']['output'];
16711690
minScorePercentage?: Maybe<Scalars['Int']['output']>;
16721691
name: Scalars['String']['output'];
16731692
points: Scalars['Int']['output'];
@@ -1860,11 +1879,13 @@ export type SimpleAchievement = Achievement & {
18601879
__typename?: 'SimpleAchievement';
18611880
achievedAt?: Maybe<Scalars['DateTime']['output']>;
18621881
challenge?: Maybe<Challenge>;
1863-
description: Scalars['String']['output'];
1882+
descriptionCompleted: Scalars['String']['output'];
1883+
descriptionPending: Scalars['String']['output'];
18641884
event?: Maybe<Event>;
18651885
hidden: Scalars['Boolean']['output'];
18661886
id: Scalars['ID']['output'];
1867-
image?: Maybe<Scalars['String']['output']>;
1887+
imageCompleted: Scalars['String']['output'];
1888+
imagePending: Scalars['String']['output'];
18681889
name: Scalars['String']['output'];
18691890
points: Scalars['Int']['output'];
18701891
project: Project;
@@ -1910,11 +1931,13 @@ export type StreakAchievement = Achievement & {
19101931
__typename?: 'StreakAchievement';
19111932
achievedAt?: Maybe<Scalars['DateTime']['output']>;
19121933
challenge?: Maybe<Challenge>;
1913-
description: Scalars['String']['output'];
1934+
descriptionCompleted: Scalars['String']['output'];
1935+
descriptionPending: Scalars['String']['output'];
19141936
event?: Maybe<Event>;
19151937
hidden: Scalars['Boolean']['output'];
19161938
id: Scalars['ID']['output'];
1917-
image?: Maybe<Scalars['String']['output']>;
1939+
imageCompleted: Scalars['String']['output'];
1940+
imagePending: Scalars['String']['output'];
19181941
name: Scalars['String']['output'];
19191942
neededStreak: Scalars['Int']['output'];
19201943
points: Scalars['Int']['output'];
@@ -2041,10 +2064,12 @@ export type TeamMember = {
20412064

20422065
export type UpdateAchievementInput = {
20432066
challengeId?: InputMaybe<Scalars['ID']['input']>;
2044-
description?: InputMaybe<Scalars['String']['input']>;
2067+
descriptionCompleted?: InputMaybe<Scalars['String']['input']>;
2068+
descriptionPending?: InputMaybe<Scalars['String']['input']>;
20452069
eventId?: InputMaybe<Scalars['ID']['input']>;
20462070
hidden?: InputMaybe<Scalars['Boolean']['input']>;
2047-
image?: InputMaybe<Scalars['String']['input']>;
2071+
imageCompleted?: InputMaybe<Scalars['String']['input']>;
2072+
imagePending?: InputMaybe<Scalars['String']['input']>;
20482073
name?: InputMaybe<Scalars['String']['input']>;
20492074
points?: InputMaybe<Scalars['Int']['input']>;
20502075
};
@@ -2072,10 +2097,12 @@ export type UpdateChurchInput = {
20722097

20732098
export type UpdateContentAchievementInput = {
20742099
challengeId?: InputMaybe<Scalars['ID']['input']>;
2075-
description?: InputMaybe<Scalars['String']['input']>;
2100+
descriptionCompleted?: InputMaybe<Scalars['String']['input']>;
2101+
descriptionPending?: InputMaybe<Scalars['String']['input']>;
20762102
eventId?: InputMaybe<Scalars['ID']['input']>;
20772103
hidden?: InputMaybe<Scalars['Boolean']['input']>;
2078-
image?: InputMaybe<Scalars['String']['input']>;
2104+
imageCompleted?: InputMaybe<Scalars['String']['input']>;
2105+
imagePending?: InputMaybe<Scalars['String']['input']>;
20792106
items?: InputMaybe<Array<ContentItemInput>>;
20802107
name?: InputMaybe<Scalars['String']['input']>;
20812108
points?: InputMaybe<Scalars['Int']['input']>;
@@ -2123,10 +2150,12 @@ export type UpdateQuizQuestionInput = {
21232150

21242151
export type UpdateStreakAchievementInput = {
21252152
challengeId?: InputMaybe<Scalars['ID']['input']>;
2126-
description?: InputMaybe<Scalars['String']['input']>;
2153+
descriptionCompleted?: InputMaybe<Scalars['String']['input']>;
2154+
descriptionPending?: InputMaybe<Scalars['String']['input']>;
21272155
eventId?: InputMaybe<Scalars['ID']['input']>;
21282156
hidden?: InputMaybe<Scalars['Boolean']['input']>;
2129-
image?: InputMaybe<Scalars['String']['input']>;
2157+
imageCompleted?: InputMaybe<Scalars['String']['input']>;
2158+
imagePending?: InputMaybe<Scalars['String']['input']>;
21302159
name?: InputMaybe<Scalars['String']['input']>;
21312160
neededStreak?: InputMaybe<Scalars['Int']['input']>;
21322161
points?: InputMaybe<Scalars['Int']['input']>;
@@ -2522,10 +2551,10 @@ export type ProfilePageQueryVariables = Exact<{ [key: string]: never; }>;
25222551

25232552

25242553
export type ProfilePageQuery = { __typename?: 'Query', me: { __typename?: 'User', id: string, name: string, consentStatus: { __typename?: 'ConsentStatus', pendingConsents: Array<{ __typename: 'Consent', id: string, key: string, version: number, title: string, url?: string | null, managementType: ConsentManagementType, managedBy?: string | null, body: { __typename?: 'MarkdownText', html: string } }> } }, myCurrentProject: { __typename?: 'Project', id: string, name: string, achievements: Array<
2525-
| { __typename?: 'ContentAchievement', id: string, name: string, description: string, image?: string | null, hidden: boolean, achievedAt?: any | null, points: number }
2526-
| { __typename?: 'QuizAchievement', id: string, name: string, description: string, image?: string | null, hidden: boolean, achievedAt?: any | null, points: number }
2527-
| { __typename?: 'SimpleAchievement', id: string, name: string, description: string, image?: string | null, hidden: boolean, achievedAt?: any | null, points: number }
2528-
| { __typename?: 'StreakAchievement', id: string, name: string, description: string, image?: string | null, hidden: boolean, achievedAt?: any | null, points: number }
2554+
| { __typename?: 'ContentAchievement', id: string, name: string, descriptionPending: string, descriptionCompleted: string, imagePending: string, imageCompleted: string, hidden: boolean, achievedAt?: any | null, points: number }
2555+
| { __typename?: 'QuizAchievement', id: string, name: string, descriptionPending: string, descriptionCompleted: string, imagePending: string, imageCompleted: string, hidden: boolean, achievedAt?: any | null, points: number }
2556+
| { __typename?: 'SimpleAchievement', id: string, name: string, descriptionPending: string, descriptionCompleted: string, imagePending: string, imageCompleted: string, hidden: boolean, achievedAt?: any | null, points: number }
2557+
| { __typename?: 'StreakAchievement', id: string, name: string, descriptionPending: string, descriptionCompleted: string, imagePending: string, imageCompleted: string, hidden: boolean, achievedAt?: any | null, points: number }
25292558
>, leaderboard: { __typename?: 'LeaderboardConnection', me?: { __typename?: 'LeaderboardEntry', score: number, rank?: number | null } | null } } };
25302559

25312560
export type ConsentsPageQueryVariables = Exact<{ [key: string]: never; }>;
@@ -2576,10 +2605,10 @@ export type AdminProjectAchievementPageQueryVariables = Exact<{
25762605

25772606

25782607
export type AdminProjectAchievementPageQuery = { __typename?: 'Query', achievement:
2579-
| { __typename?: 'ContentAchievement', id: string, name: string, description: string, image?: string | null, achievedAt?: any | null, points: number, hidden: boolean, project: { __typename?: 'Project', id: string, name: string } }
2580-
| { __typename?: 'QuizAchievement', id: string, name: string, description: string, image?: string | null, achievedAt?: any | null, points: number, hidden: boolean, project: { __typename?: 'Project', id: string, name: string } }
2581-
| { __typename?: 'SimpleAchievement', id: string, name: string, description: string, image?: string | null, achievedAt?: any | null, points: number, hidden: boolean, project: { __typename?: 'Project', id: string, name: string } }
2582-
| { __typename?: 'StreakAchievement', id: string, name: string, description: string, image?: string | null, achievedAt?: any | null, points: number, hidden: boolean, project: { __typename?: 'Project', id: string, name: string } }
2608+
| { __typename?: 'ContentAchievement', id: string, name: string, descriptionPending: string, descriptionCompleted: string, imagePending: string, imageCompleted: string, achievedAt?: any | null, points: number, hidden: boolean, project: { __typename?: 'Project', id: string, name: string } }
2609+
| { __typename?: 'QuizAchievement', id: string, name: string, descriptionPending: string, descriptionCompleted: string, imagePending: string, imageCompleted: string, achievedAt?: any | null, points: number, hidden: boolean, project: { __typename?: 'Project', id: string, name: string } }
2610+
| { __typename?: 'SimpleAchievement', id: string, name: string, descriptionPending: string, descriptionCompleted: string, imagePending: string, imageCompleted: string, achievedAt?: any | null, points: number, hidden: boolean, project: { __typename?: 'Project', id: string, name: string } }
2611+
| { __typename?: 'StreakAchievement', id: string, name: string, descriptionPending: string, descriptionCompleted: string, imagePending: string, imageCompleted: string, achievedAt?: any | null, points: number, hidden: boolean, project: { __typename?: 'Project', id: string, name: string } }
25832612
};
25842613

25852614
export type AdminProjectAchievementsNewPageQueryVariables = Exact<{
@@ -2627,10 +2656,10 @@ export type AdminProjectPageQueryVariables = Exact<{
26272656

26282657

26292658
export type AdminProjectPageQuery = { __typename?: 'Query', project: { __typename?: 'Project', id: string, name: string, description: string, startDate: any, endDate: any, branding: { __typename?: 'Branding', logo?: string | null, rounding: number, colors: { __typename?: 'Colors', light: { __typename?: 'ColorSet', accent: string }, dark: { __typename?: 'ColorSet', accent: string } } } }, achievements: { __typename?: 'AchievementConnection', edges: Array<{ __typename?: 'AchievementEdge', node:
2630-
| { __typename?: 'ContentAchievement', id: string, name: string, description: string, image?: string | null, points: number, hidden: boolean }
2631-
| { __typename?: 'QuizAchievement', id: string, name: string, description: string, image?: string | null, points: number, hidden: boolean }
2632-
| { __typename?: 'SimpleAchievement', id: string, name: string, description: string, image?: string | null, points: number, hidden: boolean }
2633-
| { __typename?: 'StreakAchievement', id: string, name: string, description: string, image?: string | null, points: number, hidden: boolean }
2659+
| { __typename?: 'ContentAchievement', id: string, name: string, descriptionPending: string, descriptionCompleted: string, imagePending: string, imageCompleted: string, points: number, hidden: boolean }
2660+
| { __typename?: 'QuizAchievement', id: string, name: string, descriptionPending: string, descriptionCompleted: string, imagePending: string, imageCompleted: string, points: number, hidden: boolean }
2661+
| { __typename?: 'SimpleAchievement', id: string, name: string, descriptionPending: string, descriptionCompleted: string, imagePending: string, imageCompleted: string, points: number, hidden: boolean }
2662+
| { __typename?: 'StreakAchievement', id: string, name: string, descriptionPending: string, descriptionCompleted: string, imagePending: string, imageCompleted: string, points: number, hidden: boolean }
26342663
}> }, events: { __typename?: 'EventConnection', edges: Array<{ __typename?: 'EventEdge', node: { __typename?: 'Event', id: string, name: string, description: string } }> }, challenges: { __typename?: 'ChallengeConnection', edges: Array<{ __typename?: 'ChallengeEdge', node:
26352664
| { __typename?: 'ExternalChallenge', id: string, name: string, description: any, image?: string | null }
26362665
| { __typename?: 'QuizChallenge', id: string, name: string, description: any, image?: string | null }
@@ -3287,8 +3316,10 @@ export const ProfilePageDocument = gql`
32873316
achievements {
32883317
id
32893318
name
3290-
description
3291-
image
3319+
descriptionPending
3320+
descriptionCompleted
3321+
imagePending
3322+
imageCompleted
32923323
hidden
32933324
achievedAt
32943325
points
@@ -3554,8 +3585,10 @@ export const AdminProjectAchievementPageDocument = gql`
35543585
achievement(id: $achievementId) {
35553586
id
35563587
name
3557-
description
3558-
image
3588+
descriptionPending
3589+
descriptionCompleted
3590+
imagePending
3591+
imageCompleted
35593592
achievedAt
35603593
points
35613594
hidden
@@ -3722,8 +3755,10 @@ export const AdminProjectPageDocument = gql`
37223755
node {
37233756
id
37243757
name
3725-
description
3726-
image
3758+
descriptionPending
3759+
descriptionCompleted
3760+
imagePending
3761+
imageCompleted
37273762
points
37283763
hidden
37293764
}

frontend/app/components/LocaleSelector.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script setup lang="ts">
22
const { locale, locales, setLocale } = useI18n()
3+
const { track } = useAnalytics()
34
45
const selectedLocale = computed({
56
get() {
@@ -9,6 +10,12 @@ const selectedLocale = computed({
910
setLocale(value)
1011
},
1112
})
13+
14+
watch(locale, (newLocale, oldLocale) => {
15+
if (oldLocale) {
16+
track(AnalyticsEvent.LanguageChanged, { from: oldLocale, to: newLocale })
17+
}
18+
})
1219
</script>
1320

1421
<template>

frontend/app/components/achievements/AchievementBadge.vue

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ watch(open, (isOpen) => {
3232
class="grid aspect-square place-items-center overflow-hidden rounded-full"
3333
>
3434
<NuxtImg
35-
v-if="achievement.image && achievement.achievedAt != null"
36-
:src="achievement.image"
35+
v-if="achievement.imageCompleted && achievement.achievedAt != null"
36+
:src="achievement.imageCompleted"
37+
class="size-full object-cover"
38+
/>
39+
<NuxtImg
40+
v-else-if="achievement.imagePending"
41+
:src="achievement.imagePending"
3742
class="size-full object-cover"
3843
/>
3944
<NuxtImg
@@ -51,8 +56,15 @@ watch(open, (isOpen) => {
5156
]"
5257
>
5358
<NuxtImg
54-
v-if="achievement.image && achievement.achievedAt != null"
55-
:src="achievement.image"
59+
v-if="
60+
achievement.imageCompleted && achievement.achievedAt != null
61+
"
62+
:src="achievement.imageCompleted"
63+
class="size-full object-cover"
64+
/>
65+
<NuxtImg
66+
v-else-if="achievement.imagePending"
67+
:src="achievement.imagePending"
5668
class="size-full object-cover"
5769
/>
5870
<NuxtImg
@@ -68,7 +80,11 @@ watch(open, (isOpen) => {
6880
{{ achievement.name }}
6981
</h3>
7082
<p class="text-label">
71-
{{ achievement.description }}
83+
{{
84+
achievement.achievedAt
85+
? achievement.descriptionCompleted
86+
: achievement.descriptionPending
87+
}}
7288
</p>
7389
</div>
7490
<div

0 commit comments

Comments
 (0)