Compare commits
8 Commits
auth-syste
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b3b2ee463 | ||
|
|
c3e4e695eb | ||
|
|
c112aded47 | ||
|
|
75f029b872 | ||
|
|
af78c053ba | ||
|
|
7b18376d28 | ||
|
|
712281d2e8 | ||
|
|
0626dcbe46 |
20
angular.json
20
angular.json
@@ -175,26 +175,6 @@
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular/build:extract-i18n"
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular/build:karma",
|
||||
"options": {
|
||||
"polyfills": [
|
||||
"zone.js",
|
||||
"zone.js/testing"
|
||||
],
|
||||
"tsConfig": "tsconfig.spec.json",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "public"
|
||||
}
|
||||
],
|
||||
"styles": [
|
||||
"src/styles.scss"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,9 @@ server {
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
|
||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://telegram.org; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https:; connect-src 'self' https:; frame-src https://telegram.org;" always;
|
||||
|
||||
# Brotli compression (if available)
|
||||
# brotli on;
|
||||
|
||||
BIN
public/icons/icon-192x192.png
Normal file
BIN
public/icons/icon-192x192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 547 B |
BIN
public/icons/icon-512x512.png
Normal file
BIN
public/icons/icon-512x512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -1,5 +1,4 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
|
||||
"name": "Novo Market - Интернет-магазин",
|
||||
"short_name": "Novo",
|
||||
"description": "Novo Market - ваш онлайн магазин качественных товаров с доставкой",
|
||||
@@ -12,34 +11,10 @@
|
||||
"categories": ["shopping", "lifestyle"],
|
||||
"icons": [
|
||||
{
|
||||
"src": "icons/icon-72x72.png",
|
||||
"sizes": "72x72",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "icons/icon-96x96.png",
|
||||
"sizes": "96x96",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "icons/icon-128x128.png",
|
||||
"sizes": "128x128",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "icons/icon-144x144.png",
|
||||
"sizes": "144x144",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "icons/icon-152x152.png",
|
||||
"sizes": "152x152",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
"src": "assets/images/novo-favicon.svg",
|
||||
"sizes": "any",
|
||||
"type": "image/svg+xml",
|
||||
"purpose": "any"
|
||||
},
|
||||
{
|
||||
"src": "icons/icon-192x192.png",
|
||||
@@ -47,12 +22,6 @@
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "icons/icon-384x384.png",
|
||||
"sizes": "384x384",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "icons/icon-512x512.png",
|
||||
"sizes": "512x512",
|
||||
|
||||
@@ -11,34 +11,10 @@
|
||||
"categories": ["shopping", "marketplace"],
|
||||
"icons": [
|
||||
{
|
||||
"src": "icons/icon-72x72.png",
|
||||
"sizes": "72x72",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "icons/icon-96x96.png",
|
||||
"sizes": "96x96",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "icons/icon-128x128.png",
|
||||
"sizes": "128x128",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "icons/icon-144x144.png",
|
||||
"sizes": "144x144",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "icons/icon-152x152.png",
|
||||
"sizes": "152x152",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
"src": "assets/images/dexar-favicon.svg",
|
||||
"sizes": "any",
|
||||
"type": "image/svg+xml",
|
||||
"purpose": "any"
|
||||
},
|
||||
{
|
||||
"src": "icons/icon-192x192.png",
|
||||
@@ -46,12 +22,6 @@
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "icons/icon-384x384.png",
|
||||
"sizes": "384x384",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable any"
|
||||
},
|
||||
{
|
||||
"src": "icons/icon-512x512.png",
|
||||
"sizes": "512x512",
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
</div>
|
||||
} @else {
|
||||
<app-header></app-header>
|
||||
<main class="main-content">
|
||||
@if (!isHomePage()) {
|
||||
<app-back-button />
|
||||
}
|
||||
<main class="main-content">
|
||||
<router-outlet></router-outlet>
|
||||
</main>
|
||||
<app-footer></app-footer>
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { App } from './app';
|
||||
import { provideRouter } from '@angular/router';
|
||||
|
||||
describe('App', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [App],
|
||||
providers: [provideRouter([])]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(App);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -17,14 +17,16 @@ import { TranslateService } from '../../i18n/translate.service';
|
||||
`,
|
||||
styles: [`
|
||||
.dexar-back-btn {
|
||||
position: fixed;
|
||||
top: 76px;
|
||||
position: sticky;
|
||||
top: 72px;
|
||||
left: 20px;
|
||||
z-index: 100;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
padding: 4px;
|
||||
padding: 8px 4px;
|
||||
margin-bottom: -40px;
|
||||
width: fit-content;
|
||||
transition: transform 0.2s ease;
|
||||
|
||||
svg path {
|
||||
@@ -47,7 +49,7 @@ import { TranslateService } from '../../i18n/translate.service';
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.dexar-back-btn {
|
||||
top: 68px;
|
||||
top: 64px;
|
||||
left: 12px;
|
||||
|
||||
svg {
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
<div class="novo-right">
|
||||
<app-language-selector />
|
||||
|
||||
<a [routerLink]="'/cart' | langRoute" routerLinkActive="novo-cart-active" class="novo-cart" (click)="closeMenu()">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<a [routerLink]="'/cart' | langRoute" routerLinkActive="novo-cart-active" class="novo-cart" (click)="closeMenu()" [attr.aria-label]="'header.cart' | translate">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
||||
<circle cx="9" cy="21" r="1"></circle>
|
||||
<circle cx="20" cy="21" r="1"></circle>
|
||||
<path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"></path>
|
||||
@@ -40,7 +40,7 @@
|
||||
}
|
||||
</a>
|
||||
|
||||
<button class="menu-toggle" (click)="toggleMenu()" [class.active]="menuOpen">
|
||||
<button class="menu-toggle" (click)="toggleMenu()" [class.active]="menuOpen" [attr.aria-label]="menuOpen ? 'Close menu' : 'Open menu'" [attr.aria-expanded]="menuOpen">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
@@ -112,7 +112,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Mobile Menu Toggle -->
|
||||
<button class="dexar-menu-toggle" (click)="toggleMenu()" [class.active]="menuOpen">
|
||||
<button class="dexar-menu-toggle" (click)="toggleMenu()" [class.active]="menuOpen" [attr.aria-label]="menuOpen ? 'Close menu' : 'Open menu'" [attr.aria-expanded]="menuOpen">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="language-selector">
|
||||
<button class="language-button" (click)="toggleDropdown()">
|
||||
<div class="language-selector" role="listbox">
|
||||
<button class="language-button" (click)="toggleDropdown()" (keydown)="onKeyDown($event)" aria-haspopup="listbox" [attr.aria-expanded]="dropdownOpen">
|
||||
<img [src]="languageService.getCurrentLanguage()?.flagSvg"
|
||||
[alt]="languageService.getCurrentLanguage()?.name"
|
||||
class="language-flag">
|
||||
@@ -13,6 +13,8 @@
|
||||
@for (lang of languageService.languages; track lang.code) {
|
||||
<button
|
||||
class="language-option"
|
||||
role="option"
|
||||
[attr.aria-selected]="languageService.currentLanguage() === lang.code"
|
||||
[class.active]="languageService.currentLanguage() === lang.code"
|
||||
[class.disabled]="!lang.enabled"
|
||||
[disabled]="!lang.enabled"
|
||||
|
||||
@@ -31,6 +31,15 @@ export class LanguageSelectorComponent {
|
||||
this.dropdownOpen = false;
|
||||
}
|
||||
|
||||
onKeyDown(event: KeyboardEvent): void {
|
||||
if (event.key === 'Escape') {
|
||||
this.dropdownOpen = false;
|
||||
} else if (event.key === 'Enter' || event.key === ' ') {
|
||||
event.preventDefault();
|
||||
this.toggleDropdown();
|
||||
}
|
||||
}
|
||||
|
||||
@HostListener('document:click', ['$event'])
|
||||
onClickOutside(event: Event): void {
|
||||
if (!this.elementRef.nativeElement.contains(event.target)) {
|
||||
|
||||
19
src/app/config/constants.ts
Normal file
19
src/app/config/constants.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
// Payment polling
|
||||
export const PAYMENT_POLL_INTERVAL_MS = 5000;
|
||||
export const PAYMENT_MAX_CHECKS = 36;
|
||||
export const PAYMENT_TIMEOUT_CLOSE_MS = 3000;
|
||||
export const PAYMENT_ERROR_CLOSE_MS = 4000;
|
||||
export const LINK_COPIED_DURATION_MS = 2000;
|
||||
|
||||
// Infinite scroll
|
||||
export const SCROLL_THRESHOLD_PX = 1200;
|
||||
export const SCROLL_DEBOUNCE_MS = 100;
|
||||
export const ITEMS_PER_PAGE = 20;
|
||||
|
||||
// Search
|
||||
export const SEARCH_DEBOUNCE_MS = 300;
|
||||
export const SEARCH_MIN_LENGTH = 3;
|
||||
|
||||
// Cache
|
||||
export const CACHE_DURATION_MS = 5 * 60 * 1000;
|
||||
export const CATEGORY_CACHE_DURATION_MS = 2 * 60 * 1000;
|
||||
@@ -2,8 +2,9 @@ import { HttpInterceptorFn, HttpResponse } from '@angular/common/http';
|
||||
import { of } from 'rxjs';
|
||||
import { tap } from 'rxjs/operators';
|
||||
|
||||
import { CACHE_DURATION_MS, CATEGORY_CACHE_DURATION_MS } from '../config/constants';
|
||||
|
||||
const cache = new Map<string, { response: HttpResponse<unknown>, timestamp: number }>();
|
||||
const CACHE_DURATION = 5 * 60 * 1000; // 5 минут
|
||||
|
||||
export const cacheInterceptor: HttpInterceptorFn = (req, next) => {
|
||||
// Кэшируем только GET запросы
|
||||
@@ -11,12 +12,16 @@ export const cacheInterceptor: HttpInterceptorFn = (req, next) => {
|
||||
return next(req);
|
||||
}
|
||||
|
||||
// Кэшируем только запросы списка категорий (не товары категорий)
|
||||
const shouldCache = req.url.match(/\/category$/) !== null;
|
||||
if (!shouldCache) {
|
||||
// Кэшируем списки категорий, товары категорий и отдельные товары
|
||||
const isCategoryList = /\/category$/.test(req.url);
|
||||
const isCategoryItems = /\/category\/\d+/.test(req.url);
|
||||
const isItem = /\/item\/\d+/.test(req.url);
|
||||
if (!isCategoryList && !isCategoryItems && !isItem) {
|
||||
return next(req);
|
||||
}
|
||||
|
||||
const ttl = isCategoryList ? CACHE_DURATION_MS : CATEGORY_CACHE_DURATION_MS;
|
||||
|
||||
// Cleanup expired entries before checking
|
||||
cleanupExpiredCache();
|
||||
|
||||
@@ -25,7 +30,7 @@ export const cacheInterceptor: HttpInterceptorFn = (req, next) => {
|
||||
// Проверяем наличие и актуальность кэша
|
||||
if (cachedResponse) {
|
||||
const age = Date.now() - cachedResponse.timestamp;
|
||||
if (age < CACHE_DURATION) {
|
||||
if (age < ttl) {
|
||||
return of(cachedResponse.response.clone());
|
||||
} else {
|
||||
cache.delete(req.url);
|
||||
@@ -53,7 +58,7 @@ export function clearCache(): void {
|
||||
function cleanupExpiredCache(): void {
|
||||
const now = Date.now();
|
||||
for (const [url, data] of cache.entries()) {
|
||||
if (now - data.timestamp >= CACHE_DURATION) {
|
||||
if (now - data.timestamp >= CACHE_DURATION_MS) {
|
||||
cache.delete(url);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import { getDiscountedPrice, getMainImage, trackByItemId } from '../../utils/ite
|
||||
import { LangRoutePipe } from '../../pipes/lang-route.pipe';
|
||||
import { TranslatePipe } from '../../i18n/translate.pipe';
|
||||
import { TranslateService } from '../../i18n/translate.service';
|
||||
import { PAYMENT_POLL_INTERVAL_MS, PAYMENT_MAX_CHECKS, PAYMENT_TIMEOUT_CLOSE_MS, PAYMENT_ERROR_CLOSE_MS, LINK_COPIED_DURATION_MS } from '../../config/constants';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cart',
|
||||
@@ -50,7 +51,7 @@ export class CartComponent implements OnDestroy {
|
||||
emailSubmitting = signal<boolean>(false);
|
||||
paidItems: CartItem[] = [];
|
||||
|
||||
maxChecks = 36; // 36 checks * 5 seconds = 180 seconds (3 minutes)
|
||||
maxChecks = PAYMENT_MAX_CHECKS;
|
||||
private pollingSubscription?: Subscription;
|
||||
private closeTimeout?: ReturnType<typeof setTimeout>;
|
||||
|
||||
@@ -167,7 +168,7 @@ export class CartComponent implements OnDestroy {
|
||||
|
||||
const paymentData = {
|
||||
amount: this.totalPrice(),
|
||||
currency: 'RUB',
|
||||
currency: this.items()[0]?.currency || 'RUB',
|
||||
siteuserID: userId,
|
||||
siteorderID: orderId,
|
||||
redirectUrl: '',
|
||||
@@ -193,15 +194,17 @@ export class CartComponent implements OnDestroy {
|
||||
error: (err) => {
|
||||
console.error('Error creating payment:', err);
|
||||
this.paymentStatus.set('timeout');
|
||||
if (this.closeTimeout) clearTimeout(this.closeTimeout);
|
||||
this.closeTimeout = setTimeout(() => {
|
||||
this.closePaymentPopup();
|
||||
}, 4000);
|
||||
}, PAYMENT_ERROR_CLOSE_MS);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
startPolling(): void {
|
||||
this.pollingSubscription = interval(5000) // every 5 seconds
|
||||
this.stopPolling();
|
||||
this.pollingSubscription = interval(PAYMENT_POLL_INTERVAL_MS)
|
||||
.pipe(
|
||||
take(this.maxChecks), // maximum 36 checks (3 minutes)
|
||||
switchMap(() => {
|
||||
@@ -225,17 +228,19 @@ export class CartComponent implements OnDestroy {
|
||||
if (this.paymentStatus() === 'waiting') {
|
||||
this.paymentStatus.set('timeout');
|
||||
// Close popup after showing timeout message
|
||||
if (this.closeTimeout) clearTimeout(this.closeTimeout);
|
||||
this.closeTimeout = setTimeout(() => {
|
||||
this.closePaymentPopup();
|
||||
}, 3000);
|
||||
}, PAYMENT_TIMEOUT_CLOSE_MS);
|
||||
}
|
||||
},
|
||||
error: (err) => {
|
||||
console.error('Error checking payment status:', err);
|
||||
// Continue checking even on error until time runs out
|
||||
if (this.closeTimeout) clearTimeout(this.closeTimeout);
|
||||
this.closeTimeout = setTimeout(() => {
|
||||
this.closePaymentPopup();
|
||||
}, 3000);
|
||||
}, PAYMENT_TIMEOUT_CLOSE_MS);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -251,7 +256,7 @@ export class CartComponent implements OnDestroy {
|
||||
if (url) {
|
||||
navigator.clipboard.writeText(url).then(() => {
|
||||
this.linkCopied.set(true);
|
||||
setTimeout(() => this.linkCopied.set(false), 2000);
|
||||
setTimeout(() => this.linkCopied.set(false), LINK_COPIED_DURATION_MS);
|
||||
}).catch(err => {
|
||||
console.error(this.i18n.t('cart.copyError'), err);
|
||||
});
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
@if (!error()) {
|
||||
<div class="items-grid">
|
||||
@for (item of items(); track trackByItemId($index, item)) {
|
||||
<div class="item-card">
|
||||
<div class="item-card" (mouseenter)="onItemHover(item.itemID)">
|
||||
<a [routerLink]="['/item', item.itemID] | langRoute" class="item-link">
|
||||
<div class="item-image">
|
||||
<img [src]="getMainImage(item)" [alt]="item.name" loading="lazy" decoding="async" width="300" height="300" />
|
||||
<img [src]="getMainImage(item)" [alt]="item.name" loading="lazy" decoding="async" />
|
||||
@if (item.discount > 0) {
|
||||
<div class="discount-badge">-{{ item.discount }}%</div>
|
||||
}
|
||||
@@ -45,19 +45,29 @@
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<button class="add-to-cart-btn" (click)="addToCart(item.itemID, $event)">
|
||||
<button class="add-to-cart-btn" (click)="addToCart(item.itemID, $event)" [attr.aria-label]="('category.addToCart' | translate) + ': ' + item.name">
|
||||
{{ 'category.addToCart' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (loading() && items().length > 0) {
|
||||
<div class="loading-more">
|
||||
<div class="spinner"></div>
|
||||
<p>{{ 'category.loadingMore' | translate }}</p>
|
||||
@for (i of skeletonSlots; track i) {
|
||||
<div class="item-card skeleton-card">
|
||||
<div class="item-link">
|
||||
<div class="item-image skeleton-image"></div>
|
||||
<div class="item-details">
|
||||
<div class="skeleton-line skeleton-title"></div>
|
||||
<div class="skeleton-line skeleton-rating"></div>
|
||||
<div class="skeleton-line skeleton-price"></div>
|
||||
<div class="skeleton-line skeleton-stock"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="skeleton-btn"></div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (!hasMore() && items().length > 0) {
|
||||
<div class="no-more">
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
|
||||
.items-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 30px;
|
||||
margin-bottom: 40px;
|
||||
width: 100%;
|
||||
@@ -103,8 +103,10 @@
|
||||
|
||||
.item-card {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
|
||||
&:hover {
|
||||
@@ -139,7 +141,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #f5f5f5;
|
||||
background: #f0f0f0;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
@@ -147,7 +149,7 @@
|
||||
object-fit: contain;
|
||||
background: white;
|
||||
padding: 12px;
|
||||
transition: transform 0.3s ease;
|
||||
transition: transform 0.3s ease, opacity 0.3s ease;
|
||||
}
|
||||
|
||||
&:hover img {
|
||||
@@ -192,6 +194,7 @@
|
||||
margin: 0;
|
||||
line-height: 1.3;
|
||||
display: -webkit-box;
|
||||
line-clamp: 2;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
@@ -287,11 +290,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.loading-more {
|
||||
text-align: center;
|
||||
padding: 40px 20px;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
@@ -312,24 +310,77 @@
|
||||
padding: 40px 20px;
|
||||
}
|
||||
|
||||
// Skeleton loading cards
|
||||
.skeleton-card {
|
||||
pointer-events: none;
|
||||
|
||||
.skeleton-image {
|
||||
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: shimmer 1.5s infinite;
|
||||
}
|
||||
|
||||
.skeleton-line {
|
||||
border-radius: 6px;
|
||||
background: linear-gradient(90deg, #e8e8e8 25%, #d8d8d8 50%, #e8e8e8 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: shimmer 1.5s infinite;
|
||||
}
|
||||
|
||||
.skeleton-title {
|
||||
height: 16px;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.skeleton-rating {
|
||||
height: 12px;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.skeleton-price {
|
||||
height: 18px;
|
||||
width: 40%;
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
.skeleton-stock {
|
||||
height: 6px;
|
||||
width: 60px;
|
||||
}
|
||||
|
||||
.skeleton-btn {
|
||||
height: 42px;
|
||||
background: linear-gradient(90deg, #5a8a85 25%, #497671 50%, #5a8a85 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: shimmer 1.5s infinite;
|
||||
border-radius: 0 0 13px 13px;
|
||||
margin-top: -1px;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes shimmer {
|
||||
0% { background-position: 200% 0; }
|
||||
100% { background-position: -200% 0; }
|
||||
}
|
||||
|
||||
// Responsive
|
||||
@media (max-width: 1200px) {
|
||||
.items-grid {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 992px) {
|
||||
.items-grid {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.items-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
@@ -353,7 +404,7 @@
|
||||
}
|
||||
|
||||
.items-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,13 @@ import { Component, OnInit, OnDestroy, signal, HostListener, ChangeDetectionStra
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { ActivatedRoute, RouterLink } from '@angular/router';
|
||||
import { ApiService, CartService } from '../../services';
|
||||
import { PrefetchService } from '../../services/prefetch.service';
|
||||
import { Item } from '../../models';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { getDiscountedPrice, getMainImage, trackByItemId } from '../../utils/item.utils';
|
||||
import { LangRoutePipe } from '../../pipes/lang-route.pipe';
|
||||
import { TranslatePipe } from '../../i18n/translate.pipe';
|
||||
import { SCROLL_THRESHOLD_PX, SCROLL_DEBOUNCE_MS, ITEMS_PER_PAGE } from '../../config/constants';
|
||||
|
||||
@Component({
|
||||
selector: 'app-category',
|
||||
@@ -23,7 +25,7 @@ export class CategoryComponent implements OnInit, OnDestroy {
|
||||
hasMore = signal(true);
|
||||
|
||||
private skip = 0;
|
||||
private readonly count = 20;
|
||||
private readonly count = ITEMS_PER_PAGE;
|
||||
private isLoadingMore = false;
|
||||
private routeSubscription?: Subscription;
|
||||
private scrollTimeout?: ReturnType<typeof setTimeout>;
|
||||
@@ -31,7 +33,8 @@ export class CategoryComponent implements OnInit, OnDestroy {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private apiService: ApiService,
|
||||
private cartService: CartService
|
||||
private cartService: CartService,
|
||||
private prefetchService: PrefetchService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -90,12 +93,12 @@ export class CategoryComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.scrollTimeout = setTimeout(() => {
|
||||
const scrollPosition = window.innerHeight + window.scrollY;
|
||||
const bottomPosition = document.documentElement.scrollHeight - 500;
|
||||
const bottomPosition = document.documentElement.scrollHeight - SCROLL_THRESHOLD_PX;
|
||||
|
||||
if (scrollPosition >= bottomPosition && !this.loading() && this.hasMore() && !this.isLoadingMore) {
|
||||
this.loadItems();
|
||||
}
|
||||
}, 100);
|
||||
}, SCROLL_DEBOUNCE_MS);
|
||||
}
|
||||
|
||||
addToCart(itemID: number, event: Event): void {
|
||||
@@ -104,6 +107,11 @@ export class CategoryComponent implements OnInit, OnDestroy {
|
||||
this.cartService.addItem(itemID);
|
||||
}
|
||||
|
||||
onItemHover(itemID: number): void {
|
||||
this.prefetchService.prefetchItem(itemID);
|
||||
}
|
||||
|
||||
readonly skeletonSlots = Array.from({ length: 8 });
|
||||
readonly getDiscountedPrice = getDiscountedPrice;
|
||||
readonly getMainImage = getMainImage;
|
||||
readonly trackByItemId = trackByItemId;
|
||||
|
||||
@@ -19,10 +19,23 @@
|
||||
<app-items-carousel />
|
||||
|
||||
@if (loading()) {
|
||||
<div class="novo-loading">
|
||||
<div class="novo-spinner"></div>
|
||||
<p>{{ 'home.loading' | translate }}</p>
|
||||
<section class="novo-categories">
|
||||
<div class="novo-section-header">
|
||||
<div class="skeleton-line" style="height: 32px; width: 200px; margin: 0 auto 12px;"></div>
|
||||
<div class="skeleton-line" style="height: 18px; width: 300px; margin: 0 auto;"></div>
|
||||
</div>
|
||||
<div class="novo-categories-grid">
|
||||
@for (i of skeletonSlots; track i) {
|
||||
<div class="novo-category-card skeleton-card">
|
||||
<div class="novo-category-image skeleton-image"></div>
|
||||
<div class="novo-category-info">
|
||||
<div class="skeleton-line" style="height: 18px; width: 70%;"></div>
|
||||
<div class="skeleton-line" style="height: 18px; width: 20px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
}
|
||||
|
||||
@if (error()) {
|
||||
@@ -101,10 +114,20 @@
|
||||
<app-items-carousel />
|
||||
|
||||
@if (loading()) {
|
||||
<div class="dexar-loading">
|
||||
<div class="dexar-spinner"></div>
|
||||
<p>{{ 'home.loadingDexar' | translate }}</p>
|
||||
<section class="dexar-categories">
|
||||
<div class="skeleton-line" style="height: 36px; width: 220px; margin-bottom: 40px;"></div>
|
||||
<div class="dexar-categories-grid">
|
||||
@for (i of skeletonSlots; track i) {
|
||||
<div class="dexar-category-card skeleton-card">
|
||||
<div class="dexar-category-image skeleton-image"></div>
|
||||
<div class="dexar-category-info">
|
||||
<div class="skeleton-line" style="height: 16px; width: 75%;"></div>
|
||||
<div class="skeleton-line" style="height: 12px; width: 40%; margin-top: 4px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
}
|
||||
|
||||
@if (error()) {
|
||||
|
||||
@@ -896,3 +896,26 @@
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
}
|
||||
|
||||
// Skeleton loading cards
|
||||
.skeleton-card {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.skeleton-image {
|
||||
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: shimmer 1.5s infinite;
|
||||
}
|
||||
|
||||
.skeleton-line {
|
||||
border-radius: 6px;
|
||||
background: linear-gradient(90deg, #e8e8e8 25%, #d8d8d8 50%, #e8e8e8 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: shimmer 1.5s infinite;
|
||||
}
|
||||
|
||||
@keyframes shimmer {
|
||||
0% { background-position: 200% 0; }
|
||||
100% { background-position: -200% 0; }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, OnInit, signal, computed, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy, signal, computed, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { ApiService, LanguageService } from '../../services';
|
||||
import { Category } from '../../models';
|
||||
@@ -14,13 +14,14 @@ import { TranslatePipe } from '../../i18n/translate.pipe';
|
||||
styleUrls: ['./home.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class HomeComponent implements OnInit {
|
||||
export class HomeComponent implements OnInit, OnDestroy {
|
||||
brandName = environment.brandFullName;
|
||||
isnovo = environment.theme === 'novo';
|
||||
categories = signal<Category[]>([]);
|
||||
wideCategories = signal<Set<number>>(new Set());
|
||||
loading = signal(true);
|
||||
error = signal<string | null>(null);
|
||||
readonly skeletonSlots = Array.from({ length: 6 });
|
||||
|
||||
// Memoized computed values for performance
|
||||
topLevelCategories = computed(() => {
|
||||
@@ -56,6 +57,14 @@ export class HomeComponent implements OnInit {
|
||||
this.loadCategories();
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.pendingImages.forEach(img => {
|
||||
img.onload = null;
|
||||
img.onerror = null;
|
||||
});
|
||||
this.pendingImages.clear();
|
||||
}
|
||||
|
||||
loadCategories(): void {
|
||||
this.loading.set(true);
|
||||
this.apiService.getCategories().subscribe({
|
||||
@@ -84,13 +93,17 @@ export class HomeComponent implements OnInit {
|
||||
return this.wideCategories().has(categoryID);
|
||||
}
|
||||
|
||||
private pendingImages = new Set<HTMLImageElement>();
|
||||
|
||||
private detectWideImages(categories: Category[]): void {
|
||||
const topLevel = categories.filter(c => c.parentID === 0);
|
||||
topLevel.forEach(cat => {
|
||||
if (!cat.wideBanner) return;
|
||||
|
||||
const img = new Image();
|
||||
this.pendingImages.add(img);
|
||||
img.onload = () => {
|
||||
this.pendingImages.delete(img);
|
||||
const ratio = img.naturalWidth / img.naturalHeight;
|
||||
if (ratio > 2) {
|
||||
this.wideCategories.update(set => {
|
||||
@@ -100,6 +113,7 @@ export class HomeComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
};
|
||||
img.onerror = () => this.pendingImages.delete(img);
|
||||
img.src = cat.wideBanner;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="legal-page">
|
||||
<div class="legal-page">
|
||||
<div class="legal-container">
|
||||
<h1>About the company LLC «INT FIN LOGISTIC»</h1>
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
<p><strong>Director:</strong> Оганнисян Ашот Рафикович</p>
|
||||
<p><strong>Legal address:</strong><br>АРМЕНИЯ, 2301, КОТАЙКСКАЯ ОБЛАСТЬ, РАЗДАН, ХАЧАТРЯНА ул, 31, 4</p>
|
||||
<p><strong>Office in Armenia:</strong><br>0033, Ереван, улица Братьев Орбели, 47</p>
|
||||
<p><strong>Office in Russia:</strong><br>121059, Москва, наб. Тараса Шевченко, 3к2</p>
|
||||
|
||||
<p><strong>Key details:</strong><br>ИНН (RF): 9909697628<br>ИНН (Armenia): 03033502<br>КПП: 770287001<br>ОГРН: 85.110.1408711</p>
|
||||
<p><strong>Banking details:</strong><br>Bank: АО "Райффайзенбанк"<br>Settlement account: 40807810500000002376<br>Correspondent account: 30101810200000000700<br>БИК: 044525700</p>
|
||||
<p><strong>Contact information:</strong><br>Phone (Russia): +7 (926) 459-31-57<br>Phone (Armenia): +374 94 86 18 16<br>Email: info@dexarmarket.ru<br>Website: www.dexarmarket.ru</p>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="legal-page">
|
||||
<div class="legal-page">
|
||||
<div class="legal-container">
|
||||
<h1>«ИНТ ФИН ЛОГИСТИК» ՍՊԸ ընկերության մասին</h1>
|
||||
|
||||
@@ -65,7 +65,6 @@
|
||||
<p><strong>Տնօրեն՝</strong> Оганнисян Ашот Рафикович</p>
|
||||
<p><strong>Իրավաբանական հասցե՝</strong><br>АРМЕНИЯ, 2301, КОТАЙКСКАЯ ОБЛАСТЬ, РАЗДАН, ХАЧАТРЯНА ул, 31, 4</p>
|
||||
<p><strong>Գրասենյակ Հայաստանում՝</strong><br>0033, Երևան, Եղբայրներ Օրբելի փողոց, 47</p>
|
||||
<p><strong>Գրասենյակ Ռուսաստանում՝</strong><br>121059, Москва, наб. Тараса Шевченко, 3к2</p>
|
||||
<p><strong>Հիմնական վավերապայմանները՝</strong><br>ՀՍՀ (ՌՄ)՝ 9909697628<br>ՀՍՀ (Հայաստան)՝ 03033502<br>ԿՊՊ՝ 770287001<br>ՕԳՌՆ՝ 85.110.1408711</p>
|
||||
<p><strong>Բանկային վավերապայմանները՝</strong><br>Բանկ՝ АО "Райффайзенбанк"<br>Հաշվարկային հաշիվ՝ 40807810500000002376<br>Թղթակցային հաշիվ՝ 30101810200000000700<br>ԲԻԿ՝ 044525700</p>
|
||||
<p><strong>Կապի տեղեկատվություն՝</strong><br>Հեռախոս (Ռուսաստան)՝ +7 (926) 459-31-57<br>Հեռախոս (Հայաստան)՝ +374 94 86 18 16<br>Էլ. փոստ՝ info@dexarmarket.ru<br>Կայք՝ www.dexarmarket.ru</p>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="legal-page">
|
||||
<div class="legal-page">
|
||||
<div class="legal-container">
|
||||
<h1>О компании ООО «ИНТ ФИН ЛОГИСТИК»</h1>
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
<p><strong>Директор:</strong> Оганнисян Ашот Рафикович</p>
|
||||
<p><strong>Юридический адрес:</strong><br>АРМЕНИЯ, 2301, КОТАЙКСКАЯ ОБЛАСТЬ, РАЗДАН, ХАЧАТРЯНА ул, 31, 4</p>
|
||||
<p><strong>Офис в Армении:</strong><br>0033, Ереван, улица Братьев Орбели, 47</p>
|
||||
<p><strong>Офис в России:</strong><br>121059, Москва, наб. Тараса Шевченко, 3к2</p>
|
||||
|
||||
<p><strong>Основные реквизиты:</strong><br>ИНН (РФ): 9909697628<br>ИНН (Армения): 03033502<br>КПП: 770287001<br>ОГРН: 85.110.1408711</p>
|
||||
<p><strong>Банковские реквизиты:</strong><br>Банк: АО "Райффайзенбанк"<br>Расчетный счет: 40807810500000002376<br>Корр. счет: 30101810200000000700<br>БИК: 044525700</p>
|
||||
<p><strong>Контактная информация:</strong><br>Телефон (Россия): +7 (926) 459-31-57<br>Телефон (Армения): +374 94 86 18 16<br>Email: info@dexarmarket.ru<br>Сайт: www.dexarmarket.ru</p>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="legal-page">
|
||||
<div class="legal-page">
|
||||
<div class="legal-container">
|
||||
<h1>Contacts</h1>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<section class="legal-section">
|
||||
<h2>Office Addresses</h2>
|
||||
<p><strong>Office in Armenia:</strong> 0033, Yerevan, Orbeli Brothers Street, 47</p>
|
||||
<p><strong>Office in Russia:</strong> 121059, Moscow, Taras Shevchenko Embankment, 3/2</p>
|
||||
|
||||
</section>
|
||||
|
||||
<section class="legal-section">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="legal-page">
|
||||
<div class="legal-page">
|
||||
<div class="legal-container">
|
||||
<h1>Կապ</h1>
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
<section class="legal-section">
|
||||
<h2>Գրասենյակների հասցեներ</h2>
|
||||
<p><strong>Գրասենյակ Հայաստանում՝</strong> 0033, Երևան, Եղբայրներ Օրբելի փողոց, 47</p>
|
||||
<p><strong>Գրասենյակ Ռուսաստանում՝</strong> 121059, Մոսկվա, Տարաս Շևչենկոի փողոց, 3կ2</p>
|
||||
</section>
|
||||
|
||||
<section class="legal-section">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="legal-page">
|
||||
<div class="legal-page">
|
||||
<div class="legal-container">
|
||||
<h1>Контакты</h1>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<section class="legal-section">
|
||||
<h2>Адреса офисов</h2>
|
||||
<p><strong>Офис в Армении:</strong> 0033, Ереван, улица Братьев Орбели, 47</p>
|
||||
<p><strong>Офис в России:</strong> 121059, Москва, наб. Тараса Шевченко, 3к2</p>
|
||||
|
||||
</section>
|
||||
|
||||
<section class="legal-section">
|
||||
|
||||
@@ -15,21 +15,22 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (item() && !loading()) {
|
||||
@if (item(); as item) {
|
||||
@if (!loading()) {
|
||||
<div class="novo-item-content">
|
||||
<div class="novo-gallery">
|
||||
@if (item()?.photos && item()!.photos!.length > 0) {
|
||||
@if (item.photos && item.photos.length > 0) {
|
||||
<div class="novo-main-photo">
|
||||
@if (item()!.photos![selectedPhotoIndex()]?.video) {
|
||||
<video [src]="item()!.photos![selectedPhotoIndex()].url" controls></video>
|
||||
@if (item.photos[selectedPhotoIndex()]?.video) {
|
||||
<video [src]="item.photos[selectedPhotoIndex()].url" controls></video>
|
||||
} @else {
|
||||
<img [src]="item()!.photos![selectedPhotoIndex()].url" [alt]="item()!.name" />
|
||||
<img [src]="item.photos[selectedPhotoIndex()].url" [alt]="item.name" />
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (item()!.photos!.length > 1) {
|
||||
@if (item.photos.length > 1) {
|
||||
<div class="novo-thumbnails">
|
||||
@for (photo of item()!.photos!; track $index) {
|
||||
@for (photo of item.photos; track $index) {
|
||||
<div
|
||||
class="novo-thumb"
|
||||
[class.active]="selectedPhotoIndex() === $index"
|
||||
@@ -55,31 +56,31 @@
|
||||
</div>
|
||||
|
||||
<div class="novo-info">
|
||||
<h1 class="novo-title">{{ item()!.name }}</h1>
|
||||
<h1 class="novo-title">{{ item.name }}</h1>
|
||||
|
||||
<div class="novo-rating">
|
||||
<span class="stars">{{ getRatingStars(item()!.rating) }}</span>
|
||||
<span class="value">{{ item()!.rating }}</span>
|
||||
<span class="reviews">({{ item()!.callbacks?.length || 0 }})</span>
|
||||
<span class="stars">{{ getRatingStars(item.rating) }}</span>
|
||||
<span class="value">{{ item.rating }}</span>
|
||||
<span class="reviews">({{ item.callbacks?.length || 0 }})</span>
|
||||
</div>
|
||||
|
||||
<div class="novo-price-block">
|
||||
@if (item()!.discount > 0) {
|
||||
@if (item.discount > 0) {
|
||||
<div class="price-row">
|
||||
<span class="old-price">{{ item()!.price }} {{ item()!.currency }}</span>
|
||||
<span class="discount-badge">-{{ item()!.discount }}%</span>
|
||||
<span class="old-price">{{ item.price }} {{ item.currency }}</span>
|
||||
<span class="discount-badge">-{{ item.discount }}%</span>
|
||||
</div>
|
||||
<div class="current-price">{{ getDiscountedPrice() | number:'1.2-2' }} {{ item()!.currency }}</div>
|
||||
<div class="current-price">{{ getDiscountedPrice() | number:'1.2-2' }} {{ item.currency }}</div>
|
||||
} @else {
|
||||
<div class="current-price">{{ item()!.price }} {{ item()!.currency }}</div>
|
||||
<div class="current-price">{{ item.price }} {{ item.currency }}</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="novo-stock">
|
||||
<span class="stock-label">{{ 'itemDetail.stock' | translate }}</span>
|
||||
<div class="stock-indicator" [class.high]="item()!.remainings === 'high'" [class.medium]="item()!.remainings === 'medium'" [class.low]="item()!.remainings === 'low'">
|
||||
<div class="stock-indicator" [class.high]="item.remainings === 'high'" [class.medium]="item.remainings === 'medium'" [class.low]="item.remainings === 'low'">
|
||||
<span class="dot"></span>
|
||||
{{ item()!.remainings === 'high' ? ('itemDetail.inStock' | translate) : item()!.remainings === 'medium' ? ('itemDetail.mediumStock' | translate) : ('itemDetail.lowStock' | translate) }}
|
||||
{{ item.remainings === 'high' ? ('itemDetail.inStock' | translate) : item.remainings === 'medium' ? ('itemDetail.mediumStock' | translate) : ('itemDetail.lowStock' | translate) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -94,13 +95,13 @@
|
||||
|
||||
<div class="novo-description">
|
||||
<h3>{{ 'itemDetail.description' | translate }}</h3>
|
||||
<div [innerHTML]="getSafeHtml(item()!.description)"></div>
|
||||
<div [innerHTML]="getSafeHtml(item.description)"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="novo-reviews">
|
||||
<h2>{{ 'itemDetail.reviews' | translate }} ({{ item()!.callbacks?.length || 0 }})</h2>
|
||||
<h2>{{ 'itemDetail.reviews' | translate }} ({{ item.callbacks?.length || 0 }})</h2>
|
||||
|
||||
<!-- novo Review Form -->
|
||||
<div class="novo-review-form">
|
||||
@@ -169,8 +170,8 @@
|
||||
</div>
|
||||
|
||||
<div class="novo-reviews-list">
|
||||
@if (item()!.callbacks && item()!.callbacks!.length > 0) {
|
||||
@for (review of item()!.callbacks!; track review.userID) {
|
||||
@if (item.callbacks && item.callbacks.length > 0) {
|
||||
@for (review of item.callbacks; track $index) {
|
||||
<div class="novo-review-card">
|
||||
<div class="review-header">
|
||||
<div class="reviewer-info">
|
||||
@@ -190,6 +191,7 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
} @else {
|
||||
<!-- DEXAR VERSION - Redesigned 2026 -->
|
||||
@@ -208,13 +210,14 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (item() && !loading()) {
|
||||
@if (item(); as item) {
|
||||
@if (!loading()) {
|
||||
<div class="dx-item-content">
|
||||
<!-- Gallery: thumbnails left + main photo -->
|
||||
<div class="dx-gallery">
|
||||
@if (item()?.photos && item()!.photos!.length > 0) {
|
||||
@if (item.photos && item.photos.length > 0) {
|
||||
<div class="dx-thumbnails">
|
||||
@for (photo of item()!.photos!; track $index) {
|
||||
@for (photo of item.photos; track $index) {
|
||||
<div
|
||||
class="dx-thumb"
|
||||
[class.active]="selectedPhotoIndex() === $index"
|
||||
@@ -228,11 +231,11 @@
|
||||
</div>
|
||||
}
|
||||
<div class="dx-main-photo">
|
||||
@if (item()?.photos && item()!.photos!.length > 0) {
|
||||
@if (item()!.photos![selectedPhotoIndex()]?.video) {
|
||||
<video [src]="item()!.photos![selectedPhotoIndex()].url" controls></video>
|
||||
@if (item.photos && item.photos.length > 0) {
|
||||
@if (item.photos[selectedPhotoIndex()]?.video) {
|
||||
<video [src]="item.photos[selectedPhotoIndex()].url" controls></video>
|
||||
} @else {
|
||||
<img [src]="item()!.photos![selectedPhotoIndex()].url" [alt]="item()!.name" fetchpriority="high" decoding="async" />
|
||||
<img [src]="item.photos[selectedPhotoIndex()].url" [alt]="item.name" fetchpriority="high" decoding="async" />
|
||||
}
|
||||
} @else {
|
||||
<div class="dx-no-image">
|
||||
@@ -249,40 +252,40 @@
|
||||
|
||||
<!-- Item Info -->
|
||||
<div class="dx-info">
|
||||
<h1 class="dx-title">{{ item()!.name }}</h1>
|
||||
<h1 class="dx-title">{{ item.name }}</h1>
|
||||
|
||||
<div class="dx-rating">
|
||||
<div class="dx-stars">
|
||||
@for (star of [1, 2, 3, 4, 5]; track star) {
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" [attr.fill]="star <= item()!.rating ? '#497671' : 'none'" [attr.stroke]="star <= item()!.rating ? '#497671' : '#a1b4b5'" stroke-width="2">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" [attr.fill]="star <= item.rating ? '#497671' : 'none'" [attr.stroke]="star <= item.rating ? '#497671' : '#a1b4b5'" stroke-width="2">
|
||||
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>
|
||||
</svg>
|
||||
}
|
||||
</div>
|
||||
<span class="dx-rating-value">{{ item()!.rating }}</span>
|
||||
<span class="dx-rating-count">({{ item()!.callbacks?.length || 0 }} {{ 'itemDetail.reviewsCount' | translate }})</span>
|
||||
<span class="dx-rating-value">{{ item.rating }}</span>
|
||||
<span class="dx-rating-count">({{ item.callbacks?.length || 0 }} {{ 'itemDetail.reviewsCount' | translate }})</span>
|
||||
</div>
|
||||
|
||||
<div class="dx-price-block">
|
||||
@if (item()!.discount > 0) {
|
||||
@if (item.discount > 0) {
|
||||
<div class="dx-price-row">
|
||||
<span class="dx-old-price">{{ item()!.price }} {{ item()!.currency }}</span>
|
||||
<span class="dx-discount-tag">-{{ item()!.discount }}%</span>
|
||||
<span class="dx-old-price">{{ item.price }} {{ item.currency }}</span>
|
||||
<span class="dx-discount-tag">-{{ item.discount }}%</span>
|
||||
</div>
|
||||
}
|
||||
<div class="dx-current-price">
|
||||
{{ item()!.discount > 0 ? (getDiscountedPrice() | number:'1.2-2') : item()!.price }} {{ item()!.currency }}
|
||||
{{ item.discount > 0 ? (getDiscountedPrice() | number:'1.2-2') : item.price }} {{ item.currency }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dx-stock">
|
||||
<span class="dx-stock-label">{{ 'itemDetail.stock' | translate }}</span>
|
||||
<span class="dx-stock-status"
|
||||
[class.high]="item()!.remainings === 'high'"
|
||||
[class.medium]="item()!.remainings === 'medium'"
|
||||
[class.low]="item()!.remainings === 'low'">
|
||||
[class.high]="item.remainings === 'high'"
|
||||
[class.medium]="item.remainings === 'medium'"
|
||||
[class.low]="item.remainings === 'low'">
|
||||
<span class="dx-stock-dot"></span>
|
||||
{{ item()!.remainings === 'high' ? ('itemDetail.inStock' | translate) : item()!.remainings === 'medium' ? ('itemDetail.mediumStock' | translate) : ('itemDetail.lastItems' | translate) }}
|
||||
{{ item.remainings === 'high' ? ('itemDetail.inStock' | translate) : item.remainings === 'medium' ? ('itemDetail.mediumStock' | translate) : ('itemDetail.lastItems' | translate) }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -297,14 +300,14 @@
|
||||
|
||||
<div class="dx-description">
|
||||
<h2>{{ 'itemDetail.description' | translate }}</h2>
|
||||
<div class="dx-description-text" [innerHTML]="getSafeHtml(item()!.description)"></div>
|
||||
<div class="dx-description-text" [innerHTML]="getSafeHtml(item.description)"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Reviews Section -->
|
||||
<div class="dx-reviews-section">
|
||||
<h2>{{ 'itemDetail.reviews' | translate }} ({{ item()!.callbacks?.length || 0 }})</h2>
|
||||
<h2>{{ 'itemDetail.reviews' | translate }} ({{ item.callbacks?.length || 0 }})</h2>
|
||||
|
||||
<div class="dx-review-form">
|
||||
<h3>{{ 'itemDetail.leaveReview' | translate }}</h3>
|
||||
@@ -365,8 +368,8 @@
|
||||
</div>
|
||||
|
||||
<div class="dx-reviews-list">
|
||||
@if (item()?.callbacks && item()!.callbacks!.length > 0) {
|
||||
@for (callback of item()!.callbacks; track $index) {
|
||||
@if (item.callbacks && item.callbacks.length > 0) {
|
||||
@for (callback of item.callbacks; track $index) {
|
||||
<div class="dx-review-card">
|
||||
<div class="dx-review-header">
|
||||
<div class="dx-reviewer">
|
||||
@@ -397,11 +400,11 @@
|
||||
</div>
|
||||
|
||||
<!-- Q&A Section -->
|
||||
@if (item()!.questions && item()!.questions!.length > 0) {
|
||||
@if (item.questions && item.questions.length > 0) {
|
||||
<div class="dx-qa-section">
|
||||
<h2>{{ 'itemDetail.qna' | translate }} ({{ item()!.questions!.length }})</h2>
|
||||
<h2>{{ 'itemDetail.qna' | translate }} ({{ item.questions.length }})</h2>
|
||||
<div class="dx-qa-list">
|
||||
@for (question of item()!.questions!; track $index) {
|
||||
@for (question of item.questions; track $index) {
|
||||
<div class="dx-qa-card">
|
||||
<div class="dx-question">
|
||||
<span class="dx-qa-label q">В</span>
|
||||
@@ -427,5 +430,6 @@
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
// ========== DEXAR ITEM DETAIL - Redesigned 2026 ==========
|
||||
@use 'sass:color';
|
||||
|
||||
// ========== DEXAR ITEM DETAIL - Redesigned 2026 ==========
|
||||
$dx-font: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
$dx-dark: #1e3c38;
|
||||
$dx-primary: #497671;
|
||||
@@ -50,7 +52,7 @@ $dx-card-bg: #f5f3f9;
|
||||
transition: all 0.2s;
|
||||
|
||||
&:hover {
|
||||
background: darken($dx-primary, 8%);
|
||||
background: color.adjust($dx-primary, $lightness: -8%);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
}
|
||||
@@ -281,7 +283,7 @@ $dx-card-bg: #f5f3f9;
|
||||
box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.15);
|
||||
|
||||
&:hover {
|
||||
background: darken($dx-primary, 8%);
|
||||
background: color.adjust($dx-primary, $lightness: -8%);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 16px rgba(73, 118, 113, 0.3);
|
||||
}
|
||||
@@ -434,7 +436,7 @@ $dx-card-bg: #f5f3f9;
|
||||
justify-content: center;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: darken($dx-primary, 8%);
|
||||
background: color.adjust($dx-primary, $lightness: -8%);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ import { Component, OnInit, OnDestroy, signal, ChangeDetectionStrategy, inject }
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { ActivatedRoute, RouterLink } from '@angular/router';
|
||||
import { ApiService, CartService, TelegramService, SeoService } from '../../services';
|
||||
import { ApiService, CartService, TelegramService, SeoService, LanguageService } from '../../services';
|
||||
import { Item } from '../../models';
|
||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { SecurityContext } from '@angular/core';
|
||||
@@ -42,6 +42,7 @@ export class ItemDetailComponent implements OnInit, OnDestroy {
|
||||
|
||||
private seoService = inject(SeoService);
|
||||
private i18n = inject(TranslateService);
|
||||
private langService = inject(LanguageService);
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
@@ -100,7 +101,7 @@ export class ItemDetailComponent implements OnInit, OnDestroy {
|
||||
return getDiscountedPrice(currentItem);
|
||||
}
|
||||
|
||||
getSafeHtml(html: string): SafeHtml {
|
||||
getSafeHtml(html: string): string {
|
||||
return this.sanitizer.sanitize(SecurityContext.HTML, html) || '';
|
||||
}
|
||||
|
||||
@@ -123,7 +124,9 @@ export class ItemDetailComponent implements OnInit, OnDestroy {
|
||||
if (diffDays < 7) return `${diffDays} ${this.i18n.t('itemDetail.daysAgo')}`;
|
||||
if (diffDays < 30) return `${Math.floor(diffDays / 7)} ${this.i18n.t('itemDetail.weeksAgo')}`;
|
||||
|
||||
return date.toLocaleDateString('ru-RU', {
|
||||
const localeMap: Record<string, string> = { ru: 'ru-RU', en: 'en-US', hy: 'hy-AM' };
|
||||
const locale = localeMap[this.langService.currentLanguage()] || 'ru-RU';
|
||||
return date.toLocaleDateString(locale, {
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
year: 'numeric'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<h1>Company Details</h1>
|
||||
<h1>Company Details</h1>
|
||||
|
||||
<section class="legal-section">
|
||||
<h2>Full Company Name</h2>
|
||||
@@ -14,7 +14,7 @@
|
||||
<section class="legal-section">
|
||||
<h2>Actual Address</h2>
|
||||
<p><strong>Office in Armenia:</strong> 0033, Yerevan, Orbeli Brothers St., 47</p>
|
||||
<p><strong>Office in Russia:</strong> 121059, Moscow, Taras Shevchenko Emb., 3/2</p>
|
||||
|
||||
</section>
|
||||
|
||||
<section class="legal-section">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<h1>Կազմակերպության տվյալներ</h1>
|
||||
<h1>Կազմակերպության տվյալներ</h1>
|
||||
|
||||
<section class="legal-section">
|
||||
<h2>Կազմակերպության լիարժեկ անվանումը</h2>
|
||||
@@ -14,8 +14,7 @@
|
||||
<section class="legal-section">
|
||||
<h2>Գործնական հասցե</h2>
|
||||
<p><strong>Գրասենյակ Հայաստանում՝</strong> 0033, Երևան, Եղբայրներ Օրբելի փկ., 47</p>
|
||||
<p><strong>Գրասենյակ Ռուսաստանում՝</strong> 121059, Մոսկվա, Տարաս Շևչենկոի փակ., 3կ2</p>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section class="legal-section">
|
||||
<h2>Հիմնական մանրամասներ</h2>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<h1>Реквизиты организации</h1>
|
||||
<h1>Реквизиты организации</h1>
|
||||
|
||||
<section class="legal-section">
|
||||
<h2>Полное наименование организации</h2>
|
||||
@@ -14,7 +14,7 @@
|
||||
<section class="legal-section">
|
||||
<h2>Фактический адрес</h2>
|
||||
<p><strong>Офис в Армении:</strong> 0033, Ереван, улица Братьев Орбели, 47</p>
|
||||
<p><strong>Офис в России:</strong> 121059, Москва, наб. Тараса Шевченко, 3к2</p>
|
||||
|
||||
</section>
|
||||
|
||||
<section class="legal-section">
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
<div class="legal-page">
|
||||
<div class="legal-container">
|
||||
<h1>PUBLIC OFFER AGREEMENT</h1>
|
||||
|
||||
<section class="legal-section">
|
||||
@@ -77,7 +79,7 @@
|
||||
<p>By placing orders through the marketplace, the User expresses full agreement with the terms of sale of goods and services defined in this agreement.</p>
|
||||
|
||||
<p><strong>3.2. Conclusion of Contracts</strong></p>
|
||||
<p>A retail sales contract or a service agreement is concluded directly between the Seller and the Buyer from the moment the Seller issues cash or sales receipts confirming payment. The Marketplace acts as an information intermediary, providing infrastructure for transactions, but is not a party to this contract. Responsibility for the performance of the contract, the quality of goods and services rests with the Seller.</p>
|
||||
<p>A retail sales contract or a service agreement is concluded directly between the Seller and the Buyer. The Site Owner is not a party (seller) to the said contracts, but merely provides the information and technical infrastructure (marketplace) for their conclusion and execution. The fact of payment for the Goods through the Site does not mean the transfer of any obligations under the transaction to the Site Owner.</p>
|
||||
|
||||
<p><strong>3.3. Consent to Contact Processing</strong></p>
|
||||
<p>The User consents to the use of their contact details (email address, phone number) by the site administration and the Seller, as well as by engaged third parties, to fulfill obligations to the Buyer, including sending advertising and other information.</p>
|
||||
@@ -175,6 +177,62 @@
|
||||
|
||||
<p><strong>6.3. User Rights</strong></p>
|
||||
<p>The User has the right to refuse to receive advertising messages by using the appropriate tool on the site or by sending a request by email to <a href="mailto:info@dexarmarket.ru">info@dexarmarket.ru</a> or by letter to the official address of the Site Owner.</p>
|
||||
|
||||
<p><strong>6.4. Prohibited Goods for Sale on dexar.market</strong></p>
|
||||
<p>The following goods and services are prohibited from being sold on the dexar.market platform:</p>
|
||||
<ul>
|
||||
<li>Weapons, ammunition, military equipment, spare parts, components and instruments thereto, explosives, detonation devices, all types of rocket fuel, as well as special materials and equipment for their production, special equipment of paramilitary organisations and regulatory documentation for their production and operation.</li>
|
||||
<li>Rocket and space systems, military communication and control systems, and regulatory documentation for their production and operation.</li>
|
||||
<li>Combat chemical agents, means of protection against them, and regulatory documentation for their production and use.</li>
|
||||
<li>Results of research, design work, and fundamental research on the development of weapons and military equipment.</li>
|
||||
<li>Services, works and materials related to military service and paramilitary activities.</li>
|
||||
<li>Any weapons, including hunting, civilian and other, as well as components thereof, knives (except kitchen, penknife and office knives).</li>
|
||||
<li>Radioactive substances and isotopes, uranium and other fissile materials and products made from them.</li>
|
||||
<li>Radioactive material waste.</li>
|
||||
<li>Precious and rare-earth metals, gemstones, as well as waste containing precious and rare-earth metals and gemstones.</li>
|
||||
<li>X-ray equipment, instruments and equipment using radioactive substances and isotopes.</li>
|
||||
<li>Poisons, narcotic drugs and psychotropic substances, their precursors.</li>
|
||||
<li>Ethyl alcohol and alcoholic beverages.</li>
|
||||
<li>Prescription medicines, as well as narcotic, psychotropic and alcohol-containing (with ethyl alcohol content above 25%) medicines and alcohol-based balsams.</li>
|
||||
<li>Medicinal raw materials obtained from reindeer farming (velvet antlers and endocrine raw materials).</li>
|
||||
<li>Tobacco products or vaping products.</li>
|
||||
<li>Encryption equipment and regulatory documentation for its production and use.</li>
|
||||
<li>Counterfeit currency.</li>
|
||||
<li>Foreign currency and other currency valuables, coins and banknotes of the Russian Federation in circulation.</li>
|
||||
<li>Radio-electronic and special technical means intended for covert collection of information, as well as high-frequency devices intended for transmitting and receiving radio waves above 8 GHz.</li>
|
||||
<li>Materials and services that violate the privacy of personal life, encroach on the honour, dignity and business reputation of individuals and legal entities, or contain state, banking, commercial and other secrets.</li>
|
||||
<li>State awards of the RF, RSFSR, USSR, and copies thereof.</li>
|
||||
<li>Government identity documents, badges, passes, permits, certificates, travel documents and licences, as well as other documents granting rights or releasing from rights or obligations, and blanks for such documents.</li>
|
||||
<li>Cultural heritage sites of the peoples of the Russian Federation, as well as archaeological heritage sites.</li>
|
||||
<li>Human organs and tissues, as well as donor services.</li>
|
||||
<li>Animals and plants listed in the Red Book of the Russian Federation and regional Red Books, parts and organs of such animals, as well as animals and plants protected by international treaties.</li>
|
||||
<li>Hides and products made from hides of rare and endangered animal species.</li>
|
||||
<li>Fishing nets, materials for their manufacture, manufacturing services, electric fishing rods and traps prohibited from sale in the Russian Federation.</li>
|
||||
<li>Extremist materials, materials inciting mass riots, terrorist and extremist activities, participation in mass public events, incitement of ethnic and religious hatred.</li>
|
||||
<li>Items bearing Nazi symbols or symbols of organisations banned in the Russian Federation.</li>
|
||||
<li>Counterfeit or stolen goods or property.</li>
|
||||
<li>Databases, including those containing personal data that may facilitate unauthorised mass mailings.</li>
|
||||
<li>Materials transmitted exclusively in virtual form and not recorded on any physical medium (ideas, methods, principles, etc.).</li>
|
||||
<li>Gaming equipment used for gambling, lottery equipment, online sports betting services, acceptance of payments for lottery tickets, and sale of virtual currency.</li>
|
||||
<li>Vehicle documents, government licence plates for vehicles.</li>
|
||||
<li>Goods whose circulation infringes the intellectual property rights of third parties (including patents, trademarks, copyrights, etc.).</li>
|
||||
<li>Investment services, transactions with funds and cryptocurrencies, as well as goods and services whose purchase or use is guaranteed to generate earnings or profit.</li>
|
||||
<li>Goods and services sold by multi-level network marketing organisations based on creating a network of independent distributors or sales agents.</li>
|
||||
<li>Services and/or work of an intimate, erotic or sexual nature, as well as pornographic or erotic materials.</li>
|
||||
<li>Goods or services whose use may be aimed at violating applicable legislation of the Russian Federation.</li>
|
||||
<li>Non-existent goods or services, as well as goods or services with no consumer value.</li>
|
||||
<li>Transcendental services and alternative medicine services.</li>
|
||||
<li>Services for replacing licensed software or circumventing technical protection measures on phones, smartphones, laptops, navigators, personal computers, etc.</li>
|
||||
<li>Other goods or services whose circulation is prohibited or restricted under Russian Federation legislation, or which may negatively affect the business reputation of international payment systems.</li>
|
||||
<li>Injectable preparations and solutions, as well as substances used in their manufacture.</li>
|
||||
<li>Services, works and materials related to the activities of occult organisations and sects.</li>
|
||||
<li>Goods and services sold by companies organised as financial pyramids.</li>
|
||||
<li>Antiques.</li>
|
||||
<li>Dietary supplements. Sale of dietary supplements is permitted only through pharmacy institutions (pharmacies, pharmacy shops, pharmacy kiosks), specialised diet food shops, and grocery stores with dedicated departments.</li>
|
||||
<li>Custom coursework and diploma papers.</li>
|
||||
<li>Anonymous work (couriers for illegal deliveries, etc.).</li>
|
||||
<li>Copies and replicas of original goods.</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="legal-section">
|
||||
@@ -242,13 +300,11 @@
|
||||
<p>The Seller bears full responsibility for the quality, safety and compliance of the products sold with the stated characteristics, as well as for losses caused by breach of obligations to the Buyer.</p>
|
||||
|
||||
<p><strong>9.7. Site Owner Liability and Claims Settlement Procedure</strong></p>
|
||||
<p>The Site Owner is responsible for the quality, safety and accuracy of information about goods and services posted on the platform. At the same time, the Site Owner is not responsible for:</p>
|
||||
<p>The Site Owner is responsible for the accuracy of general information about the platform and its operation, and also takes all possible measures to prevent the posting of knowingly false information about goods, if it becomes aware of such information. At the same time, the Site Owner is not responsible for:</p>
|
||||
<ul>
|
||||
<li>The fulfillment or improper fulfillment by Sellers of their obligations to Buyers.</li>
|
||||
<li>Damage to third-party rights, including intellectual property.</li>
|
||||
<li>Issues of delivery, completeness and condition of goods.</li>
|
||||
<li>The compliance of the Seller's activities with legal requirements, the availability of necessary permits and licenses, as well as the correctness of calculation and payment of taxes by the Seller.</li>
|
||||
</ul>
|
||||
<p>The Buyer agrees that claims regarding the quality, quantity, completeness of goods and services may be directed to both the Seller and the Site Administration. The Site Administration assumes responsibility for the quality and accuracy of services provided through the platform and actively participates in the settlement of disputes.</p>
|
||||
<p>The Buyer agrees that claims regarding the quality, quantity, completeness of goods and services may be directed to both the Seller and the Site Administration.</p>
|
||||
|
||||
<p><strong>9.8. Delivery Liability</strong></p>
|
||||
<p>Responsibility for the timing, conditions and quality of goods delivery is borne by transport companies and courier services. The Site Owner acts only as an information intermediary and is not responsible for the actions of delivery services.</p>
|
||||
@@ -384,7 +440,7 @@
|
||||
<p>When purchasing a set of products on promotion with a discount, return or exchange is possible only as a complete set. Individual products from the set cannot be returned.</p>
|
||||
|
||||
<p><strong>13.5. Delivery Cost Compensation</strong></p>
|
||||
<p>When returning a product of proper quality, the Seller or the Site Owner has the right to recover delivery costs from the Buyer.</p>
|
||||
<p>When returning a product of proper quality, the cost of delivering the product from the Buyer back to the Seller is borne by the Buyer, unless otherwise provided by law or established by the Seller. The Site Owner does not compensate such costs.</p>
|
||||
|
||||
<p><strong>13.6. Claim Satisfaction Terms</strong></p>
|
||||
<p>Refund applications are satisfied within 10 days from the date of submission.</p>
|
||||
@@ -459,3 +515,5 @@
|
||||
<p><strong>16.8. Response to Violations</strong></p>
|
||||
<p>Non-intervention by the Site Owner in the event of violations of agreements by Users does not prevent subsequent measures to protect the Owner's interests at a later date.</p>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
<div class="legal-page">
|
||||
<div class="legal-container">
|
||||
<h1>СОГЛАШЕНИЕ ПУБЛИЧНОЙ ОФЕРТЫ</h1>
|
||||
|
||||
<section class="legal-section">
|
||||
@@ -77,7 +79,7 @@
|
||||
<p>Пользователь, делая заказы через маркетплейс, выражает полное согласие с условиями продажи товаров и оказания услуг, определёнными в данном соглашении.</p>
|
||||
|
||||
<p><strong>3.2. Заключение договоров</strong></p>
|
||||
<p>Договор розничной купли-продажи или договор оказания услуг заключается непосредственно между Продавцом и Покупателем с момента выдачи Продавцом кассовых или товарных чеков, подтверждающих оплату. Маркетплейс играет роль информационного посредника, предоставляя инфраструктуру для совершения сделок, но не является участником данного договора. Ответственность за выполнение договора, качество товаров и услуг лежит на Продавце.</p>
|
||||
<p>Договор розничной купли-продажи или договор оказания услуг заключается непосредственно между Продавцом и Покупателем. Владелец сайта не является стороной (продавцом) по указанным договорам, а лишь предоставляет информационно-техническую инфраструктуру (маркетплейс) для их заключения и исполнения. Факт оплаты Товара через Сайт не означает переход каких-либо обязательств по сделке на Владельца сайта.</p>
|
||||
|
||||
<p><strong>3.3. Согласие на обработку контактов</strong></p>
|
||||
<p>Пользователь даёт согласие на использование его контактных данных (адрес электронной почты, номер телефона) администрацией сайта и Продавцом, а также привлечёнными третьими сторонами для выполнения обязательств перед Покупателем, включая рассылки рекламной и иной информации.</p>
|
||||
@@ -175,6 +177,62 @@
|
||||
|
||||
<p><strong>6.3. Права Пользователя</strong></p>
|
||||
<p>Пользователь имеет право отказаться от получения рекламных сообщений, воспользовавшись соответствующим инструментом на сайте или направив заявку по электронной почте <a href="mailto:info@dexarmarket.ru">info@dexarmarket.ru</a> или письмом по официальному адресу Владельца сайта.</p>
|
||||
|
||||
<p><strong>6.4. Запрещённые товары для продажи на dexar.market</strong></p>
|
||||
<p>На платформе dexar.market запрещена продажа следующих товаров и услуг:</p>
|
||||
<ul>
|
||||
<li>Вооружение, боеприпасы к нему, военная техника, запасные части, комплектующие изделия и приборы к ним, взрывчатые вещества, средства взрывания, все виды ракетного топлива, а также специальные материалы и специальное оборудование для их производства, специальное снаряжение военизированных организаций и нормативно-техническая продукция на их производство и эксплуатацию.</li>
|
||||
<li>Ракетно-космические комплексы, системы связи и управления военного назначения и нормативно-техническая документация на их производство и эксплуатацию.</li>
|
||||
<li>Боевые отравляющие вещества, средства защиты от них и нормативно-техническая документация на их производство и использование.</li>
|
||||
<li>Результаты научно-исследовательских и проектных работ, а также фундаментальных поисковых исследований по созданию вооружения и военной техники.</li>
|
||||
<li>Услуги, работы и материалы, связанные с осуществлением военной службы и военизированной деятельности.</li>
|
||||
<li>Любое оружие, в том числе охотничье, гражданское и иное, а также комплектующие изделия к нему, ножи (за исключением кухонных, перочинных и канцелярских).</li>
|
||||
<li>Радиоактивные вещества и изотопы, уран и другие делящиеся материалы и изделия из них.</li>
|
||||
<li>Отходы радиоактивных материалов.</li>
|
||||
<li>Драгоценные и редкоземельные металлы, драгоценные камни, а также отходы, содержащие драгоценные и редкоземельные металлы и драгоценные камни.</li>
|
||||
<li>Рентгеновское оборудование, приборы и оборудование с использованием радиоактивных веществ и изотопов.</li>
|
||||
<li>Яды, наркотические средства и психотропные вещества, их прекурсоры.</li>
|
||||
<li>Спирт этиловый, алкогольные напитки.</li>
|
||||
<li>Лекарственные препараты, отпускаемые по рецепту, а также наркотические, психотропные и спиртосодержащие (с объёмной долей этилового спирта свыше 25%) лекарственные препараты и бальзамы на основе спирта.</li>
|
||||
<li>Лекарственное сырьё, получаемое от северного оленеводства (панты и эндокринное сырьё).</li>
|
||||
<li>Табачная продукция или продукты для вейпинга.</li>
|
||||
<li>Шифровальная техника и нормативно-техническая документация на её производство и использование.</li>
|
||||
<li>Поддельные денежные знаки.</li>
|
||||
<li>Иностранная валюта и иные валютные ценности, монеты и банкноты Российской Федерации, находящиеся в обращении.</li>
|
||||
<li>Радиоэлектронные и специальные технические средства, предназначенные для негласного получения информации, а также высокочастотные устройства, предназначенные для передачи и приёма радиоволн на частоте выше 8 ГГц.</li>
|
||||
<li>Материалы и услуги, нарушающие тайну частной жизни, посягающие на честь, достоинство и деловую репутацию граждан и юридических лиц, а также содержащие государственную, банковскую, коммерческую и иную тайны.</li>
|
||||
<li>Государственные награды РФ, РСФСР, СССР, а также их копии.</li>
|
||||
<li>Государственные удостоверения личности, знаки, пропуска, разрешения, сертификаты, проездные документы и лицензии, а также иные документы, предоставляющие права или освобождающие от прав или обязанностей, бланки для этих документов, а также услуги по их получению.</li>
|
||||
<li>Объекты культурного наследия народов Российской Федерации, а также объекты археологического наследия.</li>
|
||||
<li>Человеческие органы и ткани, а также донорские услуги.</li>
|
||||
<li>Животные и растения, занесённые в Красную книгу Российской Федерации и Красные книги субъектов Российской Федерации, части и органы таких животных, а также животные и растения, охраняемые международными договорами.</li>
|
||||
<li>Шкуры и изделия из шкур редких и находящихся под угрозой исчезновения видов животных.</li>
|
||||
<li>Рыболовные сети, материалы для их изготовления, а также услуги по их изготовлению, электроудочки и капканы, запрещённые к реализации на территории Российской Федерации.</li>
|
||||
<li>Экстремистские материалы, материалы, призывающие к массовым беспорядкам, осуществлению террористической и экстремистской деятельности, к участию в массовых публичных мероприятиях, разжиганию межнациональной и межконфессиональной розни.</li>
|
||||
<li>Предметы с нацистской символикой или символикой запрещённых в Российской Федерации организаций.</li>
|
||||
<li>Контрафактная или краденая продукция, или имущество.</li>
|
||||
<li>Базы данных, в том числе содержащие персональные данные, которые могут способствовать несанкционированным рассылкам.</li>
|
||||
<li>Материалы, передаваемые исключительно виртуально и не записанные на какой-либо материальный носитель (идеи, методы, принципы и т. д.).</li>
|
||||
<li>Игровое оборудование, используемое для проведения азартных игр, лотерейное оборудование, оказание услуг по приёму ставок для участия в азартных играх в интернете, приём платежей за лотерейные билеты, а также продажа виртуальной валюты.</li>
|
||||
<li>Документы на транспортные средства, государственные номера для транспортных средств.</li>
|
||||
<li>Товары, оборот которых нарушает интеллектуальные права третьих лиц (в том числе патенты, товарные знаки, авторские права и т. д.).</li>
|
||||
<li>Инвестиционные услуги, операции с денежными средствами и криптовалютами, а также товары и услуги, приобретение или использование которых гарантированно приносит заработок или прибыль.</li>
|
||||
<li>Товары и услуги, реализуемые организацией многоуровневого сетевого маркетинга, деятельность которых основана на создании сети независимых дистрибьюторов или сбытовых агентов.</li>
|
||||
<li>Услуги и (или) работа интимного, эротического или сексуального характера, а также порнографические или эротические материалы.</li>
|
||||
<li>Товары или услуги, использование которых может быть направлено на нарушение действующего законодательства Российской Федерации.</li>
|
||||
<li>Несуществующие товары или услуги, а также товары или услуги, не имеющие потребительской ценности.</li>
|
||||
<li>Трансцендентные услуги и услуги нетрадиционной медицины.</li>
|
||||
<li>Услуги по замене лицензионного программного обеспечения или нарушению работы установленных правообладателем средств технической защиты телефонов, смартфонов, ноутбуков, навигаторов, персональных компьютеров и т. д.</li>
|
||||
<li>Иные товары или услуги, оборот которых запрещён или ограничен согласно законодательству Российской Федерации, а также способен оказать негативное влияние на деловую репутацию международных платёжных систем.</li>
|
||||
<li>Инъекционные препараты и растворы, а также вещества, применяемые для их изготовления.</li>
|
||||
<li>Услуги, работы и материалы, связанные с осуществлением деятельности оккультных организаций и сект.</li>
|
||||
<li>Товары и услуги, реализуемые компаниями по форме организации финансовых пирамид.</li>
|
||||
<li>Антиквариат.</li>
|
||||
<li>Биологически активные добавки. Продажа БАД к пище возможна только через аптечные учреждения (аптеки, аптечные магазины, аптечные киоски), специализированные магазины с диетическими продуктами, продовольственные магазины со специальными отделами и секциями.</li>
|
||||
<li>Курсовые и дипломы на заказ.</li>
|
||||
<li>Анонимная работа (закладчики и т. п.).</li>
|
||||
<li>Копии и реплики оригинальных товаров.</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="legal-section">
|
||||
@@ -242,13 +300,11 @@
|
||||
<p>Продавец несёт полную ответственность за качество, безопасность и соответствие реализуемой продукции заявленным характеристикам, а также за убытки, вызванные нарушением обязательств перед Покупателем.</p>
|
||||
|
||||
<p><strong>9.7. Ответственность Владельца сайта и порядок урегулирования претензий</strong></p>
|
||||
<p>Владелец сайта несёт ответственность за качество, безопасность и достоверность информации о товарах и услугах, размещённых на платформе. При этом Владелец сайта не несёт ответственности за:</p>
|
||||
<p>Владелец сайта несет ответственность за достоверность общей информации о платформе и ее функционировании, а также принимает все возможные меры для недопущения размещения заведомо ложной информации о товарах, если о таковой ему стало известно. При этом Владелец сайта не несёт ответственности за:</p>
|
||||
<ul>
|
||||
<li>Выполнение или ненадлежащее выполнение Продавцами своих обязательств перед Покупателями.</li>
|
||||
<li>Повреждение прав третьих лиц, включая интеллектуальную собственность.</li>
|
||||
<li>Вопросы доставки, комплектации и состояния товаров.</li>
|
||||
<li>Соответствие деятельности Продавца требованиям законодательства, наличие у него необходимых разрешений и лицензий, а также за правильность исчисления и уплаты им налогов.</li>
|
||||
</ul>
|
||||
<p>Покупатель соглашается, что претензии по качеству, количеству, комплектности товаров и услугам могут быть направлены как Продавцу, так и Администрации сайта. Администрация сайта принимает на себя ответственность за качество и достоверность услуг, предоставляемых через платформу, и активно участвует в урегулировании спорных ситуаций.</p>
|
||||
<p>Покупатель соглашается, что претензии по качеству, количеству, комплектности товаров и услугам могут быть направлены как Продавцу, так и Администрации сайта.</p>
|
||||
|
||||
<p><strong>9.8. Ответственность за доставку</strong></p>
|
||||
<p>Ответственность за сроки, условия и качество доставки товаров несут транспортные компании и курьерские службы. Владелец сайта выступает только в качестве информационного посредника и не несёт ответственности за действия служб доставки.</p>
|
||||
@@ -384,7 +440,7 @@
|
||||
<p>При приобретении набора товаров по акции с предоставлением скидки возврат или обмен возможен только в комплексе. Отдельные товары из комплекта вернуть нельзя.</p>
|
||||
|
||||
<p><strong>13.5. Компенсация затрат на доставку</strong></p>
|
||||
<p>При возврате качественного товара Продавец или Владелец сайта вправе взыскать с Покупателя затраты на доставку товара.</p>
|
||||
<p>При возврате товара надлежащего качества расходы на доставку товара от Покупателя обратно Продавцу несет Покупатель, если иное не предусмотрено законодательством или не установлено Продавцом. Владелец сайта не компенсирует такие расходы.</p>
|
||||
|
||||
<p><strong>13.6. Сроки удовлетворения требований</strong></p>
|
||||
<p>Заявления о возврате средств удовлетворяются в течение 10 дней с момента подачи.</p>
|
||||
@@ -459,3 +515,5 @@
|
||||
<p><strong>16.8. Реакция на нарушения</strong></p>
|
||||
<p>Невмешательство Владельца сайта в случае нарушений соглашений Пользователями не препятствует последующим мерам защиты интересов Владельца позже.</p>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
@if (items().length > 0) {
|
||||
<div class="items-grid">
|
||||
@for (item of items(); track trackByItemId($index, item)) {
|
||||
<div class="item-card">
|
||||
<div class="item-card" (mouseenter)="onItemHover(item.itemID)">
|
||||
<a [routerLink]="['/item', item.itemID] | langRoute" class="item-link">
|
||||
<div class="item-image">
|
||||
<img [src]="getMainImage(item)" [alt]="item.name" loading="lazy" decoding="async" width="300" height="300" />
|
||||
@@ -94,7 +94,7 @@
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<button class="add-to-cart-btn" (click)="addToCart(item.itemID, $event)">
|
||||
<button class="add-to-cart-btn" (click)="addToCart(item.itemID, $event)" [attr.aria-label]="('search.addToCart' | translate) + ': ' + item.name">
|
||||
{{ 'search.addToCart' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
@@ -102,10 +102,20 @@
|
||||
</div>
|
||||
|
||||
@if (loading() && items().length > 0) {
|
||||
<div class="loading-more">
|
||||
<div class="spinner"></div>
|
||||
<p>{{ 'search.loadingMore' | translate }}</p>
|
||||
@for (i of skeletonSlots; track i) {
|
||||
<div class="item-card skeleton-card">
|
||||
<div class="item-link">
|
||||
<div class="item-image skeleton-image"></div>
|
||||
<div class="item-details">
|
||||
<div class="skeleton-line skeleton-title"></div>
|
||||
<div class="skeleton-line skeleton-rating"></div>
|
||||
<div class="skeleton-line skeleton-price"></div>
|
||||
<div class="skeleton-line skeleton-stock"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="skeleton-btn"></div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
@if (!hasMore() && items().length > 0) {
|
||||
|
||||
@@ -344,6 +344,59 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
// Skeleton loading cards
|
||||
.skeleton-card {
|
||||
pointer-events: none;
|
||||
|
||||
.skeleton-image {
|
||||
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: shimmer 1.5s infinite;
|
||||
}
|
||||
|
||||
.skeleton-line {
|
||||
border-radius: 6px;
|
||||
background: linear-gradient(90deg, #e8e8e8 25%, #d8d8d8 50%, #e8e8e8 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: shimmer 1.5s infinite;
|
||||
}
|
||||
|
||||
.skeleton-title {
|
||||
height: 16px;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.skeleton-rating {
|
||||
height: 12px;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.skeleton-price {
|
||||
height: 18px;
|
||||
width: 40%;
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
.skeleton-stock {
|
||||
height: 6px;
|
||||
width: 60px;
|
||||
}
|
||||
|
||||
.skeleton-btn {
|
||||
height: 42px;
|
||||
background: linear-gradient(90deg, #5a8a85 25%, #497671 50%, #5a8a85 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: shimmer 1.5s infinite;
|
||||
border-radius: 0 0 13px 13px;
|
||||
margin-top: -1px;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes shimmer {
|
||||
0% { background-position: 200% 0; }
|
||||
100% { background-position: -200% 0; }
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.search-header h1 {
|
||||
font-size: 1.5rem;
|
||||
|
||||
@@ -3,6 +3,7 @@ import { DecimalPipe } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { ApiService, CartService } from '../../services';
|
||||
import { PrefetchService } from '../../services/prefetch.service';
|
||||
import { Item } from '../../models';
|
||||
import { Subject, Subscription } from 'rxjs';
|
||||
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
||||
@@ -10,6 +11,7 @@ import { getDiscountedPrice, getMainImage, trackByItemId } from '../../utils/ite
|
||||
import { LangRoutePipe } from '../../pipes/lang-route.pipe';
|
||||
import { TranslatePipe } from '../../i18n/translate.pipe';
|
||||
import { TranslateService } from '../../i18n/translate.service';
|
||||
import { SEARCH_DEBOUNCE_MS, ITEMS_PER_PAGE, SCROLL_THRESHOLD_PX, SCROLL_DEBOUNCE_MS } from '../../config/constants';
|
||||
|
||||
@Component({
|
||||
selector: 'app-search',
|
||||
@@ -27,7 +29,7 @@ export class SearchComponent implements OnDestroy {
|
||||
totalResults = signal<number>(0);
|
||||
|
||||
private skip = 0;
|
||||
private readonly count = 20;
|
||||
private readonly count = ITEMS_PER_PAGE;
|
||||
private isLoadingMore = false;
|
||||
private searchSubject = new Subject<string>();
|
||||
private searchSubscription: Subscription;
|
||||
@@ -35,11 +37,12 @@ export class SearchComponent implements OnDestroy {
|
||||
|
||||
constructor(
|
||||
private apiService: ApiService,
|
||||
private cartService: CartService
|
||||
private cartService: CartService,
|
||||
private prefetchService: PrefetchService
|
||||
) {
|
||||
this.searchSubscription = this.searchSubject
|
||||
.pipe(
|
||||
debounceTime(300),
|
||||
debounceTime(SEARCH_DEBOUNCE_MS),
|
||||
distinctUntilChanged()
|
||||
)
|
||||
.subscribe(query => {
|
||||
@@ -63,7 +66,7 @@ export class SearchComponent implements OnDestroy {
|
||||
performSearch(query: string): void {
|
||||
if (!query.trim()) {
|
||||
this.items.set([]);
|
||||
this.hasMore.set(true);
|
||||
this.hasMore.set(false);
|
||||
this.totalResults.set(0);
|
||||
return;
|
||||
}
|
||||
@@ -119,12 +122,12 @@ export class SearchComponent implements OnDestroy {
|
||||
|
||||
this.scrollTimeout = setTimeout(() => {
|
||||
const scrollPosition = window.innerHeight + window.scrollY;
|
||||
const bottomPosition = document.documentElement.scrollHeight - 500;
|
||||
const bottomPosition = document.documentElement.scrollHeight - SCROLL_THRESHOLD_PX;
|
||||
|
||||
if (scrollPosition >= bottomPosition && !this.loading() && this.hasMore()) {
|
||||
this.loadResults();
|
||||
}
|
||||
}, 100);
|
||||
}, SCROLL_DEBOUNCE_MS);
|
||||
}
|
||||
|
||||
addToCart(itemID: number, event: Event): void {
|
||||
@@ -133,6 +136,11 @@ export class SearchComponent implements OnDestroy {
|
||||
this.cartService.addItem(itemID);
|
||||
}
|
||||
|
||||
onItemHover(itemID: number): void {
|
||||
this.prefetchService.prefetchItem(itemID);
|
||||
}
|
||||
|
||||
readonly skeletonSlots = Array.from({ length: 8 });
|
||||
readonly getDiscountedPrice = getDiscountedPrice;
|
||||
readonly getMainImage = getMainImage;
|
||||
readonly trackByItemId = trackByItemId;
|
||||
|
||||
@@ -7,19 +7,30 @@ import { LanguageService } from '../services/language.service';
|
||||
})
|
||||
export class LangRoutePipe implements PipeTransform {
|
||||
private langService = inject(LanguageService);
|
||||
private lastLang = '';
|
||||
private lastInput: unknown = null;
|
||||
private lastResult: string | (string | number)[] = '';
|
||||
|
||||
transform(value: string | (string | number)[]): string | (string | number)[] {
|
||||
const lang = this.langService.currentLanguage();
|
||||
|
||||
// Short-circuit if nothing changed
|
||||
if (lang === this.lastLang && value === this.lastInput) {
|
||||
return this.lastResult;
|
||||
}
|
||||
|
||||
this.lastLang = lang;
|
||||
this.lastInput = value;
|
||||
|
||||
if (typeof value === 'string') {
|
||||
return value === '/' ? `/${lang}` : `/${lang}${value}`;
|
||||
}
|
||||
|
||||
if (Array.isArray(value) && value.length > 0) {
|
||||
this.lastResult = value === '/' ? `/${lang}` : `/${lang}${value}`;
|
||||
} else if (Array.isArray(value) && value.length > 0) {
|
||||
const [first, ...rest] = value;
|
||||
return [`/${lang}${first}`, ...rest];
|
||||
this.lastResult = [`/${lang}${first}`, ...rest];
|
||||
} else {
|
||||
this.lastResult = value;
|
||||
}
|
||||
|
||||
return value;
|
||||
return this.lastResult;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { Observable, timer } from 'rxjs';
|
||||
import { map, retry } from 'rxjs/operators';
|
||||
import { Category, Item } from '../models';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
@@ -11,6 +11,11 @@ import { environment } from '../../environments/environment';
|
||||
export class ApiService {
|
||||
private readonly baseUrl = environment.apiUrl;
|
||||
|
||||
private readonly retryConfig = {
|
||||
count: 2,
|
||||
delay: (error: unknown, retryCount: number) => timer(Math.pow(2, retryCount) * 500)
|
||||
};
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
private normalizeItem(item: Item): Item {
|
||||
@@ -32,7 +37,7 @@ export class ApiService {
|
||||
}
|
||||
|
||||
getCategories(): Observable<Category[]> {
|
||||
return this.http.get<Category[]>(`${this.baseUrl}/category`);
|
||||
return this.http.get<Category[]>(`${this.baseUrl}/category`).pipe(retry(this.retryConfig));
|
||||
}
|
||||
|
||||
getCategoryItems(categoryID: number, count: number = 50, skip: number = 0): Observable<Item[]> {
|
||||
@@ -40,12 +45,12 @@ export class ApiService {
|
||||
.set('count', count.toString())
|
||||
.set('skip', skip.toString());
|
||||
return this.http.get<Item[]>(`${this.baseUrl}/category/${categoryID}`, { params })
|
||||
.pipe(map(items => this.normalizeItems(items)));
|
||||
.pipe(retry(this.retryConfig), map(items => this.normalizeItems(items)));
|
||||
}
|
||||
|
||||
getItem(itemID: number): Observable<Item> {
|
||||
return this.http.get<Item>(`${this.baseUrl}/item/${itemID}`)
|
||||
.pipe(map(item => this.normalizeItem(item)));
|
||||
.pipe(retry(this.retryConfig), map(item => this.normalizeItem(item)));
|
||||
}
|
||||
|
||||
searchItems(search: string, count: number = 50, skip: number = 0): Observable<{ items: Item[], total: number }> {
|
||||
@@ -55,6 +60,7 @@ export class ApiService {
|
||||
.set('skip', skip.toString());
|
||||
return this.http.get<{ items: Item[], total: number, count: number, skip: number }>(`${this.baseUrl}/searchitems`, { params })
|
||||
.pipe(
|
||||
retry(this.retryConfig),
|
||||
map(response => ({
|
||||
items: this.normalizeItems(response?.items || []),
|
||||
total: response?.total || 0
|
||||
@@ -162,6 +168,6 @@ export class ApiService {
|
||||
params = params.set('category', categoryID.toString());
|
||||
}
|
||||
return this.http.get<Item[]>(`${this.baseUrl}/randomitems`, { params })
|
||||
.pipe(map(items => this.normalizeItems(items)));
|
||||
.pipe(retry(this.retryConfig), map(items => this.normalizeItems(items)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ export class CartService {
|
||||
private cartItems = signal<CartItem[]>([]);
|
||||
private isTelegram = typeof window !== 'undefined' && !!window.Telegram?.WebApp;
|
||||
private addingItems = new Set<number>();
|
||||
private initialized = false;
|
||||
|
||||
items = this.cartItems.asReadonly();
|
||||
itemCount = computed(() => {
|
||||
@@ -31,10 +32,12 @@ export class CartService {
|
||||
constructor(private apiService: ApiService) {
|
||||
this.loadCart();
|
||||
|
||||
// Auto-save whenever cart changes
|
||||
// Auto-save whenever cart changes (skip the initial empty state)
|
||||
effect(() => {
|
||||
const items = this.cartItems();
|
||||
if (this.initialized) {
|
||||
this.saveToStorage(items);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,9 +70,11 @@ export class CartService {
|
||||
// No data in CloudStorage, try localStorage
|
||||
this.loadFromLocalStorage();
|
||||
}
|
||||
this.initialized = true;
|
||||
});
|
||||
} else {
|
||||
this.loadFromLocalStorage();
|
||||
this.initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ export class LanguageService {
|
||||
|
||||
languages: Language[] = [
|
||||
{ code: 'ru', name: 'Русский', flag: '🇷🇺', flagSvg: '/flags/ru.svg', enabled: true },
|
||||
{ code: 'en', name: 'English', flag: '🇬🇧', flagSvg: '/flags/en.svg', enabled: true },
|
||||
{ code: 'hy', name: 'Հայերեն', flag: '🇦🇲', flagSvg: '/flags/arm.svg', enabled: true }
|
||||
{ code: 'en', name: 'English', flag: '🇬🇧', flagSvg: '/flags/en.svg', enabled: false },
|
||||
{ code: 'hy', name: 'Հայերեն', flag: '🇦🇲', flagSvg: '/flags/arm.svg', enabled: false }
|
||||
];
|
||||
|
||||
currentLanguage = this.currentLanguageSignal.asReadonly();
|
||||
|
||||
15
src/app/services/prefetch.service.ts
Normal file
15
src/app/services/prefetch.service.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ApiService } from './api.service';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class PrefetchService {
|
||||
private prefetched = new Set<number>();
|
||||
|
||||
constructor(private api: ApiService) {}
|
||||
|
||||
prefetchItem(itemID: number): void {
|
||||
if (this.prefetched.has(itemID)) return;
|
||||
this.prefetched.add(itemID);
|
||||
this.api.getItem(itemID).subscribe();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Injectable, inject, DOCUMENT } from '@angular/core';
|
||||
import { Meta, Title } from '@angular/platform-browser';
|
||||
import { environment } from '../../environments/environment';
|
||||
import { Item } from '../models';
|
||||
@@ -10,6 +10,7 @@ import { getDiscountedPrice, getMainImage } from '../utils/item.utils';
|
||||
export class SeoService {
|
||||
private meta = inject(Meta);
|
||||
private title = inject(Title);
|
||||
private doc = inject(DOCUMENT);
|
||||
|
||||
private readonly siteUrl = `https://${environment.domain}`;
|
||||
private readonly siteName = environment.brandFullName;
|
||||
@@ -25,6 +26,7 @@ export class SeoService {
|
||||
const titleText = `${item.name} — ${this.siteName}`;
|
||||
|
||||
this.title.setTitle(titleText);
|
||||
this.setCanonical(itemUrl);
|
||||
|
||||
this.setOrUpdate([
|
||||
// Open Graph
|
||||
@@ -81,6 +83,7 @@ export class SeoService {
|
||||
// Remove product-specific tags
|
||||
this.meta.removeTag("property='product:price:amount'");
|
||||
this.meta.removeTag("property='product:price:currency'");
|
||||
this.removeCanonical();
|
||||
}
|
||||
|
||||
private setOrUpdate(tags: Array<{ property?: string; name?: string; content: string }>): void {
|
||||
@@ -114,4 +117,19 @@ export class SeoService {
|
||||
if (!text || text.length <= maxLength) return text || '';
|
||||
return text.substring(0, maxLength - 1) + '…';
|
||||
}
|
||||
|
||||
private setCanonical(url: string): void {
|
||||
this.removeCanonical();
|
||||
const link = this.doc.createElement('link');
|
||||
link.setAttribute('rel', 'canonical');
|
||||
link.setAttribute('href', url);
|
||||
this.doc.head.appendChild(link);
|
||||
}
|
||||
|
||||
private removeCanonical(): void {
|
||||
const existing = this.doc.head.querySelector('link[rel="canonical"]');
|
||||
if (existing) {
|
||||
this.doc.head.removeChild(existing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user