2026-07-10 13:43:53 +04:00
|
|
|
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
|
feat(project-editor): finish field descriptions + enum dropdowns across all sections
Wires up the remaining editor sections (theme, header, footer, homepage,
widgets, features, languages, navigation) with the description text and
dropdown UX started for General/Branding:
- Every enum-backed field is now a <select> with a description per option,
not free text: theme.mode, the new site-wide layout.type (previously had
no editor at all - added to the Theme section, and added to that
section's reset-scope), homepage section layout.strategy, and
catalog.navigationMode (also previously unedited, added to Features).
- Every other field (colors, header toggles, footer contact/company fields,
widget props, feature flags, language add, nav link label/url/visible)
gets a one-line plain-language description under its label via the new
*Desc i18n keys (en/ru/hy) prepared earlier.
- Genuinely open text (widget layout variant strings, JSON props) stays
free text, description-only, per the existing widgetLayoutDesc/widgetJsonDesc
wording - not force-fit into a dropdown.
Verified: tsc --noEmit and ng build both clean.
2026-07-15 00:45:41 +04:00
|
|
|
import { FormsModule } from '@angular/forms';
|
2026-07-10 13:43:53 +04:00
|
|
|
import { ProjectEditorFacade } from '../facade/project-editor.facade';
|
|
|
|
|
import { TranslatePipe } from '../../../i18n/translate.pipe';
|
2026-07-16 02:12:25 +04:00
|
|
|
import { SectionCardComponent } from '../../../shared/ui/section-card/section-card.component';
|
|
|
|
|
import { ToggleComponent } from '../../../shared/ui/toggle/toggle.component';
|
2026-07-10 13:43:53 +04:00
|
|
|
|
feat(project-editor): finish field descriptions + enum dropdowns across all sections
Wires up the remaining editor sections (theme, header, footer, homepage,
widgets, features, languages, navigation) with the description text and
dropdown UX started for General/Branding:
- Every enum-backed field is now a <select> with a description per option,
not free text: theme.mode, the new site-wide layout.type (previously had
no editor at all - added to the Theme section, and added to that
section's reset-scope), homepage section layout.strategy, and
catalog.navigationMode (also previously unedited, added to Features).
- Every other field (colors, header toggles, footer contact/company fields,
widget props, feature flags, language add, nav link label/url/visible)
gets a one-line plain-language description under its label via the new
*Desc i18n keys (en/ru/hy) prepared earlier.
- Genuinely open text (widget layout variant strings, JSON props) stays
free text, description-only, per the existing widgetLayoutDesc/widgetJsonDesc
wording - not force-fit into a dropdown.
Verified: tsc --noEmit and ng build both clean.
2026-07-15 00:45:41 +04:00
|
|
|
export interface CatalogNavigationOption {
|
|
|
|
|
value: 'default' | 'left-category-navigation' | 'mega-category-layout' | 'top-category-carousel';
|
|
|
|
|
labelKey: string;
|
|
|
|
|
descKey: string;
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-10 13:43:53 +04:00
|
|
|
@Component({
|
|
|
|
|
selector: 'app-project-editor-features-section',
|
|
|
|
|
standalone: true,
|
2026-07-16 02:12:25 +04:00
|
|
|
imports: [FormsModule, TranslatePipe, SectionCardComponent, ToggleComponent],
|
2026-07-10 13:43:53 +04:00
|
|
|
templateUrl: './features-section.component.html',
|
|
|
|
|
styleUrls: ['./section.shared.scss'],
|
|
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
|
|
|
})
|
|
|
|
|
export class ProjectEditorFeaturesSectionComponent {
|
|
|
|
|
private readonly facade = inject(ProjectEditorFacade);
|
|
|
|
|
readonly bootstrap = this.facade.bootstrap;
|
|
|
|
|
|
feat(project-editor): finish field descriptions + enum dropdowns across all sections
Wires up the remaining editor sections (theme, header, footer, homepage,
widgets, features, languages, navigation) with the description text and
dropdown UX started for General/Branding:
- Every enum-backed field is now a <select> with a description per option,
not free text: theme.mode, the new site-wide layout.type (previously had
no editor at all - added to the Theme section, and added to that
section's reset-scope), homepage section layout.strategy, and
catalog.navigationMode (also previously unedited, added to Features).
- Every other field (colors, header toggles, footer contact/company fields,
widget props, feature flags, language add, nav link label/url/visible)
gets a one-line plain-language description under its label via the new
*Desc i18n keys (en/ru/hy) prepared earlier.
- Genuinely open text (widget layout variant strings, JSON props) stays
free text, description-only, per the existing widgetLayoutDesc/widgetJsonDesc
wording - not force-fit into a dropdown.
Verified: tsc --noEmit and ng build both clean.
2026-07-15 00:45:41 +04:00
|
|
|
readonly catalogNavigationOptions: CatalogNavigationOption[] = [
|
|
|
|
|
{ value: 'default', labelKey: 'builder.catalogNavDefault', descKey: 'builder.catalogNavDefaultDesc' },
|
|
|
|
|
{ value: 'left-category-navigation', labelKey: 'builder.catalogNavLeftCategory', descKey: 'builder.catalogNavLeftCategoryDesc' },
|
|
|
|
|
{ value: 'mega-category-layout', labelKey: 'builder.catalogNavMegaCategory', descKey: 'builder.catalogNavMegaCategoryDesc' },
|
|
|
|
|
{ value: 'top-category-carousel', labelKey: 'builder.catalogNavTopCarousel', descKey: 'builder.catalogNavTopCarouselDesc' },
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
catalogNavigationDescKey(mode: string | undefined): string {
|
|
|
|
|
return this.catalogNavigationOptions.find(option => option.value === mode)?.descKey ?? '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateCatalogNavigationMode(mode: string): void {
|
|
|
|
|
this.facade.updateBootstrap(current => ({
|
|
|
|
|
...current,
|
|
|
|
|
catalog: { ...current.catalog, navigationMode: mode as CatalogNavigationOption['value'] }
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-10 13:43:53 +04:00
|
|
|
toggleFeature(key: string, checked: boolean): void {
|
|
|
|
|
this.facade.updateBootstrap(current => ({ ...current, featureFlags: { ...current.featureFlags, [key]: checked } }));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
toggleUserExperience(path: 'recentlyViewed' | 'wishlist' | 'compare', checked: boolean): void {
|
|
|
|
|
this.facade.updateBootstrap(current => ({
|
|
|
|
|
...current,
|
|
|
|
|
userExperience: {
|
|
|
|
|
...current.userExperience,
|
|
|
|
|
[path]: {
|
2026-07-16 02:12:25 +04:00
|
|
|
...current.userExperience?.[path],
|
2026-07-10 13:43:53 +04:00
|
|
|
enabled: checked
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
toggleCatalog(key: 'suggestionsEnabled' | 'searchHistoryEnabled', checked: boolean): void {
|
|
|
|
|
this.facade.updateBootstrap(current => ({ ...current, catalog: { ...current.catalog, [key]: checked } }));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
toggleProductFeature(section: 'reviews' | 'questions', checked: boolean): void {
|
|
|
|
|
this.facade.updateBootstrap(current => ({
|
|
|
|
|
...current,
|
|
|
|
|
productPage: {
|
|
|
|
|
...current.productPage,
|
|
|
|
|
[section]: {
|
2026-07-16 02:12:25 +04:00
|
|
|
...current.productPage?.[section],
|
2026-07-10 13:43:53 +04:00
|
|
|
enabled: checked
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
}
|