Skip to content

Commit

Permalink
feat(client): improve modal wording (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
avine authored Mar 1, 2024
1 parent aa3e677 commit ea0f9be
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 39 deletions.
10 changes: 5 additions & 5 deletions client/src/app/shared/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export class AuthService {

user = this._user.asReadonly();

userState = computed<UserState>(() => buildUserState(this.user()));
userState = computed<UserState>(() => buildUserState(this._user()));

userEmail = computed(() => this.user()?.email ?? '');
userEmail = computed(() => this._user()?.email ?? '');

userInfo = computed(() => {
const user = this.user();
const user = this._user();
if (!user?.photoURL && !user?.displayName) {
return undefined;
}
Expand All @@ -58,7 +58,7 @@ export class AuthService {
return from(signInWithPopup(this.firebaseAuth, new GoogleAuthProvider())).pipe(
concatMap(() => this.authenticated$),
first((authenticated) => authenticated),
tap(() => this.router.navigateByUrl(this.activatedRoute.snapshot.queryParams[AUTH_REDIRECT_PARAM] ?? '/home')),
tap(() => this.router.navigateByUrl(this.activatedRoute.snapshot.queryParams[AUTH_REDIRECT_PARAM] ?? '/')),
catchError(() => of(false)),
);
}
Expand All @@ -85,7 +85,7 @@ export class AuthService {
}

getIdToken(): Observable<string | null> {
return from(this.user()?.getIdToken() ?? Promise.resolve(null));
return from(this._user()?.getIdToken() ?? Promise.resolve(null));
}

withBearerIdToken<T>(request: (headers: { Authorization: string }) => Observable<T>) {
Expand Down
3 changes: 2 additions & 1 deletion client/src/app/shared/base-href/base-href.provider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { APP_BASE_HREF, PlatformLocation } from '@angular/common';
import { FactoryProvider } from '@angular/core';

export const provideBaseHref = () => ({
export const provideBaseHref = (): FactoryProvider => ({
provide: APP_BASE_HREF,
useFactory: (platformLocation: PlatformLocation): string => platformLocation.getBaseHrefFromDOM(),
deps: [PlatformLocation],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ <h2 mat-dialog-title>{{ data.title }}</h2>
<mat-dialog-actions align="end">
<button mat-button [mat-dialog-close]="false" i18n="@@Action.Cancel">Annuler</button>

<button mat-button [mat-dialog-close]="true" color="primary" cdkFocusInitial i18n="@@Action.Confirm">
Confirmer
<button mat-button [mat-dialog-close]="true" color="primary" cdkFocusInitial>
@if (data.action?.icon) {
<mat-icon>{{ data.action!.icon }}</mat-icon>
}
@if (data.action?.label) {
{{ data.action!.label }}
} @else {
<ng-container i18n="@@Action.Confirm"> Confirmer </ng-container>
}
</button>
</mat-dialog-actions>
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@ import { ConfirmBeforeSubmitData, ConfirmBeforeSubmitType } from './confirm-befo

export const confirmBeforeSubmitMap: Record<ConfirmBeforeSubmitType, ConfirmBeforeSubmitData> = {
sendFeedbackRequest: {
title: $localize`:@@Component.ConfirmBeforeSubmit.ConfirmSending:Confirmer l'envoi ?`,
content: $localize`:@@Component.ConfirmBeforeSubmit.SendFeedbackRequestContent:Cliquer sur "Confirmer" pour finaliser l'envoi de votre demande de feedZback.`,
title: $localize`:@@Action.Send:Envoyer`,
content: $localize`:@@Component.ConfirmBeforeSubmit.SendFeedbackRequestContent:Voulez-vous envoyer votre demande de feedZback ?`,
action: { label: $localize`:@@Action.Send:Envoyer`, icon: 'send' },
},
cancelFeedbackRequest: {
title: $localize`:@@Component.ConfirmBeforeSubmit.ConfirmAction:Confirmer l'action ?`,
content: $localize`:@@Component.ConfirmBeforeSubmit.CancelFeedbackRequestContent:Cliquer sur "Confirmer" pour archiver votre demande de feedZback.`,
title: $localize`:@@Action.Archive:Archiver`,
content: $localize`:@@Component.ConfirmBeforeSubmit.CancelFeedbackRequestContent:Voulez-vous archiver votre demande de feedZback ?`,
action: { label: $localize`:@@Action.Archive:Archiver`, icon: 'archive' },
},
sendRequestedFeedback: {
title: $localize`:@@Component.ConfirmBeforeSubmit.ConfirmSending:Confirmer l'envoi ?`,
content: $localize`:@@Component.ConfirmBeforeSubmit.SendRequestedFeedbackContent:Cliquer sur "Confirmer" pour finaliser l'envoi de votre réponse.`,
title: $localize`:@@Action.Send:Envoyer`,
content: $localize`:@@Component.ConfirmBeforeSubmit.SendRequestedFeedbackContent:Voulez-vous envoyer votre feedZback ? Notez qu'un feedZback envoyé n'est plus modifiable.`,
action: { label: $localize`:@@Action.Send:Envoyer`, icon: 'send' },
},
sendSpontaneousFeedback: {
title: $localize`:@@Component.ConfirmBeforeSubmit.ConfirmSending:Confirmer l'envoi ?`,
content: $localize`:@@Component.ConfirmBeforeSubmit.SendSpontaneousFeedbackContent:Cliquer sur "Confirmer" pour finaliser l'envoi de votre feedZback spontané.`,
title: $localize`:@@Action.Send:Envoyer`,
content: $localize`:@@Component.ConfirmBeforeSubmit.SendSpontaneousFeedbackContent:Voulez-vous envoyer votre feedZback spontané ? Notez qu'un feedZback envoyé n'est plus modifiable.`,
action: { label: $localize`:@@Action.Send:Envoyer`, icon: 'send' },
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ export type ConfirmBeforeSubmitType =
export type ConfirmBeforeSubmitData = {
title: string;
content?: string;
action?: {
label: string;
icon?: string;
};
};
9 changes: 4 additions & 5 deletions client/src/app/shared/leave-form/leave-form.component.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<h2 mat-dialog-title>
<mat-icon class="me-3 scale-150">signpost</mat-icon>
<ng-container i18n="@@Component.LeaveForm.Title">Confirmer l'action ?</ng-container>
<ng-container i18n="@@Component.LeaveForm.Title">Confirmer l'action</ng-container>
</h2>

<mat-dialog-content i18n="@@Component.LeaveForm.Content"
>Les modifications apportées au formulaire seront perdues.</mat-dialog-content
>
<mat-dialog-content i18n="@@Component.LeaveForm.Content">
Notez qu'en confirmant cette action, le formulaire que vous avez commencé à remplir sera perdu.
</mat-dialog-content>

<mat-dialog-actions align="end">
<button mat-button [mat-dialog-close]="false" i18n="@@Action.Cancel">Annuler</button>
Expand Down
3 changes: 1 addition & 2 deletions client/src/app/shared/leave-form/leave-form.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { Component } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatDialogModule } from '@angular/material/dialog';
import { MatIconModule } from '@angular/material/icon';

@Component({
selector: 'app-leave-form',
standalone: true,
imports: [MatButtonModule, MatDialogModule, MatIconModule],
imports: [MatButtonModule, MatDialogModule],
templateUrl: './leave-form.component.html',
})
export class LeaveFormComponent {}
14 changes: 6 additions & 8 deletions client/src/locales/messages.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@
"Action.Update": "Update",
"Action.ViewFeedback": "View feedZback",
"Action.ViewFeedbackRequest": "View request",
"Component.ConfirmBeforeSubmit.CancelFeedbackRequestContent": "Click on \"Confirm\" to archive your feedZback request.",
"Component.ConfirmBeforeSubmit.ConfirmAction": "Confirm action?",
"Component.ConfirmBeforeSubmit.ConfirmSending": "Confirmer sending?",
"Component.ConfirmBeforeSubmit.SendFeedbackRequestContent": "Click on \"Confirm\" to finalise sending your feedZback request.",
"Component.ConfirmBeforeSubmit.SendRequestedFeedbackContent": "Click on \"Confirm\" to finalise sending your reply.",
"Component.ConfirmBeforeSubmit.SendSpontaneousFeedbackContent": "Click on \"Confirm\" to send your spontaneous feedZback.",
"Component.ConfirmBeforeSubmit.CancelFeedbackRequestContent": "Would you like to archive your feedZback request?",
"Component.ConfirmBeforeSubmit.SendFeedbackRequestContent": "Would you like to send your feedZback request?",
"Component.ConfirmBeforeSubmit.SendRequestedFeedbackContent": "Would you like to send your feedZback? Note that once a feedZback has been sent, it can no longer be modified.",
"Component.ConfirmBeforeSubmit.SendSpontaneousFeedbackContent": "Would you like to send your spontaneous feedZback? Note that once a feedZback has been sent, it can no longer be modified.",
"Component.EmailsField.Hint": "Separate emails with commas",
"Component.GiveFeedback.Share": "Share feedback with your colleague's manager",
"Component.GiveFeedback.ShareFeedbackMessageContent": "By sharing your feedZback, your colleague and his or her manager will be able to discuss it together and make the most of its content.",
Expand All @@ -46,8 +44,8 @@
"Component.GiveRequestedFeedbackListEmpty1": "You have no feedZback requests to process...",
"Component.GiveRequestedFeedbackListEmpty2": "Take this opportunity to request or give feedZback to your colleagues!",
"Component.Home.LinkToGuide": "How to write a ",
"Component.LeaveForm.Content": "Changes made to the form will be lost.",
"Component.LeaveForm.Title": "Confirm action?",
"Component.LeaveForm.Content": "Note that by confirming this action, the form you have started to fill in will be lost.",
"Component.LeaveForm.Title": "Confirm action",
"Component.ManagerDocument.SharedFeedback": "Shared feedZback",
"Component.ManagerDocument.SharedFeedbackRequest": "Request for shared feedback",
"Component.ManagerList.Collaborator": "Collaborator",
Expand Down
14 changes: 6 additions & 8 deletions client/src/locales/messages.fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@
"Action.Update": " Mettre à jour ",
"Action.ViewFeedback": "Consulter le feedZback",
"Action.ViewFeedbackRequest": "Consulter la demande",
"Component.ConfirmBeforeSubmit.CancelFeedbackRequestContent": "Cliquer sur \"Confirmer\" pour archiver votre demande de feedZback.",
"Component.ConfirmBeforeSubmit.ConfirmAction": "Confirmer l'action ?",
"Component.ConfirmBeforeSubmit.ConfirmSending": "Confirmer l'envoi ?",
"Component.ConfirmBeforeSubmit.SendFeedbackRequestContent": "Cliquer sur \"Confirmer\" pour finaliser l'envoi de votre demande de feedZback.",
"Component.ConfirmBeforeSubmit.SendRequestedFeedbackContent": "Cliquer sur \"Confirmer\" pour finaliser l'envoi de votre réponse.",
"Component.ConfirmBeforeSubmit.SendSpontaneousFeedbackContent": "Cliquer sur \"Confirmer\" pour finaliser l'envoi de votre feedZback spontané.",
"Component.ConfirmBeforeSubmit.CancelFeedbackRequestContent": "Voulez-vous archiver votre demande de feedZback ?",
"Component.ConfirmBeforeSubmit.SendFeedbackRequestContent": "Voulez-vous envoyer votre demande de feedZback ?",
"Component.ConfirmBeforeSubmit.SendRequestedFeedbackContent": "Voulez-vous envoyer votre feedZback ? Notez qu'un feedZback envoyé n'est plus modifiable.",
"Component.ConfirmBeforeSubmit.SendSpontaneousFeedbackContent": "Voulez-vous envoyer votre feedZback spontané ? Notez qu'un feedZback envoyé n'est plus modifiable.",
"Component.EmailsField.Hint": "Séparez les emails par des virgules",
"Component.GiveFeedback.Share": " Partager le feedZback avec le manager de votre collègue ",
"Component.GiveFeedback.ShareFeedbackMessageContent": "En partageant votre feedZback, votre collègue et son manager pourront échanger ensemble et ainsi bénéficier au mieux de son contenu.",
Expand All @@ -46,8 +44,8 @@
"Component.GiveRequestedFeedbackListEmpty1": " Vous n'avez pas de demande de feedZback à traiter... ",
"Component.GiveRequestedFeedbackListEmpty2": " Profitez-en pour demander ou donner du feedZback à vos collègues ! ",
"Component.Home.LinkToGuide": "Comment écrire un ",
"Component.LeaveForm.Content": "Les modifications apportées au formulaire seront perdues.",
"Component.LeaveForm.Title": "Confirmer l'action ?",
"Component.LeaveForm.Content": " Notez qu'en confirmant cette action, le formulaire que vous avez commencé à remplir sera perdu.\n",
"Component.LeaveForm.Title": "Confirmer l'action",
"Component.ManagerDocument.SharedFeedback": "FeedZback partagé",
"Component.ManagerDocument.SharedFeedbackRequest": "Demande de feedZback partagé",
"Component.ManagerList.Collaborator": "Collaborateur",
Expand Down

0 comments on commit ea0f9be

Please sign in to comment.