feat(platform): sprint 11.5 standardization
Some checks failed
Architecture Governance / architecture (push) Has been cancelled

This commit is contained in:
sdarbinyan
2026-07-09 02:29:12 +04:00
parent a16c856537
commit 8d652c8259
57 changed files with 2162 additions and 848 deletions

View File

@@ -3,7 +3,7 @@
<table class="compare-table">
<thead>
<tr>
<th>Attribute</th>
<th>{{ 'ux.compareAttribute' | translate }}</th>
@for (product of products; track product.itemID) {
<th>
<div class="compare-product-title">{{ product.name }}</div>

View File

@@ -1,5 +1,7 @@
import { ChangeDetectionStrategy, Component, Input, computed } from '@angular/core';
import { ChangeDetectionStrategy, Component, Input, computed, inject } from '@angular/core';
import { Product } from '../../../../../core/products/models/product-domain.model';
import { TranslateService } from '../../../../../i18n/translate.service';
import { TranslatePipe } from '../../../../../i18n/translate.pipe';
interface CompareRow {
key: string;
@@ -11,12 +13,14 @@ interface CompareRow {
@Component({
selector: 'app-compare-table',
standalone: true,
imports: [],
imports: [TranslatePipe],
templateUrl: './compare-table.component.html',
styleUrls: ['./compare-table.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class CompareTableComponent {
private readonly i18n = inject(TranslateService);
@Input() products: Product[] = [];
@Input() hideIdentical = false;
@Input() highlightDifferences = true;
@@ -28,12 +32,12 @@ export class CompareTableComponent {
}
const baseRows: CompareRow[] = [
this.toRow('price', 'Price', products.map(product => `${product.price.toFixed(2)} ${product.currency}`)),
this.toRow('rating', 'Rating', products.map(product => `${(product.rating ?? 0).toFixed(1)}`)),
this.toRow('stock', 'Stock', products.map(product => product.remainings ?? 'unknown')),
this.toRow('discount', 'Discount', products.map(product => `${product.discount ?? 0}%`)),
this.toRow('color', 'Color', products.map(product => product.colour ?? '—')),
this.toRow('size', 'Size', products.map(product => product.size ?? '—'))
this.toRow('price', this.i18n.t('ux.comparePrice'), products.map(product => `${product.price.toFixed(2)} ${product.currency}`)),
this.toRow('rating', this.i18n.t('ux.compareRating'), products.map(product => `${(product.rating ?? 0).toFixed(1)}`)),
this.toRow('stock', this.i18n.t('ux.compareStock'), products.map(product => product.remainings ?? this.i18n.t('ux.compareUnknown'))),
this.toRow('discount', this.i18n.t('ux.compareDiscount'), products.map(product => `${product.discount ?? 0}%`)),
this.toRow('color', this.i18n.t('ux.compareColor'), products.map(product => product.colour ?? '—')),
this.toRow('size', this.i18n.t('ux.compareSize'), products.map(product => product.size ?? '—'))
];
const dynamicKeys = [...new Set(products.flatMap(product => (product.descriptionFields ?? []).map(field => field.key)))];

View File

@@ -3,6 +3,7 @@ import { ProductCardComponent } from '../../../../../components/product-card/pro
import { Product } from '../../../../../core/products/models/product-domain.model';
import { UserExperienceFacade } from '../../../../../facades/platform/user-experience.facade';
import { TranslatePipe } from '../../../../../i18n/translate.pipe';
import { TranslateService } from '../../../../../i18n/translate.service';
import { CartService } from '../../../../../services';
import { UserNotificationService } from '../../services/user-notification.service';
@@ -15,13 +16,14 @@ import { UserNotificationService } from '../../services/user-notification.servic
changeDetection: ChangeDetectionStrategy.OnPush
})
export class RecentlyViewedStripComponent {
@Input() title = 'Recently Viewed';
@Input() title = '';
@Input() maxItems = 8;
@Input() showClear = false;
private readonly uxFacade = inject(UserExperienceFacade);
private readonly cartService = inject(CartService);
private readonly notifications = inject(UserNotificationService);
private readonly translate = inject(TranslateService);
readonly items = computed(() => this.uxFacade.recentlyViewed().slice(0, Math.max(1, this.maxItems)));
readonly hasItems = computed(() => this.items().length > 0);
@@ -30,12 +32,12 @@ export class RecentlyViewedStripComponent {
event.preventDefault();
event.stopPropagation();
this.cartService.addItem(itemID);
this.notifications.show('Added to cart', 'success');
this.notifications.show(this.translate.t('catalog.addToCart'), 'success');
}
clear(): void {
this.uxFacade.clearRecentlyViewed();
this.notifications.show('Recently viewed cleared', 'info');
this.notifications.show(this.translate.t('ux.clearRecentlyViewed'), 'info');
}
itemProduct(index: number): Product {

View File

@@ -3,6 +3,7 @@ import { RouterLink } from '@angular/router';
import { ProductCardComponent } from '../../../../../components/product-card/product-card.component';
import { UserExperienceFacade } from '../../../../../facades/platform/user-experience.facade';
import { TranslatePipe } from '../../../../../i18n/translate.pipe';
import { TranslateService } from '../../../../../i18n/translate.service';
import { LangRoutePipe } from '../../../../../pipes/lang-route.pipe';
import { CartService } from '../../../../../services';
import { UserNotificationService } from '../../services/user-notification.service';
@@ -18,6 +19,7 @@ import { UserNotificationService } from '../../services/user-notification.servic
export class WishlistPageComponent {
private readonly cartService = inject(CartService);
private readonly uxFacade = inject(UserExperienceFacade);
private readonly translate = inject(TranslateService);
private readonly notifications = inject(UserNotificationService);
readonly favorites = this.uxFacade.wishlist;
@@ -27,7 +29,7 @@ export class WishlistPageComponent {
event.preventDefault();
event.stopPropagation();
this.cartService.addItem(itemId);
this.notifications.show('Added to cart', 'success');
this.notifications.show(this.translate.t('ux.addedToCart'), 'success');
}
removeFromWishlist(itemId: number): void {
@@ -37,11 +39,11 @@ export class WishlistPageComponent {
}
this.uxFacade.toggleWishlist(target.product);
this.notifications.show('Removed from wishlist', 'info');
this.notifications.show(this.translate.t('ux.wishlistRemoved'), 'info');
}
clearWishlist(): void {
this.uxFacade.clearWishlist();
this.notifications.show('Wishlist cleared', 'info');
this.notifications.show(this.translate.t('ux.wishlistCleared'), 'info');
}
}