This commit is contained in:
Florian THIERRY
2024-09-21 21:34:16 +02:00
parent 208b935ffa
commit f8d73c9ed0
12 changed files with 110 additions and 76 deletions

View File

@@ -2,27 +2,27 @@
<mat-icon>close</mat-icon>
</button>
<header>
<h1>Select an illustration:</h1>
<h1 i18n>Select an illustration</h1>
</header>
<div class="picture-container">
@if (isLoading) {
<h2>Pictures loading...</h2>
<h2 i18n>Pictures loading...</h2>
<mat-spinner></mat-spinner>
} @else {
@if (pictures.length) {
@for(picture of pictures; track picture) {
<img src="/api/pictures/{{picture.id}}" (click)="selectPicture(picture)" matTooltip="Choose this illustration"/>
<img src="/api/pictures/{{picture.id}}" (click)="selectPicture(picture)" matTooltip="Choose this illustration" i18n-matTooltip/>
}
} @else {
<h2>There is no any picture.</h2>
<h2 i18n>There is no any picture.</h2>
}
}
</div>
<footer>
<button type="button" class="secondary" matRipple (click)="closeDialog()">
<button type="button" class="secondary" matRipple (click)="closeDialog()" i18n>
Cancel
</button>
<button type="button" (click)="fileUpload.click()" matRipple>
<button type="button" (click)="fileUpload.click()" matRipple i18n>
<mat-icon>upload_file</mat-icon>
Add new picture
</button>

View File

@@ -34,9 +34,9 @@ export class PictureSelectionDialog implements OnInit {
if (error.status === 401) {
this.dialogRef.close();
} else {
const errorMessage = 'An error occured while loading pictures.';
const errorMessage = $localize`An error occured while loading pictures.`;
console.error(errorMessage, error);
this.snackBar.open(errorMessage, 'Close', { duration: 5000 });
this.snackBar.open(errorMessage, $localize`Close`, { duration: 5000 });
}
})
.finally(() => {
@@ -61,9 +61,9 @@ export class PictureSelectionDialog implements OnInit {
this.dialogRef.close(pictureId);
})
.catch(error => {
const errorMessage = 'A technical error occured while uploading your picture.';
const errorMessage = $localize`A technical error occured while uploading your picture.`;
console.error(errorMessage, error);
this.snackBar.open(errorMessage, 'Close', { duration: 5000 });
this.snackBar.open(errorMessage, $localize`Close`, { duration: 5000 });
});
}
}

View File

@@ -16,9 +16,9 @@ export class PictureSelectionDialogService {
this.dialogRef.close(pictureId);
})
.catch(error => {
const errorMessage = 'An error occured while uploading a picture...';
const errorMessage = $localize`An error occured while uploading a picture...`;
console.error(errorMessage, error);
this.snackBar.open(errorMessage, 'Close', { duration: 5000 });
this.snackBar.open(errorMessage, $localize`Close`, { duration: 5000 });
});
}
}