From 344c726d1d594b1f228718b8cc88fda83e1c51a1 Mon Sep 17 00:00:00 2001 From: Tobias Messner Date: Thu, 28 Nov 2024 12:59:16 +0100 Subject: [PATCH] feat: Change feedback prompt for trainings --- .../feedback-dialog.component.html | 8 +------ .../feedback-dialog.component.ts | 14 ++++++++++++ .../feedback-dialog.stories.ts | 22 ++++++++++++++++++- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.component.html b/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.component.html index 0ea4f6873..29b87175f 100644 --- a/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.component.html +++ b/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.component.html @@ -9,13 +9,7 @@ (submit)="submit()" >

- @if (data.sessions.length === 0) { - How has your experience been? - } @else if (data.sessions.length === 1) { - How was your session? - } @else { - How were your sessions? - } + {{ promptText }}

diff --git a/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.component.ts b/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.component.ts index 11035483b..b987e23a0 100644 --- a/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.component.ts +++ b/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.component.ts @@ -95,6 +95,20 @@ export class FeedbackDialogComponent { return Object.values(FeedbackRating); } + get promptText() { + if ( + this.data.sessions.some((session) => session.project?.type === 'training') + ) { + return 'How was your training experience?'; + } else if (this.data.sessions.length === 0) { + return 'How was your experience?'; + } else if (this.data.sessions.length === 1) { + return 'How was your session?'; + } else { + return 'How were your sessions?'; + } + } + submitButton = { disabled: false, text: 'Submit', diff --git a/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.stories.ts b/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.stories.ts index 3ff91d298..ee7cb348c 100644 --- a/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.stories.ts +++ b/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.stories.ts @@ -10,7 +10,10 @@ import { mockFeedbackConfig, mockFeedbackWrapperServiceProvider, } from '../../../../storybook/feedback'; -import { mockPersistentSession } from '../../../../storybook/session'; +import { + mockPersistentSession, + mockTrainingSession, +} from '../../../../storybook/session'; import { FeedbackDialogComponent } from './feedback-dialog.component'; const meta: Meta = { @@ -156,3 +159,20 @@ export const TwoSessions: Story = { }), ], }; + +export const TrainingSession: Story = { + args: {}, + decorators: [ + moduleMetadata({ + providers: [ + { + provide: MAT_DIALOG_DATA, + useValue: { + sessions: [mockPersistentSession, mockTrainingSession], + trigger: 'storybook', + }, + }, + ], + }), + ], +};