docs(project-editor): document new shared/ui primitives and fixed bugs
Some checks failed
Architecture Governance / architecture (push) Has been cancelled

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
sdarbinyan
2026-07-16 02:16:29 +04:00
parent b61bf0e5bc
commit 897c1f3196
2 changed files with 40 additions and 2 deletions

View File

@@ -33,7 +33,7 @@ Route: `/edit/:section` or `/{lang}/edit/:section`.
| Widgets | `widgets-section` | homepage widget configuration — typed editors for hero/categories/product-collection, JSON fallback for everything else |
| Marketplace Features | `features-section` | feature flags, catalog navigation mode, search suggestions/history, recently viewed, reviews/questions/recommendations |
| Languages | `languages-section` | add/remove supported locale, set default locale; syncs translation keys across static pages and nav labels via `LocaleSyncService` |
| Navigation | `navigation-section` | header nav: add/remove/reorder/edit label/URL/visibility. Flat footer nav: same. Grouped (column-based) footer nav is read-only here — edit via Footer tab. |
| Navigation | `navigation-section` | header nav: add/remove/reorder/edit label/URL/visibility, per-locale via `app-locale-tabs`. Flat footer nav: same. Grouped (column-based) footer nav is read-only here — edit via Footer tab. |
| Preview | `preview-section` | export/import JSON, in-memory runtime preview without full reload |
## Save / publish / draft / reset model
@@ -54,6 +54,21 @@ Route: `/edit/:section` or `/{lang}/edit/:section`.
Admin login shares the exact same Telegram QR/session backend and `TelegramLoginComponent` as customer login (`mode: 'admin'` vs `'customer'`) — only the cookie name/`SameSite` policy, token storage keys, and guard differ. **Backend gap:** because both flows hit the same session endpoint, the backend cannot distinguish an admin scan from a customer scan today — real admin authorization must be enforced server-side. Full detail: `docs/BACKEND.md` item 1.
## Design system primitives (post-Sprint 30 redesign)
All 11 section components (`sections/*.component.html`) share these 6 `shared/ui/*` primitives instead of copy-pasted markup. They mirror the existing `InputComponent` CVA idiom (standalone, `OnPush`, `NG_VALUE_ACCESSOR` where they're form controls):
| Primitive | Selector | Replaces | Used in |
|---|---|---|---|
| `ToggleComponent` | `app-toggle` | raw `<input type="checkbox">` + `$any($event.target).checked` | header, homepage, widgets, navigation, features |
| `SelectComponent` | `app-select` | raw `<select>` | theme (`theme.mode`, `layout.type`) |
| `ColorPickerComponent` | `app-color-picker` | raw `<input type="color">` | theme (8 palette colors) |
| `SectionCardComponent` | `app-section-card` | the copy-pasted `editor-section-card`/`<h2>` shell | all 11 sections |
| `LocaleTabsComponent` | `app-locale-tabs` | (new capability) | languages, navigation |
| `KeyValueEditorComponent<T>` | `app-key-value-editor` | pipe-delimited `<textarea>` lists | footer (payment icons, social links) |
`section.shared.scss`'s `.editor-grid.*` classes are unchanged and still used inside `SectionCard` bodies; only the outer `.editor-section-card` shell and per-section `<h2>` were replaced (that rule has been removed from the shared stylesheet since it has no remaining consumers).
## Field-description / dropdown UX (Sprint 19+)
Every field across the 10 editor section templates now carries a one-line, i18n'd description under its label explaining what it does in plain language (all new copy routed through `TranslateService`/`TranslatePipe`, added to `Translations` + `en.ts`/`ru.ts`/`hy.ts` following the existing `builder.*` key pattern — see `src/app/i18n/translations.ts`).

View File

@@ -40,7 +40,30 @@ don't fix inline unless asked.
## Fixed
1. **Quick Actions: 3 untranslated raw i18n keys.**
1. **Project Editor footer: payment icons and social links had no validation.**
`footer-section.component.ts` parsed both fields from pipe-delimited
`<textarea>` strings (`icon.src|icon.alt`, `link.id|link.label|link.url`)
with zero validation - malformed rows silently produced empty `src`/`alt`/
`url` values instead of surfacing an error.
- Fixed: 2026-07-16, replaced both textareas with `app-key-value-editor`
rows (icon picked via `MediaPickerComponent`, label/URL via `app-input`),
added inline URL-format validation on social links (same `HTTP_URL`
pattern used in `project-validator.service.ts`) and a missing footer-logo
media picker.
2. **Project Editor navigation: nav link labels only editable for the default locale.**
`navigation-section.component.ts`'s `labelOf` helper (and the facade's
`updateNavLinkLabel`) always read/wrote the default locale's key on a
`NavigationLocalizedText` label map, so switching locales elsewhere in the
editor had no effect on nav link text - other locales' translations could
only be edited by hand-editing the exported JSON.
- Fixed: 2026-07-16, added `app-locale-tabs` to the section; the label
input now reads/writes the active tab's locale via a new
`editableLabel()` helper, and `ProjectEditorFacade.updateNavLinkLabel()`
gained an optional `locale` parameter (defaults to the current default
locale, so existing callers are unaffected).
3. **Quick Actions: 3 untranslated raw i18n keys.**
`dashboard.actionUsers`, `dashboard.actionMonitoring`,
`dashboard.actionAnalytics` rendered as literal key strings instead of
translated labels on the admin dashboard's Quick Actions section, because