feat(builder): visual homepage blocks, merchant-language widget settings, real carousel arrows

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

P0 user feedback: homepage builder showed raw section.id like 'section-hero'/'section-categories'; hero widget exposed 'full-bleed'/'boxed' and raw px/vh as free text with no explanation; Overlay/Autoplay toggles made no sense without a slides concept; product carousel widgets rendered arrows nowhere near a working carousel.

Homepage section (sections list -> visual blocks):
- Replaced raw section.id display with a merchant-facing block catalog (icon + name + one-line explanation) for hero/categories/featured-products/product-carousel/recently-viewed/banner/partners/custom-html
- Added block catalog picker to append new blocks (was fixed at whatever the seed data had - task asked 'what if we add manually? not fixed 3')
- Added duplicate and remove per block, alongside the existing drag-to-reorder
- Verified in browser: labels render correctly, add-block and duplicate both confirmed working end-to-end

Widgets section (hero widget):
- 'Layout' free-text replaced with a select (Full width / Boxed) instead of typing 'full-bleed'/'boxed' blind
- 'Height' free-text replaced with a select (Compact/Medium/Tall/Full screen) mapped to real vh values
- New Slides editor: title/subtitle pairs an admin can add/remove: this is the actual multi-slide data the Overlay/Autoplay toggles were referring to with nothing to point at before
- HeroWidgetData contract gains slides[]/autoplay; HeroWidgetComponent now renders a real rotator (dots, click-to-jump, autoplay interval) when more than one slide exists - previously autoplay/overlay props existed but there was no slideshow behavior anywhere to control

Carousel arrows root cause and fix:
- widget-manifest.json offers 'carousel' as a layout option for product-collection/product-carousel widgets, and the admin UI let you select it, but ProductCarouselWidgetComponent always rendered a static CSS grid regardless - there was no carousel implementation to have arrows in the first place
- Now renders a real horizontally-scrollable strip with working prev/next buttons (native scrollBy, disabled at each end) when section.layout.strategy === 'carousel'; falls back to the existing grid otherwise
- Confirmed src/app/components/items-carousel (a PrimeNG p-carousel) is dead code, not wired into any route or widget - not the source of the reported bug

New builder.* i18n keys (en/ru/hy), zero duplicate-key collisions verified via scan
This commit is contained in:
sdarbinyan
2026-07-19 14:14:29 +04:00
parent 726df0cee0
commit 71d5f4d320
14 changed files with 705 additions and 66 deletions

View File

@@ -0,0 +1,98 @@
.block-list { display: grid; gap: 10px; margin: 10px 0; }
.block-card {
display: grid;
grid-template-columns: auto auto 1fr auto;
gap: 12px;
align-items: start;
padding: 12px;
border: 1px solid var(--border-color, #d3dad9);
border-radius: var(--radius-sm);
background: #fff;
&.block-card--hidden { opacity: 0.6; }
&.cdk-drag-preview { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); }
&.cdk-drag-placeholder { opacity: 0.3; }
}
.block-card__handle {
cursor: grab;
color: var(--text-secondary, #6b7280);
padding-top: 4px;
}
.block-card__preview {
width: 44px;
height: 44px;
border-radius: var(--radius-sm);
background: var(--bg-secondary, #f7f8f8);
display: flex;
align-items: center;
justify-content: center;
font-size: 1.2rem;
color: var(--color-primary, #2f8f5b);
}
.block-card__title-row { display: flex; align-items: center; gap: 8px; }
.block-card__desc { margin: 2px 0 8px; color: var(--text-secondary, #6b7280); font-size: 0.85rem; }
.block-card__hidden-badge {
font-size: 0.7rem;
text-transform: uppercase;
letter-spacing: 0.4px;
color: var(--text-secondary, #6b7280);
border: 1px solid var(--border-color, #d3dad9);
border-radius: 999px;
padding: 1px 8px;
}
.block-card__actions {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 8px;
button {
border: none;
background: transparent;
cursor: pointer;
color: var(--text-secondary, #6b7280);
&:hover { color: var(--text-primary, #1e3c38); }
}
}
.block-card__visible-toggle { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; }
.block-card__remove:hover { color: var(--danger-color, #c0392b); }
.block-catalog { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-color, #d3dad9); }
.block-catalog__grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
gap: 8px;
}
.block-catalog__item {
display: flex;
flex-direction: column;
align-items: center;
gap: 6px;
padding: 12px 8px;
border: 1px dashed var(--border-color, #d3dad9);
border-radius: var(--radius-sm);
background: var(--bg-secondary, #f7f8f8);
cursor: pointer;
font-size: 0.8rem;
color: var(--text-primary, #1e3c38);
.pi { font-size: 1.2rem; color: var(--color-primary, #2f8f5b); }
&:hover { border-color: var(--color-primary, #2f8f5b); background: #fff; }
&:focus-visible { outline: 2px solid var(--color-primary, #2f8f5b); outline-offset: 2px; }
}
@media (max-width: 640px) {
.block-card { grid-template-columns: auto 1fr; }
.block-card__actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; }
}