fix(storefront): read active event social media from bootstrap
This commit is contained in:
@@ -64,9 +64,14 @@ export interface ActiveEventDate {
|
||||
}
|
||||
|
||||
export interface TenantEvent {
|
||||
id: number;
|
||||
title: string;
|
||||
location: string;
|
||||
subtitle: string | null;
|
||||
description: string | null;
|
||||
location: string | null;
|
||||
date_text: string | null;
|
||||
dates: ActiveEventDate[];
|
||||
social_media: SocialMedia[];
|
||||
}
|
||||
|
||||
export interface WebsiteExtras {
|
||||
@@ -129,7 +134,6 @@ export interface Tenant {
|
||||
footer_bg_image?: string | null;
|
||||
storefront_website_type_code?: string | null;
|
||||
header_type?: 'standard' | 'immersive';
|
||||
event_date_text?: string | null;
|
||||
extras?: WebsiteExtras;
|
||||
event?: TenantEvent | null;
|
||||
selected_bank_account_id?: number | null;
|
||||
|
||||
@@ -216,8 +216,20 @@ describe('StoreHomePageComponent', () => {
|
||||
},
|
||||
});
|
||||
tenant.event = {
|
||||
id: 1,
|
||||
title: 'Fiesta Fútbol Infantil',
|
||||
subtitle: null,
|
||||
description: null,
|
||||
location: 'Rosario, Santa Fe',
|
||||
date_text: '5 y 6 de Diciembre 2026',
|
||||
social_media: [
|
||||
{
|
||||
code: 'whatsapp',
|
||||
icon: 'fa-brands fa-whatsapp',
|
||||
name: 'WhatsApp',
|
||||
url: 'https://wa.me/5493410000000',
|
||||
},
|
||||
],
|
||||
dates: [
|
||||
{
|
||||
id: 20,
|
||||
@@ -237,16 +249,7 @@ describe('StoreHomePageComponent', () => {
|
||||
},
|
||||
],
|
||||
};
|
||||
tenant.event_date_text = '5 y 6 de Diciembre 2026';
|
||||
tenant.storefront_website_type_code = 'onticket';
|
||||
tenant.social_media = [
|
||||
{
|
||||
code: 'whatsapp',
|
||||
icon: 'fa-brands fa-whatsapp',
|
||||
name: 'WhatsApp',
|
||||
url: 'https://wa.me/5493410000000',
|
||||
},
|
||||
];
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [StoreHomePageComponent],
|
||||
@@ -279,7 +282,7 @@ describe('StoreHomePageComponent', () => {
|
||||
expect(hero.textContent).toContain('5 y 6 de Diciembre 2026');
|
||||
const heroComponent = fixture.debugElement.query(By.directive(HeroBannerComponent))
|
||||
.componentInstance as HeroBannerComponent;
|
||||
expect(heroComponent.eventConfig?.contact).toEqual(tenant.social_media);
|
||||
expect(heroComponent.eventConfig?.contact).toEqual(tenant.event.social_media);
|
||||
});
|
||||
|
||||
it('renders additional information as an HTML section', async () => {
|
||||
@@ -347,8 +350,13 @@ describe('StoreHomePageComponent', () => {
|
||||
it('renders only the active event data when the tenant does not have the hero extra', async () => {
|
||||
const tenant = createTenant();
|
||||
tenant.event = {
|
||||
id: 2,
|
||||
title: 'Fiesta Fútbol Infantil',
|
||||
subtitle: null,
|
||||
description: null,
|
||||
location: 'Sunchales, Santa Fe',
|
||||
date_text: null,
|
||||
social_media: [],
|
||||
dates: [
|
||||
{
|
||||
id: 25,
|
||||
|
||||
@@ -75,15 +75,14 @@ export class StoreHomePageComponent implements OnInit, OnDestroy {
|
||||
);
|
||||
protected readonly eventConfig = computed(() => {
|
||||
const tenant = this.tenant();
|
||||
const contact = tenant?.social_media ?? [];
|
||||
const event = tenant?.event;
|
||||
|
||||
if (event) {
|
||||
return {
|
||||
id: tenant.id,
|
||||
id: event.id,
|
||||
title: event.title,
|
||||
location: event.location,
|
||||
dates_text: tenant.event_date_text,
|
||||
dates_text: event.date_text,
|
||||
dates: event.dates.map((eventDate) => ({
|
||||
id: eventDate.id,
|
||||
date: eventDate.date,
|
||||
@@ -92,7 +91,7 @@ export class StoreHomePageComponent implements OnInit, OnDestroy {
|
||||
info_text: eventDate.info_text,
|
||||
isCanceled: eventDate.isCanceled,
|
||||
})),
|
||||
contact,
|
||||
contact: event.social_media,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user