Skip to content

Commit 30c26bb

Browse files
committed
feat: show points in achievements
1 parent 58a13b1 commit 30c26bb

File tree

4 files changed

+73
-10
lines changed

4 files changed

+73
-10
lines changed

frontend/app/api/generated.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export type Scalars = {
1818
Date: { input: any; output: any; }
1919
DateTime: { input: any; output: any; }
2020
HTML: { input: any; output: any; }
21+
Markdown: { input: any; output: any; }
2122
Upload: { input: any; output: any; }
2223
};
2324

@@ -209,6 +210,22 @@ export type ColorsInput = {
209210
light: ColorSetInput;
210211
};
211212

213+
export type Consent = {
214+
__typename?: 'Consent';
215+
body: MarkdownText;
216+
id: Scalars['ID']['output'];
217+
key: Scalars['String']['output'];
218+
publishedAt?: Maybe<Scalars['DateTime']['output']>;
219+
title: Scalars['String']['output'];
220+
version: Scalars['Int']['output'];
221+
};
222+
223+
export type ConsentStatus = {
224+
__typename?: 'ConsentStatus';
225+
acceptedConsents: Array<UserConsent>;
226+
pendingConsents: Array<Consent>;
227+
};
228+
212229
export type CreateChallengeInput = {
213230
buttonText: Scalars['String']['input'];
214231
description?: InputMaybe<Scalars['HTML']['input']>;
@@ -466,6 +483,7 @@ export type MarkdownText = {
466483
export type Mutation = {
467484
__typename?: 'Mutation';
468485
_empty?: Maybe<Scalars['Boolean']['output']>;
486+
acceptConsent: UserConsent;
469487
addTeamMembers: Team;
470488
archiveProject: Scalars['Boolean']['output'];
471489
assignChallengeToEvent: Challenge;
@@ -483,6 +501,7 @@ export type Mutation = {
483501
bulkPublishChallenges: Array<Challenge>;
484502
completeChallenge: Challenge;
485503
createChallenge: Challenge;
504+
createConsent: Consent;
486505
createEvent: Event;
487506
createListeningAchievement: ListeningAchievement;
488507
createProject: Project;
@@ -522,6 +541,7 @@ export type Mutation = {
522541
updateAchievement: Achievement;
523542
updateAvatar: User;
524543
updateChallenge: Challenge;
544+
updateConsent: Consent;
525545
updateEvent: Event;
526546
updateListeningAchievement: ListeningAchievement;
527547
updateProject: Project;
@@ -533,6 +553,11 @@ export type Mutation = {
533553
};
534554

535555

556+
export type MutationAcceptConsentArgs = {
557+
consentId: Scalars['ID']['input'];
558+
};
559+
560+
536561
export type MutationAddTeamMembersArgs = {
537562
force?: InputMaybe<Scalars['Boolean']['input']>;
538563
teamId: Scalars['ID']['input'];
@@ -638,6 +663,14 @@ export type MutationCreateChallengeArgs = {
638663
};
639664

640665

666+
export type MutationCreateConsentArgs = {
667+
body: Scalars['String']['input'];
668+
key: Scalars['String']['input'];
669+
publishedAt?: InputMaybe<Scalars['DateTime']['input']>;
670+
title: Scalars['String']['input'];
671+
};
672+
673+
641674
export type MutationCreateEventArgs = {
642675
input: CreateEventInput;
643676
projectId: Scalars['ID']['input'];
@@ -857,6 +890,14 @@ export type MutationUpdateChallengeArgs = {
857890
};
858891

859892

893+
export type MutationUpdateConsentArgs = {
894+
body?: InputMaybe<Scalars['String']['input']>;
895+
id: Scalars['ID']['input'];
896+
publishedAt?: InputMaybe<Scalars['DateTime']['input']>;
897+
title?: InputMaybe<Scalars['String']['input']>;
898+
};
899+
900+
860901
export type MutationUpdateEventArgs = {
861902
id: Scalars['ID']['input'];
862903
input: UpdateEventInput;
@@ -981,6 +1022,8 @@ export type Query = {
9811022
challenges: ChallengeConnection;
9821023
church: Church;
9831024
churches: ChurchConnection;
1025+
consent: Consent;
1026+
consents: Array<Consent>;
9841027
currentEvent: Event;
9851028
currentProject: Project;
9861029
event: Event;
@@ -990,6 +1033,7 @@ export type Query = {
9901033
myCurrentProject: Project;
9911034
myEvents: Array<Event>;
9921035
myProjects: Array<Project>;
1036+
pendingConsents: Array<Consent>;
9931037
project: Project;
9941038
projects: ProjectConnection;
9951039
scoreJournal: ScoreJournalConnection;
@@ -1048,6 +1092,11 @@ export type QueryChurchesArgs = {
10481092
};
10491093

10501094

1095+
export type QueryConsentArgs = {
1096+
id: Scalars['ID']['input'];
1097+
};
1098+
1099+
10511100
export type QueryEventArgs = {
10521101
id: Scalars['ID']['input'];
10531102
};
@@ -1518,6 +1567,7 @@ export type User = {
15181567
birthdate: Scalars['String']['output'];
15191568
church: Church;
15201569
churchId: Scalars['ID']['output'];
1570+
consentStatus: ConsentStatus;
15211571
email: Scalars['String']['output'];
15221572
events: Array<Event>;
15231573
gender: Gender;
@@ -1538,6 +1588,13 @@ export type UserConnection = {
15381588
totalCount: Scalars['Int']['output'];
15391589
};
15401590

1591+
export type UserConsent = {
1592+
__typename?: 'UserConsent';
1593+
acceptedAt: Scalars['DateTime']['output'];
1594+
consent: Consent;
1595+
id: Scalars['ID']['output'];
1596+
};
1597+
15411598
export type UserEdge = {
15421599
__typename?: 'UserEdge';
15431600
cursor: Scalars['String']['output'];

frontend/app/components/achievements/AchievementBadge.vue

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script setup lang="ts">
2-
import { DevOnly } from '#components'
3-
42
defineProps<{
53
achievement: Partial<Achievement>
64
}>()
@@ -11,7 +9,6 @@ const open = ref(false)
119
<template>
1210
<div>
1311
<button
14-
v-if="!achievement.hidden"
1512
class="grid aspect-square place-items-center overflow-hidden rounded-full"
1613
@click="open = true"
1714
>
@@ -68,11 +65,18 @@ const open = ref(false)
6865
<p class="text-label">
6966
{{ achievement.description }}
7067
</p>
71-
<DevOnly>
72-
<p class="text-caption text-muted mt-default">
73-
{{ achievement.id }}
74-
</p>
75-
</DevOnly>
68+
</div>
69+
<div
70+
v-if="achievement.achievedAt"
71+
class="rounded-full bg-background-indent py-2 px-3 text-label text-accent-contrast"
72+
>
73+
+{{ achievement.points }} {{ $t('points') }}
74+
</div>
75+
<div
76+
v-else-if="achievement.points"
77+
class="rounded-full bg-background-indent py-2 px-3 text-label text-text-muted"
78+
>
79+
{{ $t('givesYouXPoints', { points: achievement.points }) }}
7680
</div>
7781
</div>
7882
</PageLayout>

frontend/i18n/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@
4343
"selectUnitLeader": "Select unit leader"
4444
},
4545
"points": "points",
46-
"place": "place"
46+
"place": "place",
47+
"givesYouXPoints": "Gives you {points} points"
4748
}

frontend/i18n/locales/nb.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@
4343
"selectUnitLeader": "Velg unitleder"
4444
},
4545
"place": "plass",
46-
"points": "poeng"
46+
"points": "poeng",
47+
"givesYouXPoints": "Gir deg {points} poeng"
4748
}

0 commit comments

Comments
 (0)