added language routing system
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<div class="novo-hero-content">
|
||||
<h1 class="novo-hero-title">Добро пожаловать в {{ brandName }}</h1>
|
||||
<p class="novo-hero-subtitle">Найдите всё, что нужно, в одном месте</p>
|
||||
<a routerLink="/search" class="novo-hero-btn">
|
||||
<a [routerLink]="'/search' | langRoute" class="novo-hero-btn">
|
||||
Начать поиск
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<line x1="5" y1="12" x2="19" y2="12"></line>
|
||||
@@ -50,7 +50,7 @@
|
||||
} @else {
|
||||
<div class="novo-categories-grid">
|
||||
@for (category of topLevelCategories(); track category.categoryID) {
|
||||
<a [routerLink]="['/category', category.categoryID]" class="novo-category-card">
|
||||
<a [routerLink]="['/category', category.categoryID] | langRoute" class="novo-category-card">
|
||||
<div class="novo-category-image">
|
||||
@if (category.icon) {
|
||||
<img [src]="category.icon" [alt]="category.name" loading="lazy" />
|
||||
@@ -126,7 +126,7 @@
|
||||
} @else {
|
||||
<div class="dexar-categories-grid">
|
||||
@for (category of topLevelCategories(); track category.categoryID) {
|
||||
<a [routerLink]="['/category', category.categoryID]"
|
||||
<a [routerLink]="['/category', category.categoryID] | langRoute"
|
||||
class="dexar-category-card"
|
||||
[class.dexar-category-card--wide]="isWideCategory(category.categoryID)">
|
||||
<div class="dexar-category-image">
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { Component, OnInit, signal, computed, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { ApiService } from '../../services';
|
||||
import { ApiService, LanguageService } from '../../services';
|
||||
import { Category } from '../../models';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { ItemsCarouselComponent } from '../../components/items-carousel/items-carousel.component';
|
||||
import { LangRoutePipe } from '../../pipes/lang-route.pipe';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
imports: [RouterLink, ItemsCarouselComponent],
|
||||
imports: [RouterLink, ItemsCarouselComponent, LangRoutePipe],
|
||||
templateUrl: './home.component.html',
|
||||
styleUrls: ['./home.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
@@ -48,7 +49,7 @@ export class HomeComponent implements OnInit {
|
||||
return cache;
|
||||
});
|
||||
|
||||
constructor(private apiService: ApiService, private router: Router) {}
|
||||
constructor(private apiService: ApiService, private router: Router, private langService: LanguageService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadCategories();
|
||||
@@ -103,7 +104,8 @@ export class HomeComponent implements OnInit {
|
||||
}
|
||||
|
||||
navigateToSearch(): void {
|
||||
this.router.navigate(['/search']);
|
||||
const lang = this.langService.currentLanguage();
|
||||
this.router.navigate([`/${lang}/search`]);
|
||||
}
|
||||
|
||||
scrollToCatalog(): void {
|
||||
|
||||
Reference in New Issue
Block a user