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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,266 +1,168 @@
|
||||
# API Changes Required for Backend
|
||||
# Backend API Changes Required
|
||||
|
||||
## Overview
|
||||
## Cart Quantity Support
|
||||
|
||||
Frontend has been updated with two new features:
|
||||
1. **Region/Location system** — catalog filtering by region
|
||||
2. **Auth/Login system** — Telegram-based authentication required before payment
|
||||
### 1. Add Quantity to Cart Items
|
||||
|
||||
Base URLs:
|
||||
- Dexar: `https://api.dexarmarket.ru:445`
|
||||
- Novo: `https://api.novo.market:444`
|
||||
|
||||
---
|
||||
|
||||
## 1. Region / Location Endpoints
|
||||
|
||||
### 1.1 `GET /regions` — List available regions
|
||||
|
||||
Returns the list of regions where the marketplace operates.
|
||||
|
||||
**Response** `200 OK`
|
||||
**Current GET /cart Response:**
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id": "moscow",
|
||||
"city": "Москва",
|
||||
"country": "Россия",
|
||||
"countryCode": "RU",
|
||||
"timezone": "Europe/Moscow"
|
||||
},
|
||||
{
|
||||
"id": "spb",
|
||||
"city": "Санкт-Петербург",
|
||||
"country": "Россия",
|
||||
"countryCode": "RU",
|
||||
"timezone": "Europe/Moscow"
|
||||
},
|
||||
{
|
||||
"id": "yerevan",
|
||||
"city": "Ереван",
|
||||
"country": "Армения",
|
||||
"countryCode": "AM",
|
||||
"timezone": "Asia/Yerevan"
|
||||
"itemID": 123,
|
||||
"name": "Product Name",
|
||||
"price": 100,
|
||||
"currency": "RUB",
|
||||
...other item fields
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
**Region object:**
|
||||
| Field | Type | Required | Description |
|
||||
|---------------|--------|----------|------------------------------|
|
||||
| `id` | string | yes | Unique region identifier |
|
||||
| `city` | string | yes | City name (display) |
|
||||
| `country` | string | yes | Country name (display) |
|
||||
| `countryCode` | string | yes | ISO 3166-1 alpha-2 code |
|
||||
| `timezone` | string | no | IANA timezone string |
|
||||
**NEW Required Response:**
|
||||
```json
|
||||
[
|
||||
{
|
||||
"itemID": 123,
|
||||
"name": "Product Name",
|
||||
"price": 100,
|
||||
"currency": "RUB",
|
||||
"quantity": 2, // <-- ADD THIS FIELD
|
||||
...other item fields
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
> If this endpoint is unavailable, the frontend falls back to 6 hardcoded regions (Moscow, SPB, Yerevan, Minsk, Almaty, Tbilisi).
|
||||
### 2. POST /cart - Add Item to Cart
|
||||
|
||||
---
|
||||
**Current Request:**
|
||||
```json
|
||||
{
|
||||
"itemID": 123
|
||||
}
|
||||
```
|
||||
|
||||
### 1.2 Region Query Parameter on Existing Endpoints
|
||||
|
||||
The following **existing** endpoints now accept an optional `?region=` query parameter:
|
||||
|
||||
| Endpoint | Example |
|
||||
|---------------------------------|----------------------------------------------|
|
||||
| `GET /category` | `GET /category?region=moscow` |
|
||||
| `GET /category/:id` | `GET /category/5?count=50&skip=0®ion=spb` |
|
||||
| `GET /item/:id` | `GET /item/123?region=yerevan` |
|
||||
| `GET /searchitems` | `GET /searchitems?search=phone®ion=moscow` |
|
||||
| `GET /randomitems` | `GET /randomitems?count=5®ion=almaty` |
|
||||
**NEW Request (with optional quantity):**
|
||||
```json
|
||||
{
|
||||
"itemID": 123,
|
||||
"quantity": 1 // Optional, defaults to 1 if not provided
|
||||
}
|
||||
```
|
||||
|
||||
**Behavior:**
|
||||
- If `region` param is **present** → return only items/categories available in that region
|
||||
- If `region` param is **absent** → return all items globally (current behavior, no change)
|
||||
- The `region` value matches the `id` field from the `/regions` response
|
||||
- If item already exists in cart, **increment** the quantity by the provided amount
|
||||
- If item doesn't exist, add it with the specified quantity
|
||||
|
||||
---
|
||||
|
||||
## 2. Auth / Login Endpoints
|
||||
|
||||
Authentication is **Telegram-based** with **cookie sessions** (HttpOnly, Secure, SameSite=None).
|
||||
|
||||
All auth endpoints must support CORS with `credentials: true`.
|
||||
|
||||
### 2.1 `GET /auth/session` — Check current session
|
||||
|
||||
Called on every page load to check if the user has an active session.
|
||||
### 3. PATCH /cart - Update Item Quantity (NEW ENDPOINT)
|
||||
|
||||
**Request:**
|
||||
- Cookies: session cookie (set by backend)
|
||||
- CORS: `withCredentials: true`
|
||||
|
||||
**Response `200 OK`** (authenticated):
|
||||
```json
|
||||
{
|
||||
"sessionId": "sess_abc123",
|
||||
"telegramUserId": 123456789,
|
||||
"username": "john_doe",
|
||||
"displayName": "John Doe",
|
||||
"active": true,
|
||||
"expiresAt": "2026-03-01T12:00:00Z"
|
||||
"itemID": 123,
|
||||
"quantity": 5 // New quantity value (not increment, but absolute value)
|
||||
}
|
||||
```
|
||||
|
||||
**Response `200 OK`** (expired session):
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"sessionId": "sess_abc123",
|
||||
"telegramUserId": 123456789,
|
||||
"username": "john_doe",
|
||||
"displayName": "John Doe",
|
||||
"active": false,
|
||||
"expiresAt": "2026-02-27T12:00:00Z"
|
||||
"message": "Cart updated successfully"
|
||||
}
|
||||
```
|
||||
|
||||
**Response `401 Unauthorized`** (no session / invalid cookie):
|
||||
**Behavior:**
|
||||
- Set the quantity to the exact value provided
|
||||
- If quantity is 0 or negative, remove the item from cart
|
||||
|
||||
### 4. Payment Endpoints - Include Quantity
|
||||
|
||||
**POST /payment/create**
|
||||
|
||||
Update the items array to include quantity:
|
||||
|
||||
**Current:**
|
||||
```json
|
||||
{
|
||||
"error": "No active session"
|
||||
"amount": 1000,
|
||||
"currency": "RUB",
|
||||
"items": [
|
||||
{
|
||||
"itemID": 123,
|
||||
"price": 500,
|
||||
"name": "Product Name"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**AuthSession object:**
|
||||
| Field | Type | Required | Description |
|
||||
|------------------|---------|----------|------------------------------------------|
|
||||
| `sessionId` | string | yes | Unique session ID |
|
||||
| `telegramUserId` | number | yes | Telegram user ID |
|
||||
| `username` | string? | no | Telegram @username (can be null) |
|
||||
| `displayName` | string | yes | User display name (first_name + last_name) |
|
||||
| `active` | boolean | yes | Whether session is currently valid |
|
||||
| `expiresAt` | string | yes | ISO 8601 expiration datetime |
|
||||
|
||||
---
|
||||
|
||||
### 2.2 `GET /auth/telegram/callback` — Telegram bot auth callback
|
||||
|
||||
This is the URL the Telegram bot redirects to after the user starts the bot.
|
||||
|
||||
**Flow:**
|
||||
1. Frontend generates link: `https://t.me/{botUsername}?start=auth_{encodedCallbackUrl}`
|
||||
2. User clicks → opens Telegram → starts the bot
|
||||
3. Bot sends user data to this callback endpoint
|
||||
4. Backend creates session, sets `Set-Cookie` header
|
||||
5. Frontend polls `GET /auth/session` every 3 seconds to detect when session becomes active
|
||||
|
||||
**Request** (from Telegram bot / webhook):
|
||||
**NEW:**
|
||||
```json
|
||||
{
|
||||
"id": 123456789,
|
||||
"first_name": "John",
|
||||
"last_name": "Doe",
|
||||
"username": "john_doe",
|
||||
"photo_url": "https://t.me/i/userpic/...",
|
||||
"auth_date": 1709100000,
|
||||
"hash": "abc123def456..."
|
||||
"amount": 1000,
|
||||
"currency": "RUB",
|
||||
"items": [
|
||||
{
|
||||
"itemID": 123,
|
||||
"price": 500,
|
||||
"name": "Product Name",
|
||||
"quantity": 2 // <-- ADD THIS FIELD
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Response:** Should set a session cookie and return:
|
||||
### 5. Email Purchase Confirmation
|
||||
|
||||
**POST /purchase-email**
|
||||
|
||||
Update items to include quantity:
|
||||
|
||||
**NEW:**
|
||||
```json
|
||||
{
|
||||
"sessionId": "sess_abc123",
|
||||
"message": "Authenticated successfully"
|
||||
"email": "user@example.com",
|
||||
"telegramUserId": "123456",
|
||||
"items": [
|
||||
{
|
||||
"itemID": 123,
|
||||
"name": "Product Name",
|
||||
"price": 500,
|
||||
"currency": "RUB",
|
||||
"quantity": 2 // <-- ADD THIS FIELD
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Cookie requirements:**
|
||||
| Attribute | Value | Notes |
|
||||
|------------|----------------|------------------------------------------|
|
||||
| `HttpOnly` | `true` | Not accessible via JS |
|
||||
| `Secure` | `true` | HTTPS only |
|
||||
| `SameSite` | `None` | Required for cross-origin (API ≠ frontend) |
|
||||
| `Path` | `/` | |
|
||||
| `Max-Age` | `86400` (24h) | Or as needed |
|
||||
| `Domain` | API domain | |
|
||||
## Future: Filters & Sorting (To Be Discussed)
|
||||
|
||||
> **Important:** Since the API domain differs from the frontend domain, `SameSite=None` + `Secure=true` is required for the cookie to be sent cross-origin.
|
||||
### GET /category/{categoryID}
|
||||
|
||||
---
|
||||
Add query parameters for filtering and sorting:
|
||||
|
||||
### 2.3 `POST /auth/logout` — End session
|
||||
**Proposed Query Parameters:**
|
||||
- `sort`: Sort order (e.g., `price_asc`, `price_desc`, `rating_desc`, `name_asc`)
|
||||
- `minPrice`: Minimum price filter
|
||||
- `maxPrice`: Maximum price filter
|
||||
- `minRating`: Minimum rating filter (1-5)
|
||||
- `count`: Number of items per page (already exists)
|
||||
- `skip`: Offset for pagination (already exists)
|
||||
|
||||
**Request:**
|
||||
- Cookies: session cookie
|
||||
- CORS: `withCredentials: true`
|
||||
- Body: `{}` (empty)
|
||||
|
||||
**Response `200 OK`:**
|
||||
```json
|
||||
{
|
||||
"message": "Logged out"
|
||||
}
|
||||
**Example:**
|
||||
```
|
||||
GET /category/5?sort=price_asc&minPrice=100&maxPrice=500&minRating=4&count=20&skip=0
|
||||
```
|
||||
|
||||
Should clear/invalidate the session cookie.
|
||||
**Response:** Same as current (array of items)
|
||||
|
||||
---
|
||||
|
||||
## 3. CORS Configuration
|
||||
## Summary
|
||||
|
||||
For auth cookies to work cross-origin, the backend CORS config must include:
|
||||
**Required NOW:**
|
||||
1. Add `quantity` field to cart item responses
|
||||
2. Support `quantity` parameter in POST /cart
|
||||
3. Create new PATCH /cart endpoint for updating quantities
|
||||
4. Include `quantity` in payment and email endpoints
|
||||
|
||||
```
|
||||
Access-Control-Allow-Origin: https://dexarmarket.ru (NOT *)
|
||||
Access-Control-Allow-Credentials: true
|
||||
Access-Control-Allow-Headers: Content-Type, Authorization
|
||||
Access-Control-Allow-Methods: GET, POST, PATCH, DELETE, OPTIONS
|
||||
```
|
||||
|
||||
> `Access-Control-Allow-Origin` **cannot** be `*` when `Allow-Credentials: true`. Must be the exact frontend origin.
|
||||
|
||||
For Novo, also allow `https://novo.market`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Session Refresh Behavior
|
||||
|
||||
The frontend automatically re-checks the session **60 seconds before `expiresAt`**. If the backend supports session extension (sliding expiration), it can re-set the cookie with a fresh `Max-Age` on every `GET /auth/session` call.
|
||||
|
||||
---
|
||||
|
||||
## 5. Auth Gate — Checkout Flow
|
||||
|
||||
The checkout button (`POST /cart` payment) now requires authentication:
|
||||
- If the user is **not logged in** → frontend shows a Telegram login dialog instead of proceeding
|
||||
- If the user **is logged in** → checkout proceeds normally
|
||||
- The session cookie is sent automatically with the payment request
|
||||
|
||||
No backend changes needed for the payment endpoint itself — just ensure it reads the session cookie if needed for order association.
|
||||
|
||||
---
|
||||
|
||||
## Summary of New Endpoints
|
||||
|
||||
| Method | Path | Purpose | Auth Required |
|
||||
|--------|----------------------------|-----------------------------|---------------|
|
||||
| `GET` | `/regions` | List available regions | No |
|
||||
| `GET` | `/auth/session` | Check current session | Cookie |
|
||||
| `GET` | `/auth/telegram/callback` | Telegram bot auth callback | No (from bot) |
|
||||
| `POST` | `/auth/logout` | End session | Cookie |
|
||||
|
||||
## Summary of Modified Endpoints
|
||||
|
||||
| Method | Path | Change |
|
||||
|--------|-------------------|---------------------------------------|
|
||||
| `GET` | `/category` | Added optional `?region=` param |
|
||||
| `GET` | `/category/:id` | Added optional `?region=` param |
|
||||
| `GET` | `/item/:id` | Added optional `?region=` param |
|
||||
| `GET` | `/searchitems` | Added optional `?region=` param |
|
||||
| `GET` | `/randomitems` | Added optional `?region=` param |
|
||||
|
||||
---
|
||||
|
||||
## Telegram Bot Setup
|
||||
|
||||
Each brand needs its own bot:
|
||||
- **Dexar:** `@dexarmarket_bot`
|
||||
- **Novo:** `@novomarket_bot`
|
||||
|
||||
The bot should:
|
||||
1. Listen for `/start auth_{callbackUrl}` command
|
||||
2. Extract the callback URL
|
||||
3. Send the user's Telegram data (id, first_name, username, etc.) to that callback URL
|
||||
4. The callback URL is `{apiUrl}/auth/telegram/callback`
|
||||
**Future (After Discussion):**
|
||||
- Sorting and filtering query parameters for category items endpoint
|
||||
|
||||
@@ -1,11 +1,500 @@
|
||||
bro we need to do changes, that client required
|
||||
1. we need to add location logic
|
||||
1.1 the catalogs will come or for global or for exact region
|
||||
1.2 need to add a place where the user can choose his region like city if choosed moscow the country is set russian
|
||||
1.3 can we try to understand what country is user logged or whach city by global ip and set it?
|
||||
2. we need to add somekind of user login logic
|
||||
2.1 user can add to cart, look the items and etc without logged in, but when he is going to buy/pay ->
|
||||
at first he have to login with telegram, i will send you the bots adress.
|
||||
2.1.1 if is not logged -> will see the QR or link for logging via telegram
|
||||
2.1.2 if logged we need to ping server to check if he is active user. the expiration date (like day or 5 days) we will get from bakcend with session id
|
||||
2.2 and when user is logged, that time he can do a payment
|
||||
we ae going to redesing dexar. here are css from the figma. i will try to explain all.
|
||||
pls do responsive and better! thank you
|
||||
|
||||
you are free to do changes better and responsive ofc!!
|
||||
|
||||
Header:
|
||||
<div class="frame">
|
||||
<img class="group" src="img/group-2.png" />
|
||||
<div class="div">
|
||||
<div class="div-wrapper"><div class="text-wrapper">Главная</div></div>
|
||||
<div class="div-wrapper-2"><div class="text-wrapper">О нас</div></div>
|
||||
<div class="div-wrapper-3"><div class="text-wrapper-2">Контакты</div></div>
|
||||
</div>
|
||||
<div class="frame-wrapper">
|
||||
<div class="div-2">
|
||||
<div class="text-wrapper-3">Искать...</div>
|
||||
<img class="icn" src="img/icn-05.png" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="korzina-frame"><img class="cart" src="img/cart.svg" /></div>
|
||||
<div class="RU-frame">
|
||||
<div class="text-wrapper-4">RU</div>
|
||||
<div class="group-2"><img class="line" src="img/line-2.svg" /> <img class="img" src="img/line-3.svg" /></div>
|
||||
</div>
|
||||
<div class="login-frame"><img class="icon" src="img/icon.svg" /></div>
|
||||
</div>
|
||||
|
||||
.frame {
|
||||
width: 1440px;
|
||||
height: 84px;
|
||||
display: flex;
|
||||
background-color: #74787b1a;
|
||||
}
|
||||
|
||||
.frame .group {
|
||||
margin-top: 18px;
|
||||
width: 148px;
|
||||
height: 48px;
|
||||
position: relative;
|
||||
margin-left: 56px;
|
||||
}
|
||||
|
||||
.frame .div {
|
||||
display: inline-flex;
|
||||
margin-top: 18px;
|
||||
width: 569px;
|
||||
height: 49px;
|
||||
position: relative;
|
||||
margin-left: 57px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.frame .div-wrapper {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
padding: 10px 48px;
|
||||
position: relative;
|
||||
flex: 0 0 auto;
|
||||
background-color: #497671;
|
||||
border-radius: 13px 0px 0px 13px;
|
||||
border: 1px solid;
|
||||
border-color: #d3dad9;
|
||||
box-shadow: 0px 3px 4px #00000026;
|
||||
}
|
||||
|
||||
.frame .text-wrapper {
|
||||
position: relative;
|
||||
width: fit-content;
|
||||
margin-top: -1.00px;
|
||||
font-family: "DM Sans-SemiBold", Helvetica;
|
||||
font-weight: 600;
|
||||
color: #ffffff;
|
||||
font-size: 22px;
|
||||
text-align: center;
|
||||
letter-spacing: 0;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.frame .div-wrapper-2 {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
padding: 10px 63px;
|
||||
position: relative;
|
||||
flex: 0 0 auto;
|
||||
background-color: #a1b4b5;
|
||||
border: 1px solid;
|
||||
border-color: #d3dad9;
|
||||
box-shadow: 0px 3px 4px #00000026;
|
||||
}
|
||||
|
||||
.frame .div-wrapper-3 {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
padding: 10px 42px;
|
||||
position: relative;
|
||||
flex: 0 0 auto;
|
||||
background-color: #ffffffbd;
|
||||
border-radius: 0px 13px 13px 0px;
|
||||
border: 1px solid;
|
||||
border-color: #d3dad9;
|
||||
box-shadow: 0px 3px 4px #00000026;
|
||||
}
|
||||
|
||||
.frame .text-wrapper-2 {
|
||||
color: #1e3c38;
|
||||
position: relative;
|
||||
width: fit-content;
|
||||
margin-top: -1.00px;
|
||||
font-family: "DM Sans-SemiBold", Helvetica;
|
||||
font-weight: 600;
|
||||
font-size: 22px;
|
||||
text-align: center;
|
||||
letter-spacing: 0;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.frame .frame-wrapper {
|
||||
margin-top: 18px;
|
||||
width: 234px;
|
||||
height: 49px;
|
||||
position: relative;
|
||||
margin-left: 126px;
|
||||
background-color: #ffffffbd;
|
||||
border-radius: 22px;
|
||||
border: 1px solid;
|
||||
border-color: #d2dad9;
|
||||
box-shadow: 0px 3px 4px #00000026;
|
||||
}
|
||||
|
||||
.frame .div-2 {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 27px;
|
||||
padding: 0px 20px;
|
||||
position: relative;
|
||||
top: 10px;
|
||||
left: 50px;
|
||||
}
|
||||
|
||||
.frame .text-wrapper-3 {
|
||||
color: #828e8d;
|
||||
position: relative;
|
||||
width: fit-content;
|
||||
margin-top: -1.00px;
|
||||
font-family: "DM Sans-SemiBold", Helvetica;
|
||||
font-weight: 600;
|
||||
font-size: 22px;
|
||||
text-align: center;
|
||||
letter-spacing: 0;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.frame .icn {
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
left: -32px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
.frame .korzina-frame {
|
||||
margin-top: 26px;
|
||||
width: 48px;
|
||||
height: 32px;
|
||||
position: relative;
|
||||
margin-left: 57px;
|
||||
background-color: #ffffff4c;
|
||||
border-radius: 12px;
|
||||
border: 1px solid;
|
||||
border-color: #667a77;
|
||||
}
|
||||
|
||||
.frame .cart {
|
||||
position: absolute;
|
||||
top: calc(50.00% - 13px);
|
||||
left: calc(50.00% - 14px);
|
||||
width: 27px;
|
||||
height: 27px;
|
||||
}
|
||||
|
||||
.frame .RU-frame {
|
||||
display: flex;
|
||||
margin-top: 26px;
|
||||
width: 67px;
|
||||
height: 32px;
|
||||
position: relative;
|
||||
margin-left: 4px;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 6px;
|
||||
background-color: #ffffff4c;
|
||||
border-radius: 12px;
|
||||
border: 1px solid;
|
||||
border-color: #667a77;
|
||||
}
|
||||
|
||||
.frame .text-wrapper-4 {
|
||||
position: relative;
|
||||
width: fit-content;
|
||||
margin-top: -6.50px;
|
||||
margin-bottom: -4.50px;
|
||||
font-family: "DM Sans-Medium", Helvetica;
|
||||
font-weight: 500;
|
||||
color: #1e3c38;
|
||||
font-size: 24px;
|
||||
letter-spacing: 0;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.frame .group-2 {
|
||||
position: relative;
|
||||
width: 9.29px;
|
||||
height: 14px;
|
||||
transform: rotate(90.00deg);
|
||||
}
|
||||
|
||||
.frame .line {
|
||||
top: -2px;
|
||||
position: absolute;
|
||||
left: 1px;
|
||||
width: 9px;
|
||||
height: 10px;
|
||||
transform: rotate(-90.00deg);
|
||||
}
|
||||
|
||||
.frame .img {
|
||||
top: 6px;
|
||||
position: absolute;
|
||||
left: 1px;
|
||||
width: 9px;
|
||||
height: 10px;
|
||||
transform: rotate(-90.00deg);
|
||||
}
|
||||
|
||||
.frame .login-frame {
|
||||
margin-top: 26px;
|
||||
width: 48px;
|
||||
height: 32px;
|
||||
position: relative;
|
||||
margin-left: 4px;
|
||||
background-color: #ffffff4c;
|
||||
border-radius: 12px;
|
||||
border: 1px solid;
|
||||
border-color: #667a77;
|
||||
}
|
||||
|
||||
.frame .icon {
|
||||
position: absolute;
|
||||
top: calc(50.00% - 12px);
|
||||
left: calc(50.00% - 12px);
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
1. background: rgba(117, 121, 124, 0.1);
|
||||
padding: 14px 0px;
|
||||
width: 1440px;
|
||||
height: 84px;
|
||||
2. logo stays the
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="_Слой_1" data-name="Слой 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 308.43 100.53">
|
||||
<defs>
|
||||
<style>
|
||||
.cls-1 {
|
||||
fill: #477470;
|
||||
stroke-width: 0px;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<path class="cls-1" d="m101.66,15.71c-4.16-.3-8.34-.35-12.51-.46-3.85-.1-7.69-.15-11.54-.21-9.14-.15-18.29-.32-27.44-.44-7.84-.11-15.68-.18-23.53-.21-.83,0-1.17-.3-1.33-1.01-.81-3.51-1.64-7.02-2.44-10.53-.31-1.33-1.42-2.36-2.68-2.41-1.59-.07-3.18-.17-4.77-.21C11.37.13,7.31.06,3.25,0,1.27-.03,0,1.13,0,2.92c0,1.78,1.38,3.14,3.26,3.17,4.28.08,8.56.17,12.84.2.89,0,1.34.26,1.56,1.17,1.2,4.99,2.47,9.95,3.69,14.93,2.3,9.38,4.58,18.77,6.88,28.15,1.11,4.54,2.21,9.07,3.36,13.6.28,1.11.15,1.73-1.02,2.31-3.76,1.85-5.33,5.91-4.45,9.93.91,4.11,4.58,6.95,9.07,7.02.46,0,.92,0,1.38,0-2.97,1.75-4.68,4.13-4.95,7.42-.27,3.32,1.42,5.8,3.95,7.96-4.85.74-6.27.75-9.41,1.23.8.23,1.31.11,1.98.12,4.46.05,8.92.17,13.37.01,4.94-.17,8.86-5.16,7.57-10.63-.63-2.66-2.21-4.7-5.04-5.9h39.73c-2.87,1.74-4.53,4.14-4.85,7.36-.32,3.29,1.08,5.9,3.89,8.11-9.01.38-17.71.47-26.34,1.09l30.02.35c1.84-.07,3.73.03,5.49-.97,4.82-2.75,6.23-8.3,3.26-12.73-.84-1.26-2.17-2.19-3.21-3.2,1.3,0,2.83.03,4.35,0,1.66-.04,2.81-1.34,2.78-3.08-.02-1.56-1.25-2.77-2.82-2.79-6.68-.07-13.36-.18-20.04-.2-9.37-.04-18.74-.01-28.11-.02-4.25,0-8.5,0-12.75,0-2.17,0-3.72-1.47-3.62-3.37.09-1.79,1.73-3.16,3.83-3.15,8.39.04,16.77.1,25.16.13,8.61.04,17.21.06,25.82.07.97,0,1.94-.09,2.9-.21,3.83-.52,6.67-3.16,7.69-6.89,1.84-6.75,3.76-13.47,5.65-20.21,1.36-4.84,2.79-9.66,4.08-14.52.59-2.2,1.13-4.45,1.32-6.7.29-3.53-2.89-6.7-6.6-6.96Zm-13.8,71.86c2.2-.07,4.11,1.95,4.1,4.15-.18,2.67-1.84,3.97-4.24,4.07-2.17.08-4.06-1.98-4.03-4.18.03-2.3,1.72-3.96,4.17-4.04Zm-47.43-.03c2.45-.06,4.19,1.8,4.15,4.03-.05,2.63-2.02,3.98-4.06,4.02-2.23.04-4.05-1.86-4.15-4.07-.1-2.22,2.05-4.07,4.06-3.98Zm30.45-67.01v12.33c-1.89,0-3.69.02-5.48,0-3.15-.05-6.3-.18-9.45-.18-.98,0-1.2-.35-1.27-1.24-.22-2.76-.55-5.5-.82-8.25-.09-.93-.15-1.86-.21-2.66h17.23Zm-.14,17.64v12.64c-4.47,0-8.88.02-13.29-.04-.26,0-.71-.63-.75-1.01-.35-3.18-.62-6.37-.91-9.55,0-.04,0-.07,0-.11-.15-1.98-.15-1.95,1.83-1.94,4.35.02,8.69,0,13.13,0Zm-41.31-8.1c-.62-2.71-1.26-5.41-1.88-8.12-.15-.65-.27-1.32-.43-2.1,7.05.12,13.97.24,21.04.37.41,4.15.81,8.23,1.19,12.14-5.73,0-11.3,0-16.87,0-.11,0-.22-.02-.32-.03-2.25-.14-2.24-.14-2.73-2.26Zm5.02,20.67c-1.01-4.24-2.02-8.49-3.03-12.7h18.64c.47,4.3.93,8.46,1.39,12.7h-17.01Zm57.74,8.57c-.3,1.1-.54,2.23-.89,3.31-.51,1.58-1.87,2.54-3.47,2.54-16.08-.01-32.17-.04-48.25,0-1.26,0-1.71-.36-1.95-1.57-.44-2.27-1.1-4.5-1.65-6.75-.04-.17,0-.35,0-.67,18.95.13,37.85.26,56.99.39-.29,1.03-.53,1.89-.77,2.76Zm4.75-16.54c-.7,2.51-1.41,5.02-2.17,7.51-.09.29-.56.65-.85.65-5.59.04-11.18.04-16.77,0-.29,0-.83-.42-.84-.64-.05-3.87-.04-7.75-.04-11.6h21.71c-.38,1.5-.69,2.8-1.05,4.08Zm5.38-19.31c-.83,2.95-1.7,5.89-2.49,8.85-.19.73-.47,1.01-1.23.99-6.45-.16-12.91-.28-19.36-.41-.94-.02-1.88,0-2.97,0,0-3.91.01-7.67,0-11.43,0-.76.45-.78,1-.77,2.83.08,5.65.17,8.48.22,4.93.09,9.86.15,14.79.22,1.49.02,2.18.94,1.78,2.34Z"/>
|
||||
<path class="cls-1" d="m299.48,39.67c.17-.09.36-.18.54-.28,3.09-1.58,5.27-3.86,5.99-7.4.42-2.08.51-4.14.17-6.22-.51-3.09-1.95-5.6-4.74-7.19-2.92-1.67-6.16-2.13-9.43-2.22-4.54-.13-9.08-.02-13.62-.04-.68,0-.98.18-.98.92.02,11.58.02,23.15,0,34.73,0,.72.26.96.96.95,1.71-.03,3.41-.03,5.12.02.85.03,1.15-.26,1.14-1.12-.04-3.23-.02-6.46-.02-9.69v-1.18c2.28,0,4.38.04,6.48-.02.77-.02,1.18.27,1.57.87,1.95,3.04,4,6.02,5.85,9.11.89,1.49,1.85,2.24,3.68,2.06,1.95-.2,3.94-.04,6.23-.04-3.09-4.57-6.01-8.89-8.95-13.25Zm-.65-8.49c-.41,1.92-1.85,2.99-3.63,3.16-3.3.31-6.64.33-9.96.42-.2,0-.59-.48-.59-.74-.04-3.81-.03-7.61-.03-11.8,3.68.22,7.25.24,10.77.71,2.49.33,3.8,2.22,3.81,4.75,0,1.17-.13,2.36-.37,3.51Z"/>
|
||||
<path class="cls-1" d="m160.88,43.32c2.31-4.64,2.45-9.55,1.34-14.5-.78-3.47-2.57-6.41-5.35-8.65-3.79-3.05-8.3-4.12-13.04-4.26-3.99-.11-7.99.01-11.98-.05-1.08-.02-1.33.33-1.33,1.36.03,11.35.02,22.71.02,34.06v1.2c3.27,0,6.38.06,9.5-.02,2.92-.07,5.87-.03,8.73-.48,5.42-.85,9.62-3.66,12.11-8.67Zm-5.96-4c-1.11,3.56-4.21,6.16-7.89,6.59-2.68.32-5.41.24-8.12.41-.96.06-1.17-.33-1.16-1.19.03-3.66.01-7.32.01-10.99.02,0,.03,0,.05,0,0-3.7-.01-7.4.02-11.09,0-.28.34-.81.52-.81,3.16.01,6.35-.32,9.47.56,4.39,1.24,6.86,4.16,7.57,8.62.43,2.66.34,5.3-.47,7.88Z"/>
|
||||
<path class="cls-1" d="m176.08,37.91c0-.65.38-.66.86-.65,3.92.06,7.84.12,11.76.16,1.36.02,2.72,0,4.17,0,0-1.95-.04-3.62.02-5.28.03-.84-.28-1.03-1.07-1.02-4.83.03-9.66.02-14.49.02h-1.27c0-2.91-.01-5.7.03-8.48,0-.17.43-.48.66-.48,5.15-.02,10.31-.01,15.46-.01.47,0,.94-.05,1.42-.03.73.04,1.03-.22,1-1-.06-1.27-.07-2.54,0-3.81.06-.94-.22-1.25-1.2-1.24-7.04.03-14.09,0-21.13,0-1.11,0-2.22,0-3.31,0v36.58h25.96v-6.21h-18.86c0-2.98,0-5.76,0-8.55Z"/>
|
||||
<path class="cls-1" d="m265.06,35c-2.49-6.04-4.99-12.08-7.52-18.1-.12-.28-.65-.53-1-.54-1.92-.05-3.85,0-5.77-.04-.7-.02-1,.27-1.26.89-2.73,6.57-5.49,13.12-8.23,19.68-2.17,5.21-4.32,10.42-6.61,15.95,2.43,0,4.65.03,6.86-.04.34-.01.81-.44.96-.79.93-2.17,1.76-4.38,2.69-6.55.15-.34.61-.79.93-.79,4.94.01,9.87.11,14.81.13.67,0,.84.31,1.04.81.86,2.16,1.73,4.31,2.63,6.45.11.26.38.65.59.65,2.34.05,4.68.03,7.12.03-.11-.33-.19-.63-.31-.91-2.3-5.62-4.6-11.23-6.91-16.84Zm-17.29,3.48c1.91-4.7,3.81-9.35,5.79-14.21,1.96,4.85,3.84,9.48,5.76,14.21h-11.54Z"/>
|
||||
<path class="cls-1" d="m225.35,52.65c2.59.09,5.19.05,7.88.05-.08-.32-.09-.51-.18-.64-1.34-1.94-2.7-3.86-4.04-5.8-2.54-3.68-5.05-7.38-7.59-11.06-.54-.78-.8-1.41-.12-2.37,2.6-3.69,5.06-7.47,7.59-11.21,1.18-1.74,2.4-3.46,3.72-5.35-.47-.07-.71-.13-.95-.13-2.11,0-4.21-.06-6.32.03-.52.02-1.21.36-1.51.77-1.3,1.77-2.49,3.62-3.72,5.43-1.3,1.92-2.61,3.85-3.96,5.84-.26-.31-.43-.49-.57-.7-2.13-3.22-4.31-6.4-6.36-9.67-.79-1.26-1.63-1.88-3.2-1.76-2.04.17-4.09.04-6.28.04.14.36.18.57.29.73,3.71,5.4,7.42,10.8,11.15,16.19.43.62.42,1.09-.02,1.72-3.29,4.7-6.54,9.42-9.8,14.14-.83,1.21-1.63,2.45-2.53,3.81,2.74,0,5.24.02,7.74-.02.31,0,.73-.26.92-.53,2.4-3.49,4.77-7,7.15-10.51.45-.67.9-1.34,1.38-2.05,2.79,4.08,5.5,8.05,8.23,12,.29.42.72,1.05,1.1,1.06Z"/>
|
||||
<path class="cls-1" d="m141.52,77.32l-1.21,2.83h-.11l-1.21-2.83-3.33-7.36h-3.58v14.94h2.99v-6.83c0-1.39-.25-3.38-.4-4.75h.11l1.47,3.4,3.19,6.78h1.5l3.19-6.78,1.5-3.4h.11c-.17,1.37-.42,3.36-.42,4.75v6.83h3.08v-14.94h-3.61l-3.24,7.36Z"/>
|
||||
<path class="cls-1" d="m162.26,69.96l-6.04,14.94h3.36l1.44-4.04h6.18l1.44,4.04h3.47l-6.01-14.94h-3.84Zm-.51,8.82l.65-1.83c.59-1.58,1.13-3.27,1.64-4.93h.11c.54,1.64,1.1,3.36,1.66,4.93l.65,1.83h-4.71Z"/>
|
||||
<path class="cls-1" d="m192.96,74.39c0-3.34-2.96-4.43-6.8-4.43h-6.21v14.94h3.27v-5.85h2.79l3.98,5.85h3.67l-4.4-6.24c2.23-.62,3.7-1.99,3.7-4.27Zm-7.14,2.56h-2.6v-4.87h2.6c2.54,0,3.89.59,3.89,2.31s-1.35,2.56-3.89,2.56Z"/>
|
||||
<polygon class="cls-1" points="215.96 69.96 212.34 69.96 205.77 76.75 205.69 76.75 205.69 69.96 202.41 69.96 202.41 84.9 205.69 84.9 205.69 80.54 208.34 77.87 213.3 84.9 216.92 84.9 210.29 75.79 215.96 69.96"/>
|
||||
<polygon class="cls-1" points="228.09 78.25 234.72 78.25 234.72 76.01 228.09 76.01 228.09 72.2 235.9 72.2 235.9 69.96 224.82 69.96 224.82 84.9 236.19 84.9 236.19 82.66 228.09 82.66 228.09 78.25"/>
|
||||
<polygon class="cls-1" points="243.92 72.2 249.25 72.2 249.25 84.9 252.52 84.9 252.52 72.2 257.83 72.2 257.83 69.96 243.92 69.96 243.92 72.2"/>
|
||||
</svg>
|
||||
|
||||
|
||||
3. after logo 3 btns in same div and without gap
|
||||
3.1 "главная"
|
||||
border: 1px solid #d3dad9;
|
||||
border-radius: 13px 0 0 13px;
|
||||
padding: 10px 48px;
|
||||
width: 187px;
|
||||
height: 49px;
|
||||
3.2 "о нас"border:
|
||||
1px solid #d3dad9;
|
||||
padding: 10px 63px;
|
||||
width: 188px;
|
||||
height: 49px;
|
||||
3.3 "котакты"border:
|
||||
1px solid #d3dad9;
|
||||
border-radius: 0 13px 13px 0;
|
||||
padding: 10px 42px;
|
||||
width: 194px;
|
||||
height: 49px;
|
||||
|
||||
box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.15);
|
||||
background: rgba(255, 255, 255, 0.74);
|
||||
hover: background: #a1b4b5;
|
||||
active : background: #497671;
|
||||
|
||||
|
||||
4. next search btn with place holder "искать..." and on the left fixed svg icon "<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4ZM2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12Z" fill="#576463" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.2929 18.2929C18.6834 17.9024 19.3166 17.9024 19.7071 18.2929L25.7071 24.2929C26.0976 24.6834 26.0976 25.3166 25.7071 25.7071C25.3166 26.0976 24.6834 26.0976 24.2929 25.7071L18.2929 19.7071C17.9024 19.3166 17.9024 18.6834 18.2929 18.2929Z" fill="#576463" />
|
||||
</svg>"
|
||||
border: 1px solid #d3dad9;
|
||||
border-radius: 22px;
|
||||
padding: 6px 10px;
|
||||
width: 234px;
|
||||
height: 49px;
|
||||
box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.15);
|
||||
background: rgba(255, 255, 255, 0.74);
|
||||
|
||||
|
||||
5. after 3 buttons to the right
|
||||
5.1 cart btn
|
||||
border-radius: 12px;
|
||||
fill: rgba(255, 255, 255, 0.3);
|
||||
border: 1px solid #677b78;
|
||||
|
||||
<svg width="48" height="32" viewBox="0 0 48 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M12 0.5H36C42.3513 0.5 47.5 5.64873 47.5 12V20C47.5 26.3513 42.3513 31.5 36 31.5H12C5.64873 31.5 0.5 26.3513 0.5 20V12C0.5 5.64873 5.64873 0.5 12 0.5Z" fill="white" fill-opacity="0.3" />
|
||||
<path d="M12 0.5H36C42.3513 0.5 47.5 5.64873 47.5 12V20C47.5 26.3513 42.3513 31.5 36 31.5H12C5.64873 31.5 0.5 26.3513 0.5 20V12C0.5 5.64873 5.64873 0.5 12 0.5Z" stroke="#677B78" />
|
||||
<path d="M10 3.9C10 3.40294 10.4029 3 10.9 3H13.6C14.013 3 14.373 3.28107 14.4731 3.68172L15.2027 6.6H36.1C36.3677 6.6 36.6216 6.7192 36.7925 6.92523C36.9635 7.13125 37.0339 7.40271 36.9846 7.66586L34.2846 22.0659C34.2048 22.4915 33.8331 22.8 33.4 22.8H31.6H19H17.2C16.7669 22.8 16.3952 22.4915 16.3154 22.0659L13.6204 7.69224L12.8973 4.8H10.9C10.4029 4.8 10 4.39706 10 3.9ZM15.5844 8.4L17.9469 21H32.6531L35.0156 8.4H15.5844ZM19 22.8C17.0118 22.8 15.4 24.4118 15.4 26.4C15.4 28.3882 17.0118 30 19 30C20.9882 30 22.6 28.3882 22.6 26.4C22.6 24.4118 20.9882 22.8 19 22.8ZM31.6 22.8C29.6118 22.8 28 24.4118 28 26.4C28 28.3882 29.6118 30 31.6 30C33.5882 30 35.2 28.3882 35.2 26.4C35.2 24.4118 33.5882 22.8 31.6 22.8ZM19 24.6C19.9941 24.6 20.8 25.4059 20.8 26.4C20.8 27.3941 19.9941 28.2 19 28.2C18.0059 28.2 17.2 27.3941 17.2 26.4C17.2 25.4059 18.0059 24.6 19 24.6ZM31.6 24.6C32.5941 24.6 33.4 25.4059 33.4 26.4C33.4 27.3941 32.5941 28.2 31.6 28.2C30.6059 28.2 29.8 27.3941 29.8 26.4C29.8 25.4059 30.6059 24.6 31.6 24.6Z" fill="#1E3C38" />
|
||||
</svg>
|
||||
|
||||
5.2 lang selector btn style border: 1px solid #677b78;
|
||||
border-radius: 12px;
|
||||
padding: 6px;
|
||||
width: 67px;
|
||||
height: 32px;
|
||||
|
||||
|
||||
HERO
|
||||
we are goung to have a width wide hero, photos for dekstop and mobile you can see in the same folder
|
||||
|
||||
on it text. here are codes from figma
|
||||
<div class="frame">
|
||||
<div class="text-wrapper">Здесь ты найдёшь всё</div>
|
||||
<p class="div">Тысячи товаров в одном месте</p>
|
||||
<div class="text-wrapper-2">просто и удобно</div>
|
||||
</div>
|
||||
|
||||
.frame {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 639px;
|
||||
align-items: flex-start;
|
||||
gap: 18px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.frame .text-wrapper {
|
||||
position: relative;
|
||||
width: 659px;
|
||||
margin-top: -1.00px;
|
||||
margin-right: -20.00px;
|
||||
font-size: 57px;
|
||||
font-family: "DM Sans-Medium", Helvetica;
|
||||
font-weight: 500;
|
||||
color: #1e3c38;
|
||||
letter-spacing: 0;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.frame .div {
|
||||
position: absolute;
|
||||
top: 87px;
|
||||
left: 0;
|
||||
width: 581px;
|
||||
font-size: 34px;
|
||||
font-family: "DM Sans-Medium", Helvetica;
|
||||
font-weight: 500;
|
||||
color: #1e3c38;
|
||||
letter-spacing: 0;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.frame .text-wrapper-2 {
|
||||
position: absolute;
|
||||
top: 133px;
|
||||
left: 0;
|
||||
width: 281px;
|
||||
font-size: 34px;
|
||||
font-family: "DM Sans-Medium", Helvetica;
|
||||
font-weight: 500;
|
||||
color: #1e3c38;
|
||||
letter-spacing: 0;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
under the text we have btns.. hovers and actives for all web site are the same as from header
|
||||
|
||||
first
|
||||
<div class="pereyti-v-katalog"><div class="text-wrapper">Перейти в каталог</div></div>
|
||||
.pereyti-v-katalog {
|
||||
width: 337px;
|
||||
height: 60px;
|
||||
display: flex;
|
||||
border-radius: 13px;
|
||||
border: 1px solid;
|
||||
border-color: #d3dad9;
|
||||
background: linear-gradient(
|
||||
360deg,
|
||||
rgba(73, 118, 113, 1) 0%,
|
||||
rgba(167, 206, 202, 1) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.pereyti-v-katalog .text-wrapper {
|
||||
margin-top: 12px;
|
||||
width: 269px;
|
||||
height: 36px;
|
||||
margin-left: 34px;
|
||||
position: relative;
|
||||
font-family: "DM Sans-Medium", Helvetica;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
font-size: 27px;
|
||||
text-align: center;
|
||||
letter-spacing: 1.08px;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
|
||||
second btn
|
||||
<div class="frame">
|
||||
<div class="text-wrapper">Найти товар</div>
|
||||
<div class="group"><img class="line" src="img/line-2.svg" /> <img class="img" src="img/line-3.svg" /></div>
|
||||
</div>
|
||||
|
||||
.frame {
|
||||
width: 264px;
|
||||
height: 60px;
|
||||
display: flex;
|
||||
gap: 9.2px;
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 13px;
|
||||
border: 1px solid;
|
||||
border-color: #d3dad9;
|
||||
}
|
||||
|
||||
.frame .text-wrapper {
|
||||
margin-top: 12px;
|
||||
width: 181px;
|
||||
height: 36px;
|
||||
position: relative;
|
||||
margin-left: 36px;
|
||||
font-family: "DM Sans-Medium", Helvetica;
|
||||
font-weight: 500;
|
||||
color: #1e3c38;
|
||||
font-size: 27px;
|
||||
text-align: center;
|
||||
letter-spacing: 1.08px;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.frame .group {
|
||||
margin-top: 22.0px;
|
||||
width: 10.62px;
|
||||
height: 16px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.frame .line {
|
||||
top: -1px;
|
||||
width: 12px;
|
||||
position: absolute;
|
||||
left: 1px;
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
.frame .img {
|
||||
top: 7px;
|
||||
width: 11px;
|
||||
position: absolute;
|
||||
left: 1px;
|
||||
height: 10px;
|
||||
}
|
||||
@@ -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,12 +12,11 @@
|
||||
</div>
|
||||
} @else {
|
||||
<app-header></app-header>
|
||||
@if (!isHomePage()) {
|
||||
<app-back-button />
|
||||
}
|
||||
<main class="main-content">
|
||||
@if (!isHomePage()) {
|
||||
<app-back-button />
|
||||
}
|
||||
<router-outlet></router-outlet>
|
||||
</main>
|
||||
<app-footer></app-footer>
|
||||
<app-telegram-login />
|
||||
}
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
@@ -5,7 +5,6 @@ import { Title } from '@angular/platform-browser';
|
||||
import { HeaderComponent } from './components/header/header.component';
|
||||
import { FooterComponent } from './components/footer/footer.component';
|
||||
import { BackButtonComponent } from './components/back-button/back-button.component';
|
||||
import { TelegramLoginComponent } from './components/telegram-login/telegram-login.component';
|
||||
import { ApiService } from './services';
|
||||
import { interval, concat } from 'rxjs';
|
||||
import { filter, first } from 'rxjs/operators';
|
||||
@@ -17,7 +16,7 @@ import { TranslateService } from './i18n/translate.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
imports: [RouterOutlet, HeaderComponent, FooterComponent, BackButtonComponent, TelegramLoginComponent, TranslatePipe],
|
||||
imports: [RouterOutlet, HeaderComponent, FooterComponent, BackButtonComponent, TranslatePipe],
|
||||
templateUrl: './app.html',
|
||||
styleUrl: './app.scss'
|
||||
})
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -27,11 +27,10 @@
|
||||
</nav>
|
||||
|
||||
<div class="novo-right">
|
||||
<app-region-selector />
|
||||
<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>
|
||||
@@ -41,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>
|
||||
@@ -107,18 +106,13 @@
|
||||
}
|
||||
</a>
|
||||
|
||||
<!-- Region Selector (desktop only) -->
|
||||
<div class="dexar-region-selector dexar-lang-desktop">
|
||||
<app-region-selector />
|
||||
</div>
|
||||
|
||||
<!-- Language Selector (desktop only) -->
|
||||
<div class="dexar-lang-selector dexar-lang-desktop">
|
||||
<app-language-selector />
|
||||
</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>
|
||||
@@ -177,11 +171,6 @@
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
<!-- Region Selector in mobile menu -->
|
||||
<div class="dexar-mobile-lang">
|
||||
<app-region-selector />
|
||||
</div>
|
||||
|
||||
<!-- Language Selector in mobile menu -->
|
||||
<div class="dexar-mobile-lang">
|
||||
<app-language-selector />
|
||||
|
||||
@@ -4,13 +4,12 @@ import { CartService, LanguageService } from '../../services';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { LogoComponent } from '../logo/logo.component';
|
||||
import { LanguageSelectorComponent } from '../language-selector/language-selector.component';
|
||||
import { RegionSelectorComponent } from '../region-selector/region-selector.component';
|
||||
import { LangRoutePipe } from '../../pipes/lang-route.pipe';
|
||||
import { TranslatePipe } from '../../i18n/translate.pipe';
|
||||
|
||||
@Component({
|
||||
selector: 'app-header',
|
||||
imports: [RouterLink, RouterLinkActive, LogoComponent, LanguageSelectorComponent, RegionSelectorComponent, LangRoutePipe, TranslatePipe],
|
||||
imports: [RouterLink, RouterLinkActive, LogoComponent, LanguageSelectorComponent, LangRoutePipe, TranslatePipe],
|
||||
templateUrl: './header.component.html',
|
||||
styleUrls: ['./header.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
<div class="region-selector">
|
||||
<button class="region-trigger" (click)="toggleDropdown()" [class.active]="dropdownOpen()">
|
||||
<svg class="pin-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path>
|
||||
<circle cx="12" cy="10" r="3"></circle>
|
||||
</svg>
|
||||
<span class="region-name">
|
||||
@if (detecting()) {
|
||||
<span class="detecting">...</span>
|
||||
} @else if (region()) {
|
||||
{{ region()!.city }}
|
||||
} @else {
|
||||
{{ 'location.allRegions' | translate }}
|
||||
}
|
||||
</span>
|
||||
<svg class="chevron" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"
|
||||
[class.rotated]="dropdownOpen()">
|
||||
<path d="M6 9l6 6 6-6"></path>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
@if (dropdownOpen()) {
|
||||
<div class="region-dropdown">
|
||||
<div class="dropdown-header">
|
||||
<span>{{ 'location.chooseRegion' | translate }}</span>
|
||||
@if (!detecting()) {
|
||||
<button class="detect-btn" (click)="detectLocation()" title="{{ 'location.detectAuto' | translate }}">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<circle cx="12" cy="12" r="3"></circle>
|
||||
<path d="M12 2v4M12 18v4M2 12h4M18 12h4"></path>
|
||||
</svg>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="region-list">
|
||||
<button class="region-option" [class.selected]="!region()" (click)="selectGlobal()">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<circle cx="12" cy="12" r="10"></circle>
|
||||
<path d="M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path>
|
||||
</svg>
|
||||
<span>{{ 'location.allRegions' | translate }}</span>
|
||||
</button>
|
||||
|
||||
@for (r of regions(); track r.id) {
|
||||
<button class="region-option" [class.selected]="region()?.id === r.id" (click)="selectRegion(r)">
|
||||
<span class="region-city">{{ r.city }}</span>
|
||||
<span class="region-country">{{ r.country }}</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -1,180 +0,0 @@
|
||||
.region-selector {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.region-trigger {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid var(--border-color, #e0e0e0);
|
||||
border-radius: 8px;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
color: var(--text-primary, #333);
|
||||
transition: all 0.2s ease;
|
||||
white-space: nowrap;
|
||||
|
||||
&:hover, &.active {
|
||||
border-color: var(--accent-color, #497671);
|
||||
background: var(--bg-hover, rgba(73, 118, 113, 0.05));
|
||||
}
|
||||
|
||||
.pin-icon {
|
||||
flex-shrink: 0;
|
||||
color: var(--accent-color, #497671);
|
||||
}
|
||||
|
||||
.region-name {
|
||||
max-width: 120px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
.detecting {
|
||||
animation: pulse 1s ease infinite;
|
||||
}
|
||||
}
|
||||
|
||||
.chevron {
|
||||
flex-shrink: 0;
|
||||
transition: transform 0.2s ease;
|
||||
|
||||
&.rotated {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.region-dropdown {
|
||||
position: absolute;
|
||||
top: calc(100% + 4px);
|
||||
left: 0;
|
||||
min-width: 220px;
|
||||
background: var(--bg-card, #fff);
|
||||
border: 1px solid var(--border-color, #e0e0e0);
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
||||
z-index: 1000;
|
||||
overflow: hidden;
|
||||
animation: slideDown 0.15s ease;
|
||||
}
|
||||
|
||||
.dropdown-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 10px 14px;
|
||||
border-bottom: 1px solid var(--border-color, #e0e0e0);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary, #666);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.detect-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
background: var(--bg-hover, rgba(73, 118, 113, 0.08));
|
||||
color: var(--accent-color, #497671);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
background: var(--accent-color, #497671);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.region-list {
|
||||
max-height: 280px;
|
||||
overflow-y: auto;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.region-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
padding: 10px 12px;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
color: var(--text-primary, #333);
|
||||
text-align: left;
|
||||
transition: background 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
background: var(--bg-hover, rgba(73, 118, 113, 0.06));
|
||||
}
|
||||
|
||||
&.selected {
|
||||
background: var(--accent-color, #497671);
|
||||
color: #fff;
|
||||
|
||||
.region-country {
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
}
|
||||
|
||||
.region-city {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.region-country {
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary, #999);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes slideDown {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-4px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.4; }
|
||||
}
|
||||
|
||||
// Mobile adjustments
|
||||
@media (max-width: 768px) {
|
||||
.region-trigger {
|
||||
padding: 5px 8px;
|
||||
font-size: 12px;
|
||||
|
||||
.region-name {
|
||||
max-width: 80px;
|
||||
}
|
||||
}
|
||||
|
||||
.region-dropdown {
|
||||
position: fixed;
|
||||
top: auto;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
min-width: 100%;
|
||||
border-radius: 16px 16px 0 0;
|
||||
max-height: 60vh;
|
||||
|
||||
.region-list {
|
||||
max-height: 50vh;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
import { Component, ChangeDetectionStrategy, inject, signal, HostListener } from '@angular/core';
|
||||
import { LocationService } from '../../services/location.service';
|
||||
import { Region } from '../../models/location.model';
|
||||
import { TranslatePipe } from '../../i18n/translate.pipe';
|
||||
|
||||
@Component({
|
||||
selector: 'app-region-selector',
|
||||
imports: [TranslatePipe],
|
||||
templateUrl: './region-selector.component.html',
|
||||
styleUrls: ['./region-selector.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class RegionSelectorComponent {
|
||||
private locationService = inject(LocationService);
|
||||
|
||||
region = this.locationService.region;
|
||||
regions = this.locationService.regions;
|
||||
detecting = this.locationService.detecting;
|
||||
|
||||
dropdownOpen = signal(false);
|
||||
|
||||
toggleDropdown(): void {
|
||||
this.dropdownOpen.update(v => !v);
|
||||
}
|
||||
|
||||
selectRegion(region: Region): void {
|
||||
this.locationService.setRegion(region);
|
||||
this.dropdownOpen.set(false);
|
||||
}
|
||||
|
||||
selectGlobal(): void {
|
||||
this.locationService.clearRegion();
|
||||
this.dropdownOpen.set(false);
|
||||
}
|
||||
|
||||
detectLocation(): void {
|
||||
this.locationService.detectLocation();
|
||||
}
|
||||
|
||||
@HostListener('document:click', ['$event'])
|
||||
onDocumentClick(event: MouseEvent): void {
|
||||
const target = event.target as HTMLElement;
|
||||
if (!target.closest('app-region-selector')) {
|
||||
this.dropdownOpen.set(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
@if (showDialog()) {
|
||||
<div class="login-overlay" (click)="close()">
|
||||
<div class="login-dialog" (click)="$event.stopPropagation()">
|
||||
<button class="close-btn" (click)="close()">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M18 6L6 18M6 6l12 12"/>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<div class="login-icon">
|
||||
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
||||
<path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"/>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<h2>{{ 'auth.loginRequired' | translate }}</h2>
|
||||
<p class="login-desc">{{ 'auth.loginDescription' | translate }}</p>
|
||||
|
||||
@if (status() === 'checking') {
|
||||
<div class="login-status checking">
|
||||
<div class="spinner"></div>
|
||||
<span>{{ 'auth.checking' | translate }}</span>
|
||||
</div>
|
||||
} @else {
|
||||
<button class="telegram-btn" (click)="openTelegramLogin()">
|
||||
<svg class="tg-icon" width="22" height="22" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"/>
|
||||
</svg>
|
||||
{{ 'auth.loginWithTelegram' | translate }}
|
||||
</button>
|
||||
|
||||
<div class="qr-section">
|
||||
<p class="qr-hint">{{ 'auth.orScanQr' | translate }}</p>
|
||||
<div class="qr-container">
|
||||
<img [src]="'https://api.qrserver.com/v1/create-qr-code/?size=180x180&data=' + loginUrl()"
|
||||
alt="QR Code"
|
||||
width="180"
|
||||
height="180"
|
||||
loading="lazy" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="login-note">{{ 'auth.loginNote' | translate }}</p>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -1,184 +0,0 @@
|
||||
.login-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
backdrop-filter: blur(4px);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 10000;
|
||||
animation: fadeIn 0.2s ease;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.login-dialog {
|
||||
position: relative;
|
||||
background: var(--bg-card, #fff);
|
||||
border-radius: 20px;
|
||||
padding: 32px 28px;
|
||||
max-width: 400px;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
|
||||
animation: scaleIn 0.25s ease;
|
||||
}
|
||||
|
||||
.close-btn {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 12px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
background: var(--bg-hover, #f0f0f0);
|
||||
color: var(--text-secondary, #666);
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
background: #e0e0e0;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.login-icon {
|
||||
margin: 0 auto 16px;
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
border-radius: 50%;
|
||||
background: var(--accent-light, rgba(73, 118, 113, 0.1));
|
||||
color: var(--accent-color, #497671);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 0 0 8px;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary, #1a1a1a);
|
||||
}
|
||||
|
||||
.login-desc {
|
||||
margin: 0 0 24px;
|
||||
font-size: 14px;
|
||||
color: var(--text-secondary, #666);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.telegram-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
padding: 14px 24px;
|
||||
border: none;
|
||||
border-radius: 12px;
|
||||
background: #2AABEE;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
background: #229ED9;
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 12px rgba(42, 171, 238, 0.3);
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.tg-icon {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.qr-section {
|
||||
margin-top: 20px;
|
||||
|
||||
.qr-hint {
|
||||
margin: 0 0 12px;
|
||||
font-size: 13px;
|
||||
color: var(--text-secondary, #999);
|
||||
}
|
||||
|
||||
.qr-container {
|
||||
display: inline-flex;
|
||||
padding: 12px;
|
||||
background: #fff;
|
||||
border-radius: 12px;
|
||||
border: 1px solid #e8e8e8;
|
||||
|
||||
img {
|
||||
display: block;
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.login-note {
|
||||
margin: 16px 0 0;
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary, #999);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.login-status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
padding: 16px;
|
||||
color: var(--text-secondary, #666);
|
||||
font-size: 14px;
|
||||
|
||||
.spinner {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: 2px solid #e0e0e0;
|
||||
border-top-color: var(--accent-color, #497671);
|
||||
border-radius: 50%;
|
||||
animation: spin 0.8s linear infinite;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
@keyframes scaleIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: scale(0.95);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.login-dialog {
|
||||
padding: 24px 20px;
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.qr-section .qr-container img {
|
||||
width: 140px;
|
||||
height: 140px;
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
import { Component, ChangeDetectionStrategy, inject, signal, OnInit, OnDestroy } from '@angular/core';
|
||||
import { AuthService } from '../../services/auth.service';
|
||||
import { TranslatePipe } from '../../i18n/translate.pipe';
|
||||
|
||||
@Component({
|
||||
selector: 'app-telegram-login',
|
||||
imports: [TranslatePipe],
|
||||
templateUrl: './telegram-login.component.html',
|
||||
styleUrls: ['./telegram-login.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class TelegramLoginComponent implements OnInit, OnDestroy {
|
||||
private authService = inject(AuthService);
|
||||
|
||||
showDialog = this.authService.showLoginDialog;
|
||||
status = this.authService.status;
|
||||
loginUrl = signal('');
|
||||
|
||||
private pollTimer?: ReturnType<typeof setInterval>;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loginUrl.set(this.authService.getTelegramLoginUrl());
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.stopPolling();
|
||||
}
|
||||
|
||||
close(): void {
|
||||
this.authService.hideLogin();
|
||||
this.stopPolling();
|
||||
}
|
||||
|
||||
/** Open Telegram login link and start polling for session */
|
||||
openTelegramLogin(): void {
|
||||
window.open(this.loginUrl(), '_blank');
|
||||
this.startPolling();
|
||||
}
|
||||
|
||||
/** Start polling the backend to detect when user completes Telegram auth */
|
||||
private startPolling(): void {
|
||||
this.stopPolling();
|
||||
// Check every 3 seconds for up to 5 minutes
|
||||
let checks = 0;
|
||||
this.pollTimer = setInterval(() => {
|
||||
checks++;
|
||||
if (checks > 100) { // 100 * 3s = 5 min
|
||||
this.stopPolling();
|
||||
return;
|
||||
}
|
||||
this.authService.checkSession();
|
||||
// If authenticated, stop polling and close dialog
|
||||
if (this.authService.isAuthenticated()) {
|
||||
this.stopPolling();
|
||||
this.authService.hideLogin();
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
private stopPolling(): void {
|
||||
if (this.pollTimer) {
|
||||
clearInterval(this.pollTimer);
|
||||
this.pollTimer = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
@@ -185,17 +185,4 @@ export const en: Translations = {
|
||||
retry: 'Try again',
|
||||
loading: 'Loading...',
|
||||
},
|
||||
location: {
|
||||
allRegions: 'All regions',
|
||||
chooseRegion: 'Choose region',
|
||||
detectAuto: 'Detect automatically',
|
||||
},
|
||||
auth: {
|
||||
loginRequired: 'Login required',
|
||||
loginDescription: 'Please log in via Telegram to proceed with your order',
|
||||
checking: 'Checking...',
|
||||
loginWithTelegram: 'Log in with Telegram',
|
||||
orScanQr: 'Or scan the QR code',
|
||||
loginNote: 'You will be redirected back after login',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -185,18 +185,4 @@ export const hy: Translations = {
|
||||
retry: 'Փորձել կրկին',
|
||||
loading: 'Բեռնվում է...',
|
||||
},
|
||||
|
||||
location: {
|
||||
allRegions: 'Բոլոր տարածաշրջաններ',
|
||||
chooseRegion: 'Ընտրեք տարածաշրջան',
|
||||
detectAuto: 'Որոշել ինքնաշխատ',
|
||||
},
|
||||
auth: {
|
||||
loginRequired: 'Մուտք պահանջվում է',
|
||||
loginDescription: 'Պատվերի կատարման համար մուտք արեք Telegram-ի միջոցով',
|
||||
checking: 'Ստուգում է...',
|
||||
loginWithTelegram: 'Մուտք գործել Telegram-ով',
|
||||
orScanQr: 'Կամ սկանավորեք QR կոդը',
|
||||
loginNote: 'Մուտքից հետո դուք կվերադառնավեք',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -185,17 +185,4 @@ export const ru: Translations = {
|
||||
retry: 'Попробовать снова',
|
||||
loading: 'Загрузка...',
|
||||
},
|
||||
location: {
|
||||
allRegions: 'Все регионы',
|
||||
chooseRegion: 'Выберите регион',
|
||||
detectAuto: 'Определить автоматически',
|
||||
},
|
||||
auth: {
|
||||
loginRequired: 'Требуется авторизация',
|
||||
loginDescription: 'Для оформления заказа войдите через Telegram',
|
||||
checking: 'Проверка...',
|
||||
loginWithTelegram: 'Войти через Telegram',
|
||||
orScanQr: 'Или отсканируйте QR-код',
|
||||
loginNote: 'После входа вы будете перенаправлены обратно',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -183,17 +183,4 @@ export interface Translations {
|
||||
retry: string;
|
||||
loading: string;
|
||||
};
|
||||
location: {
|
||||
allRegions: string;
|
||||
chooseRegion: string;
|
||||
detectAuto: string;
|
||||
};
|
||||
auth: {
|
||||
loginRequired: string;
|
||||
loginDescription: string;
|
||||
checking: string;
|
||||
loginWithTelegram: string;
|
||||
orScanQr: string;
|
||||
loginNote: string;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
export interface AuthSession {
|
||||
sessionId: string;
|
||||
telegramUserId: number;
|
||||
username: string | null;
|
||||
displayName: string;
|
||||
active: boolean;
|
||||
expiresAt: string;
|
||||
}
|
||||
|
||||
export interface TelegramAuthData {
|
||||
id: number;
|
||||
first_name: string;
|
||||
last_name?: string;
|
||||
username?: string;
|
||||
photo_url?: string;
|
||||
auth_date: number;
|
||||
hash: string;
|
||||
}
|
||||
|
||||
export type AuthStatus = 'unknown' | 'checking' | 'authenticated' | 'expired' | 'unauthenticated';
|
||||
@@ -1,4 +1,2 @@
|
||||
export * from './category.model';
|
||||
export * from './item.model';
|
||||
export * from './location.model';
|
||||
export * from './auth.model';
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
export interface Region {
|
||||
id: string;
|
||||
city: string;
|
||||
country: string;
|
||||
countryCode: string;
|
||||
timezone?: string;
|
||||
}
|
||||
|
||||
export interface GeoIpResponse {
|
||||
city: string;
|
||||
country: string;
|
||||
countryCode: string;
|
||||
region?: string;
|
||||
timezone?: string;
|
||||
lat?: number;
|
||||
lon?: number;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import { Component, computed, ChangeDetectionStrategy, signal, OnDestroy, inject
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { CartService, ApiService, LanguageService, AuthService } from '../../services';
|
||||
import { CartService, ApiService, LanguageService } from '../../services';
|
||||
import { Item, CartItem } from '../../models';
|
||||
import { interval, Subscription } from 'rxjs';
|
||||
import { switchMap, take } from 'rxjs/operators';
|
||||
@@ -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',
|
||||
@@ -28,7 +29,6 @@ export class CartComponent implements OnDestroy {
|
||||
isnovo = environment.theme === 'novo';
|
||||
|
||||
private i18n = inject(TranslateService);
|
||||
private authService = inject(AuthService);
|
||||
|
||||
// Swipe state
|
||||
swipedItemId = signal<number | null>(null);
|
||||
@@ -51,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>;
|
||||
|
||||
@@ -135,11 +135,6 @@ export class CartComponent implements OnDestroy {
|
||||
alert(this.i18n.t('cart.acceptTerms'));
|
||||
return;
|
||||
}
|
||||
// Auth gate: require Telegram login before payment
|
||||
if (!this.authService.isAuthenticated()) {
|
||||
this.authService.requestLogin();
|
||||
return;
|
||||
}
|
||||
this.openPaymentPopup();
|
||||
}
|
||||
|
||||
@@ -173,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: '',
|
||||
@@ -199,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(() => {
|
||||
@@ -231,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);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -257,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>
|
||||
</div>
|
||||
}
|
||||
@if (loading() && items().length > 0) {
|
||||
@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>
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
<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,8 +35,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 @@
|
||||
<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">
|
||||
@@ -189,6 +190,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
} @else {
|
||||
@@ -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>
|
||||
@@ -426,6 +429,7 @@
|
||||
</div>
|
||||
</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,19 +94,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]="('search.addToCart' | translate) + ': ' + item.name">
|
||||
{{ 'search.addToCart' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (loading() && items().length > 0) {
|
||||
<div class="loading-more">
|
||||
<div class="spinner"></div>
|
||||
<p>{{ 'search.loadingMore' | translate }}</p>
|
||||
</div>
|
||||
}
|
||||
@if (loading() && items().length > 0) {
|
||||
@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) {
|
||||
<div class="no-more">
|
||||
|
||||
@@ -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,17 +1,20 @@
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
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';
|
||||
import { LocationService } from './location.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ApiService {
|
||||
private readonly baseUrl = environment.apiUrl;
|
||||
private locationService = inject(LocationService);
|
||||
|
||||
private readonly retryConfig = {
|
||||
count: 2,
|
||||
delay: (error: unknown, retryCount: number) => timer(Math.pow(2, retryCount) * 500)
|
||||
};
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
@@ -29,44 +32,35 @@ export class ApiService {
|
||||
return items.map(item => this.normalizeItem(item));
|
||||
}
|
||||
|
||||
/** Append region query param if a region is selected */
|
||||
private withRegion(params: HttpParams = new HttpParams()): HttpParams {
|
||||
const regionId = this.locationService.regionId();
|
||||
return regionId ? params.set('region', regionId) : params;
|
||||
}
|
||||
|
||||
ping(): Observable<{ message: string }> {
|
||||
return this.http.get<{ message: string }>(`${this.baseUrl}/ping`);
|
||||
}
|
||||
|
||||
getCategories(): Observable<Category[]> {
|
||||
return this.http.get<Category[]>(`${this.baseUrl}/category`, { params: this.withRegion() });
|
||||
return this.http.get<Category[]>(`${this.baseUrl}/category`).pipe(retry(this.retryConfig));
|
||||
}
|
||||
|
||||
getCategoryItems(categoryID: number, count: number = 50, skip: number = 0): Observable<Item[]> {
|
||||
const params = this.withRegion(
|
||||
new HttpParams()
|
||||
.set('count', count.toString())
|
||||
.set('skip', skip.toString())
|
||||
);
|
||||
const params = new HttpParams()
|
||||
.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}`, { params: this.withRegion() })
|
||||
.pipe(map(item => this.normalizeItem(item)));
|
||||
return this.http.get<Item>(`${this.baseUrl}/item/${itemID}`)
|
||||
.pipe(retry(this.retryConfig), map(item => this.normalizeItem(item)));
|
||||
}
|
||||
|
||||
searchItems(search: string, count: number = 50, skip: number = 0): Observable<{ items: Item[], total: number }> {
|
||||
const params = this.withRegion(
|
||||
new HttpParams()
|
||||
.set('search', search)
|
||||
.set('count', count.toString())
|
||||
.set('skip', skip.toString())
|
||||
);
|
||||
const params = new HttpParams()
|
||||
.set('search', search)
|
||||
.set('count', count.toString())
|
||||
.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
|
||||
@@ -169,11 +163,11 @@ export class ApiService {
|
||||
}
|
||||
|
||||
getRandomItems(count: number = 5, categoryID?: number): Observable<Item[]> {
|
||||
let params = this.withRegion(new HttpParams().set('count', count.toString()));
|
||||
let params = new HttpParams().set('count', count.toString());
|
||||
if (categoryID) {
|
||||
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)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
import { Injectable, signal, computed } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable, of, catchError, map, tap } from 'rxjs';
|
||||
import { AuthSession, AuthStatus } from '../models/auth.model';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AuthService {
|
||||
private sessionSignal = signal<AuthSession | null>(null);
|
||||
private statusSignal = signal<AuthStatus>('unknown');
|
||||
private showLoginSignal = signal(false);
|
||||
|
||||
/** Current auth session */
|
||||
readonly session = this.sessionSignal.asReadonly();
|
||||
/** Current auth status */
|
||||
readonly status = this.statusSignal.asReadonly();
|
||||
/** Whether user is fully authenticated */
|
||||
readonly isAuthenticated = computed(() => this.statusSignal() === 'authenticated');
|
||||
/** Whether to show login dialog */
|
||||
readonly showLoginDialog = this.showLoginSignal.asReadonly();
|
||||
/** Display name of authenticated user */
|
||||
readonly displayName = computed(() => this.sessionSignal()?.displayName ?? null);
|
||||
|
||||
private readonly apiUrl = environment.apiUrl;
|
||||
private sessionCheckTimer?: ReturnType<typeof setInterval>;
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
// On init, check existing session via cookie
|
||||
this.checkSession();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check current session status with backend.
|
||||
* The backend reads the session cookie and returns the session info.
|
||||
*/
|
||||
checkSession(): void {
|
||||
this.statusSignal.set('checking');
|
||||
|
||||
this.http.get<AuthSession>(`${this.apiUrl}/auth/session`, {
|
||||
withCredentials: true
|
||||
}).pipe(
|
||||
catchError(() => {
|
||||
this.statusSignal.set('unauthenticated');
|
||||
this.sessionSignal.set(null);
|
||||
return of(null);
|
||||
})
|
||||
).subscribe(session => {
|
||||
if (session && session.active) {
|
||||
this.sessionSignal.set(session);
|
||||
this.statusSignal.set('authenticated');
|
||||
this.scheduleSessionRefresh(session.expiresAt);
|
||||
} else if (session && !session.active) {
|
||||
this.sessionSignal.set(null);
|
||||
this.statusSignal.set('expired');
|
||||
} else {
|
||||
this.statusSignal.set('unauthenticated');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after user completes Telegram login.
|
||||
* The callback URL from Telegram will hit our backend which sets the cookie.
|
||||
* Then we re-check the session.
|
||||
*/
|
||||
onTelegramLoginComplete(): void {
|
||||
this.checkSession();
|
||||
this.hideLogin();
|
||||
}
|
||||
|
||||
/** Generate the Telegram login URL for bot-based auth */
|
||||
getTelegramLoginUrl(): string {
|
||||
const botUsername = (environment as Record<string, unknown>)['telegramBot'] as string || 'dexarmarket_bot';
|
||||
const callbackUrl = encodeURIComponent(`${this.apiUrl}/auth/telegram/callback`);
|
||||
return `https://t.me/${botUsername}?start=auth_${callbackUrl}`;
|
||||
}
|
||||
|
||||
/** Get QR code data URL for Telegram login */
|
||||
getTelegramQrUrl(): string {
|
||||
return this.getTelegramLoginUrl();
|
||||
}
|
||||
|
||||
/** Show login dialog (called when user tries to pay without being logged in) */
|
||||
requestLogin(): void {
|
||||
this.showLoginSignal.set(true);
|
||||
}
|
||||
|
||||
/** Hide login dialog */
|
||||
hideLogin(): void {
|
||||
this.showLoginSignal.set(false);
|
||||
}
|
||||
|
||||
/** Logout — clears session on backend and locally */
|
||||
logout(): void {
|
||||
this.http.post(`${this.apiUrl}/auth/logout`, {}, {
|
||||
withCredentials: true
|
||||
}).pipe(
|
||||
catchError(() => of(null))
|
||||
).subscribe(() => {
|
||||
this.sessionSignal.set(null);
|
||||
this.statusSignal.set('unauthenticated');
|
||||
this.clearSessionRefresh();
|
||||
});
|
||||
}
|
||||
|
||||
/** Schedule a session re-check before it expires */
|
||||
private scheduleSessionRefresh(expiresAt: string): void {
|
||||
this.clearSessionRefresh();
|
||||
|
||||
const expiresMs = new Date(expiresAt).getTime();
|
||||
const nowMs = Date.now();
|
||||
// Re-check 60 seconds before expiry, minimum 30s from now
|
||||
const refreshIn = Math.max(expiresMs - nowMs - 60_000, 30_000);
|
||||
|
||||
this.sessionCheckTimer = setTimeout(() => {
|
||||
this.checkSession();
|
||||
}, refreshIn);
|
||||
}
|
||||
|
||||
private clearSessionRefresh(): void {
|
||||
if (this.sessionCheckTimer) {
|
||||
clearTimeout(this.sessionCheckTimer);
|
||||
this.sessionCheckTimer = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
this.saveToStorage(items);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,5 +3,3 @@ export * from './cart.service';
|
||||
export * from './telegram.service';
|
||||
export * from './language.service';
|
||||
export * from './seo.service';
|
||||
export * from './location.service';
|
||||
export * from './auth.service';
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
import { Injectable, signal, computed } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Region, GeoIpResponse } from '../models/location.model';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
const STORAGE_KEY = 'selected_region';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class LocationService {
|
||||
private regionSignal = signal<Region | null>(null);
|
||||
private regionsSignal = signal<Region[]>([]);
|
||||
private loadingSignal = signal(false);
|
||||
private detectedSignal = signal(false);
|
||||
|
||||
/** Current selected region (null = global / all regions) */
|
||||
readonly region = this.regionSignal.asReadonly();
|
||||
/** All available regions */
|
||||
readonly regions = this.regionsSignal.asReadonly();
|
||||
/** Whether geo-detection is in progress */
|
||||
readonly detecting = this.loadingSignal.asReadonly();
|
||||
/** Whether region was auto-detected */
|
||||
readonly autoDetected = this.detectedSignal.asReadonly();
|
||||
|
||||
/** Computed region id for API calls — empty string means global */
|
||||
readonly regionId = computed(() => this.regionSignal()?.id ?? '');
|
||||
|
||||
private readonly apiUrl = environment.apiUrl;
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
this.loadRegions();
|
||||
this.restoreFromStorage();
|
||||
}
|
||||
|
||||
/** Fetch available regions from backend */
|
||||
loadRegions(): void {
|
||||
this.http.get<Region[]>(`${this.apiUrl}/regions`).subscribe({
|
||||
next: (regions) => {
|
||||
this.regionsSignal.set(regions);
|
||||
// If we have a stored region, validate it still exists
|
||||
const stored = this.regionSignal();
|
||||
if (stored && !regions.find(r => r.id === stored.id)) {
|
||||
this.clearRegion();
|
||||
}
|
||||
},
|
||||
error: () => {
|
||||
// Fallback: hardcoded popular regions
|
||||
this.regionsSignal.set(this.getFallbackRegions());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Set region by user choice */
|
||||
setRegion(region: Region): void {
|
||||
this.regionSignal.set(region);
|
||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(region));
|
||||
}
|
||||
|
||||
/** Clear region (go global) */
|
||||
clearRegion(): void {
|
||||
this.regionSignal.set(null);
|
||||
localStorage.removeItem(STORAGE_KEY);
|
||||
}
|
||||
|
||||
/** Auto-detect user location via IP geolocation */
|
||||
detectLocation(): void {
|
||||
if (this.detectedSignal()) return; // already tried
|
||||
this.loadingSignal.set(true);
|
||||
|
||||
// Using free ip-api.com — no key required, 45 req/min
|
||||
this.http.get<GeoIpResponse>('http://ip-api.com/json/?fields=city,country,countryCode,region,timezone,lat,lon')
|
||||
.subscribe({
|
||||
next: (geo) => {
|
||||
this.detectedSignal.set(true);
|
||||
this.loadingSignal.set(false);
|
||||
|
||||
// Only auto-set if user hasn't manually chosen a region
|
||||
if (!this.regionSignal()) {
|
||||
const matchedRegion = this.findRegionByGeo(geo);
|
||||
if (matchedRegion) {
|
||||
this.setRegion(matchedRegion);
|
||||
}
|
||||
}
|
||||
},
|
||||
error: () => {
|
||||
this.detectedSignal.set(true);
|
||||
this.loadingSignal.set(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Try to match detected geo data to an available region */
|
||||
private findRegionByGeo(geo: GeoIpResponse): Region | null {
|
||||
const regions = this.regionsSignal();
|
||||
if (!regions.length) return null;
|
||||
|
||||
// Exact city match
|
||||
const cityMatch = regions.find(r =>
|
||||
r.city.toLowerCase() === geo.city?.toLowerCase()
|
||||
);
|
||||
if (cityMatch) return cityMatch;
|
||||
|
||||
// Country match — pick the first region for that country
|
||||
const countryMatch = regions.find(r =>
|
||||
r.countryCode.toLowerCase() === geo.countryCode?.toLowerCase()
|
||||
);
|
||||
return countryMatch || null;
|
||||
}
|
||||
|
||||
/** Restore previously selected region from storage */
|
||||
private restoreFromStorage(): void {
|
||||
try {
|
||||
const stored = localStorage.getItem(STORAGE_KEY);
|
||||
if (stored) {
|
||||
const region: Region = JSON.parse(stored);
|
||||
this.regionSignal.set(region);
|
||||
}
|
||||
} catch {
|
||||
localStorage.removeItem(STORAGE_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
/** Fallback regions if backend /regions endpoint is unavailable */
|
||||
private getFallbackRegions(): Region[] {
|
||||
return [
|
||||
{ id: 'moscow', city: 'Москва', country: 'Россия', countryCode: 'RU', timezone: 'Europe/Moscow' },
|
||||
{ id: 'spb', city: 'Санкт-Петербург', country: 'Россия', countryCode: 'RU', timezone: 'Europe/Moscow' },
|
||||
{ id: 'yerevan', city: 'Ереван', country: 'Армения', countryCode: 'AM', timezone: 'Asia/Yerevan' },
|
||||
{ id: 'minsk', city: 'Минск', country: 'Беларусь', countryCode: 'BY', timezone: 'Europe/Minsk' },
|
||||
{ id: 'almaty', city: 'Алматы', country: 'Казахстан', countryCode: 'KZ', timezone: 'Asia/Almaty' },
|
||||
{ id: 'tbilisi', city: 'Тбилиси', country: 'Грузия', countryCode: 'GE', timezone: 'Asia/Tbilisi' },
|
||||
];
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ export const environment = {
|
||||
supportEmail: 'info@novo.market',
|
||||
domain: 'novo.market',
|
||||
telegram: '@novomarket',
|
||||
telegramBot: 'novomarket_bot',
|
||||
phones: {
|
||||
armenia: '+374 98 731231',
|
||||
support: '+374 98 731231'
|
||||
|
||||
@@ -10,7 +10,6 @@ export const environment = {
|
||||
supportEmail: 'info@novo.market',
|
||||
domain: 'novo.market',
|
||||
telegram: '@novomarket',
|
||||
telegramBot: 'novomarket_bot',
|
||||
phones: {
|
||||
armenia: '+374 98 731231',
|
||||
support: '+374 98 731231'
|
||||
|
||||
@@ -10,7 +10,6 @@ export const environment = {
|
||||
supportEmail: 'info@dexarmarket.ru',
|
||||
domain: 'dexarmarket.ru',
|
||||
telegram: '@dexarmarket',
|
||||
telegramBot: 'dexarmarket_bot',
|
||||
phones: {
|
||||
russia: '+7 (926) 459-31-57',
|
||||
armenia: '+374 94 86 18 16'
|
||||
|
||||
@@ -10,7 +10,6 @@ export const environment = {
|
||||
supportEmail: 'info@dexarmarket.ru',
|
||||
domain: 'dexarmarket.ru',
|
||||
telegram: '@dexarmarket',
|
||||
telegramBot: 'dexarmarket_bot',
|
||||
phones: {
|
||||
russia: '+7 (926) 459-31-57',
|
||||
armenia: '+374 94 86 18 16'
|
||||
|
||||
Reference in New Issue
Block a user