diff --git a/packages/admin-ui/src/lib/core/src/components/notification/notification.component.html b/packages/admin-ui/src/lib/core/src/components/notification/notification.component.html index d736ec5eb7..db1b7567df 100644 --- a/packages/admin-ui/src/lib/core/src/components/notification/notification.component.html +++ b/packages/admin-ui/src/lib/core/src/components/notification/notification.component.html @@ -1,15 +1,12 @@ -
- - {{ stringifyMessage(message) | translate: translationVars }} -
+
+
+ + {{ stringifyMessage(message) | translate: translationVars }} +
+
\ No newline at end of file diff --git a/packages/admin-ui/src/lib/core/src/components/notification/notification.component.ts b/packages/admin-ui/src/lib/core/src/components/notification/notification.component.ts index 145ddfb1f0..c5205c98b8 100644 --- a/packages/admin-ui/src/lib/core/src/components/notification/notification.component.ts +++ b/packages/admin-ui/src/lib/core/src/components/notification/notification.component.ts @@ -1,13 +1,21 @@ -import { Component, ElementRef, HostListener, ViewChild } from '@angular/core'; +import { Component, ElementRef, HostListener, OnInit, ViewChild } from '@angular/core'; +import { Observable, map } from 'rxjs'; import { NotificationType } from '../../providers/notification/notification.service'; +import { DataService } from '../../data/providers/data.service'; +import { I18nService } from '../../providers/i18n/i18n.service'; +import { LanguageCode } from '../../common/generated-types'; + @Component({ selector: 'vdr-notification', templateUrl: './notification.component.html', styleUrls: ['./notification.component.scss'], }) -export class NotificationComponent { +export class NotificationComponent implements OnInit { + uiLanguageAndLocale$: Observable<[LanguageCode, string | undefined]>; + direction$: Observable<'ltr' | 'rtl'>; + @ViewChild('wrapper', { static: true }) wrapper: ElementRef; offsetTop = 0; message = ''; @@ -18,6 +26,23 @@ export class NotificationComponent { /* */ }; + /** + * + */ + constructor(private i18nService: I18nService, private dataService: DataService) {} + + ngOnInit(): void { + this.uiLanguageAndLocale$ = this.dataService.client + .uiState() + .stream$.pipe(map(({ uiState }) => [uiState.language, uiState.locale ?? undefined])); + + this.direction$ = this.uiLanguageAndLocale$.pipe( + map(([languageCode]) => { + return this.i18nService.isRTL(languageCode) ? 'rtl' : 'ltr'; + }), + ); + } + registerOnClickFn(fn: () => void): void { this.onClickFn = fn; }