- header-section: raw checkboxes -> app-toggle, wrap in SectionCard - footer-section: replace unvalidated pipe-delimited textareas for payment icons/social links with KeyValueEditor + MediaPickerComponent, add missing footer logo picker, validate social link URLs (http/https), wrap in SectionCard - i18n: add footer logo / key-value-editor labels and URL validation message Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
43 lines
2.1 KiB
TypeScript
43 lines
2.1 KiB
TypeScript
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 { HeaderConfig } from '../../../shared/models/config';
|
|
import { SectionCardComponent } from '../../../shared/ui/section-card/section-card.component';
|
|
import { ToggleComponent } from '../../../shared/ui/toggle/toggle.component';
|
|
|
|
@Component({
|
|
selector: 'app-project-editor-header-section',
|
|
standalone: true,
|
|
imports: [FormsModule, TranslatePipe, SectionCardComponent, ToggleComponent],
|
|
templateUrl: './header-section.component.html',
|
|
styleUrls: ['./section.shared.scss'],
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
})
|
|
export class ProjectEditorHeaderSectionComponent {
|
|
private readonly facade = inject(ProjectEditorFacade);
|
|
readonly bootstrap = this.facade.bootstrap;
|
|
readonly items: Array<{ key: keyof HeaderConfig; label: string; descKey: string }> = [
|
|
{ key: 'showLogo', label: 'builder.showLogo', descKey: 'builder.showLogoDesc' },
|
|
{ key: 'showSearch', label: 'builder.showSearch', descKey: 'builder.showSearchDesc' },
|
|
{ key: 'showCategories', label: 'builder.showCategories', descKey: 'builder.showCategoriesDesc' },
|
|
{ key: 'showLanguages', label: 'builder.showLanguages', descKey: 'builder.showLanguagesDesc' },
|
|
{ key: 'showCart', label: 'builder.showCart', descKey: 'builder.showCartDesc' },
|
|
{ key: 'showProfile', label: 'builder.showProfile', descKey: 'builder.showProfileDesc' },
|
|
{ key: 'showWishlist', label: 'builder.showWishlist', descKey: 'builder.showWishlistDesc' },
|
|
{ key: 'showCompare', label: 'builder.showCompare', descKey: 'builder.showCompareDesc' },
|
|
{ key: 'showRegion', label: 'builder.showRegion', descKey: 'builder.showRegionDesc' },
|
|
];
|
|
|
|
toggle(key: keyof HeaderConfig, checked: boolean): void {
|
|
this.facade.updateBootstrap(current => ({
|
|
...current,
|
|
header: { ...(current.header ?? {}), [key]: checked }
|
|
}));
|
|
}
|
|
|
|
isChecked(key: keyof HeaderConfig): boolean {
|
|
return !!this.bootstrap()?.header?.[key];
|
|
}
|
|
}
|