diff --git a/src/app/core/services/tenant.interface.ts b/src/app/core/services/tenant.interface.ts index 0207fe4..267ca26 100644 --- a/src/app/core/services/tenant.interface.ts +++ b/src/app/core/services/tenant.interface.ts @@ -25,6 +25,7 @@ export interface HeroConfig { export interface EventConfig { title?: string | null; location?: string | null; + dates_text?: string | null; dates?: string[] | null; } diff --git a/src/app/features/store/pages/store-home-page/store-home-page.component.spec.ts b/src/app/features/store/pages/store-home-page/store-home-page.component.spec.ts index 3c1e1c8..334cac9 100644 --- a/src/app/features/store/pages/store-home-page/store-home-page.component.spec.ts +++ b/src/app/features/store/pages/store-home-page/store-home-page.component.spec.ts @@ -187,6 +187,7 @@ describe('StoreHomePageComponent', () => { eventConfig: { title: 'Fiesta Fútbol Infantil', location: 'Rosario, Santa Fe', + dates_text: '5 y 6 de diciembre de 2026', dates: ['2026-12-05'], }, }); @@ -219,6 +220,7 @@ describe('StoreHomePageComponent', () => { expect(hero.style.backgroundImage).toContain('https://example.com/hero.jpg'); expect(hero.textContent).toContain('Fiesta Fútbol Infantil'); expect(hero.textContent).toContain('Rosario, Santa Fe'); + expect(hero.textContent).toContain('5 y 6 de diciembre de 2026'); }); it('requests another page for the selected featured group', async () => { diff --git a/src/app/shared/components/hero-banner/hero-banner.component.ts b/src/app/shared/components/hero-banner/hero-banner.component.ts index c540993..5662c57 100644 --- a/src/app/shared/components/hero-banner/hero-banner.component.ts +++ b/src/app/shared/components/hero-banner/hero-banner.component.ts @@ -17,25 +17,14 @@ export class HeroBannerComponent { @Input() eventConfig?: EventConfig | null; get formattedDates(): string { + if (this.eventConfig?.dates_text) { + return this.eventConfig.dates_text; + } + if (!this.eventConfig?.dates || this.eventConfig.dates.length === 0) { return ''; } - // Si ya viene formateado o es un string libre largo, lo devolvemos - if (this.eventConfig.dates.length === 1 && this.eventConfig.dates[0].length > 10) { - return this.eventConfig.dates[0]; - } - - // Si viene como array de fechas ISO, intentamos formatearlo bonito - // Pero por simplicidad ahora, los unimos. - // Idealmente el backend manda el texto formateado o se usa un DatePipe avanzado - const hasIsoDates = this.eventConfig.dates.some((d) => d.includes('-')); - - if (hasIsoDates) { - // Un simple join por si acaso, aunque lo ideal es que el admin ponga el texto tal cual - return '9, 10, 11 y 12 de Octubre 2026'; // Placeholder basado en los requerimientos, si no se envía como string formateado - } - return this.eventConfig.dates.join(', '); } }