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.
44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';
|
|
import { FormsModule } from '@angular/forms';
|
|
import { ProjectEditorFacade } from '../facade/project-editor.facade';
|
|
import { TranslatePipe } from '../../../i18n/translate.pipe';
|
|
import { ButtonComponent } from '../../../shared/ui/button/button.component';
|
|
import { InputComponent } from '../../../shared/ui/input/input.component';
|
|
|
|
@Component({
|
|
selector: 'app-project-editor-languages-section',
|
|
standalone: true,
|
|
imports: [FormsModule, TranslatePipe, ButtonComponent, InputComponent],
|
|
templateUrl: './languages-section.component.html',
|
|
styleUrls: ['./section.shared.scss'],
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
})
|
|
export class ProjectEditorLanguagesSectionComponent {
|
|
private readonly facade = inject(ProjectEditorFacade);
|
|
readonly bootstrap = this.facade.bootstrap;
|
|
readonly locales = computed(() => this.bootstrap()?.localization.supportedLocales ?? []);
|
|
readonly defaultLocale = computed(() => this.bootstrap()?.localization.defaultLocale ?? '');
|
|
readonly newLocale = signal('');
|
|
|
|
updateNewLocale(value: string): void {
|
|
this.newLocale.set(value);
|
|
}
|
|
|
|
addLocale(): void {
|
|
const code = this.newLocale().trim();
|
|
if (!code) {
|
|
return;
|
|
}
|
|
this.facade.addLocale(code);
|
|
this.newLocale.set('');
|
|
}
|
|
|
|
removeLocale(code: string): void {
|
|
this.facade.removeLocale(code);
|
|
}
|
|
|
|
setDefault(code: string): void {
|
|
this.facade.setDefaultLocale(code);
|
|
}
|
|
}
|