Skip to content

Commit

Permalink
HELLODATA-1485 - adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
Slawomir Wieczorek committed Oct 16, 2024
1 parent c2510f0 commit 1557394
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class AnnouncementsManagementComponent extends BaseComponent implements O
return deleteAnnouncement();
}

getMessage(announcement: Announcement, selectedLanguage: string): string | undefined {
return announcement?.messages?.[selectedLanguage];
getMessage(announcement: Announcement, selectedLanguage: any): string | undefined {
return announcement?.messages?.[selectedLanguage.code];
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<h2 class="content-block">{{ '@Documentation management' | transloco }}</h2>
<div *ngIf="documentation$ | async"></div>
<div class="card">
<form *ngIf="(documentation$ | async) as documentation" [formGroup]="documentationForm">
<form *ngIf="(initForm$ | async) as result" [formGroup]="documentationForm">
<p-tabView *ngIf="(supportedLanguages$ | async) as supportedLanguages">
<ng-template ngFor let-language [ngForOf]="supportedLanguages">
<p-tabPanel [header]="language.slice(0, 2).toUpperCase()">
Expand Down Expand Up @@ -55,7 +54,7 @@ <h2 class="content-block">{{ '@Documentation management' | transloco }}</h2>
<p-toolbar>
<div class="p-toolbar-group-start">&nbsp;</div>
<div class="p-toolbar-group-end">
<p-button (click)="createOrUpdateDocumentation(documentation)"
<p-button (click)="createOrUpdateDocumentation(result.doc)"
icon="fas fa-floppy-disk"
label="{{'@Save' | transloco}}"
styleClass="p-button-success mr-2"></p-button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ import {take} from "rxjs/operators";
})
export class DocumentationManagementComponent extends BaseComponent implements OnInit {
documentationForm!: FormGroup;
documentation$: Observable<any>;
initForm$: Observable<any>;
selectedLanguage$: Observable<any>;
supportedLanguages$: Observable<string[]>;

constructor(private store: Store<AppState>, private fb: FormBuilder) {
super();
this.store.dispatch(loadDocumentation());
this.documentation$ = combineLatest([
this.initForm$ = combineLatest([
this.store.select(selectDocumentation),
this.store.select(selectSupportedLanguages).pipe(take(1))
]).pipe(
Expand All @@ -73,8 +74,11 @@ export class DocumentationManagementComponent extends BaseComponent implements O
languages: this.fb.group(languageAnnouncementFormGroups),
});
}),
map(([doc]) => doc)
map(([doc, supportedLanguages]) => {
return {doc: doc, langs: supportedLanguages};
})
);
this.selectedLanguage$ = this.store.select(selectSelectedLanguage);
this.supportedLanguages$ = this.store.select(selectSupportedLanguages);
this.createBreadcrumbs();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ export class FaqListComponent extends BaseComponent implements OnInit {
return deleteFaq();
}

getTitle(faq: Faq, selectedLanguage: string): string | undefined {
return faq?.messages?.[selectedLanguage].title;
getTitle(faq: Faq, selectedLanguage: any): string | undefined {
return faq?.messages?.[selectedLanguage.code].title;
}

getMessage(faq: Faq, selectedLanguage: string): string | undefined {
return faq?.messages?.[selectedLanguage].message;
getMessage(faq: Faq, selectedLanguage: any): string | undefined {
return faq?.messages?.[selectedLanguage.code].message;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<i class="fas fa-circle-info"></i>
</div>
<div class="p-toolbar-group-center" style="width: 65%">
<p-editor [ngModel]="getMessage(announcement, selectedLanguage.code)" [disabled]="true" [readonly]="true" [style]="{width: '100%'}">
<p-editor [ngModel]="getMessage(announcement, selectedLanguage)" [disabled]="true" [readonly]="true" [style]="{width: '100%'}">
<p-header hidden></p-header>
</p-editor>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export class PublishedAnnouncementsComponent implements OnInit {
this.selectedLanguage$ = store.select(selectSelectedLanguage);
}

getMessage(announcement: Announcement, selectedLanguage: string): string | undefined {
return announcement?.messages?.[selectedLanguage];
getMessage(announcement: Announcement, selectedLanguage: any): string | undefined {
return announcement?.messages?.[selectedLanguage.code];
}

ngOnInit(): void {
Expand Down

0 comments on commit 1557394

Please sign in to comment.