fix(project-editor): editable nav link labels per locale, add LocaleTabs
- navigation-section: add LocaleTabs; label input now reads/writes the active locale's translation via a new editableLabel() helper instead of always the default locale. facade.updateNavLinkLabel() gained an optional locale param (defaults to current default locale, so existing callers are unaffected) and correctly promotes a plain-string label into a per-locale map when writing a non-default locale. - languages-section: wrap in SectionCard, add LocaleTabs for consistency. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,11 +4,13 @@ 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';
|
||||
import { SectionCardComponent } from '../../../shared/ui/section-card/section-card.component';
|
||||
import { LocaleTabsComponent } from '../../../shared/ui/locale-tabs/locale-tabs.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-project-editor-languages-section',
|
||||
standalone: true,
|
||||
imports: [FormsModule, TranslatePipe, ButtonComponent, InputComponent],
|
||||
imports: [FormsModule, TranslatePipe, ButtonComponent, InputComponent, SectionCardComponent, LocaleTabsComponent],
|
||||
templateUrl: './languages-section.component.html',
|
||||
styleUrls: ['./section.shared.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
@@ -18,8 +20,15 @@ export class ProjectEditorLanguagesSectionComponent {
|
||||
readonly bootstrap = this.facade.bootstrap;
|
||||
readonly locales = computed(() => this.bootstrap()?.localization.supportedLocales ?? []);
|
||||
readonly defaultLocale = computed(() => this.bootstrap()?.localization.defaultLocale ?? '');
|
||||
readonly supportedLocales = computed(() => this.bootstrap()?.tenant.supportedLocales ?? []);
|
||||
readonly tenantDefaultLocale = computed(() => this.bootstrap()?.tenant.defaultLocale ?? '');
|
||||
readonly activeLocale = signal<string | null>(null);
|
||||
readonly newLocale = signal('');
|
||||
|
||||
onActiveLocaleChange(locale: string): void {
|
||||
this.activeLocale.set(locale);
|
||||
}
|
||||
|
||||
updateNewLocale(value: string): void {
|
||||
this.newLocale.set(value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user