2026-07-10 13:43:53 +04:00
|
|
|
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';
|
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 { PlatformLayoutType, ThemePaletteConfig } from '../../../shared/models/config';
|
feat(project-editor): adopt Design System primitives across editor sections
Applied app-input/app-form-field/app-button to 9 of 11 Project Editor
sections: general, branding, theme, footer, homepage, widgets, languages,
navigation, preview. header and features sections were left unchanged -
they contain only checkboxes and selects, and no Checkbox/Select primitive
exists yet.
Theme section's 8 color pickers stay native <input type=color> (app-input's
type union doesn't include 'color') but are now wrapped in app-form-field
for consistent label/hint treatment. Added app-form-field.full grid-column
rule to section.shared.scss (shared by all 11 sections) alongside the
existing label.full rule, since the custom element doesn't match that
selector.
Production build green, arch:check passes.
2026-07-15 07:55:38 +04:00
|
|
|
import { FormFieldComponent } from '../../../shared/ui/form-field/form-field.component';
|
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 ThemeModeOption {
|
|
|
|
|
value: 'light' | 'dark' | 'system';
|
|
|
|
|
labelKey: string;
|
|
|
|
|
descKey: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface SiteLayoutOption {
|
|
|
|
|
value: PlatformLayoutType;
|
|
|
|
|
labelKey: string;
|
|
|
|
|
descKey: string;
|
|
|
|
|
}
|
2026-07-10 13:43:53 +04:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-project-editor-theme-section',
|
|
|
|
|
standalone: true,
|
feat(project-editor): adopt Design System primitives across editor sections
Applied app-input/app-form-field/app-button to 9 of 11 Project Editor
sections: general, branding, theme, footer, homepage, widgets, languages,
navigation, preview. header and features sections were left unchanged -
they contain only checkboxes and selects, and no Checkbox/Select primitive
exists yet.
Theme section's 8 color pickers stay native <input type=color> (app-input's
type union doesn't include 'color') but are now wrapped in app-form-field
for consistent label/hint treatment. Added app-form-field.full grid-column
rule to section.shared.scss (shared by all 11 sections) alongside the
existing label.full rule, since the custom element doesn't match that
selector.
Production build green, arch:check passes.
2026-07-15 07:55:38 +04:00
|
|
|
imports: [FormsModule, TranslatePipe, FormFieldComponent],
|
2026-07-10 13:43:53 +04:00
|
|
|
templateUrl: './theme-section.component.html',
|
|
|
|
|
styleUrls: ['./section.shared.scss'],
|
|
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
|
|
|
})
|
|
|
|
|
export class ProjectEditorThemeSectionComponent {
|
|
|
|
|
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 themeModeOptions: ThemeModeOption[] = [
|
|
|
|
|
{ value: 'light', labelKey: 'builder.themeModeLight', descKey: 'builder.themeModeLightDesc' },
|
|
|
|
|
{ value: 'dark', labelKey: 'builder.themeModeDark', descKey: 'builder.themeModeDarkDesc' },
|
|
|
|
|
{ value: 'system', labelKey: 'builder.themeModeSystem', descKey: 'builder.themeModeSystemDesc' },
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
readonly siteLayoutOptions: SiteLayoutOption[] = [
|
|
|
|
|
{ value: 'default', labelKey: 'builder.siteLayoutDefault', descKey: 'builder.siteLayoutDefaultDesc' },
|
|
|
|
|
{ value: 'sidebar-left', labelKey: 'builder.siteLayoutSidebarLeft', descKey: 'builder.siteLayoutSidebarLeftDesc' },
|
|
|
|
|
{ value: 'carousel-home', labelKey: 'builder.siteLayoutCarouselHome', descKey: 'builder.siteLayoutCarouselHomeDesc' },
|
|
|
|
|
{ value: 'minimal', labelKey: 'builder.siteLayoutMinimal', descKey: 'builder.siteLayoutMinimalDesc' },
|
|
|
|
|
];
|
|
|
|
|
|
2026-07-10 13:43:53 +04:00
|
|
|
updatePalette<K extends keyof ThemePaletteConfig>(key: K, value: string): void {
|
|
|
|
|
this.facade.updateBootstrap(current => ({
|
|
|
|
|
...current,
|
|
|
|
|
theme: { ...current.theme, palette: { ...current.theme.palette, [key]: value } }
|
|
|
|
|
}));
|
|
|
|
|
}
|
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
|
|
|
|
|
|
|
|
updateThemeMode(mode: string): void {
|
|
|
|
|
this.facade.updateBootstrap(current => ({
|
|
|
|
|
...current,
|
|
|
|
|
theme: { ...current.theme, mode: mode as 'light' | 'dark' | 'system' }
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateSiteLayout(type: string): void {
|
|
|
|
|
this.facade.updateBootstrap(current => ({
|
|
|
|
|
...current,
|
|
|
|
|
layout: { ...current.layout, type: type as PlatformLayoutType }
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
themeModeDescKey(mode: string): string {
|
|
|
|
|
return this.themeModeOptions.find(option => option.value === mode)?.descKey ?? '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
siteLayoutDescKey(type: string): string {
|
|
|
|
|
return this.siteLayoutOptions.find(option => option.value === type)?.descKey ?? '';
|
|
|
|
|
}
|
2026-07-10 13:43:53 +04:00
|
|
|
}
|