diff --git a/src/app/features/content-management/components/static-pages-editor.component.html b/src/app/features/content-management/components/static-pages-editor.component.html index bb0aab8..a167f93 100644 --- a/src/app/features/content-management/components/static-pages-editor.component.html +++ b/src/app/features/content-management/components/static-pages-editor.component.html @@ -1,55 +1,78 @@

{{ 'builder.staticPages' | translate }}

- + {{ 'builder.createPage' | translate }}
@if (validation().duplicateSlugs.length > 0) { -

{{ 'staticPages.duplicateSlug' | translate }}

+ {{ 'staticPages.duplicateSlug' | translate }} } @if (validation().emptyTitles.length > 0) { -

{{ 'staticPages.emptyTitle' | translate }}

+ {{ 'staticPages.emptyTitle' | translate }} + } + + @if (pages().length === 0) { + + + {{ 'builder.createPage' | translate }} + + }
@for (page of pages(); track page.id) { -
-
-

{{ page.id }}

-
- - - + +
+
+

{{ page.id }}

+
+ + + {{ 'builder.deletePage' | translate }} +
-
-
- - - - - - - - - -
- @for (locale of locales(); track locale) { -
- - +
+ + + + + + + + + + + + + + +
- } -
+ +
+ + + + +
+ + @for (locale of locales(); track locale) { +
+ + + + +
+ } +
+ }
diff --git a/src/app/features/content-management/components/static-pages-editor.component.scss b/src/app/features/content-management/components/static-pages-editor.component.scss new file mode 100644 index 0000000..2fafaba --- /dev/null +++ b/src/app/features/content-management/components/static-pages-editor.component.scss @@ -0,0 +1,31 @@ +.page-card { + display: grid; + gap: 14px; +} + +.page-card__header { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + gap: 10px; +} + +.page-card__title { + margin: 0; + font-size: 1rem; + font-weight: 700; + color: var(--text-primary, #1e3c38); +} + +.toggle-grid { + display: grid; + grid-template-columns: repeat(4, minmax(0, 1fr)); + gap: 12px; +} + +@media (max-width: 900px) { + .toggle-grid { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } +} diff --git a/src/app/features/content-management/components/static-pages-editor.component.ts b/src/app/features/content-management/components/static-pages-editor.component.ts index fa463f9..b09462e 100644 --- a/src/app/features/content-management/components/static-pages-editor.component.ts +++ b/src/app/features/content-management/components/static-pages-editor.component.ts @@ -5,13 +5,29 @@ import { ContentManagementFacade } from '../facade/content-management.facade'; import { ContentPage } from '../models/content-page.model'; import { TranslatePipe } from '../../../i18n/translate.pipe'; import { MarketplaceHtmlEditorComponent } from '../../project-editor/components/html-editor/marketplace-html-editor.component'; +import { ButtonComponent } from '../../../shared/ui/button/button.component'; +import { InputComponent } from '../../../shared/ui/input/input.component'; +import { CardComponent } from '../../../shared/ui/card/card.component'; +import { FormFieldComponent } from '../../../shared/ui/form-field/form-field.component'; +import { BadgeComponent } from '../../../shared/ui/badge/badge.component'; +import { EmptyStateComponent } from '../../../shared/ui/empty-state/empty-state.component'; @Component({ selector: 'app-static-pages-editor', standalone: true, - imports: [FormsModule, TranslatePipe, MarketplaceHtmlEditorComponent], + imports: [ + FormsModule, + TranslatePipe, + MarketplaceHtmlEditorComponent, + ButtonComponent, + InputComponent, + CardComponent, + FormFieldComponent, + BadgeComponent, + EmptyStateComponent + ], templateUrl: './static-pages-editor.component.html', - styleUrls: ['../../project-editor/sections/section.shared.scss'], + styleUrls: ['../../project-editor/sections/section.shared.scss', './static-pages-editor.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush }) export class StaticPagesEditorComponent { diff --git a/src/app/features/content-management/services/content-page.service.ts b/src/app/features/content-management/services/content-page.service.ts index d1c9cb6..35e42ed 100644 --- a/src/app/features/content-management/services/content-page.service.ts +++ b/src/app/features/content-management/services/content-page.service.ts @@ -27,8 +27,8 @@ export class ContentPageService { })); } - return Object.values(config) - .map((page, index) => this.normalizePage(page as ContentPageBootstrapInput, index)) + return Object.entries(config) + .map(([key, page], index) => this.normalizePage(page as ContentPageBootstrapInput, index, key)) .sort((left, right) => left.order - right.order); } @@ -117,7 +117,7 @@ export class ContentPageService { }, {}); } - private normalizePage(page: ContentPageBootstrapInput, index: number): ContentPage { + private normalizePage(page: ContentPageBootstrapInput, index: number, key: string): ContentPage { const titleMap = typeof page.title === 'object' && page.title ? page.title : {}; const htmlMap = typeof page.html === 'object' && page.html ? page.html : {}; const translations = { ...(page.translations ?? {}) }; @@ -131,9 +131,9 @@ export class ContentPageService { } return { - id: page.id, - slug: this.normalizeSlug(page.slug || page.id), - title: typeof page.title === 'string' ? page.title : Object.values(titleMap)[0] ?? page.id, + id: page.id || key, + slug: this.normalizeSlug(page.slug || page.id || key), + title: typeof page.title === 'string' ? page.title : Object.values(titleMap)[0] ?? page.id ?? key, icon: page.icon, order: page.order ?? index + 1, showInFooter: page.showInFooter !== false,