Files
marketplaces/src/app/components/footer/footer.component.ts

60 lines
2.0 KiB
TypeScript
Raw Normal View History

2026-07-10 13:43:53 +04:00
import { Component, ChangeDetectionStrategy, effect, inject, signal } from '@angular/core';
import { RouterLink } from '@angular/router';
2026-02-26 23:09:20 +04:00
import { TranslatePipe } from '../../i18n/translate.pipe';
2026-07-02 02:22:00 +04:00
import { LogoComponent } from '../logo/logo.component';
import { UiRuntimeFacade } from '../../facades/runtime/ui-runtime.facade';
import { LangRoutePipe } from '../../pipes/lang-route.pipe';
import { FooterPaymentIcon, FooterResolvedGroup, FooterResolverService } from '../../core/config/footer-resolver.service';
2026-07-10 13:43:53 +04:00
import { ConfigService } from '../../core/config/config.service';
import { onImageError } from '../../utils/item.utils';
2026-01-18 18:57:06 +04:00
@Component({
selector: 'app-footer',
imports: [TranslatePipe, LogoComponent, RouterLink, LangRoutePipe],
2026-01-18 18:57:06 +04:00
templateUrl: './footer.component.html',
2026-02-19 01:23:25 +04:00
styleUrls: ['./footer.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
2026-01-18 18:57:06 +04:00
})
export class FooterComponent {
readonly onImageError = onImageError;
readonly footerGroups = signal<FooterResolvedGroup[]>([]);
readonly paymentIcons = signal<FooterPaymentIcon[]>([]);
readonly copyrightText = signal('');
2026-07-10 13:43:53 +04:00
private readonly configService = inject(ConfigService);
constructor(
private readonly uiRuntime: UiRuntimeFacade,
private readonly footerResolver: FooterResolverService
) {
2026-07-10 13:43:53 +04:00
effect(() => {
this.configService.bootstrapRevision();
const bootstrap = this.configService.getBootstrapSnapshot();
if (!bootstrap) {
this.footerGroups.set([]);
this.paymentIcons.set([]);
this.copyrightText.set('');
2026-07-10 13:43:53 +04:00
return;
}
2026-07-10 13:43:53 +04:00
const model = this.footerResolver.resolveFooterModelFromBootstrap(bootstrap);
this.footerGroups.set(model.groups);
this.paymentIcons.set(model.paymentIcons);
this.copyrightText.set(model.copyrightText);
});
2026-07-10 13:43:53 +04:00
this.configService.loadBootstrap().subscribe();
}
2026-01-18 18:57:06 +04:00
currentYear = new Date().getFullYear();
get brandName(): string {
2026-07-05 00:38:21 +04:00
return this.uiRuntime.marketplaceName();
}
get contactEmail(): string {
return this.uiRuntime.contactEmail();
}
2026-01-18 18:57:06 +04:00
}