diff --git a/src/app/features/content-management/components/static-pages-editor.component.html b/src/app/features/content-management/components/static-pages-editor.component.html index 7806588..8656dba 100644 --- a/src/app/features/content-management/components/static-pages-editor.component.html +++ b/src/app/features/content-management/components/static-pages-editor.component.html @@ -3,6 +3,9 @@

{{ 'builder.staticPages' | translate }}

{{ 'builder.createPage' | translate }} + @if (fieldError('staticPages'); as msg) { +

{{ msg }}

+ }
diff --git a/src/app/features/content-management/components/static-pages-editor.component.ts b/src/app/features/content-management/components/static-pages-editor.component.ts index 3e01d88..7b36343 100644 --- a/src/app/features/content-management/components/static-pages-editor.component.ts +++ b/src/app/features/content-management/components/static-pages-editor.component.ts @@ -51,6 +51,10 @@ export class StaticPagesEditorComponent { private readonly translate = inject(TranslateService); readonly bootstrap = this.projectEditor.bootstrap; + readonly fieldError = (key: string): string | null => { + const messageKey = this.projectEditor.fieldError(key); + return messageKey ? this.translate.t(messageKey) : null; + }; readonly allPages = computed(() => this.contentFacade.pages(this.bootstrap())); readonly validation = computed(() => this.contentFacade.validatePages(this.bootstrap())); readonly locales = computed(() => this.bootstrap()?.localization.supportedLocales ?? ['en']); diff --git a/src/app/features/project-editor/sections/homepage-section.component.html b/src/app/features/project-editor/sections/homepage-section.component.html index 777d459..72276ed 100644 --- a/src/app/features/project-editor/sections/homepage-section.component.html +++ b/src/app/features/project-editor/sections/homepage-section.component.html @@ -1,5 +1,8 @@ @if (homePage()) { + @if (fieldError('pages'); as msg) { +

{{ msg }}

+ }
@for (section of sections(); track section.id) {
diff --git a/src/app/features/project-editor/sections/homepage-section.component.ts b/src/app/features/project-editor/sections/homepage-section.component.ts index 977944d..45ecae0 100644 --- a/src/app/features/project-editor/sections/homepage-section.component.ts +++ b/src/app/features/project-editor/sections/homepage-section.component.ts @@ -3,6 +3,7 @@ import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/c import { FormsModule } from '@angular/forms'; import { ProjectEditorFacade } from '../facade/project-editor.facade'; import { TranslatePipe } from '../../../i18n/translate.pipe'; +import { TranslateService } from '../../../i18n/translate.service'; import { InputComponent } from '../../../shared/ui/input/input.component'; import { SectionCardComponent } from '../../../shared/ui/section-card/section-card.component'; import { ToggleComponent } from '../../../shared/ui/toggle/toggle.component'; @@ -23,7 +24,12 @@ export interface LayoutStrategyOption { }) export class ProjectEditorHomepageSectionComponent { private readonly facade = inject(ProjectEditorFacade); + private readonly translate = inject(TranslateService); readonly homePage = this.facade.homepagePage; + readonly fieldError = (key: string): string | null => { + const messageKey = this.facade.fieldError(key); + return messageKey ? this.translate.t(messageKey) : null; + }; readonly sections = computed(() => [...(this.homePage()?.sections ?? [])].sort((a, b) => a.order - b.order)); readonly layoutStrategyOptions: LayoutStrategyOption[] = [ diff --git a/src/app/features/project-editor/sections/languages-section.component.html b/src/app/features/project-editor/sections/languages-section.component.html index 13980ae..94aec46 100644 --- a/src/app/features/project-editor/sections/languages-section.component.html +++ b/src/app/features/project-editor/sections/languages-section.component.html @@ -1,6 +1,9 @@ {{ 'builder.languagesTabDesc' | translate }} + @if (fieldError('localization.supportedLocales'); as msg) { +

{{ msg }}

+ }
{ + const messageKey = this.facade.fieldError(key); + return messageKey ? this.translate.t(messageKey) : null; + }; readonly locales = computed(() => this.bootstrap()?.localization.supportedLocales ?? []); readonly defaultLocale = computed(() => this.bootstrap()?.localization.defaultLocale ?? ''); readonly supportedLocales = computed(() => this.bootstrap()?.tenant.supportedLocales ?? []); diff --git a/src/app/features/project-editor/sections/navigation-section.component.html b/src/app/features/project-editor/sections/navigation-section.component.html index a904996..b45c83f 100644 --- a/src/app/features/project-editor/sections/navigation-section.component.html +++ b/src/app/features/project-editor/sections/navigation-section.component.html @@ -1,5 +1,8 @@ + @if (fieldError('navigation.header'); as msg) { +

{{ msg }}

+ }
{{ 'builder.addLink' | translate }} diff --git a/src/app/features/project-editor/sections/navigation-section.component.ts b/src/app/features/project-editor/sections/navigation-section.component.ts index 4d524b8..f43652e 100644 --- a/src/app/features/project-editor/sections/navigation-section.component.ts +++ b/src/app/features/project-editor/sections/navigation-section.component.ts @@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@a import { FormsModule } from '@angular/forms'; import { ProjectEditorFacade } from '../facade/project-editor.facade'; import { TranslatePipe } from '../../../i18n/translate.pipe'; +import { TranslateService } from '../../../i18n/translate.service'; import { NavigationItemConfig } from '../../../shared/models/config'; import { ButtonComponent } from '../../../shared/ui/button/button.component'; import { InputComponent } from '../../../shared/ui/input/input.component'; @@ -22,7 +23,12 @@ import { ContentManagementFacade } from '../../content-management/facade/content export class ProjectEditorNavigationSectionComponent { private readonly facade = inject(ProjectEditorFacade); private readonly contentFacade = inject(ContentManagementFacade); + private readonly translate = inject(TranslateService); readonly bootstrap = this.facade.bootstrap; + readonly fieldError = (key: string): string | null => { + const messageKey = this.facade.fieldError(key); + return messageKey ? this.translate.t(messageKey) : null; + }; readonly pageOptions = computed(() => this.contentFacade.pages(this.bootstrap()).map(page => ({ value: page.id, label: page.title || page.id })), diff --git a/src/app/features/project-editor/sections/widgets-section.component.html b/src/app/features/project-editor/sections/widgets-section.component.html index 4344450..ff7e3dc 100644 --- a/src/app/features/project-editor/sections/widgets-section.component.html +++ b/src/app/features/project-editor/sections/widgets-section.component.html @@ -1,5 +1,8 @@ @if (widgets().length > 0) { + @if (fieldError('pages'); as msg) { +

{{ msg }}

+ }
@for (entry of widgets(); track entry.widget.id) {
diff --git a/src/app/features/project-editor/sections/widgets-section.component.ts b/src/app/features/project-editor/sections/widgets-section.component.ts index 89299d5..b9a2bdc 100644 --- a/src/app/features/project-editor/sections/widgets-section.component.ts +++ b/src/app/features/project-editor/sections/widgets-section.component.ts @@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { ProjectEditorFacade } from '../facade/project-editor.facade'; import { TranslatePipe } from '../../../i18n/translate.pipe'; +import { TranslateService } from '../../../i18n/translate.service'; import { InputComponent } from '../../../shared/ui/input/input.component'; import { SectionCardComponent } from '../../../shared/ui/section-card/section-card.component'; import { ToggleComponent } from '../../../shared/ui/toggle/toggle.component'; @@ -16,7 +17,12 @@ import { ToggleComponent } from '../../../shared/ui/toggle/toggle.component'; }) export class ProjectEditorWidgetsSectionComponent { private readonly facade = inject(ProjectEditorFacade); + private readonly translate = inject(TranslateService); readonly widgets = this.facade.homepageWidgets; + readonly fieldError = (key: string): string | null => { + const messageKey = this.facade.fieldError(key); + return messageKey ? this.translate.t(messageKey) : null; + }; updateWidget(widgetId: string, updater: (props: Record) => Record): void { this.facade.updateBootstrap(current => ({