Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a738fbc729 | ||
|
|
33cc27797e | ||
|
|
0119ac291f | ||
|
|
c62136481b | ||
|
|
26b8459121 | ||
|
|
dbf6e05f29 | ||
|
|
053d83245f | ||
|
|
5e266c0ebd | ||
|
|
41c5f81027 | ||
|
|
a65d4185f3 | ||
|
|
548ba43dc2 | ||
|
|
2b4967dd8c | ||
|
|
f86777e2cd | ||
|
|
cdcdd22526 | ||
|
|
e676717ffb | ||
|
|
e384bc4872 | ||
|
|
628b993041 | ||
|
|
a18f6da573 | ||
|
|
63107164ed | ||
|
|
0e2bcf0380 | ||
|
|
c17c97bd2b | ||
|
|
173a2bc10f | ||
|
|
bc55d55a92 | ||
|
|
b4e61698ce | ||
|
|
ecfd02c671 | ||
|
|
82318aaf6c | ||
|
|
38d58bcf8d | ||
|
|
3a711fb8f0 | ||
|
|
28d0e3edf6 | ||
|
|
deceebd899 | ||
|
|
7e8cb26ddd | ||
|
|
501e890d99 |
@@ -0,0 +1,8 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
.git
|
||||||
|
.angular
|
||||||
|
coverage
|
||||||
|
out-tsc
|
||||||
|
tmp
|
||||||
|
*.md
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
FROM node:20-alpine AS build
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm i
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM nginx:1.27-alpine
|
||||||
|
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
COPY --from=build /app/dist/gorodar-front/browser /usr/share/nginx/html
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
"version": 1,
|
"version": 1,
|
||||||
"newProjectRoot": "projects",
|
"newProjectRoot": "projects",
|
||||||
"projects": {
|
"projects": {
|
||||||
"maps": {
|
"gorodar-front": {
|
||||||
"projectType": "application",
|
"projectType": "application",
|
||||||
"schematics": {
|
"schematics": {
|
||||||
"@schematics/angular:component": {
|
"@schematics/angular:component": {
|
||||||
@@ -18,20 +18,19 @@
|
|||||||
"builder": "@angular/build:application",
|
"builder": "@angular/build:application",
|
||||||
"options": {
|
"options": {
|
||||||
"browser": "src/main.ts",
|
"browser": "src/main.ts",
|
||||||
"polyfills": [
|
"polyfills": ["zone.js"],
|
||||||
"zone.js"
|
|
||||||
],
|
|
||||||
"tsConfig": "tsconfig.app.json",
|
"tsConfig": "tsconfig.app.json",
|
||||||
"inlineStyleLanguage": "scss",
|
"inlineStyleLanguage": "scss",
|
||||||
|
"stylePreprocessorOptions": {
|
||||||
|
"includePaths": ["src/assets/styles"]
|
||||||
|
},
|
||||||
"assets": [
|
"assets": [
|
||||||
{
|
{
|
||||||
"glob": "**/*",
|
"glob": "**/*",
|
||||||
"input": "public"
|
"input": "public"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"styles": [
|
"styles": ["@angular/material/prebuilt-themes/magenta-violet.css", "src/styles.scss"]
|
||||||
"src/styles.scss"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
@@ -47,7 +46,23 @@
|
|||||||
"maximumError": "8kB"
|
"maximumError": "8kB"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"outputHashing": "all"
|
"outputHashing": "all",
|
||||||
|
"serviceWorker": "ngsw-config.json",
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "src/environments/environment.ts",
|
||||||
|
"with": "src/environments/environment.prod.ts"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"outputHashing": "all",
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "src/environments/environment.ts",
|
||||||
|
"with": "src/environments/environment.test.ts"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"development": {
|
"development": {
|
||||||
"optimization": false,
|
"optimization": false,
|
||||||
@@ -59,12 +74,18 @@
|
|||||||
},
|
},
|
||||||
"serve": {
|
"serve": {
|
||||||
"builder": "@angular/build:dev-server",
|
"builder": "@angular/build:dev-server",
|
||||||
|
"options": {
|
||||||
|
"proxyConfig": "proxy.conf.json"
|
||||||
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
"buildTarget": "maps:build:production"
|
"buildTarget": "gorodar-front:build:production"
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"buildTarget": "gorodar-front:build:test"
|
||||||
},
|
},
|
||||||
"development": {
|
"development": {
|
||||||
"buildTarget": "maps:build:development"
|
"buildTarget": "gorodar-front:build:development"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"defaultConfiguration": "development"
|
"defaultConfiguration": "development"
|
||||||
@@ -75,21 +96,19 @@
|
|||||||
"test": {
|
"test": {
|
||||||
"builder": "@angular/build:karma",
|
"builder": "@angular/build:karma",
|
||||||
"options": {
|
"options": {
|
||||||
"polyfills": [
|
"polyfills": ["zone.js", "zone.js/testing"],
|
||||||
"zone.js",
|
|
||||||
"zone.js/testing"
|
|
||||||
],
|
|
||||||
"tsConfig": "tsconfig.spec.json",
|
"tsConfig": "tsconfig.spec.json",
|
||||||
"inlineStyleLanguage": "scss",
|
"inlineStyleLanguage": "scss",
|
||||||
|
"stylePreprocessorOptions": {
|
||||||
|
"includePaths": ["src/assets/styles"]
|
||||||
|
},
|
||||||
"assets": [
|
"assets": [
|
||||||
{
|
{
|
||||||
"glob": "**/*",
|
"glob": "**/*",
|
||||||
"input": "public"
|
"input": "public"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"styles": [
|
"styles": ["@angular/material/prebuilt-themes/magenta-violet.css", "src/styles.scss"]
|
||||||
"src/styles.scss"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
services:
|
||||||
|
front:
|
||||||
|
image: git.gorodar.ru/gorodar/front:latest
|
||||||
|
ports:
|
||||||
|
- '82:80'
|
||||||
|
restart: unless-stopped
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
|
||||||
|
"index": "/index.html",
|
||||||
|
|
||||||
|
"navigationUrls": [
|
||||||
|
"/**",
|
||||||
|
"!/**/*.*",
|
||||||
|
"!/**/*__*",
|
||||||
|
"!/**/*__*/**",
|
||||||
|
"!/admin",
|
||||||
|
"!/admin/**"
|
||||||
|
],
|
||||||
|
|
||||||
|
"assetGroups": [
|
||||||
|
{
|
||||||
|
"name": "app",
|
||||||
|
"installMode": "prefetch",
|
||||||
|
"resources": {
|
||||||
|
"files": [
|
||||||
|
"/apple-touch-icon.png",
|
||||||
|
"/favicon.ico",
|
||||||
|
"/favicon.svg",
|
||||||
|
"/index.csr.html",
|
||||||
|
"/index.html",
|
||||||
|
"/manifest.webmanifest",
|
||||||
|
"/*.css",
|
||||||
|
"/*.js"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "assets",
|
||||||
|
"installMode": "lazy",
|
||||||
|
"updateMode": "prefetch",
|
||||||
|
"resources": {
|
||||||
|
"files": ["/**/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"dataGroups": [
|
||||||
|
{
|
||||||
|
"name": "fonts",
|
||||||
|
"urls": ["https://fonts.googleapis.com/**", "https://fonts.gstatic.com/**"],
|
||||||
|
"cacheConfig": {
|
||||||
|
"maxSize": 20,
|
||||||
|
"maxAge": "30d",
|
||||||
|
"strategy": "performance"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "maps",
|
"name": "gorodar-front",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
@@ -22,20 +22,35 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@angular/animations": "^20.3.32",
|
||||||
|
"@angular/cdk": "^20.2.14",
|
||||||
"@angular/common": "^20.3.0",
|
"@angular/common": "^20.3.0",
|
||||||
"@angular/compiler": "^20.3.0",
|
"@angular/compiler": "^20.3.0",
|
||||||
"@angular/core": "^20.3.0",
|
"@angular/core": "^20.3.0",
|
||||||
"@angular/forms": "^20.3.0",
|
"@angular/forms": "^20.3.0",
|
||||||
|
"@angular/material": "^20.2.14",
|
||||||
"@angular/platform-browser": "^20.3.0",
|
"@angular/platform-browser": "^20.3.0",
|
||||||
"@angular/router": "^20.3.0",
|
"@angular/router": "^20.3.0",
|
||||||
|
"@angular/service-worker": "^20.3.0",
|
||||||
|
"@capacitor/camera": "^8.2.4",
|
||||||
|
"@capacitor/core": "^8.5.2",
|
||||||
|
"@capacitor/geolocation": "^8.2.2",
|
||||||
|
"@google/model-viewer": "^4.3.1",
|
||||||
|
"@ionic/pwa-elements": "^3.4.0",
|
||||||
|
"@ngneat/until-destroy": "^10.0.0",
|
||||||
|
"@ngrx/effects": "^20.1.0",
|
||||||
|
"@ngrx/store": "^20.1.0",
|
||||||
|
"@ngrx/store-devtools": "^20.1.0",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.0",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
|
"wavesurfer.js": "^8.0.1",
|
||||||
"zone.js": "~0.15.0"
|
"zone.js": "~0.15.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular/build": "^20.3.37",
|
"@angular/build": "^20.3.37",
|
||||||
"@angular/cli": "^20.3.37",
|
"@angular/cli": "^20.3.37",
|
||||||
"@angular/compiler-cli": "^20.3.0",
|
"@angular/compiler-cli": "^20.3.0",
|
||||||
|
"@capacitor/cli": "^6.2.2",
|
||||||
"@types/jasmine": "~5.1.0",
|
"@types/jasmine": "~5.1.0",
|
||||||
"jasmine-core": "~5.9.0",
|
"jasmine-core": "~5.9.0",
|
||||||
"karma": "~6.4.0",
|
"karma": "~6.4.0",
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"/oauth2": {
|
||||||
|
"target": "https://gorodar.ru",
|
||||||
|
"secure": true,
|
||||||
|
"changeOrigin": true
|
||||||
|
},
|
||||||
|
"/api": {
|
||||||
|
"target": "https://gorodar.ru",
|
||||||
|
"secure": true,
|
||||||
|
"changeOrigin": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 28 28" fill="none">
|
||||||
|
<path d="M4 8 H8 L9.5 5.5 H14.5 L16 8 H20 V19 H4 Z" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M8.6 13.2 a3.4 3.4 0 1 0 6.8 0 a3.4 3.4 0 1 0 -6.8 0" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 361 B |
@@ -0,0 +1,15 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="none">
|
||||||
|
<rect x="7" y="7" width="86" height="86" fill="rgba(255,255,255,0.02)" stroke="#4B453B" stroke-width="1.6" stroke-dasharray="3 3"/>
|
||||||
|
<g transform="translate(34.4 34.4) scale(1.3)" stroke="#8A8172" stroke-width="1.6" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M6 11 H18 V20 H6 Z"/>
|
||||||
|
<path d="M8.5 11 V8 A3.5 3.5 0 0 1 15.5 8 V11"/>
|
||||||
|
</g>
|
||||||
|
<rect x="3.5" y="3.5" width="7" height="7" fill="#14120F" stroke="#4B453B" stroke-width="1"/>
|
||||||
|
<rect x="89.5" y="3.5" width="7" height="7" fill="#14120F" stroke="#4B453B" stroke-width="1"/>
|
||||||
|
<rect x="3.5" y="89.5" width="7" height="7" fill="#14120F" stroke="#4B453B" stroke-width="1"/>
|
||||||
|
<rect x="89.5" y="89.5" width="7" height="7" fill="#14120F" stroke="#4B453B" stroke-width="1"/>
|
||||||
|
<path d="M50 3.5 L53.5 7 L50 10.5 L46.5 7 Z" fill="#14120F" stroke="#4B453B" stroke-width="1"/>
|
||||||
|
<path d="M50 89.5 L53.5 93 L50 96.5 L46.5 93 Z" fill="#14120F" stroke="#4B453B" stroke-width="1"/>
|
||||||
|
<path d="M3.5 50 L7 46.5 L10.5 50 L7 53.5 Z" fill="#14120F" stroke="#4B453B" stroke-width="1"/>
|
||||||
|
<path d="M89.5 50 L93 46.5 L96.5 50 L93 53.5 Z" fill="#14120F" stroke="#4B453B" stroke-width="1"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,16 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="none">
|
||||||
|
<rect x="7" y="7" width="86" height="86" fill="rgba(255,255,255,0.02)" stroke="#4B453B" stroke-width="1.6" stroke-dasharray="3 3"/>
|
||||||
|
<rect x="11.5" y="11.5" width="77" height="77" stroke="#4B453B" stroke-width="0.6" opacity="0.6"/>
|
||||||
|
<g transform="translate(34.4 34.4) scale(1.3)" stroke="#8A8172" stroke-width="1.6" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M6 11 H18 V20 H6 Z"/>
|
||||||
|
<path d="M8.5 11 V8 A3.5 3.5 0 0 1 15.5 8 V11"/>
|
||||||
|
</g>
|
||||||
|
<rect x="3.5" y="3.5" width="7" height="7" fill="#14120F" stroke="#4B453B" stroke-width="1"/>
|
||||||
|
<rect x="89.5" y="3.5" width="7" height="7" fill="#14120F" stroke="#4B453B" stroke-width="1"/>
|
||||||
|
<rect x="3.5" y="89.5" width="7" height="7" fill="#14120F" stroke="#4B453B" stroke-width="1"/>
|
||||||
|
<rect x="89.5" y="89.5" width="7" height="7" fill="#14120F" stroke="#4B453B" stroke-width="1"/>
|
||||||
|
<path d="M50 3.5 L53.5 7 L50 10.5 L46.5 7 Z" fill="#14120F" stroke="#4B453B" stroke-width="1"/>
|
||||||
|
<path d="M50 89.5 L53.5 93 L50 96.5 L46.5 93 Z" fill="#14120F" stroke="#4B453B" stroke-width="1"/>
|
||||||
|
<path d="M3.5 50 L7 46.5 L10.5 50 L7 53.5 Z" fill="#14120F" stroke="#4B453B" stroke-width="1"/>
|
||||||
|
<path d="M89.5 50 L93 46.5 L96.5 50 L93 53.5 Z" fill="#14120F" stroke="#4B453B" stroke-width="1"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none">
|
||||||
|
<circle cx="20" cy="20" r="17.5" fill="#E0B84F" stroke="#12110F" stroke-width="3"/>
|
||||||
|
<path d="M12 20.4 L17.6 26 L28.4 13.6" stroke="#1A1508" stroke-width="3.2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 315 B |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 28 28" fill="none">
|
||||||
|
<path d="M5 12.5 L10 17.5 L19 7.5" stroke="#fff" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 201 B |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 28 28" fill="none">
|
||||||
|
<path d="M5 9 L12 16 L19 9" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 192 B |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 28 28" fill="none">
|
||||||
|
<path d="M15 5 L8 12 L15 19" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 195 B |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 28 28" fill="none">
|
||||||
|
<path d="M9 5 L16 12 L9 19" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 192 B |
@@ -0,0 +1,6 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 28 28" fill="none">
|
||||||
|
<path d="M4 4 H10 V10 H4 Z" stroke="#fff" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M14 4 H20 V10 H14 Z" stroke="#fff" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M4 14 H10 V20 H4 Z" stroke="#fff" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M14 14 H20 V20 H14 Z" stroke="#fff" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 536 B |
@@ -0,0 +1,6 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 28 28" fill="none">
|
||||||
|
<path d="M10 4 V9 H4" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M14 4 V9 H20" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M20 15 H14 V20" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M4 15 H10 V20" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 512 B |
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 28 28" fill="none">
|
||||||
|
<path d="M7 9 a5 5 0 1 0 10 0 a5 5 0 1 0 -10 0" stroke="#fff" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M9 13.5 L7 21 L12 18.5 L17 21 L15 13.5" stroke="#fff" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 347 B |
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 112 112" fill="none">
|
||||||
|
<circle cx="56" cy="56" r="52" fill="#F0876A"/>
|
||||||
|
<path d="M40 40 L72 72 M72 40 L40 72" stroke="#1A1508" stroke-width="7" stroke-linecap="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 231 B |
@@ -0,0 +1,6 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 28 28" fill="none">
|
||||||
|
<path d="M7 4.5 H14 L18.5 9 V19.5 a1.5 1.5 0 0 1 -1.5 1.5 H7 a1.5 1.5 0 0 1 -1.5 -1.5 V6 a1.5 1.5 0 0 1 1.5 -1.5 Z" stroke="#fff" stroke-width="1.8" stroke-linejoin="round"/>
|
||||||
|
<path d="M14 4.5 V9 H18.5" stroke="#fff" stroke-width="1.8" stroke-linejoin="round"/>
|
||||||
|
<path d="M8.5 13 H15.5" stroke="#fff" stroke-width="1.8" stroke-linecap="round"/>
|
||||||
|
<path d="M8.5 16.5 H13" stroke="#fff" stroke-width="1.8" stroke-linecap="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 515 B |
@@ -0,0 +1,6 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 28 28" fill="none">
|
||||||
|
<path d="M9 4 H4 V9" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M15 4 H20 V9" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M20 15 V20 H15" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M4 15 V20 H9" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 510 B |
@@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
|
||||||
|
<path d="M3 12 a9 9 0 1 0 18 0 a9 9 0 1 0 -18 0" stroke="#fff" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M3 12 H21" stroke="#fff" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M12 3 C8 8 8 16 12 21 C16 16 16 8 12 3" stroke="#fff" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 450 B |
@@ -0,0 +1,24 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="none">
|
||||||
|
<rect x="7" y="7" width="86" height="86" fill="rgba(224,184,79,0.07)" stroke="#E0B84F" stroke-width="2.2"/>
|
||||||
|
<rect x="11.5" y="11.5" width="77" height="77" stroke="#E0B84F" stroke-width="0.6" opacity="0.6"/>
|
||||||
|
<g transform="translate(18 18)" stroke="#F2D98E" stroke-width="1.7" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M8 56 H56"/>
|
||||||
|
<path d="M26 56 V34 M38 56 V34"/>
|
||||||
|
<path d="M25 34 L32 12 L39 34 Z"/>
|
||||||
|
<path d="M32 12 V5 M30 8 H34"/>
|
||||||
|
<path d="M10 56 V42 M18 56 V42"/>
|
||||||
|
<path d="M10 42 C8 34 14 32 14 26 C14 32 20 34 18 42 Z"/>
|
||||||
|
<path d="M14 26 V22"/>
|
||||||
|
<path d="M46 56 V42 M54 56 V42"/>
|
||||||
|
<path d="M46 42 C44 34 50 32 50 26 C50 32 56 34 54 42 Z"/>
|
||||||
|
<path d="M50 26 V22"/>
|
||||||
|
</g>
|
||||||
|
<rect x="3.5" y="3.5" width="7" height="7" fill="#14120F" stroke="#E0B84F" stroke-width="1"/>
|
||||||
|
<rect x="89.5" y="3.5" width="7" height="7" fill="#14120F" stroke="#E0B84F" stroke-width="1"/>
|
||||||
|
<rect x="3.5" y="89.5" width="7" height="7" fill="#14120F" stroke="#E0B84F" stroke-width="1"/>
|
||||||
|
<rect x="89.5" y="89.5" width="7" height="7" fill="#14120F" stroke="#E0B84F" stroke-width="1"/>
|
||||||
|
<path d="M50 3.5 L53.5 7 L50 10.5 L46.5 7 Z" fill="#14120F" stroke="#E0B84F" stroke-width="1"/>
|
||||||
|
<path d="M50 89.5 L53.5 93 L50 96.5 L46.5 93 Z" fill="#14120F" stroke="#E0B84F" stroke-width="1"/>
|
||||||
|
<path d="M3.5 50 L7 46.5 L10.5 50 L7 53.5 Z" fill="#14120F" stroke="#E0B84F" stroke-width="1"/>
|
||||||
|
<path d="M89.5 50 L93 46.5 L96.5 50 L93 53.5 Z" fill="#14120F" stroke="#E0B84F" stroke-width="1"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1,7 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none">
|
||||||
|
<circle cx="20" cy="20" r="18" fill="#1C1A17" stroke="#E0B84F" stroke-width="2"/>
|
||||||
|
<g transform="translate(8 8)" stroke="#F2D98E" stroke-width="1.8" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M6 11 H18 V20 H6 Z"/>
|
||||||
|
<path d="M8.5 11 V8 A3.5 3.5 0 0 1 15.5 8 V11"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 410 B |
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 28 28" fill="none">
|
||||||
|
<path d="M6 11 H18 V20 H6 Z" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M8.5 11 V8 A3.5 3.5 0 0 1 15.5 8 V11" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 326 B |
@@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 28 28" fill="none">
|
||||||
|
<path d="M10 5 H6.5 a1.5 1.5 0 0 0 -1.5 1.5 V17.5 a1.5 1.5 0 0 0 1.5 1.5 H10" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M13 12 H21" stroke="#fff" stroke-width="1.8" stroke-linecap="round"/>
|
||||||
|
<path d="M17.5 8.5 L21 12 L17.5 15.5" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 447 B |
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 28 28" fill="none">
|
||||||
|
<path d="M4 7 H20 a1 1 0 0 1 1 1 V17 a1 1 0 0 1 -1 1 H4 a1 1 0 0 1 -1 -1 V8 a1 1 0 0 1 1 -1 Z" stroke="#fff" stroke-width="1.8" stroke-linejoin="round"/>
|
||||||
|
<path d="M3 8 L12 13.5 L21 8" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 352 B |
@@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="58" viewBox="0 0 48 58" fill="none">
|
||||||
|
<path d="M24 0C10.75 0 0 10.75 0 24c0 18 24 34 24 34s24-16 24-34C48 10.75 37.25 0 24 0z" fill="#E0B84F"/>
|
||||||
|
<circle cx="24" cy="24" r="11" fill="#1A1508"/>
|
||||||
|
<circle cx="24" cy="24" r="5" fill="#F2D98E"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 310 B |
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 28 28" fill="none">
|
||||||
|
<path d="M3 6 L9 4 L15 6 L21 4 V18 L15 20 L9 18 L3 20 Z" stroke="#fff" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M9 4 V18 M15 6 V20" stroke="#fff" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 336 B |
@@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 28 28" fill="none">
|
||||||
|
<path d="M6 12 a6 6 0 1 0 12 0 a6 6 0 1 0 -12 0" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M10.5 12 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M12 2 V5 M12 19 V22 M2 12 H5 M19 12 H22" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 491 B |
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 28 28" fill="none">
|
||||||
|
<path d="M12 21 C12 21 5 14.5 5 9.5 A7 7 0 0 1 19 9.5 C19 14.5 12 21 12 21 Z" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M9.6 9.5 a2.4 2.4 0 1 0 4.8 0 a2.4 2.4 0 1 0 -4.8 0" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 390 B |
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 28 28" fill="none">
|
||||||
|
<path d="M8 8 a4 4 0 1 0 8 0 a4 4 0 1 0 -8 0" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M4 20 C4 15 8 13.5 12 13.5 C16 13.5 20 15 20 20" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 354 B |
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
|
||||||
|
<path d="M5 11 a6 6 0 1 0 12 0 a6 6 0 1 0 -12 0" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M16 16 L21 21" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 317 B |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 7.4 KiB |
@@ -0,0 +1,133 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
viewBox="0 0 1920 1920"
|
||||||
|
version="1.1"
|
||||||
|
id="svg10"
|
||||||
|
sodipodi:docname="logo_color_transparent — копия.svg"
|
||||||
|
inkscape:version="1.3.2 (091e20e, 2023-11-25)"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview10"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#000000"
|
||||||
|
borderopacity="0.25"
|
||||||
|
inkscape:showpageshadow="2"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:zoom="0.12291667"
|
||||||
|
inkscape:cx="951.86441"
|
||||||
|
inkscape:cy="825.76271"
|
||||||
|
inkscape:window-width="1616"
|
||||||
|
inkscape:window-height="932"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="33"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="g9" />
|
||||||
|
<defs
|
||||||
|
id="defs1">
|
||||||
|
<clipPath
|
||||||
|
id="logo">
|
||||||
|
<rect
|
||||||
|
x="0"
|
||||||
|
y="0"
|
||||||
|
width="1920"
|
||||||
|
height="1920"
|
||||||
|
id="rect1" />
|
||||||
|
</clipPath>
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#color-1"
|
||||||
|
id="linearGradient10"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
x1="200"
|
||||||
|
y1="296.11"
|
||||||
|
x2="200"
|
||||||
|
y2="30"
|
||||||
|
gradientTransform="translate(0.00312153,36.940864)" />
|
||||||
|
</defs>
|
||||||
|
<g
|
||||||
|
clip-path="url(#logo)"
|
||||||
|
id="g10">
|
||||||
|
<rect
|
||||||
|
fill="none"
|
||||||
|
width="1920"
|
||||||
|
height="1920"
|
||||||
|
id="rect2" />
|
||||||
|
<g
|
||||||
|
transform="scale(4.8)"
|
||||||
|
id="g9">
|
||||||
|
<defs
|
||||||
|
id="defs3">
|
||||||
|
<linearGradient
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
id="color-1"
|
||||||
|
x1="200"
|
||||||
|
x2="200"
|
||||||
|
y1="296.11"
|
||||||
|
y2="30">
|
||||||
|
<stop
|
||||||
|
offset="0"
|
||||||
|
stop-color="#852614"
|
||||||
|
id="stop2" />
|
||||||
|
<stop
|
||||||
|
offset="1"
|
||||||
|
stop-color="#c3b218"
|
||||||
|
id="stop3" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<g
|
||||||
|
fill="none"
|
||||||
|
font-family="none"
|
||||||
|
font-size="none"
|
||||||
|
font-weight="none"
|
||||||
|
stroke-miterlimit="10"
|
||||||
|
style="mix-blend-mode:normal"
|
||||||
|
text-anchor="none"
|
||||||
|
id="g8">
|
||||||
|
<rect
|
||||||
|
fill="none"
|
||||||
|
height="400"
|
||||||
|
width="400"
|
||||||
|
id="rect3" />
|
||||||
|
<rect
|
||||||
|
fill="none"
|
||||||
|
height="400"
|
||||||
|
width="400"
|
||||||
|
id="rect4" />
|
||||||
|
<rect
|
||||||
|
fill="none"
|
||||||
|
height="400"
|
||||||
|
width="400"
|
||||||
|
id="rect5" />
|
||||||
|
<rect
|
||||||
|
fill="none"
|
||||||
|
height="400"
|
||||||
|
width="400"
|
||||||
|
id="rect6" />
|
||||||
|
<rect
|
||||||
|
fill="none"
|
||||||
|
height="400"
|
||||||
|
width="400"
|
||||||
|
id="rect7" />
|
||||||
|
<rect
|
||||||
|
fill="none"
|
||||||
|
height="400"
|
||||||
|
width="400"
|
||||||
|
id="rect8" />
|
||||||
|
<g
|
||||||
|
fill="url(#color-1)"
|
||||||
|
id="symbol">
|
||||||
|
<path
|
||||||
|
d="m 126.18312,95.762864 c 3.034,-2.9021 6.134,-5.7383 9.278,-8.4865 8.0908,11.323 15.104,23.349006 22.689,35.001006 13.565,21.128 28.384,41.531 39.816,63.935 0.79147,3.1 4.1553,-0.17589 4.7489,-1.7149 9.7617,-16.511 20.513,-32.407 30.802,-48.589 10.509,-15.764 19.128,-32.759 30.45,-47.995006 3.4737,2.7043 6.9035,5.5184 10.333,8.3326 -24.052,31.879006 -45.752,65.518006 -65.43,100.260006 21.238,0.022 42.477,0.24186 63.737,0.21985 13.609,-0.50567 26.603,5.4305 37.178,13.609 12.686,10.026 16.335,30.362 6.3759,43.466 -8.0248,10.993 -23.481,15.456 -36.145,10.399 -13.961,-4.1993 -24.052,-19.633 -20.381,-34.1 1.8688,-10.135 10.751,-16.291 17.633,-23.063 -22.865,-0.17589 -45.73,-0.24186 -68.596,-0.7695 19.194,32.561 40.52,63.825 63.715,93.66 -2.9021,2.3085 -5.7823,4.639 -8.6404,6.9915 -24.954,-28.977 -42.806,-63.055 -63.737,-94.825 -7.9369,12.114 -14.379,25.152 -22.601,37.112 -13.345,19.809 -25.108,40.938 -41.465,58.504 -2.9461,-2.8801 -5.7383,-5.8482 -8.3766,-8.9702 12.026,-13.279 22.14,-28.142 32.231,-42.916 10.289,-15.984 21.15,-31.616 30.099,-48.391 -21.7,-0.79147 -43.466,-0.96737 -65.144,0.19785 5.7383,7.6511 14.181,14.577 15.104,24.756 0.85744,14.533 -8.8603,29.901 -23.503,33.243 -11.828,2.2865 -25.722998,-1.2752 -33.000998,-11.411 -9.6958,-13.983 -5.7603,-35.111 7.9369,-45.027 11.190998,-7.783 24.469998,-13.477 38.364998,-12.994 20.557,0.15389 41.135,0.13192 61.714,0.6156 -5.6723,-12.136 -12.488,-23.701 -20.073,-34.716 -15.038,-22.118 -29.461,-44.653 -45.115,-66.331006 z m -19.765,119.870006 c -13.564998,2.6383 -22.886998,21.612 -12.399998,32.429 8.596398,10.663 28.822998,8.1567 32.472998,-5.7383 5.1667,-12.488 -6.0241,-29.725 -20.073,-26.691 z m 178.2,0.21986 c -11.894,4.5071 -19.04,21.37 -9.8496,31.66 7.739,10.179 24.734,9.5418 31.791,-1.0773 9.8277,-13.741 -5.6284,-35.969 -21.942,-30.582 z m -187.079998,-86.096 c 18.841998,-7.9588 41.574998,7.805 42.542998,27.724 1.627,17.721 -14.467,34.979 -32.385,33.748 -16.862998,-0.9234 -30.537998,-17.149 -29.570998,-33.814 -0.37376,-12.158 8.1128,-23.613 19.413,-27.658 z m 6.661698,11.103 c -15.785998,2.3305 -19.368998,24.8 -7.145398,33.66 9.849598,8.3766 25.832998,2.4624 29.614998,-9.3879 6.112,-13.301 -9.0142,-28.362 -22.47,-24.272 z m 89.922,-72.861006 c 18.6,-5.4965 37.552,11.389 37.596,29.989 2.0667,19.172006 -17.083,37.310006 -36.101,33.616006 -15.676,-2.3305 -29.527,-17.237 -28.12,-33.506006 0.52766,-14.599 12.554,-27.24 26.625,-30.099 z m -1.9348,15.522 c -6.134,3.122 -12.048,9.1461 -11.477,16.555006 0.63758,9.8057 8.9482,19.721 19.304,19.523 14.225,0.28582 23.591,-18.908 15.126,-30.143006 -4.7929,-7.4312 -15.17,-10.399 -22.953,-5.9362 z m 87.789,46.104006 c 20.403,-8.6404 44.433,10.663 41.839,32.231 -0.17589,18.842 -20.381,32.671 -38.145,28.713 -16.489,-4.0894 -27.944,-22.491 -23.745,-39.069 2.2425,-10.179 10.311,-18.468 20.051,-21.876 z m 6.5078,10.839 c -5.7603,1.3851 -11.081,5.0567 -13.917,10.311 -4.4411,8.8163 -0.37376,20.161 8.1567,24.866 8.9262,5.8922 22.162,2.1986 26.713,-7.4972 6.9915,-13.126 -5.6943,-32.385 -20.952,-27.68 z m -94.451,130.2 c 15.874,-4.2213 33.484,5.8922 38.079,21.59 7.1674,20.469 -13.148,43.136 -34.056,40.608 -16.16,-2.5723 -29.923,-17.918 -28.538,-34.65 -0.32978,-13.829 11.828,-24.646 24.514,-27.548 z m 2.1106,12.642 c -12.84,3.078 -17.852,20.007 -9.0142,29.725 7.9809,11.367 26.603,6.9915 31.396,-5.1447 6.5957,-13.17 -8.4206,-30.318 -22.382,-24.58 z"
|
||||||
|
id="path8"
|
||||||
|
style="fill:url(#linearGradient10)" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 6.5 KiB |
@@ -0,0 +1,87 @@
|
|||||||
|
{
|
||||||
|
"name": "Городар",
|
||||||
|
"short_name": "Городар",
|
||||||
|
"description": "Открывайте города с Городаром: находите достопримечательности на карте, посещайте их и фотографируйте, чтобы пополнять личную коллекцию.",
|
||||||
|
"lang": "ru",
|
||||||
|
"dir": "ltr",
|
||||||
|
"display": "standalone",
|
||||||
|
"orientation": "portrait",
|
||||||
|
"scope": "./",
|
||||||
|
"start_url": "./",
|
||||||
|
"background_color": "#12110F",
|
||||||
|
"theme_color": "#12110F",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "assets/logo/32.png",
|
||||||
|
"sizes": "32x32",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "assets/logo/64.png",
|
||||||
|
"sizes": "64x64",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "assets/logo/72.png",
|
||||||
|
"sizes": "72x72",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "assets/logo/96.png",
|
||||||
|
"sizes": "96x96",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "assets/logo/128.png",
|
||||||
|
"sizes": "128x128",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "assets/logo/144.png",
|
||||||
|
"sizes": "144x144",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "assets/logo/152.png",
|
||||||
|
"sizes": "152x152",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "assets/logo/196.png",
|
||||||
|
"sizes": "196x196",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "assets/logo/384.png",
|
||||||
|
"sizes": "384x384",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "assets/logo/512.png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "assets/logo/196.png",
|
||||||
|
"sizes": "196x196",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "maskable"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "assets/logo/512.png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "maskable"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,12 +1,31 @@
|
|||||||
import { ApplicationConfig, provideBrowserGlobalErrorListeners, provideZoneChangeDetection } from '@angular/core';
|
import { ApplicationConfig, isDevMode, provideBrowserGlobalErrorListeners, provideZoneChangeDetection } from '@angular/core';
|
||||||
import { provideRouter } from '@angular/router';
|
import { provideHttpClient, withInterceptors } from '@angular/common/http';
|
||||||
|
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
||||||
|
import { provideRouter, withComponentInputBinding } from '@angular/router';
|
||||||
|
import { provideServiceWorker } from '@angular/service-worker';
|
||||||
|
import { provideEffects } from '@ngrx/effects';
|
||||||
|
import { provideState, provideStore } from '@ngrx/store';
|
||||||
|
import { provideStoreDevtools } from '@ngrx/store-devtools';
|
||||||
|
|
||||||
|
import { authInterceptor } from './auth/auth.interceptor';
|
||||||
import { routes } from './app.routes';
|
import { routes } from './app.routes';
|
||||||
|
import { AreasEffects, AuthEffects, GorodarEffects, gorodarFeature } from './state';
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [
|
providers: [
|
||||||
provideBrowserGlobalErrorListeners(),
|
provideBrowserGlobalErrorListeners(),
|
||||||
provideZoneChangeDetection({ eventCoalescing: true }),
|
provideZoneChangeDetection({ eventCoalescing: true }),
|
||||||
provideRouter(routes)
|
provideHttpClient(withInterceptors([authInterceptor])),
|
||||||
]
|
provideRouter(routes, withComponentInputBinding()),
|
||||||
|
provideAnimationsAsync(),
|
||||||
|
provideStore(),
|
||||||
|
provideState(gorodarFeature),
|
||||||
|
provideEffects(GorodarEffects, AuthEffects, AreasEffects),
|
||||||
|
provideStoreDevtools({ maxAge: 25, logOnly: !isDevMode() }),
|
||||||
|
provideServiceWorker('ngsw-worker.js', {
|
||||||
|
enabled: !isDevMode(),
|
||||||
|
registrationStrategy: 'registerWhenStable:30000',
|
||||||
|
}),
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,342 +1,11 @@
|
|||||||
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
<div class="app">
|
||||||
<!-- * * * * * * * * * * * The content below * * * * * * * * * * * -->
|
<main class="app__main">
|
||||||
<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * -->
|
<router-outlet />
|
||||||
<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * -->
|
</main>
|
||||||
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
|
||||||
<!-- * * * * * * * * * Delete the template below * * * * * * * * * -->
|
|
||||||
<!-- * * * * * * * to get started with your project! * * * * * * * -->
|
|
||||||
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
|
||||||
|
|
||||||
<style>
|
@if (!hideNav()) {
|
||||||
:host {
|
<app-bottom-nav />
|
||||||
--bright-blue: oklch(51.01% 0.274 263.83);
|
|
||||||
--electric-violet: oklch(53.18% 0.28 296.97);
|
|
||||||
--french-violet: oklch(47.66% 0.246 305.88);
|
|
||||||
--vivid-pink: oklch(69.02% 0.277 332.77);
|
|
||||||
--hot-red: oklch(61.42% 0.238 15.34);
|
|
||||||
--orange-red: oklch(63.32% 0.24 31.68);
|
|
||||||
|
|
||||||
--gray-900: oklch(19.37% 0.006 300.98);
|
|
||||||
--gray-700: oklch(36.98% 0.014 302.71);
|
|
||||||
--gray-400: oklch(70.9% 0.015 304.04);
|
|
||||||
|
|
||||||
--red-to-pink-to-purple-vertical-gradient: linear-gradient(
|
|
||||||
180deg,
|
|
||||||
var(--orange-red) 0%,
|
|
||||||
var(--vivid-pink) 50%,
|
|
||||||
var(--electric-violet) 100%
|
|
||||||
);
|
|
||||||
|
|
||||||
--red-to-pink-to-purple-horizontal-gradient: linear-gradient(
|
|
||||||
90deg,
|
|
||||||
var(--orange-red) 0%,
|
|
||||||
var(--vivid-pink) 50%,
|
|
||||||
var(--electric-violet) 100%
|
|
||||||
);
|
|
||||||
|
|
||||||
--pill-accent: var(--bright-blue);
|
|
||||||
|
|
||||||
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
|
||||||
Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
|
|
||||||
"Segoe UI Symbol";
|
|
||||||
box-sizing: border-box;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
<app-auth-sheet />
|
||||||
font-size: 3.125rem;
|
</div>
|
||||||
color: var(--gray-900);
|
|
||||||
font-weight: 500;
|
|
||||||
line-height: 100%;
|
|
||||||
letter-spacing: -0.125rem;
|
|
||||||
margin: 0;
|
|
||||||
font-family: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
|
||||||
Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
|
|
||||||
"Segoe UI Symbol";
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin: 0;
|
|
||||||
color: var(--gray-700);
|
|
||||||
}
|
|
||||||
|
|
||||||
main {
|
|
||||||
width: 100%;
|
|
||||||
min-height: 100%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
padding: 1rem;
|
|
||||||
box-sizing: inherit;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.angular-logo {
|
|
||||||
max-width: 9.2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-around;
|
|
||||||
width: 100%;
|
|
||||||
max-width: 700px;
|
|
||||||
margin-bottom: 3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content h1 {
|
|
||||||
margin-top: 1.75rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content p {
|
|
||||||
margin-top: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.divider {
|
|
||||||
width: 1px;
|
|
||||||
background: var(--red-to-pink-to-purple-vertical-gradient);
|
|
||||||
margin-inline: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pill-group {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: start;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 1.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pill {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
--pill-accent: var(--bright-blue);
|
|
||||||
background: color-mix(in srgb, var(--pill-accent) 5%, transparent);
|
|
||||||
color: var(--pill-accent);
|
|
||||||
padding-inline: 0.75rem;
|
|
||||||
padding-block: 0.375rem;
|
|
||||||
border-radius: 2.75rem;
|
|
||||||
border: 0;
|
|
||||||
transition: background 0.3s ease;
|
|
||||||
font-family: var(--inter-font);
|
|
||||||
font-size: 0.875rem;
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 500;
|
|
||||||
line-height: 1.4rem;
|
|
||||||
letter-spacing: -0.00875rem;
|
|
||||||
text-decoration: none;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pill:hover {
|
|
||||||
background: color-mix(in srgb, var(--pill-accent) 15%, transparent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.pill-group .pill:nth-child(6n + 1) {
|
|
||||||
--pill-accent: var(--bright-blue);
|
|
||||||
}
|
|
||||||
.pill-group .pill:nth-child(6n + 2) {
|
|
||||||
--pill-accent: var(--electric-violet);
|
|
||||||
}
|
|
||||||
.pill-group .pill:nth-child(6n + 3) {
|
|
||||||
--pill-accent: var(--french-violet);
|
|
||||||
}
|
|
||||||
|
|
||||||
.pill-group .pill:nth-child(6n + 4),
|
|
||||||
.pill-group .pill:nth-child(6n + 5),
|
|
||||||
.pill-group .pill:nth-child(6n + 6) {
|
|
||||||
--pill-accent: var(--hot-red);
|
|
||||||
}
|
|
||||||
|
|
||||||
.pill-group svg {
|
|
||||||
margin-inline-start: 0.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.social-links {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.73rem;
|
|
||||||
margin-top: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.social-links path {
|
|
||||||
transition: fill 0.3s ease;
|
|
||||||
fill: var(--gray-400);
|
|
||||||
}
|
|
||||||
|
|
||||||
.social-links a:hover svg path {
|
|
||||||
fill: var(--gray-900);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 650px) {
|
|
||||||
.content {
|
|
||||||
flex-direction: column;
|
|
||||||
width: max-content;
|
|
||||||
}
|
|
||||||
|
|
||||||
.divider {
|
|
||||||
height: 1px;
|
|
||||||
width: 100%;
|
|
||||||
background: var(--red-to-pink-to-purple-horizontal-gradient);
|
|
||||||
margin-block: 1.5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<main class="main">
|
|
||||||
<div class="content">
|
|
||||||
<div class="left-side">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 982 239"
|
|
||||||
fill="none"
|
|
||||||
class="angular-logo"
|
|
||||||
>
|
|
||||||
<g clip-path="url(#a)">
|
|
||||||
<path
|
|
||||||
fill="url(#b)"
|
|
||||||
d="M388.676 191.625h30.849L363.31 31.828h-35.758l-56.215 159.797h30.848l13.174-39.356h60.061l13.256 39.356Zm-65.461-62.675 21.602-64.311h1.227l21.602 64.311h-44.431Zm126.831-7.527v70.202h-28.23V71.839h27.002v20.374h1.392c2.782-6.71 7.2-12.028 13.255-15.956 6.056-3.927 13.584-5.89 22.503-5.89 8.264 0 15.465 1.8 21.684 5.318 6.137 3.518 10.964 8.673 14.319 15.382 3.437 6.71 5.074 14.81 4.992 24.383v76.175h-28.23v-71.92c0-8.019-2.046-14.237-6.219-18.819-4.173-4.5-9.819-6.791-17.102-6.791-4.91 0-9.328 1.063-13.174 3.272-3.846 2.128-6.792 5.237-9.001 9.328-2.046 4.009-3.191 8.918-3.191 14.728ZM589.233 239c-10.147 0-18.82-1.391-26.103-4.091-7.282-2.7-13.092-6.382-17.511-10.964-4.418-4.582-7.528-9.655-9.164-15.219l25.448-6.136c1.145 2.372 2.782 4.663 4.991 6.954 2.209 2.291 5.155 4.255 8.837 5.81 3.683 1.554 8.428 2.291 14.074 2.291 8.019 0 14.647-1.964 19.884-5.81 5.237-3.845 7.856-10.227 7.856-19.064v-22.665h-1.391c-1.473 2.946-3.601 5.892-6.383 9.001-2.782 3.109-6.464 5.645-10.965 7.691-4.582 2.046-10.228 3.109-17.101 3.109-9.165 0-17.511-2.209-25.039-6.545-7.446-4.337-13.42-10.883-17.757-19.474-4.418-8.673-6.628-19.473-6.628-32.565 0-13.091 2.21-24.301 6.628-33.383 4.419-9.082 10.311-15.955 17.839-20.7 7.528-4.746 15.874-7.037 25.039-7.037 7.037 0 12.846 1.145 17.347 3.518 4.582 2.373 8.182 5.236 10.883 8.51 2.7 3.272 4.746 6.382 6.137 9.327h1.554v-19.8h27.821v121.749c0 10.228-2.454 18.737-7.364 25.447-4.91 6.709-11.538 11.7-20.048 15.055-8.509 3.355-18.165 4.991-28.884 4.991Zm.245-71.266c5.974 0 11.047-1.473 15.302-4.337 4.173-2.945 7.446-7.118 9.573-12.519 2.21-5.482 3.274-12.027 3.274-19.637 0-7.609-1.064-14.155-3.274-19.8-2.127-5.646-5.318-10.064-9.491-13.255-4.174-3.11-9.329-4.746-15.384-4.746s-11.537 1.636-15.792 4.91c-4.173 3.272-7.365 7.772-9.492 13.418-2.128 5.727-3.191 12.191-3.191 19.392 0 7.2 1.063 13.745 3.273 19.228 2.127 5.482 5.318 9.736 9.573 12.764 4.174 3.027 9.41 4.582 15.629 4.582Zm141.56-26.51V71.839h28.23v119.786h-27.412v-21.273h-1.227c-2.7 6.709-7.119 12.191-13.338 16.446-6.137 4.255-13.747 6.382-22.748 6.382-7.855 0-14.81-1.718-20.783-5.237-5.974-3.518-10.72-8.591-14.075-15.382-3.355-6.709-5.073-14.891-5.073-24.464V71.839h28.312v71.921c0 7.609 2.046 13.664 6.219 18.083 4.173 4.5 9.655 6.709 16.365 6.709 4.173 0 8.183-.982 12.111-3.028 3.927-2.045 7.118-5.072 9.655-9.082 2.537-4.091 3.764-9.164 3.764-15.218Zm65.707-109.395v159.796h-28.23V31.828h28.23Zm44.841 162.169c-7.61 0-14.402-1.391-20.457-4.091-6.055-2.7-10.883-6.791-14.32-12.109-3.518-5.319-5.237-11.946-5.237-19.801 0-6.791 1.228-12.355 3.765-16.773 2.536-4.419 5.891-7.937 10.228-10.637 4.337-2.618 9.164-4.664 14.647-6.055 5.4-1.391 11.046-2.373 16.856-3.027 7.037-.737 12.683-1.391 17.102-1.964 4.337-.573 7.528-1.555 9.574-2.782 1.963-1.309 3.027-3.273 3.027-5.973v-.491c0-5.891-1.718-10.391-5.237-13.664-3.518-3.191-8.51-4.828-15.056-4.828-6.955 0-12.356 1.473-16.447 4.5-4.009 3.028-6.71 6.546-8.183 10.719l-26.348-3.764c2.046-7.282 5.483-13.336 10.31-18.328 4.746-4.909 10.638-8.59 17.511-11.045 6.955-2.455 14.565-3.682 22.912-3.682 5.809 0 11.537.654 17.265 2.045s10.965 3.6 15.711 6.71c4.746 3.109 8.51 7.282 11.455 12.6 2.864 5.318 4.337 11.946 4.337 19.883v80.184h-27.166v-16.446h-.9c-1.719 3.355-4.092 6.464-7.201 9.328-3.109 2.864-6.955 5.237-11.619 6.955-4.828 1.718-10.229 2.536-16.529 2.536Zm7.364-20.701c5.646 0 10.556-1.145 14.729-3.354 4.173-2.291 7.364-5.237 9.655-9.001 2.292-3.763 3.355-7.854 3.355-12.273v-14.155c-.9.737-2.373 1.391-4.5 2.046-2.128.654-4.419 1.145-7.037 1.636-2.619.491-5.155.9-7.692 1.227-2.537.328-4.746.655-6.628.901-4.173.572-8.019 1.472-11.292 2.781-3.355 1.31-5.973 3.11-7.855 5.401-1.964 2.291-2.864 5.318-2.864 8.918 0 5.237 1.882 9.164 5.728 11.782 3.682 2.782 8.51 4.091 14.401 4.091Zm64.643 18.328V71.839h27.412v19.965h1.227c2.21-6.955 5.974-12.274 11.292-16.038 5.319-3.763 11.456-5.645 18.329-5.645 1.555 0 3.355.082 5.237.163 1.964.164 3.601.328 4.91.573v25.938c-1.227-.41-3.109-.819-5.646-1.146a58.814 58.814 0 0 0-7.446-.49c-5.155 0-9.738 1.145-13.829 3.354-4.091 2.209-7.282 5.236-9.655 9.164-2.373 3.927-3.519 8.427-3.519 13.5v70.448h-28.312ZM222.077 39.192l-8.019 125.923L137.387 0l84.69 39.192Zm-53.105 162.825-57.933 33.056-57.934-33.056 11.783-28.556h92.301l11.783 28.556ZM111.039 62.675l30.357 73.803H80.681l30.358-73.803ZM7.937 165.115 0 39.192 84.69 0 7.937 165.115Z"
|
|
||||||
/>
|
|
||||||
<path
|
|
||||||
fill="url(#c)"
|
|
||||||
d="M388.676 191.625h30.849L363.31 31.828h-35.758l-56.215 159.797h30.848l13.174-39.356h60.061l13.256 39.356Zm-65.461-62.675 21.602-64.311h1.227l21.602 64.311h-44.431Zm126.831-7.527v70.202h-28.23V71.839h27.002v20.374h1.392c2.782-6.71 7.2-12.028 13.255-15.956 6.056-3.927 13.584-5.89 22.503-5.89 8.264 0 15.465 1.8 21.684 5.318 6.137 3.518 10.964 8.673 14.319 15.382 3.437 6.71 5.074 14.81 4.992 24.383v76.175h-28.23v-71.92c0-8.019-2.046-14.237-6.219-18.819-4.173-4.5-9.819-6.791-17.102-6.791-4.91 0-9.328 1.063-13.174 3.272-3.846 2.128-6.792 5.237-9.001 9.328-2.046 4.009-3.191 8.918-3.191 14.728ZM589.233 239c-10.147 0-18.82-1.391-26.103-4.091-7.282-2.7-13.092-6.382-17.511-10.964-4.418-4.582-7.528-9.655-9.164-15.219l25.448-6.136c1.145 2.372 2.782 4.663 4.991 6.954 2.209 2.291 5.155 4.255 8.837 5.81 3.683 1.554 8.428 2.291 14.074 2.291 8.019 0 14.647-1.964 19.884-5.81 5.237-3.845 7.856-10.227 7.856-19.064v-22.665h-1.391c-1.473 2.946-3.601 5.892-6.383 9.001-2.782 3.109-6.464 5.645-10.965 7.691-4.582 2.046-10.228 3.109-17.101 3.109-9.165 0-17.511-2.209-25.039-6.545-7.446-4.337-13.42-10.883-17.757-19.474-4.418-8.673-6.628-19.473-6.628-32.565 0-13.091 2.21-24.301 6.628-33.383 4.419-9.082 10.311-15.955 17.839-20.7 7.528-4.746 15.874-7.037 25.039-7.037 7.037 0 12.846 1.145 17.347 3.518 4.582 2.373 8.182 5.236 10.883 8.51 2.7 3.272 4.746 6.382 6.137 9.327h1.554v-19.8h27.821v121.749c0 10.228-2.454 18.737-7.364 25.447-4.91 6.709-11.538 11.7-20.048 15.055-8.509 3.355-18.165 4.991-28.884 4.991Zm.245-71.266c5.974 0 11.047-1.473 15.302-4.337 4.173-2.945 7.446-7.118 9.573-12.519 2.21-5.482 3.274-12.027 3.274-19.637 0-7.609-1.064-14.155-3.274-19.8-2.127-5.646-5.318-10.064-9.491-13.255-4.174-3.11-9.329-4.746-15.384-4.746s-11.537 1.636-15.792 4.91c-4.173 3.272-7.365 7.772-9.492 13.418-2.128 5.727-3.191 12.191-3.191 19.392 0 7.2 1.063 13.745 3.273 19.228 2.127 5.482 5.318 9.736 9.573 12.764 4.174 3.027 9.41 4.582 15.629 4.582Zm141.56-26.51V71.839h28.23v119.786h-27.412v-21.273h-1.227c-2.7 6.709-7.119 12.191-13.338 16.446-6.137 4.255-13.747 6.382-22.748 6.382-7.855 0-14.81-1.718-20.783-5.237-5.974-3.518-10.72-8.591-14.075-15.382-3.355-6.709-5.073-14.891-5.073-24.464V71.839h28.312v71.921c0 7.609 2.046 13.664 6.219 18.083 4.173 4.5 9.655 6.709 16.365 6.709 4.173 0 8.183-.982 12.111-3.028 3.927-2.045 7.118-5.072 9.655-9.082 2.537-4.091 3.764-9.164 3.764-15.218Zm65.707-109.395v159.796h-28.23V31.828h28.23Zm44.841 162.169c-7.61 0-14.402-1.391-20.457-4.091-6.055-2.7-10.883-6.791-14.32-12.109-3.518-5.319-5.237-11.946-5.237-19.801 0-6.791 1.228-12.355 3.765-16.773 2.536-4.419 5.891-7.937 10.228-10.637 4.337-2.618 9.164-4.664 14.647-6.055 5.4-1.391 11.046-2.373 16.856-3.027 7.037-.737 12.683-1.391 17.102-1.964 4.337-.573 7.528-1.555 9.574-2.782 1.963-1.309 3.027-3.273 3.027-5.973v-.491c0-5.891-1.718-10.391-5.237-13.664-3.518-3.191-8.51-4.828-15.056-4.828-6.955 0-12.356 1.473-16.447 4.5-4.009 3.028-6.71 6.546-8.183 10.719l-26.348-3.764c2.046-7.282 5.483-13.336 10.31-18.328 4.746-4.909 10.638-8.59 17.511-11.045 6.955-2.455 14.565-3.682 22.912-3.682 5.809 0 11.537.654 17.265 2.045s10.965 3.6 15.711 6.71c4.746 3.109 8.51 7.282 11.455 12.6 2.864 5.318 4.337 11.946 4.337 19.883v80.184h-27.166v-16.446h-.9c-1.719 3.355-4.092 6.464-7.201 9.328-3.109 2.864-6.955 5.237-11.619 6.955-4.828 1.718-10.229 2.536-16.529 2.536Zm7.364-20.701c5.646 0 10.556-1.145 14.729-3.354 4.173-2.291 7.364-5.237 9.655-9.001 2.292-3.763 3.355-7.854 3.355-12.273v-14.155c-.9.737-2.373 1.391-4.5 2.046-2.128.654-4.419 1.145-7.037 1.636-2.619.491-5.155.9-7.692 1.227-2.537.328-4.746.655-6.628.901-4.173.572-8.019 1.472-11.292 2.781-3.355 1.31-5.973 3.11-7.855 5.401-1.964 2.291-2.864 5.318-2.864 8.918 0 5.237 1.882 9.164 5.728 11.782 3.682 2.782 8.51 4.091 14.401 4.091Zm64.643 18.328V71.839h27.412v19.965h1.227c2.21-6.955 5.974-12.274 11.292-16.038 5.319-3.763 11.456-5.645 18.329-5.645 1.555 0 3.355.082 5.237.163 1.964.164 3.601.328 4.91.573v25.938c-1.227-.41-3.109-.819-5.646-1.146a58.814 58.814 0 0 0-7.446-.49c-5.155 0-9.738 1.145-13.829 3.354-4.091 2.209-7.282 5.236-9.655 9.164-2.373 3.927-3.519 8.427-3.519 13.5v70.448h-28.312ZM222.077 39.192l-8.019 125.923L137.387 0l84.69 39.192Zm-53.105 162.825-57.933 33.056-57.934-33.056 11.783-28.556h92.301l11.783 28.556ZM111.039 62.675l30.357 73.803H80.681l30.358-73.803ZM7.937 165.115 0 39.192 84.69 0 7.937 165.115Z"
|
|
||||||
/>
|
|
||||||
</g>
|
|
||||||
<defs>
|
|
||||||
<radialGradient
|
|
||||||
id="c"
|
|
||||||
cx="0"
|
|
||||||
cy="0"
|
|
||||||
r="1"
|
|
||||||
gradientTransform="rotate(118.122 171.182 60.81) scale(205.794)"
|
|
||||||
gradientUnits="userSpaceOnUse"
|
|
||||||
>
|
|
||||||
<stop stop-color="#FF41F8" />
|
|
||||||
<stop offset=".707" stop-color="#FF41F8" stop-opacity=".5" />
|
|
||||||
<stop offset="1" stop-color="#FF41F8" stop-opacity="0" />
|
|
||||||
</radialGradient>
|
|
||||||
<linearGradient
|
|
||||||
id="b"
|
|
||||||
x1="0"
|
|
||||||
x2="982"
|
|
||||||
y1="192"
|
|
||||||
y2="192"
|
|
||||||
gradientUnits="userSpaceOnUse"
|
|
||||||
>
|
|
||||||
<stop stop-color="#F0060B" />
|
|
||||||
<stop offset="0" stop-color="#F0070C" />
|
|
||||||
<stop offset=".526" stop-color="#CC26D5" />
|
|
||||||
<stop offset="1" stop-color="#7702FF" />
|
|
||||||
</linearGradient>
|
|
||||||
<clipPath id="a"><path fill="#fff" d="M0 0h982v239H0z" /></clipPath>
|
|
||||||
</defs>
|
|
||||||
</svg>
|
|
||||||
<h1>Hello, {{ title() }}</h1>
|
|
||||||
<p>Congratulations! Your app is running. 🎉</p>
|
|
||||||
</div>
|
|
||||||
<div class="divider" role="separator" aria-label="Divider"></div>
|
|
||||||
<div class="right-side">
|
|
||||||
<div class="pill-group">
|
|
||||||
@for (item of [
|
|
||||||
{ title: 'Explore the Docs', link: 'https://angular.dev' },
|
|
||||||
{ title: 'Learn with Tutorials', link: 'https://angular.dev/tutorials' },
|
|
||||||
{ title: 'Prompt and best practices for AI', link: 'https://angular.dev/ai/develop-with-ai'},
|
|
||||||
{ title: 'CLI Docs', link: 'https://angular.dev/tools/cli' },
|
|
||||||
{ title: 'Angular Language Service', link: 'https://angular.dev/tools/language-service' },
|
|
||||||
{ title: 'Angular DevTools', link: 'https://angular.dev/tools/devtools' },
|
|
||||||
]; track item.title) {
|
|
||||||
<a
|
|
||||||
class="pill"
|
|
||||||
[href]="item.link"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener"
|
|
||||||
>
|
|
||||||
<span>{{ item.title }}</span>
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
height="14"
|
|
||||||
viewBox="0 -960 960 960"
|
|
||||||
width="14"
|
|
||||||
fill="currentColor"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div class="social-links">
|
|
||||||
<a
|
|
||||||
href="https://github.com/angular/angular"
|
|
||||||
aria-label="Github"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
width="25"
|
|
||||||
height="24"
|
|
||||||
viewBox="0 0 25 24"
|
|
||||||
fill="none"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
alt="Github"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M12.3047 0C5.50634 0 0 5.50942 0 12.3047C0 17.7423 3.52529 22.3535 8.41332 23.9787C9.02856 24.0946 9.25414 23.7142 9.25414 23.3871C9.25414 23.0949 9.24389 22.3207 9.23876 21.2953C5.81601 22.0377 5.09414 19.6444 5.09414 19.6444C4.53427 18.2243 3.72524 17.8449 3.72524 17.8449C2.61064 17.082 3.81137 17.0973 3.81137 17.0973C5.04697 17.1835 5.69604 18.3647 5.69604 18.3647C6.79321 20.2463 8.57636 19.7029 9.27978 19.3881C9.39052 18.5924 9.70736 18.0499 10.0591 17.7423C7.32641 17.4347 4.45429 16.3765 4.45429 11.6618C4.45429 10.3185 4.9311 9.22133 5.72065 8.36C5.58222 8.04931 5.16694 6.79833 5.82831 5.10337C5.82831 5.10337 6.85883 4.77319 9.2121 6.36459C10.1965 6.09082 11.2424 5.95546 12.2883 5.94931C13.3342 5.95546 14.3801 6.09082 15.3644 6.36459C17.7023 4.77319 18.7328 5.10337 18.7328 5.10337C19.3942 6.79833 18.9789 8.04931 18.8559 8.36C19.6403 9.22133 20.1171 10.3185 20.1171 11.6618C20.1171 16.3888 17.2409 17.4296 14.5031 17.7321C14.9338 18.1012 15.3337 18.8559 15.3337 20.0084C15.3337 21.6552 15.3183 22.978 15.3183 23.3779C15.3183 23.7009 15.5336 24.0854 16.1642 23.9623C21.0871 22.3484 24.6094 17.7341 24.6094 12.3047C24.6094 5.50942 19.0999 0 12.3047 0Z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
<a
|
|
||||||
href="https://twitter.com/angular"
|
|
||||||
aria-label="Twitter"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
width="24"
|
|
||||||
height="24"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
fill="none"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
alt="Twitter"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
<a
|
|
||||||
href="https://www.youtube.com/channel/UCbn1OgGei-DV7aSRo_HaAiw"
|
|
||||||
aria-label="Youtube"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
width="29"
|
|
||||||
height="20"
|
|
||||||
viewBox="0 0 29 20"
|
|
||||||
fill="none"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
alt="Youtube"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
fill-rule="evenodd"
|
|
||||||
clip-rule="evenodd"
|
|
||||||
d="M27.4896 1.52422C27.9301 1.96749 28.2463 2.51866 28.4068 3.12258C29.0004 5.35161 29.0004 10 29.0004 10C29.0004 10 29.0004 14.6484 28.4068 16.8774C28.2463 17.4813 27.9301 18.0325 27.4896 18.4758C27.0492 18.9191 26.5 19.2389 25.8972 19.4032C23.6778 20 14.8068 20 14.8068 20C14.8068 20 5.93586 20 3.71651 19.4032C3.11363 19.2389 2.56449 18.9191 2.12405 18.4758C1.68361 18.0325 1.36732 17.4813 1.20683 16.8774C0.613281 14.6484 0.613281 10 0.613281 10C0.613281 10 0.613281 5.35161 1.20683 3.12258C1.36732 2.51866 1.68361 1.96749 2.12405 1.52422C2.56449 1.08095 3.11363 0.76113 3.71651 0.596774C5.93586 0 14.8068 0 14.8068 0C14.8068 0 23.6778 0 25.8972 0.596774C26.5 0.76113 27.0492 1.08095 27.4896 1.52422ZM19.3229 10L11.9036 5.77905V14.221L19.3229 10Z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
|
||||||
<!-- * * * * * * * * * * * The content above * * * * * * * * * * * * -->
|
|
||||||
<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * * -->
|
|
||||||
<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * -->
|
|
||||||
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
|
||||||
<!-- * * * * * * * * * * End of Placeholder * * * * * * * * * * * * -->
|
|
||||||
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
|
||||||
|
|
||||||
|
|
||||||
<router-outlet />
|
|
||||||
|
|||||||
@@ -1,3 +1,20 @@
|
|||||||
import { Routes } from '@angular/router';
|
import { Routes } from '@angular/router';
|
||||||
|
|
||||||
export const routes: Routes = [];
|
import { CitiesPage } from './pages/cities-page/cities-page';
|
||||||
|
import { CityPage } from './pages/city-page/city-page';
|
||||||
|
import { CollectionsPage } from './pages/collections-page/collections-page';
|
||||||
|
import { IconPreviewPage } from './pages/icon-preview-page/icon-preview-page';
|
||||||
|
import { MapItemPage } from './pages/map-item-page/map-item-page';
|
||||||
|
import { visitedItemGuard } from './pages/map-item-page/visited-item.guard';
|
||||||
|
import { MapPage } from './pages/map-page/map-page';
|
||||||
|
|
||||||
|
export const routes: Routes = [
|
||||||
|
{ path: '', component: CitiesPage },
|
||||||
|
{ path: 'map', component: MapPage },
|
||||||
|
{ path: 'collections', component: CollectionsPage },
|
||||||
|
{ path: 'collection', pathMatch: 'full', redirectTo: '' },
|
||||||
|
{ path: 'city/:areaId/:id/icon', component: IconPreviewPage },
|
||||||
|
{ path: 'city/:areaId/:id', component: MapItemPage, canActivate: [visitedItemGuard] },
|
||||||
|
{ path: 'city/:areaId', component: CityPage },
|
||||||
|
{ path: '**', redirectTo: '' },
|
||||||
|
];
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
background: var(--color-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (display-mode: standalone) {
|
||||||
|
.app {
|
||||||
|
padding-top: env(safe-area-inset-top);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.app__main {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app__main router-outlet {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app__main > :not(router-outlet) {
|
||||||
|
display: block;
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,10 +1,25 @@
|
|||||||
|
import { provideHttpClient } from '@angular/common/http';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
import { provideRouter } from '@angular/router';
|
||||||
|
import { provideServiceWorker } from '@angular/service-worker';
|
||||||
|
import { provideEffects } from '@ngrx/effects';
|
||||||
|
import { provideState, provideStore } from '@ngrx/store';
|
||||||
|
|
||||||
import { App } from './app';
|
import { App } from './app';
|
||||||
|
import { AuthEffects, GorodarEffects, gorodarFeature } from './state';
|
||||||
|
|
||||||
describe('App', () => {
|
describe('App', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [App],
|
imports: [App],
|
||||||
|
providers: [
|
||||||
|
provideHttpClient(),
|
||||||
|
provideRouter([]),
|
||||||
|
provideStore(),
|
||||||
|
provideState(gorodarFeature),
|
||||||
|
provideEffects(GorodarEffects, AuthEffects),
|
||||||
|
provideServiceWorker('ngsw-worker.js', { enabled: false }),
|
||||||
|
],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -14,10 +29,10 @@ describe('App', () => {
|
|||||||
expect(app).toBeTruthy();
|
expect(app).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render title', () => {
|
it('should render bottom navigation', () => {
|
||||||
const fixture = TestBed.createComponent(App);
|
const fixture = TestBed.createComponent(App);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const compiled = fixture.nativeElement as HTMLElement;
|
const compiled = fixture.nativeElement as HTMLElement;
|
||||||
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, maps');
|
expect(compiled.querySelector('app-bottom-nav')?.textContent).toContain('Города');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,12 +1,37 @@
|
|||||||
import { Component, signal } from '@angular/core';
|
import { Component, computed, inject } from '@angular/core';
|
||||||
import { RouterOutlet } from '@angular/router';
|
import { toSignal } from '@angular/core/rxjs-interop';
|
||||||
|
import { NavigationEnd, Router, RouterOutlet } from '@angular/router';
|
||||||
|
import { filter, map, startWith } from 'rxjs';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
|
import { AuthSheet } from './auth/ui/auth-sheet/auth-sheet';
|
||||||
|
import { BottomNav } from './layout/bottom-nav/bottom-nav';
|
||||||
|
import { GorodarActions } from './state';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
imports: [RouterOutlet],
|
imports: [RouterOutlet, BottomNav, AuthSheet],
|
||||||
templateUrl: './app.html',
|
templateUrl: './app.html',
|
||||||
styleUrl: './app.scss'
|
styleUrl: './app.scss',
|
||||||
})
|
})
|
||||||
export class App {
|
export class App {
|
||||||
protected readonly title = signal('maps');
|
private readonly router = inject(Router);
|
||||||
|
private readonly store = inject(Store);
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.store.dispatch(GorodarActions.areasRequested());
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly url = toSignal(
|
||||||
|
this.router.events.pipe(
|
||||||
|
filter((event): event is NavigationEnd => event instanceof NavigationEnd),
|
||||||
|
map(() => this.router.url),
|
||||||
|
startWith(this.router.url),
|
||||||
|
),
|
||||||
|
{ initialValue: this.router.url },
|
||||||
|
);
|
||||||
|
|
||||||
|
protected readonly hideNav = computed(() =>
|
||||||
|
/^\/city\/[^/]+\/[^/]+/.test(this.url().split('?')[0]),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
export interface Attraction {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
about: string;
|
||||||
|
iconUrl: string;
|
||||||
|
backgroundUrl: string;
|
||||||
|
audioUrl: string;
|
||||||
|
modelUrl: string;
|
||||||
|
latitude: number;
|
||||||
|
longitude: number;
|
||||||
|
visited: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AttractionDetails extends Attraction {
|
||||||
|
address: string;
|
||||||
|
facts: string[];
|
||||||
|
photoUrl: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AreaProgress {
|
||||||
|
visited: number;
|
||||||
|
total: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type VisitStatus = 'VISITED' | 'ALREADY_VISITED' | 'NOT_MATCHED' | 'UNCERTAIN';
|
||||||
|
|
||||||
|
export interface VisitResult {
|
||||||
|
status: VisitStatus;
|
||||||
|
confidence: number;
|
||||||
|
progress: AreaProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Area {
|
||||||
|
id: string;
|
||||||
|
parentId: string | null;
|
||||||
|
name: string;
|
||||||
|
attractions: Attraction[];
|
||||||
|
progress: AreaProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AreaDetails extends Area {
|
||||||
|
children: Area[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AreasPage {
|
||||||
|
content: Area[];
|
||||||
|
page: {
|
||||||
|
size: number;
|
||||||
|
number: number;
|
||||||
|
totalElements: number;
|
||||||
|
totalPages: number;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AreasStatus = 'idle' | 'loading' | 'ready' | 'error';
|
||||||
|
|
||||||
|
export function areaAttractions(area: Area | AreaDetails): Attraction[] {
|
||||||
|
const own = area.attractions ?? [];
|
||||||
|
const children = 'children' in area ? area.children : [];
|
||||||
|
|
||||||
|
return [...own, ...children.flatMap((child) => child.attractions ?? [])];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function findAttraction(area: Area | AreaDetails, id: string): Attraction | null {
|
||||||
|
return areaAttractions(area).find((item) => item.id === id) ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function areaOpenedCount(area: Area | AreaDetails): number {
|
||||||
|
const attractions = areaAttractions(area);
|
||||||
|
|
||||||
|
if (attractions.length > 0) {
|
||||||
|
return attractions.filter((item) => item.visited).length;
|
||||||
|
}
|
||||||
|
|
||||||
|
return area.progress?.visited ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function areaTotalCount(area: Area | AreaDetails): number {
|
||||||
|
const attractions = areaAttractions(area);
|
||||||
|
|
||||||
|
if (attractions.length > 0) {
|
||||||
|
return attractions.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
return area.progress?.total ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function areaProgress(area: Area | AreaDetails): number {
|
||||||
|
const total = areaTotalCount(area);
|
||||||
|
|
||||||
|
if (!total) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.round((areaOpenedCount(area) / total) * 100);
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { Injectable, inject } from '@angular/core';
|
||||||
|
import { Observable, map } from 'rxjs';
|
||||||
|
|
||||||
|
import { endpoints } from '../../environments/api';
|
||||||
|
import type { Area, AreaDetails, AreasPage, AttractionDetails, VisitResult } from './area.models';
|
||||||
|
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class AreasApiService {
|
||||||
|
private readonly http = inject(HttpClient);
|
||||||
|
|
||||||
|
getAreas(): Observable<Area[]> {
|
||||||
|
return this.http
|
||||||
|
.get<AreasPage>(endpoints.areas, {
|
||||||
|
params: { page: '0', size: '100' },
|
||||||
|
})
|
||||||
|
.pipe(map((page) => page.content));
|
||||||
|
}
|
||||||
|
|
||||||
|
getArea(id: string): Observable<AreaDetails> {
|
||||||
|
return this.http.get<AreaDetails>(endpoints.area(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
getAttraction(id: string): Observable<AttractionDetails> {
|
||||||
|
return this.http.get<AttractionDetails>(endpoints.attraction(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
visit(id: string, photo: Blob): Observable<VisitResult> {
|
||||||
|
const body = new FormData();
|
||||||
|
body.append('photo', photo, 'photo.jpg');
|
||||||
|
return this.http.post<VisitResult>(endpoints.visit(id), body);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
const PHOTO_SIZE = 512;
|
||||||
|
const JPEG_QUALITY = 0.8;
|
||||||
|
|
||||||
|
export function resizePhoto(dataUrl: string): Promise<Blob> {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const image = new Image();
|
||||||
|
|
||||||
|
image.onload = () => {
|
||||||
|
const canvas = document.createElement('canvas');
|
||||||
|
canvas.width = PHOTO_SIZE;
|
||||||
|
canvas.height = PHOTO_SIZE;
|
||||||
|
|
||||||
|
const context = canvas.getContext('2d');
|
||||||
|
if (!context || image.width === 0 || image.height === 0) {
|
||||||
|
reject(new Error('Photo compression failed'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const scale = Math.max(PHOTO_SIZE / image.width, PHOTO_SIZE / image.height);
|
||||||
|
const width = image.width * scale;
|
||||||
|
const height = image.height * scale;
|
||||||
|
|
||||||
|
context.imageSmoothingQuality = 'high';
|
||||||
|
context.drawImage(image, (PHOTO_SIZE - width) / 2, (PHOTO_SIZE - height) / 2, width, height);
|
||||||
|
|
||||||
|
canvas.toBlob(
|
||||||
|
(blob) => (blob ? resolve(blob) : reject(new Error('Photo compression failed'))),
|
||||||
|
'image/jpeg',
|
||||||
|
JPEG_QUALITY,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
image.onerror = () => reject(new Error('Photo is unreadable'));
|
||||||
|
image.src = dataUrl;
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import { Injectable, inject } from '@angular/core';
|
||||||
|
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
import { endpoints, grants } from '../../environments/api';
|
||||||
|
import type { TokenResponse } from './auth.models';
|
||||||
|
|
||||||
|
const tokenHeaders = new HttpHeaders({
|
||||||
|
Accept: 'application/json, text/plain, */*',
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
});
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root',
|
||||||
|
})
|
||||||
|
export class AuthApiService {
|
||||||
|
private readonly http = inject(HttpClient);
|
||||||
|
|
||||||
|
requestCode(email: string): Observable<string> {
|
||||||
|
return this.http.post(endpoints.oauth.authorize, { email }, { responseType: 'text' });
|
||||||
|
}
|
||||||
|
|
||||||
|
exchangeCode(email: string, code: string): Observable<TokenResponse> {
|
||||||
|
const body = new HttpParams()
|
||||||
|
.set('grant_type', grants.emailCode)
|
||||||
|
.set('email', email)
|
||||||
|
.set('code', code)
|
||||||
|
.toString();
|
||||||
|
|
||||||
|
return this.http.post<TokenResponse>(endpoints.oauth.token, body, { headers: tokenHeaders });
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import { HttpErrorResponse } from '@angular/common/http';
|
||||||
|
|
||||||
|
export function authErrorMessage(error: unknown): string {
|
||||||
|
if (error instanceof Error && !(error instanceof HttpErrorResponse) && error.message) {
|
||||||
|
return error.message;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(error instanceof HttpErrorResponse)) {
|
||||||
|
return 'Не удалось выполнить запрос';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error.status === 0) {
|
||||||
|
return 'Нет соединения с сервером';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error.status === 429) {
|
||||||
|
return 'Слишком много попыток. Попробуйте чуть позже';
|
||||||
|
}
|
||||||
|
|
||||||
|
return readErrorBody(error.error) ?? 'Не удалось выполнить запрос';
|
||||||
|
}
|
||||||
|
|
||||||
|
function readErrorBody(body: unknown): string | null {
|
||||||
|
const parsed = typeof body === 'string' ? parseJson(body) : body;
|
||||||
|
|
||||||
|
if (!parsed || typeof parsed !== 'object') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const record = parsed as { error_description?: unknown; message?: unknown };
|
||||||
|
|
||||||
|
if (typeof record.error_description === 'string' && record.error_description) {
|
||||||
|
return record.error_description;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof record.message === 'string' && record.message) {
|
||||||
|
return record.message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseJson(value: string): unknown {
|
||||||
|
try {
|
||||||
|
return JSON.parse(value) as unknown;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import type { AuthSession } from './auth.models';
|
||||||
|
|
||||||
|
const SESSION_KEY = 'gorodar.session';
|
||||||
|
|
||||||
|
export function readAuthSession(): AuthSession | null {
|
||||||
|
const raw = localStorage.getItem(SESSION_KEY);
|
||||||
|
|
||||||
|
if (!raw) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const session = parseSession(raw);
|
||||||
|
const expired = !!session && typeof session.expiresAt === 'number' && session.expiresAt <= Date.now();
|
||||||
|
|
||||||
|
if (!session || !isEmail(session.email) || !session.accessToken || expired) {
|
||||||
|
localStorage.removeItem(SESSION_KEY);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return session;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function writeAuthSession(session: AuthSession): void {
|
||||||
|
localStorage.setItem(SESSION_KEY, JSON.stringify(session));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function clearAuthSession(): void {
|
||||||
|
localStorage.removeItem(SESSION_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseSession(raw: string): AuthSession | null {
|
||||||
|
try {
|
||||||
|
const parsed: unknown = JSON.parse(raw);
|
||||||
|
|
||||||
|
if (!parsed || typeof parsed !== 'object') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parsed as AuthSession;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isEmail(value: string): boolean {
|
||||||
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import { HttpInterceptorFn } from '@angular/common/http';
|
||||||
|
import { Injectable, inject } from '@angular/core';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
|
import { selectAuth } from '../state/gorodar.selectors';
|
||||||
|
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
class AccessTokenReader {
|
||||||
|
private readonly auth = inject(Store).selectSignal(selectAuth);
|
||||||
|
|
||||||
|
token(): string | null {
|
||||||
|
return this.auth().accessToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const authInterceptor: HttpInterceptorFn = (req, next) => {
|
||||||
|
if (req.url.includes('/oauth2/')) {
|
||||||
|
return next(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
const token = inject(AccessTokenReader).token();
|
||||||
|
|
||||||
|
if (!token) {
|
||||||
|
return next(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
return next(
|
||||||
|
req.clone({
|
||||||
|
setHeaders: { Authorization: `Bearer ${token}` },
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
export type AuthIntent = 'claim' | 'collection';
|
||||||
|
|
||||||
|
export type AuthPromptResult = 'authenticated' | 'dismissed';
|
||||||
|
|
||||||
|
export type AuthStep = 'email' | 'code';
|
||||||
|
|
||||||
|
export interface AuthSession {
|
||||||
|
email: string;
|
||||||
|
accessToken: string;
|
||||||
|
tokenType: string;
|
||||||
|
refreshToken?: string;
|
||||||
|
expiresAt?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TokenResponse {
|
||||||
|
access_token: string;
|
||||||
|
token_type?: string;
|
||||||
|
expires_in?: number;
|
||||||
|
refresh_token?: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
@if (sheetVisible()) {
|
||||||
|
<div class="sheet-root" [style.--drag-y.px]="dragY()">
|
||||||
|
<button
|
||||||
|
class="sheet-root__backdrop"
|
||||||
|
type="button"
|
||||||
|
aria-label="Свернуть"
|
||||||
|
(click)="dismiss()"
|
||||||
|
></button>
|
||||||
|
|
||||||
|
<div class="sheet-pop">
|
||||||
|
<section
|
||||||
|
class="sheet"
|
||||||
|
[class.sheet--dragging]="dragging()"
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
aria-labelledby="auth-sheet-title"
|
||||||
|
(pointerdown)="onDragStart($event)"
|
||||||
|
(pointermove)="onDragMove($event)"
|
||||||
|
(pointerup)="onDragEnd($event)"
|
||||||
|
(pointercancel)="onDragEnd($event)"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
class="sheet__handle"
|
||||||
|
type="button"
|
||||||
|
aria-label="Свернуть"
|
||||||
|
(click)="dismiss()"
|
||||||
|
></button>
|
||||||
|
|
||||||
|
@if (step() === 'email') {
|
||||||
|
<div class="sheet__lock" aria-hidden="true">
|
||||||
|
<app-icon name="lock" [size]="28" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2 id="auth-sheet-title">{{ title() }}</h2>
|
||||||
|
<p class="sheet__lead">
|
||||||
|
Сохраним вашу коллекцию и прогресс. Смотреть города и карту можно без входа.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<label class="sheet__email">
|
||||||
|
<app-icon name="mail" [size]="20" />
|
||||||
|
<input
|
||||||
|
type="email"
|
||||||
|
inputmode="email"
|
||||||
|
autocomplete="email"
|
||||||
|
placeholder="Почта"
|
||||||
|
[value]="emailDraft()"
|
||||||
|
(input)="onEmail($event)"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
@if (error()) {
|
||||||
|
<p class="sheet__error" role="alert">{{ error() }}</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="btn sheet__submit"
|
||||||
|
type="button"
|
||||||
|
[disabled]="!emailValid() || pending()"
|
||||||
|
(click)="requestCode()"
|
||||||
|
>
|
||||||
|
{{ pending() ? 'Отправляем…' : 'Получить код' }}
|
||||||
|
</button>
|
||||||
|
<button class="sheet__ghost" type="button" (click)="dismiss()">Пока просто посмотрю</button>
|
||||||
|
<p class="sheet__legal">
|
||||||
|
Продолжая, вы принимаете
|
||||||
|
<a [href]="termsUrl" target="_blank" rel="noopener noreferrer">Пользовательское соглашение</a>
|
||||||
|
и
|
||||||
|
<a [href]="privacyUrl" target="_blank" rel="noopener noreferrer">Политику обработки персональных данных</a>.
|
||||||
|
</p>
|
||||||
|
} @else {
|
||||||
|
<h2 id="auth-sheet-title">{{ title() }}</h2>
|
||||||
|
<p class="sheet__lead">
|
||||||
|
Отправили 6 цифр на <b>{{ email() }}</b>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="sheet__digits">
|
||||||
|
@for (digit of digits(); track $index) {
|
||||||
|
<input
|
||||||
|
#digit
|
||||||
|
type="text"
|
||||||
|
inputmode="numeric"
|
||||||
|
autocomplete="one-time-code"
|
||||||
|
maxlength="1"
|
||||||
|
[attr.aria-label]="'Цифра ' + ($index + 1)"
|
||||||
|
[value]="digit"
|
||||||
|
(input)="onDigit($index, $event)"
|
||||||
|
(keydown)="onDigitKey($index, $event)"
|
||||||
|
(paste)="onPaste($event)"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="sheet__resend"
|
||||||
|
type="button"
|
||||||
|
[disabled]="secondsLeft() > 0 || pending()"
|
||||||
|
(click)="resend()"
|
||||||
|
>
|
||||||
|
{{ resendLabel() }}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
@if (error()) {
|
||||||
|
<p class="sheet__error" role="alert">{{ error() }}</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="btn sheet__submit"
|
||||||
|
type="button"
|
||||||
|
[disabled]="!codeReady() || pending()"
|
||||||
|
(click)="confirm()"
|
||||||
|
>
|
||||||
|
{{ pending() ? 'Проверяем…' : 'Подтвердить' }}
|
||||||
|
</button>
|
||||||
|
<button class="sheet__ghost" type="button" (click)="changeEmail()">Изменить почту</button>
|
||||||
|
}
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
@@ -0,0 +1,235 @@
|
|||||||
|
:host {
|
||||||
|
display: contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-root {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 70;
|
||||||
|
inset: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-root__backdrop {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
border: 0;
|
||||||
|
background: rgb(8 7 6 / 64%);
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: calc(1 - min(var(--drag-y, 0px), 280px) / 280px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-pop {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
width: min(100%, 480px);
|
||||||
|
max-height: min(92dvh, 760px);
|
||||||
|
animation: sheet-in 0.28s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet {
|
||||||
|
width: 100%;
|
||||||
|
max-height: min(92dvh, 760px);
|
||||||
|
overflow: hidden auto;
|
||||||
|
padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-bottom: 0;
|
||||||
|
border-radius: 28px 28px 0 0;
|
||||||
|
background: #1a1815;
|
||||||
|
transform: translateY(var(--drag-y, 0px));
|
||||||
|
transition: transform 0.22s ease-out;
|
||||||
|
touch-action: pan-y;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet--dragging {
|
||||||
|
overflow: hidden;
|
||||||
|
transition: none;
|
||||||
|
touch-action: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__handle {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 28px;
|
||||||
|
margin: 0 auto 4px;
|
||||||
|
padding: 10px 0 12px;
|
||||||
|
border: 0;
|
||||||
|
background: transparent;
|
||||||
|
cursor: grab;
|
||||||
|
touch-action: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__handle::before {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
width: 42px;
|
||||||
|
height: 4px;
|
||||||
|
margin: 0 auto;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #4a453c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__lock {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
margin: 8px auto 16px;
|
||||||
|
color: var(--color-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-family: var(--font-display);
|
||||||
|
font-size: clamp(26px, 7vw, 32px);
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.15;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__lead {
|
||||||
|
margin: 10px 0 0;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 15px;
|
||||||
|
line-height: 1.4;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__lead b {
|
||||||
|
color: var(--color-accent-soft);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__email {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
min-height: 52px;
|
||||||
|
margin-top: 18px;
|
||||||
|
padding: 0 14px;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: 16px;
|
||||||
|
background: #12110f;
|
||||||
|
color: var(--color-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__email input {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
border: 0;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--color-text);
|
||||||
|
font: inherit;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__email input:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__digits {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__digits input {
|
||||||
|
width: 46px;
|
||||||
|
height: 56px;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: 14px;
|
||||||
|
background: #12110f;
|
||||||
|
color: var(--color-text);
|
||||||
|
font: inherit;
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__digits input:focus {
|
||||||
|
border-color: var(--color-accent);
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__resend {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 20px;
|
||||||
|
margin-top: 14px;
|
||||||
|
padding: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 0;
|
||||||
|
background: none;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font: inherit;
|
||||||
|
font-size: 14px;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__resend:disabled {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__error {
|
||||||
|
margin: 14px 0 0;
|
||||||
|
color: var(--color-danger);
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.35;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__submit {
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__ghost {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 44px;
|
||||||
|
margin-top: 4px;
|
||||||
|
border: 0;
|
||||||
|
background: none;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font: inherit;
|
||||||
|
font-size: 15px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__legal {
|
||||||
|
margin: 8px 0 0;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.45;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet__legal a {
|
||||||
|
color: var(--color-accent-soft);
|
||||||
|
text-decoration: underline;
|
||||||
|
text-underline-offset: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes sheet-in {
|
||||||
|
from {
|
||||||
|
transform: translateY(24px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.sheet-pop {
|
||||||
|
animation: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet {
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,360 @@
|
|||||||
|
import {
|
||||||
|
ChangeDetectionStrategy,
|
||||||
|
Component,
|
||||||
|
DestroyRef,
|
||||||
|
ElementRef,
|
||||||
|
HostListener,
|
||||||
|
computed,
|
||||||
|
effect,
|
||||||
|
inject,
|
||||||
|
signal,
|
||||||
|
untracked,
|
||||||
|
viewChildren,
|
||||||
|
} from '@angular/core';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
|
import { Icon } from '../../../shared/icon/icon';
|
||||||
|
import { privacyDocumentUrl, termsDocumentUrl } from '../../../shared/legal-documents';
|
||||||
|
import { RESEND_SECONDS } from '../../../state/gorodar.models';
|
||||||
|
import {
|
||||||
|
GorodarActions,
|
||||||
|
selectAuthCodeRequestId,
|
||||||
|
selectAuthEmail,
|
||||||
|
selectAuthError,
|
||||||
|
selectAuthIntent,
|
||||||
|
selectAuthPending,
|
||||||
|
selectAuthSheetVisible,
|
||||||
|
selectAuthStep,
|
||||||
|
} from '../../../state';
|
||||||
|
|
||||||
|
const CODE_LENGTH = 6;
|
||||||
|
const DISMISS_DISTANCE = 120;
|
||||||
|
const DISMISS_VELOCITY = 0.55;
|
||||||
|
|
||||||
|
function emptyDigits(): string[] {
|
||||||
|
return Array.from({ length: CODE_LENGTH }, () => '');
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-auth-sheet',
|
||||||
|
imports: [Icon],
|
||||||
|
templateUrl: './auth-sheet.html',
|
||||||
|
styleUrl: './auth-sheet.scss',
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
})
|
||||||
|
export class AuthSheet {
|
||||||
|
private readonly store = inject(Store);
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
private readonly digitFields = viewChildren<ElementRef<HTMLInputElement>>('digit');
|
||||||
|
private pointerId: number | null = null;
|
||||||
|
private dragOriginY = 0;
|
||||||
|
private dragOriginX = 0;
|
||||||
|
private dragScrollTop = 0;
|
||||||
|
private dragFromHandle = false;
|
||||||
|
private dragTracking = false;
|
||||||
|
private dragMoved = false;
|
||||||
|
private dragLastY = 0;
|
||||||
|
private dragLastTime = 0;
|
||||||
|
private dragVelocity = 0;
|
||||||
|
private closeTimer = 0;
|
||||||
|
|
||||||
|
protected readonly termsUrl = termsDocumentUrl;
|
||||||
|
protected readonly privacyUrl = privacyDocumentUrl;
|
||||||
|
protected readonly emailDraft = signal('');
|
||||||
|
protected readonly digits = signal<string[]>(emptyDigits());
|
||||||
|
protected readonly secondsLeft = signal(0);
|
||||||
|
protected readonly dragY = signal(0);
|
||||||
|
protected readonly dragging = signal(false);
|
||||||
|
|
||||||
|
protected readonly sheetVisible = this.store.selectSignal(selectAuthSheetVisible);
|
||||||
|
protected readonly step = this.store.selectSignal(selectAuthStep);
|
||||||
|
protected readonly email = this.store.selectSignal(selectAuthEmail);
|
||||||
|
protected readonly error = this.store.selectSignal(selectAuthError);
|
||||||
|
protected readonly pending = this.store.selectSignal(selectAuthPending);
|
||||||
|
protected readonly intent = this.store.selectSignal(selectAuthIntent);
|
||||||
|
private readonly codeRequestId = this.store.selectSignal(selectAuthCodeRequestId);
|
||||||
|
|
||||||
|
protected readonly emailValid = computed(() =>
|
||||||
|
/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(this.emailDraft().trim()),
|
||||||
|
);
|
||||||
|
|
||||||
|
protected readonly codeReady = computed(() => this.digits().every((digit) => digit.length === 1));
|
||||||
|
|
||||||
|
protected readonly title = computed(() => {
|
||||||
|
if (this.step() === 'code') {
|
||||||
|
return 'Введите код из письма';
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.intent() === 'claim'
|
||||||
|
? 'Войдите, чтобы забрать объект'
|
||||||
|
: 'Войдите, чтобы открыть коллекцию';
|
||||||
|
});
|
||||||
|
|
||||||
|
protected readonly resendLabel = computed(() => {
|
||||||
|
const seconds = this.secondsLeft();
|
||||||
|
|
||||||
|
if (seconds <= 0) {
|
||||||
|
return 'Отправить код ещё раз';
|
||||||
|
}
|
||||||
|
|
||||||
|
const minutes = Math.floor(seconds / 60);
|
||||||
|
const rest = String(seconds % 60).padStart(2, '0');
|
||||||
|
return `Отправить код ещё раз через ${minutes}:${rest}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
effect(() => {
|
||||||
|
if (!this.sheetVisible()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
untracked(() => this.emailDraft.set(this.email()));
|
||||||
|
});
|
||||||
|
|
||||||
|
effect(() => {
|
||||||
|
const requestId = this.codeRequestId();
|
||||||
|
|
||||||
|
if (requestId === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
untracked(() => this.digits.set(emptyDigits()));
|
||||||
|
});
|
||||||
|
|
||||||
|
effect(() => {
|
||||||
|
if (this.step() !== 'code' || !this.sheetVisible()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
requestAnimationFrame(() =>
|
||||||
|
this.digitFields()[0]?.nativeElement.focus({ preventScroll: true }),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
effect((onCleanup) => {
|
||||||
|
const requestId = this.codeRequestId();
|
||||||
|
|
||||||
|
if (requestId === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let left = RESEND_SECONDS;
|
||||||
|
untracked(() => this.secondsLeft.set(left));
|
||||||
|
|
||||||
|
const timerId = window.setInterval(() => {
|
||||||
|
left -= 1;
|
||||||
|
const next = Math.max(left, 0);
|
||||||
|
this.secondsLeft.set(next);
|
||||||
|
|
||||||
|
if (next === 0) {
|
||||||
|
window.clearInterval(timerId);
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
onCleanup(() => window.clearInterval(timerId));
|
||||||
|
});
|
||||||
|
|
||||||
|
this.destroyRef.onDestroy(() => window.clearTimeout(this.closeTimer));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onEmail(event: Event): void {
|
||||||
|
const input = event.target as HTMLInputElement;
|
||||||
|
this.emailDraft.set(input.value);
|
||||||
|
this.store.dispatch(GorodarActions.authErrorCleared());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected requestCode(): void {
|
||||||
|
this.store.dispatch(GorodarActions.authCodeRequested({ email: this.emailDraft() }));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected confirm(): void {
|
||||||
|
this.store.dispatch(GorodarActions.authCodeConfirmed({ code: this.digits().join('') }));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected resend(): void {
|
||||||
|
if (this.secondsLeft() > 0 || this.pending()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.store.dispatch(GorodarActions.authCodeRequested({ email: this.email() }));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected changeEmail(): void {
|
||||||
|
this.store.dispatch(GorodarActions.authEmailChangeRequested());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected dismiss(): void {
|
||||||
|
window.clearTimeout(this.closeTimer);
|
||||||
|
this.closeTimer = 0;
|
||||||
|
this.dragY.set(0);
|
||||||
|
this.dragging.set(false);
|
||||||
|
this.store.dispatch(GorodarActions.authSheetDismissed());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onDragStart(event: PointerEvent): void {
|
||||||
|
if (!event.isPrimary || event.button !== 0 || !this.canDragFrom(event.target)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sheet = event.currentTarget as HTMLElement;
|
||||||
|
this.pointerId = event.pointerId;
|
||||||
|
this.dragOriginY = event.clientY;
|
||||||
|
this.dragOriginX = event.clientX;
|
||||||
|
this.dragScrollTop = sheet.scrollTop;
|
||||||
|
this.dragFromHandle = this.isHandle(event.target);
|
||||||
|
this.dragTracking = false;
|
||||||
|
this.dragMoved = false;
|
||||||
|
this.dragLastY = event.clientY;
|
||||||
|
this.dragLastTime = event.timeStamp;
|
||||||
|
this.dragVelocity = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onDragMove(event: PointerEvent): void {
|
||||||
|
if (event.pointerId !== this.pointerId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dy = event.clientY - this.dragOriginY;
|
||||||
|
const dx = event.clientX - this.dragOriginX;
|
||||||
|
const sheet = event.currentTarget as HTMLElement;
|
||||||
|
|
||||||
|
if (!this.dragTracking) {
|
||||||
|
if (Math.abs(dy) < 8 && Math.abs(dx) < 8) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pullingDown = dy > 0 && Math.abs(dy) > Math.abs(dx);
|
||||||
|
const atTop = this.dragScrollTop <= 0;
|
||||||
|
|
||||||
|
if (!pullingDown || (!atTop && !this.dragFromHandle)) {
|
||||||
|
this.pointerId = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.dragTracking = true;
|
||||||
|
this.dragMoved = true;
|
||||||
|
this.dragging.set(true);
|
||||||
|
sheet.setPointerCapture(event.pointerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const elapsed = event.timeStamp - this.dragLastTime;
|
||||||
|
|
||||||
|
if (elapsed > 0) {
|
||||||
|
this.dragVelocity = (event.clientY - this.dragLastY) / elapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.dragLastY = event.clientY;
|
||||||
|
this.dragLastTime = event.timeStamp;
|
||||||
|
this.dragY.set(Math.max(0, dy));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onDragEnd(event: PointerEvent): void {
|
||||||
|
if (event.pointerId !== this.pointerId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sheet = event.currentTarget as HTMLElement;
|
||||||
|
const offset = this.dragY();
|
||||||
|
const close =
|
||||||
|
event.type !== 'pointercancel' &&
|
||||||
|
this.dragTracking &&
|
||||||
|
(offset > DISMISS_DISTANCE || (offset > 48 && this.dragVelocity > DISMISS_VELOCITY));
|
||||||
|
|
||||||
|
this.pointerId = null;
|
||||||
|
this.dragTracking = false;
|
||||||
|
this.dragging.set(false);
|
||||||
|
|
||||||
|
if (this.dragMoved) {
|
||||||
|
const stopClick = (clickEvent: Event): void => {
|
||||||
|
clickEvent.preventDefault();
|
||||||
|
clickEvent.stopPropagation();
|
||||||
|
};
|
||||||
|
sheet.addEventListener('click', stopClick, { capture: true, once: true });
|
||||||
|
this.dragMoved = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!close) {
|
||||||
|
this.dragY.set(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.dragY.set(sheet.getBoundingClientRect().height);
|
||||||
|
window.clearTimeout(this.closeTimer);
|
||||||
|
this.closeTimer = window.setTimeout(() => this.dismiss(), 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
private canDragFrom(target: EventTarget | null): boolean {
|
||||||
|
if (!(target instanceof Element)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.isHandle(target)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return target.closest('input, textarea, button, a, label') == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private isHandle(target: EventTarget | null): boolean {
|
||||||
|
return target instanceof Element && target.closest('.sheet__handle') != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onDigit(index: number, event: Event): void {
|
||||||
|
const input = event.target as HTMLInputElement;
|
||||||
|
const value = input.value.replace(/\D/g, '').slice(-1);
|
||||||
|
input.value = value;
|
||||||
|
|
||||||
|
this.store.dispatch(GorodarActions.authErrorCleared());
|
||||||
|
this.digits.update((current) => {
|
||||||
|
const next = [...current];
|
||||||
|
next[index] = value;
|
||||||
|
return next;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (value && index < this.digits().length - 1) {
|
||||||
|
this.digitFields()[index + 1]?.nativeElement.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onDigitKey(index: number, event: KeyboardEvent): void {
|
||||||
|
if (event.key !== 'Backspace' || this.digits()[index]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const previous = index - 1;
|
||||||
|
|
||||||
|
if (previous < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
this.digits.update((current) => {
|
||||||
|
const next = [...current];
|
||||||
|
next[previous] = '';
|
||||||
|
return next;
|
||||||
|
});
|
||||||
|
this.digitFields()[previous]?.nativeElement.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onPaste(event: ClipboardEvent): void {
|
||||||
|
const text = event.clipboardData?.getData('text') ?? '';
|
||||||
|
const parsed = text.replace(/\D/g, '').slice(0, CODE_LENGTH).split('');
|
||||||
|
|
||||||
|
if (parsed.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
this.digits.set(Array.from({ length: CODE_LENGTH }, (_, index) => parsed[index] ?? ''));
|
||||||
|
|
||||||
|
const focusIndex = Math.min(parsed.length, CODE_LENGTH - 1);
|
||||||
|
this.digitFields()[focusIndex]?.nativeElement.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
@HostListener('document:keydown.escape')
|
||||||
|
protected onEscape(): void {
|
||||||
|
if (this.sheetVisible()) {
|
||||||
|
this.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
@if (claim().stage === 'check' && claim().photo; as image) {
|
||||||
|
<app-photo-check [photo]="image" [title]="landmark().name" [step]="claim().step" />
|
||||||
|
} @else if (claim().stage === 'failed') {
|
||||||
|
<app-photo-fail
|
||||||
|
[uncertain]="claim().failure === 'uncertain'"
|
||||||
|
[confidence]="claim().confidence"
|
||||||
|
(retake)="retake()"
|
||||||
|
(back)="leave()"
|
||||||
|
/>
|
||||||
|
} @else if (claim().stage === 'success') {
|
||||||
|
<app-collect-success
|
||||||
|
[title]="landmark().name"
|
||||||
|
[image]="landmark().iconUrl"
|
||||||
|
[model]="landmark().modelUrl || undefined"
|
||||||
|
[alreadyVisited]="claim().alreadyVisited"
|
||||||
|
[cityName]="cityName()"
|
||||||
|
[opened]="opened()"
|
||||||
|
[total]="total()"
|
||||||
|
[areaId]="areaId()"
|
||||||
|
/>
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
|
import type { Attraction } from '../../areas/area.models';
|
||||||
|
import { GorodarActions, selectClaim } from '../../state';
|
||||||
|
import { CollectSuccess } from '../collect-success/collect-success';
|
||||||
|
import { PhotoCheck } from '../photo-check/photo-check';
|
||||||
|
import { PhotoFail } from '../photo-fail/photo-fail';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-claim-flow',
|
||||||
|
imports: [PhotoCheck, PhotoFail, CollectSuccess],
|
||||||
|
templateUrl: './claim-flow.html',
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
})
|
||||||
|
export class ClaimFlow {
|
||||||
|
private readonly store = inject(Store);
|
||||||
|
|
||||||
|
readonly landmark = input.required<Attraction>();
|
||||||
|
readonly cityName = input('');
|
||||||
|
readonly opened = input(0);
|
||||||
|
readonly total = input(1);
|
||||||
|
readonly areaId = input('');
|
||||||
|
|
||||||
|
protected readonly claim = this.store.selectSignal(selectClaim);
|
||||||
|
|
||||||
|
protected retake(): void {
|
||||||
|
this.store.dispatch(GorodarActions.takePhoto({ landmarkId: this.landmark().id }));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected leave(): void {
|
||||||
|
this.store.dispatch(GorodarActions.claimReset());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
<section
|
||||||
|
class="success"
|
||||||
|
[class.success--preview]="mode() === 'preview'"
|
||||||
|
[class.success--model]="model()"
|
||||||
|
>
|
||||||
|
@if (mode() === 'preview') {
|
||||||
|
<button class="success__back" type="button" aria-label="Назад" (click)="goBack()">
|
||||||
|
<app-icon name="chevron-left" [size]="22" />
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (model()) {
|
||||||
|
<div class="success__switch" role="group" aria-label="Вид объекта">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
[class.is-active]="view() === 'image'"
|
||||||
|
[attr.aria-pressed]="view() === 'image'"
|
||||||
|
(click)="showImage()"
|
||||||
|
>
|
||||||
|
Картинка
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
[class.is-active]="view() === 'model'"
|
||||||
|
[attr.aria-pressed]="view() === 'model'"
|
||||||
|
(click)="showModel()"
|
||||||
|
>
|
||||||
|
3D
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="success__glow"></div>
|
||||||
|
|
||||||
|
<div class="success__stamp">
|
||||||
|
<svg class="success__rays anim-rays" viewBox="0 0 340 340" aria-hidden="true">
|
||||||
|
@for (ray of rays; track $index) {
|
||||||
|
<line
|
||||||
|
[attr.x1]="ray.x1"
|
||||||
|
[attr.y1]="ray.y1"
|
||||||
|
[attr.x2]="ray.x2"
|
||||||
|
[attr.y2]="ray.y2"
|
||||||
|
stroke="#E0B84F"
|
||||||
|
[attr.stroke-width]="ray.strong ? 2.5 : 1.5"
|
||||||
|
[attr.opacity]="ray.strong ? 0.5 : 0.28"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
</svg>
|
||||||
|
<span class="success__spark success__spark--a"></span>
|
||||||
|
<span class="success__spark success__spark--b"></span>
|
||||||
|
<span class="success__spark success__spark--c"></span>
|
||||||
|
<span class="success__spark success__spark--d"></span>
|
||||||
|
<div class="success__mark anim-pop" [class.success__mark--model]="model()">
|
||||||
|
@if (model(); as src) {
|
||||||
|
<model-viewer
|
||||||
|
#viewer
|
||||||
|
class="success__model"
|
||||||
|
[class.success__model--off]="view() !== 'model'"
|
||||||
|
[attr.src]="src"
|
||||||
|
[attr.alt]="title()"
|
||||||
|
auto-rotate
|
||||||
|
auto-rotate-delay="0"
|
||||||
|
camera-controls
|
||||||
|
environment-image="neutral"
|
||||||
|
shadow-intensity="0.7"
|
||||||
|
exposure="1.05"
|
||||||
|
interaction-prompt="auto"
|
||||||
|
reveal="auto"
|
||||||
|
></model-viewer>
|
||||||
|
}
|
||||||
|
@if (!model() || view() === 'image') {
|
||||||
|
<img [src]="image()" [alt]="title()" />
|
||||||
|
}
|
||||||
|
@if (model() && view() === 'model' && !modelLoaded()) {
|
||||||
|
<div class="success__loader" role="status" aria-live="polite">
|
||||||
|
<span class="success__spinner anim-spinner" aria-hidden="true"></span>
|
||||||
|
<span>Загрузка</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (mode() === 'preview') {
|
||||||
|
<h1 class="success__title">{{ title() }}</h1>
|
||||||
|
} @else {
|
||||||
|
<div class="success__copy">
|
||||||
|
<p class="success__eyebrow">
|
||||||
|
{{ alreadyVisited() ? 'Уже в коллекции' : 'Новое в коллекции' }}
|
||||||
|
</p>
|
||||||
|
<h1>{{ title() }}</h1>
|
||||||
|
<p>
|
||||||
|
{{
|
||||||
|
alreadyVisited()
|
||||||
|
? 'Этот объект уже был в коллекции «' + cityName() + '»'
|
||||||
|
: 'Добавлено в коллекцию «' + cityName() + '»'
|
||||||
|
}}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="success__card anim-rise">
|
||||||
|
<div class="success__row">
|
||||||
|
<span>{{ cityName() }}</span>
|
||||||
|
<span>
|
||||||
|
<b>{{ opened() }} из {{ total() }}</b>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="success__bar">
|
||||||
|
<span class="anim-grow" [style.--from]="from() + '%'" [style.--to]="to() + '%'"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="success__actions">
|
||||||
|
<a class="btn" routerLink="/collections" (click)="leave()">Открыть коллекцию</a>
|
||||||
|
<a
|
||||||
|
class="success__ghost"
|
||||||
|
[routerLink]="areaId() ? ['/city', areaId()] : ['/']"
|
||||||
|
(click)="leave()"
|
||||||
|
>Назад</a
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,321 @@
|
|||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
min-height: 100%;
|
||||||
|
background: var(--color-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.success {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 100%;
|
||||||
|
padding: 48px 16px 24px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__glow {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: radial-gradient(circle at 50% 220px, rgb(224 184 79 / 30%), rgb(224 184 79 / 0%) 60%);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__stamp {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
width: min(340px, 88vw);
|
||||||
|
aspect-ratio: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__rays {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__mark {
|
||||||
|
position: absolute;
|
||||||
|
top: 21%;
|
||||||
|
left: 21%;
|
||||||
|
width: 58%;
|
||||||
|
height: 58%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__mark img,
|
||||||
|
.success__model {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: contain;
|
||||||
|
background: transparent;
|
||||||
|
--poster-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__model--off {
|
||||||
|
position: absolute;
|
||||||
|
visibility: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__model::part(default-progress-bar) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__loader {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 2;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 12px;
|
||||||
|
color: var(--color-text-soft);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__spinner {
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 3px solid #312d27;
|
||||||
|
border-top-color: var(--color-accent);
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__switch {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 2;
|
||||||
|
top: 16px;
|
||||||
|
left: 50%;
|
||||||
|
display: flex;
|
||||||
|
gap: 4px;
|
||||||
|
padding: 4px;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: 16px;
|
||||||
|
background: rgb(28 26 23 / 92%);
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__switch button {
|
||||||
|
min-width: 88px;
|
||||||
|
height: 36px;
|
||||||
|
padding: 0 14px;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font: inherit;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__switch button.is-active {
|
||||||
|
background: var(--color-primary);
|
||||||
|
color: var(--color-label);
|
||||||
|
}
|
||||||
|
|
||||||
|
.success--model {
|
||||||
|
padding-top: 72px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__mark--model {
|
||||||
|
top: 6%;
|
||||||
|
left: 6%;
|
||||||
|
width: 88%;
|
||||||
|
height: 88%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__spark {
|
||||||
|
position: absolute;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
background: var(--color-accent-soft);
|
||||||
|
clip-path: polygon(50% 0, 65% 35%, 100% 50%, 65% 65%, 50% 100%, 35% 65%, 0 50%, 35% 35%);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__spark--a {
|
||||||
|
top: 18%;
|
||||||
|
left: 16%;
|
||||||
|
}
|
||||||
|
.success__spark--b {
|
||||||
|
top: 22%;
|
||||||
|
right: 14%;
|
||||||
|
}
|
||||||
|
.success__spark--c {
|
||||||
|
bottom: 16%;
|
||||||
|
left: 20%;
|
||||||
|
}
|
||||||
|
.success__spark--d {
|
||||||
|
bottom: 18%;
|
||||||
|
right: 16%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__copy,
|
||||||
|
.success__card,
|
||||||
|
.success__actions {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 560px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__copy {
|
||||||
|
margin-top: 8px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__eyebrow {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--color-accent);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.12em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__copy h1,
|
||||||
|
.success__title {
|
||||||
|
margin: 8px 0 0;
|
||||||
|
font-family: var(--font-display);
|
||||||
|
font-size: clamp(28px, 8vw, 34px);
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.15;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__title {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
max-width: 560px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success--preview {
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 100dvh;
|
||||||
|
padding: 20px 0 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success--preview.success--model {
|
||||||
|
padding-top: 72px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success--preview.success--model .success__stamp {
|
||||||
|
width: min(100vw, calc(100dvh - 210px));
|
||||||
|
}
|
||||||
|
|
||||||
|
.success--preview .success__stamp {
|
||||||
|
width: min(100vw, calc(100dvh - 148px));
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success--preview .success__mark {
|
||||||
|
top: 14%;
|
||||||
|
left: 14%;
|
||||||
|
width: 72%;
|
||||||
|
height: 72%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success--preview .success__mark--model {
|
||||||
|
top: 2%;
|
||||||
|
left: 2%;
|
||||||
|
width: 96%;
|
||||||
|
height: 96%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success--preview .success__title {
|
||||||
|
margin-top: 4px;
|
||||||
|
padding: 0 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__back {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 2;
|
||||||
|
top: 16px;
|
||||||
|
left: 16px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
padding: 0;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: 14px;
|
||||||
|
background: rgb(28 26 23 / 86%);
|
||||||
|
color: var(--color-text);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__copy p:last-child {
|
||||||
|
margin: 8px 0 0;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__card {
|
||||||
|
margin-top: 24px;
|
||||||
|
padding: 16px;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: 20px;
|
||||||
|
background: var(--color-surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__row span:last-child {
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__row b {
|
||||||
|
color: var(--color-accent-soft);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__bar {
|
||||||
|
height: 8px;
|
||||||
|
margin-top: 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #2e2a24;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__bar span {
|
||||||
|
display: block;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: var(--color-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__actions {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success__ghost {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 48px;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 500;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
import { Location } from '@angular/common';
|
||||||
|
import {
|
||||||
|
ChangeDetectionStrategy,
|
||||||
|
Component,
|
||||||
|
CUSTOM_ELEMENTS_SCHEMA,
|
||||||
|
ElementRef,
|
||||||
|
NgZone,
|
||||||
|
computed,
|
||||||
|
effect,
|
||||||
|
inject,
|
||||||
|
input,
|
||||||
|
signal,
|
||||||
|
untracked,
|
||||||
|
viewChild,
|
||||||
|
} from '@angular/core';
|
||||||
|
import { Router, RouterLink } from '@angular/router';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
|
import { Icon } from '../../shared/icon/icon';
|
||||||
|
import { GorodarActions } from '../../state';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-collect-success',
|
||||||
|
imports: [Icon, RouterLink],
|
||||||
|
templateUrl: './collect-success.html',
|
||||||
|
styleUrl: './collect-success.scss',
|
||||||
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
})
|
||||||
|
export class CollectSuccess {
|
||||||
|
private readonly store = inject(Store);
|
||||||
|
private readonly location = inject(Location);
|
||||||
|
private readonly router = inject(Router);
|
||||||
|
private readonly zone = inject(NgZone);
|
||||||
|
private readonly viewer = viewChild<ElementRef<ModelViewerElement>>('viewer');
|
||||||
|
|
||||||
|
readonly mode = input<'claim' | 'preview'>('claim');
|
||||||
|
readonly title = input.required<string>();
|
||||||
|
readonly image = input.required<string>();
|
||||||
|
readonly model = input<string | undefined>(undefined);
|
||||||
|
readonly cityName = input('');
|
||||||
|
readonly opened = input(0);
|
||||||
|
readonly total = input(1);
|
||||||
|
readonly areaId = input('');
|
||||||
|
readonly alreadyVisited = input(false);
|
||||||
|
|
||||||
|
protected readonly view = signal<'model' | 'image'>('image');
|
||||||
|
protected readonly modelLoaded = signal(false);
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
effect(() => {
|
||||||
|
const src = this.model();
|
||||||
|
|
||||||
|
untracked(() => {
|
||||||
|
this.view.set('image');
|
||||||
|
this.modelLoaded.set(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!src) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void import('@google/model-viewer/dist/model-viewer.min.js');
|
||||||
|
});
|
||||||
|
|
||||||
|
effect((onCleanup) => {
|
||||||
|
const element = this.viewer()?.nativeElement;
|
||||||
|
|
||||||
|
if (!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const markLoaded = (): void => {
|
||||||
|
this.zone.run(() => this.modelLoaded.set(true));
|
||||||
|
};
|
||||||
|
|
||||||
|
if (element.loaded) {
|
||||||
|
markLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
|
element.addEventListener('load', markLoaded);
|
||||||
|
onCleanup(() => element.removeEventListener('load', markLoaded));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected showModel(): void {
|
||||||
|
this.view.set('model');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected showImage(): void {
|
||||||
|
this.view.set('image');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected readonly from = computed(() => {
|
||||||
|
const total = this.total();
|
||||||
|
if (total <= 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return Math.max(0, Math.round(((this.opened() - 1) / total) * 100));
|
||||||
|
});
|
||||||
|
protected readonly to = computed(() => {
|
||||||
|
const total = this.total();
|
||||||
|
if (total <= 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return Math.round((this.opened() / total) * 100);
|
||||||
|
});
|
||||||
|
|
||||||
|
protected readonly rays = Array.from({ length: 24 }, (_, index) => {
|
||||||
|
const angle = (index / 24) * Math.PI * 2;
|
||||||
|
const inner = 96;
|
||||||
|
const outer = index % 2 === 0 ? 168 : 138;
|
||||||
|
|
||||||
|
return {
|
||||||
|
x1: 170 + Math.cos(angle) * inner,
|
||||||
|
y1: 170 + Math.sin(angle) * inner,
|
||||||
|
x2: 170 + Math.cos(angle) * outer,
|
||||||
|
y2: 170 + Math.sin(angle) * outer,
|
||||||
|
strong: index % 2 === 0,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
protected leave(): void {
|
||||||
|
this.store.dispatch(GorodarActions.claimReset());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected goBack(): void {
|
||||||
|
if (window.history.length > 1) {
|
||||||
|
this.location.back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const areaId = this.areaId();
|
||||||
|
void this.router.navigate(areaId ? ['/city', areaId] : ['/']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ModelViewerElement extends HTMLElement {
|
||||||
|
loaded: boolean;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<section class="check">
|
||||||
|
<div class="check__frame">
|
||||||
|
<img [src]="photo()" [alt]="title()" />
|
||||||
|
<span class="check__scan anim-scan"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h1>Проверяем фото</h1>
|
||||||
|
<p>Сверяем снимок с эталоном</p>
|
||||||
|
|
||||||
|
<ol class="steps">
|
||||||
|
@for (item of items(); track item.title) {
|
||||||
|
<li [class.steps__item--done]="item.state === 'done'" [class.steps__item--active]="item.state === 'active'">
|
||||||
|
@if (item.state === 'done') {
|
||||||
|
<span class="steps__mark steps__mark--done">
|
||||||
|
<app-icon name="check" [size]="18" />
|
||||||
|
</span>
|
||||||
|
} @else if (item.state === 'active') {
|
||||||
|
<span class="steps__mark steps__mark--spin anim-spinner"></span>
|
||||||
|
} @else {
|
||||||
|
<span class="steps__mark"></span>
|
||||||
|
}
|
||||||
|
<div>
|
||||||
|
<b>{{ item.title }}</b>
|
||||||
|
<span>{{ item.text }}</span>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
</ol>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
min-height: 100%;
|
||||||
|
background: var(--color-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.check {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 100%;
|
||||||
|
padding: 40px 24px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.check__frame {
|
||||||
|
position: relative;
|
||||||
|
width: min(240px, 64vw);
|
||||||
|
height: min(320px, 42vh);
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid var(--color-accent-strong);
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.check__frame img {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.check__scan {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
height: 3px;
|
||||||
|
background: var(--color-accent-soft);
|
||||||
|
box-shadow: 0 0 18px 4px rgb(242 217 142 / 55%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.check h1 {
|
||||||
|
margin: 28px 0 0;
|
||||||
|
font-family: var(--font-display);
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 700;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.check > p {
|
||||||
|
margin: 6px 0 0;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 15px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-self: stretch;
|
||||||
|
gap: 18px;
|
||||||
|
margin: 28px 0 0;
|
||||||
|
padding: 20px;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: 20px;
|
||||||
|
background: var(--color-surface);
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps li {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps__mark {
|
||||||
|
flex: none;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 2px solid #312d27;
|
||||||
|
border-radius: 15px;
|
||||||
|
|
||||||
|
app-icon {
|
||||||
|
display: flex;
|
||||||
|
height: 100%;
|
||||||
|
align-items: center;
|
||||||
|
color: var(--color-surface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps__mark--spin {
|
||||||
|
border-width: 3px;
|
||||||
|
border-top-color: var(--color-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps__mark--done {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border: 0;
|
||||||
|
background: var(--color-accent);
|
||||||
|
color: var(--color-on-accent);
|
||||||
|
animation: step-pop 0.35s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes step-pop {
|
||||||
|
from {
|
||||||
|
transform: scale(0.4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps b,
|
||||||
|
.steps span {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps b {
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--color-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps span {
|
||||||
|
margin-top: 2px;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps__item--done b,
|
||||||
|
.steps__item--active b {
|
||||||
|
color: var(--color-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.steps__mark--done {
|
||||||
|
animation: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
||||||
|
|
||||||
|
import { Icon } from '../../shared/icon/icon';
|
||||||
|
|
||||||
|
type StepState = 'done' | 'active' | 'wait';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-photo-check',
|
||||||
|
imports: [Icon],
|
||||||
|
templateUrl: './photo-check.html',
|
||||||
|
styleUrl: './photo-check.scss',
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
})
|
||||||
|
export class PhotoCheck {
|
||||||
|
readonly photo = input.required<string>();
|
||||||
|
readonly title = input.required<string>();
|
||||||
|
readonly step = input(0);
|
||||||
|
|
||||||
|
protected readonly items = computed(() => {
|
||||||
|
const step = this.step();
|
||||||
|
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
title: 'Фото отправлено',
|
||||||
|
text: step >= 1 ? 'Снимок получен сервисом' : 'Готовим снимок',
|
||||||
|
state: stepState(step, 0),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Сравниваем с эталонами',
|
||||||
|
text: `Ищем совпадение с ${this.title()}`,
|
||||||
|
state: stepState(step, 1),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Добавляем в коллекцию',
|
||||||
|
text: 'Объект появится в вашей коллекции',
|
||||||
|
state: stepState(step, 2),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function stepState(step: number, index: number): StepState {
|
||||||
|
if (step > index) {
|
||||||
|
return 'done';
|
||||||
|
}
|
||||||
|
|
||||||
|
return step === index ? 'active' : 'wait';
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<section class="fail">
|
||||||
|
<header class="fail__top">
|
||||||
|
<button class="fail__back" type="button" aria-label="К карточке объекта" (click)="back.emit()">
|
||||||
|
<app-icon name="chevron-left" [size]="22" />
|
||||||
|
</button>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="fail__body">
|
||||||
|
<div class="fail__cross">
|
||||||
|
<img src="/assets/icons/cross.svg" alt="" width="80" height="80" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h1>{{ uncertain() ? 'Снимок неоднозначный' : 'Не получилось подтвердить' }}</h1>
|
||||||
|
|
||||||
|
@if (confidence() !== null) {
|
||||||
|
<div class="match">
|
||||||
|
<div class="match__head">
|
||||||
|
<span>Совпадение с эталонами</span>
|
||||||
|
<b class="match__value" [class.match__value--met]="shownPercent() >= requiredPercent">{{ shownPercent() }}%</b>
|
||||||
|
</div>
|
||||||
|
<div class="match__track">
|
||||||
|
<div class="match__fill" [style.width.%]="shownPercent()"></div>
|
||||||
|
<span class="match__mark" [style.left.%]="requiredPercent"></span>
|
||||||
|
<span class="match__need" [style.left.%]="requiredPercent">нужно от {{ requiredPercent }}%</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<ul class="fail__tips">
|
||||||
|
@for (tip of tips; track tip) {
|
||||||
|
<li>
|
||||||
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
||||||
|
<path d="M3 12 a9 9 0 1 0 18 0 a9 9 0 1 0 -18 0" stroke="currentColor" stroke-width="1.8" />
|
||||||
|
<path d="M12 11 V17 M12 7.5 V7.6" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" />
|
||||||
|
</svg>
|
||||||
|
<span>{{ tip }}</span>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer class="fail__actions">
|
||||||
|
<button class="btn" type="button" (click)="retake.emit()">
|
||||||
|
<app-icon name="camera" [size]="24" />
|
||||||
|
Сделать новое фото
|
||||||
|
</button>
|
||||||
|
<button class="fail__leave" type="button" (click)="back.emit()">Вернуться к карточке</button>
|
||||||
|
</footer>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,175 @@
|
|||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
min-height: 100%;
|
||||||
|
background: var(--color-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fail {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 100dvh;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 16px 16px calc(28px + env(safe-area-inset-bottom));
|
||||||
|
}
|
||||||
|
|
||||||
|
.fail__top {
|
||||||
|
padding: 0 0 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fail__back {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
padding: 0;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: 14px;
|
||||||
|
background: rgb(28 26 23 / 86%);
|
||||||
|
color: var(--color-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fail__body {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 8px 8px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fail__cross {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fail h1 {
|
||||||
|
margin: 28px 0 0;
|
||||||
|
font-family: var(--font-display);
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.2;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.match {
|
||||||
|
align-self: stretch;
|
||||||
|
margin-top: 22px;
|
||||||
|
padding: 16px 16px 14px;
|
||||||
|
border: 1px solid rgb(255 255 255 / 8%);
|
||||||
|
border-radius: 16px;
|
||||||
|
background: #161513;
|
||||||
|
animation: match-in 0.45s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.match__head {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.match__value {
|
||||||
|
color: #f0876a;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.match__value--met {
|
||||||
|
color: var(--color-accent-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
.match__track {
|
||||||
|
position: relative;
|
||||||
|
height: 8px;
|
||||||
|
margin: 14px 0 26px;
|
||||||
|
border-radius: 99px;
|
||||||
|
background: #3a342e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.match__fill {
|
||||||
|
height: 100%;
|
||||||
|
border-radius: inherit;
|
||||||
|
background: #efb0a0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes match-in {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(10px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.match__mark {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
z-index: 1;
|
||||||
|
width: 2px;
|
||||||
|
height: 18px;
|
||||||
|
background: #fff;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.match__need {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 6px);
|
||||||
|
color: #9c958a;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.2;
|
||||||
|
white-space: nowrap;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.match {
|
||||||
|
animation: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fail__tips {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-self: stretch;
|
||||||
|
gap: 10px;
|
||||||
|
margin: 28px 0 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
color: #ddd6c8;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fail__tips li {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fail__tips svg {
|
||||||
|
flex: none;
|
||||||
|
margin-top: 2px;
|
||||||
|
color: var(--color-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fail__actions {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fail__leave {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 10px;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 48px;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 16px;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import {
|
||||||
|
afterNextRender,
|
||||||
|
ChangeDetectionStrategy,
|
||||||
|
Component,
|
||||||
|
computed,
|
||||||
|
input,
|
||||||
|
output,
|
||||||
|
signal,
|
||||||
|
} from '@angular/core';
|
||||||
|
|
||||||
|
import { Icon } from '../../shared/icon/icon';
|
||||||
|
|
||||||
|
const COUNTER_MS = 1200;
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-photo-fail',
|
||||||
|
imports: [Icon],
|
||||||
|
templateUrl: './photo-fail.html',
|
||||||
|
styleUrl: './photo-fail.scss',
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
})
|
||||||
|
export class PhotoFail {
|
||||||
|
readonly uncertain = input(false);
|
||||||
|
readonly confidence = input.required<number | null>();
|
||||||
|
readonly retake = output<void>();
|
||||||
|
readonly back = output<void>();
|
||||||
|
|
||||||
|
protected readonly requiredPercent = 55;
|
||||||
|
protected readonly percent = computed(() => confidencePercent(this.confidence()));
|
||||||
|
protected readonly shownPercent = signal(0);
|
||||||
|
|
||||||
|
protected readonly tips = [
|
||||||
|
'Фотографируйте из точки указанной карте.',
|
||||||
|
'Постарайтесь чтобы объект попал в кадр полностью.',
|
||||||
|
'Снимайте при хорошем свете, без пальце в кадре.',
|
||||||
|
];
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
afterNextRender(() => this.playCounter());
|
||||||
|
}
|
||||||
|
|
||||||
|
private playCounter(): void {
|
||||||
|
const target = this.percent();
|
||||||
|
const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||||
|
|
||||||
|
if (target === 0 || reduceMotion) {
|
||||||
|
this.shownPercent.set(target);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const started = performance.now();
|
||||||
|
const tick = (now: number) => {
|
||||||
|
const progress = Math.min(1, (now - started) / COUNTER_MS);
|
||||||
|
this.shownPercent.set(Math.round(target * progress));
|
||||||
|
|
||||||
|
if (progress < 1) {
|
||||||
|
requestAnimationFrame(tick);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
requestAnimationFrame(tick);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function confidencePercent(confidence: number | null): number {
|
||||||
|
if (confidence === null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const value = confidence <= 1 ? confidence * 100 : confidence;
|
||||||
|
return Math.max(0, Math.min(100, Math.round(value)));
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<nav class="nav" aria-label="Основная навигация">
|
||||||
|
@for (item of items; track item.path) {
|
||||||
|
<a
|
||||||
|
class="nav__item"
|
||||||
|
[routerLink]="item.path"
|
||||||
|
[class.nav__item--active]="isActive(item.path, item.exact)"
|
||||||
|
>
|
||||||
|
<app-icon [name]="item.icon" [size]="24" />
|
||||||
|
<span>{{ item.label }}</span>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
|
</nav>
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
flex: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
align-items: stretch;
|
||||||
|
gap: 8px;
|
||||||
|
min-height: var(--nav-height);
|
||||||
|
padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
|
||||||
|
border-top: 1px solid var(--color-border);
|
||||||
|
background: rgb(18 17 15 / 96%);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav__item {
|
||||||
|
display: flex;
|
||||||
|
flex: 1 1 0;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 4px;
|
||||||
|
min-width: 0;
|
||||||
|
min-height: 44px;
|
||||||
|
padding: 4px 2px;
|
||||||
|
border-radius: 12px;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
text-decoration: none;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav__item--active {
|
||||||
|
color: var(--color-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (display-mode: standalone), (display-mode: fullscreen) {
|
||||||
|
.nav {
|
||||||
|
align-items: center;
|
||||||
|
min-height: 0;
|
||||||
|
padding: 4px 12px max(8px, calc(env(safe-area-inset-bottom) - 10px));
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav__item {
|
||||||
|
gap: 2px;
|
||||||
|
padding: 4px 2px 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
|
||||||
|
import { toSignal } from '@angular/core/rxjs-interop';
|
||||||
|
import { NavigationEnd, Router, RouterLink } from '@angular/router';
|
||||||
|
import { filter, map, startWith } from 'rxjs';
|
||||||
|
|
||||||
|
import { Icon } from '../../shared/icon/icon';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-bottom-nav',
|
||||||
|
imports: [RouterLink, Icon],
|
||||||
|
templateUrl: './bottom-nav.html',
|
||||||
|
styleUrl: './bottom-nav.scss',
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
})
|
||||||
|
export class BottomNav {
|
||||||
|
private readonly router = inject(Router);
|
||||||
|
private readonly url = toSignal(
|
||||||
|
this.router.events.pipe(
|
||||||
|
filter((event): event is NavigationEnd => event instanceof NavigationEnd),
|
||||||
|
map(() => this.router.url.split('?')[0]),
|
||||||
|
startWith(this.router.url.split('?')[0]),
|
||||||
|
),
|
||||||
|
{ initialValue: this.router.url.split('?')[0] },
|
||||||
|
);
|
||||||
|
|
||||||
|
protected readonly items = [
|
||||||
|
{ path: '/', icon: 'cities', label: 'Города', exact: true },
|
||||||
|
{ path: '/collections', icon: 'collection', label: 'Коллекция', exact: false },
|
||||||
|
];
|
||||||
|
|
||||||
|
protected isActive(path: string, exact: boolean): boolean {
|
||||||
|
const url = this.url();
|
||||||
|
if (path === '/') {
|
||||||
|
return url === '/' || /^\/city\/[^/]+$/.test(url);
|
||||||
|
}
|
||||||
|
if (exact) {
|
||||||
|
return url === path;
|
||||||
|
}
|
||||||
|
return url === path || url.startsWith(`${path}/`);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<div class="city-map">
|
||||||
|
<div #map class="city-map__canvas"></div>
|
||||||
|
|
||||||
|
<div class="city-map__hud">
|
||||||
|
@if (!embedded() && !fullscreen()) {
|
||||||
|
<button
|
||||||
|
class="city-map__chip"
|
||||||
|
type="button"
|
||||||
|
[attr.aria-label]="'Показать центр: ' + (cityName() || 'Город')"
|
||||||
|
(click)="focusCity()"
|
||||||
|
>
|
||||||
|
<app-icon name="pin" [size]="18" />
|
||||||
|
<span>{{ cityName() || 'Город' }}</span>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="city-map__tools">
|
||||||
|
@if (embedded()) {
|
||||||
|
<button
|
||||||
|
class="city-map__locate"
|
||||||
|
type="button"
|
||||||
|
[attr.aria-label]="fullscreen() ? 'Свернуть карту' : 'На весь экран'"
|
||||||
|
(click)="toggleFullscreen()"
|
||||||
|
>
|
||||||
|
<app-icon [name]="fullscreen() ? 'collapse' : 'expand'" [size]="22" />
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="city-map__locate"
|
||||||
|
type="button"
|
||||||
|
[class.city-map__locate--active]="following()"
|
||||||
|
[attr.aria-label]="following() ? 'Остановить навигацию' : 'Моя геопозиция'"
|
||||||
|
(click)="locate()"
|
||||||
|
>
|
||||||
|
<app-icon name="my-location" [size]="22" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (selected(); as landmark) {
|
||||||
|
<div class="city-map__sheet">
|
||||||
|
<app-map-item-sheet [attraction]="landmark" [areaId]="areaId()" />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
:host.is-fullscreen {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 40;
|
||||||
|
inset: 0;
|
||||||
|
height: 100%;
|
||||||
|
background: var(--color-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-map {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
background: var(--color-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-map__canvas {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-map__hud {
|
||||||
|
position: absolute;
|
||||||
|
top: 16px;
|
||||||
|
right: 16px;
|
||||||
|
left: 16px;
|
||||||
|
z-index: 2;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-map__tools {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-map__chip,
|
||||||
|
.city-map__locate,
|
||||||
|
.city-map__back {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 48px;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: 24px;
|
||||||
|
background: rgb(28 26 23 / 94%);
|
||||||
|
color: var(--color-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-map__chip,
|
||||||
|
.city-map__back {
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-map__back {
|
||||||
|
justify-content: center;
|
||||||
|
width: 48px;
|
||||||
|
padding: 0;
|
||||||
|
border-radius: 14px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-map__chip {
|
||||||
|
gap: 8px;
|
||||||
|
padding: 0 16px;
|
||||||
|
font: inherit;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--color-accent);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-map__chip app-icon:last-child {
|
||||||
|
color: var(--color-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-map__chip span {
|
||||||
|
color: var(--color-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-map__locate {
|
||||||
|
justify-content: center;
|
||||||
|
width: 48px;
|
||||||
|
padding: 0;
|
||||||
|
color: var(--color-accent);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-map__locate--active {
|
||||||
|
border-color: var(--color-accent-strong);
|
||||||
|
background: var(--color-surface-2);
|
||||||
|
color: var(--color-accent-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-map__sheet {
|
||||||
|
position: absolute;
|
||||||
|
right: 16px;
|
||||||
|
bottom: 16px;
|
||||||
|
left: 16px;
|
||||||
|
z-index: 3;
|
||||||
|
}
|
||||||
@@ -0,0 +1,569 @@
|
|||||||
|
import {
|
||||||
|
AfterViewInit,
|
||||||
|
ChangeDetectionStrategy,
|
||||||
|
Component,
|
||||||
|
ElementRef,
|
||||||
|
HostListener,
|
||||||
|
NgZone,
|
||||||
|
OnDestroy,
|
||||||
|
ViewChild,
|
||||||
|
effect,
|
||||||
|
inject,
|
||||||
|
input,
|
||||||
|
signal,
|
||||||
|
} from '@angular/core';
|
||||||
|
import { Geolocation, type Position } from '@capacitor/geolocation';
|
||||||
|
|
||||||
|
import type { Attraction } from '../../areas/area.models';
|
||||||
|
import { Icon } from '../../shared/icon/icon';
|
||||||
|
import { MapItemSheet } from '../map-item-sheet/map-item-sheet';
|
||||||
|
|
||||||
|
const MAP_KEY = '35e12bfe-922e-4ec1-bb89-ad404cbf8378';
|
||||||
|
const CITY_CENTER: [number, number] = [43.99934, 56.329399];
|
||||||
|
const CITY_ZOOM = 16;
|
||||||
|
const USER_ZOOM = 20;
|
||||||
|
const LANDMARK_SIZE = 40;
|
||||||
|
const USER_SIZE = 32;
|
||||||
|
|
||||||
|
interface DgPoint {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DgMarker {
|
||||||
|
addTo(map: DgMap): this;
|
||||||
|
remove(): void;
|
||||||
|
setLatLng(latLng: [number, number]): this;
|
||||||
|
setZIndexOffset(offset: number): this;
|
||||||
|
getElement(): HTMLElement | undefined;
|
||||||
|
on(type: string, handler: (event: Event) => void): this;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DgMap {
|
||||||
|
on(type: string, handler: () => void): this;
|
||||||
|
off(type: string, handler: () => void): this;
|
||||||
|
setView(
|
||||||
|
center: [number, number],
|
||||||
|
zoom: number,
|
||||||
|
options?: { animate?: boolean; duration?: number },
|
||||||
|
): this;
|
||||||
|
getZoom(): number;
|
||||||
|
latLngToContainerPoint(latLng: [number, number]): DgPoint;
|
||||||
|
invalidateSize?(): void;
|
||||||
|
remove(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DgLoader {
|
||||||
|
then(resolve: () => void, reject?: (error: unknown) => void): Promise<void>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DgApi {
|
||||||
|
map(element: HTMLElement, options: Record<string, unknown>): DgMap;
|
||||||
|
marker(latLng: [number, number], options: Record<string, unknown>): DgMarker;
|
||||||
|
divIcon(options: Record<string, unknown>): unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
DG?: DgLoader & DgApi;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let rasterApi: Promise<DgApi> | null = null;
|
||||||
|
|
||||||
|
function loadRasterApi(): Promise<DgApi> {
|
||||||
|
if (rasterApi) {
|
||||||
|
return rasterApi;
|
||||||
|
}
|
||||||
|
|
||||||
|
rasterApi = new Promise<DgApi>((resolve, reject) => {
|
||||||
|
const ready = (): void => {
|
||||||
|
const api = window.DG;
|
||||||
|
|
||||||
|
if (!api) {
|
||||||
|
reject(new Error('RasterJS API не загрузился'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void api.then(
|
||||||
|
() => {
|
||||||
|
const readyApi = window.DG;
|
||||||
|
|
||||||
|
if (!readyApi?.map || !readyApi.marker || !readyApi.divIcon) {
|
||||||
|
reject(new Error('RasterJS API не загрузился'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve({
|
||||||
|
map: readyApi.map.bind(readyApi),
|
||||||
|
marker: readyApi.marker.bind(readyApi),
|
||||||
|
divIcon: readyApi.divIcon.bind(readyApi),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
(error: unknown) => reject(error),
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (window.DG) {
|
||||||
|
ready();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const script = document.createElement('script');
|
||||||
|
script.src = `https://maps.api.2gis.ru/2.0/loader.js?pkg=full&lazy=true&skin=dark&key=${MAP_KEY}`;
|
||||||
|
script.async = true;
|
||||||
|
script.onload = ready;
|
||||||
|
script.onerror = () => reject(new Error('Не удалось загрузить RasterJS API'));
|
||||||
|
document.body.appendChild(script);
|
||||||
|
});
|
||||||
|
|
||||||
|
return rasterApi;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-city-map',
|
||||||
|
imports: [Icon, MapItemSheet],
|
||||||
|
templateUrl: './city-map.html',
|
||||||
|
styleUrl: './city-map.scss',
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
host: {
|
||||||
|
'[class.is-fullscreen]': 'fullscreen()',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
export class CityMap implements AfterViewInit, OnDestroy {
|
||||||
|
@ViewChild('map', { static: true })
|
||||||
|
private mapElement!: ElementRef<HTMLElement>;
|
||||||
|
|
||||||
|
private readonly zone = inject(NgZone);
|
||||||
|
private raster: DgApi | null = null;
|
||||||
|
private map: DgMap | null = null;
|
||||||
|
private userMarker: DgMarker | null = null;
|
||||||
|
private userMarkerElement: HTMLElement | null = null;
|
||||||
|
private watchId: string | null = null;
|
||||||
|
private lastPosition: Position | null = null;
|
||||||
|
private zoomOnNextPan = true;
|
||||||
|
private destroyed = false;
|
||||||
|
private programmaticMove = false;
|
||||||
|
private resizeObserver: ResizeObserver | null = null;
|
||||||
|
private readonly hostRef = inject(ElementRef<HTMLElement>);
|
||||||
|
private readonly clippedAncestors: HTMLElement[] = [];
|
||||||
|
private readonly markerElements = new Map<string, HTMLElement>();
|
||||||
|
private readonly markers = new Map<string, DgMarker>();
|
||||||
|
private readonly mapReady = signal(false);
|
||||||
|
private placedKey = '';
|
||||||
|
private readonly stopFollowing = (): void => {
|
||||||
|
this.programmaticMove = false;
|
||||||
|
this.zone.run(() => this.following.set(false));
|
||||||
|
};
|
||||||
|
private readonly onZoomStart = (): void => {
|
||||||
|
if (this.programmaticMove) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.stopFollowing();
|
||||||
|
};
|
||||||
|
private readonly onMoveEnd = (): void => {
|
||||||
|
this.programmaticMove = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
readonly embedded = input(false);
|
||||||
|
readonly cityName = input('');
|
||||||
|
readonly areaId = input('');
|
||||||
|
readonly attractions = input<Attraction[]>([]);
|
||||||
|
|
||||||
|
protected readonly selected = signal<Attraction | null>(null);
|
||||||
|
protected readonly following = signal(false);
|
||||||
|
protected readonly fullscreen = signal(false);
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
effect(() => {
|
||||||
|
const items = this.attractions();
|
||||||
|
|
||||||
|
if (!this.mapReady()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.placeMarkers(items);
|
||||||
|
});
|
||||||
|
|
||||||
|
effect(() => {
|
||||||
|
const active = this.fullscreen();
|
||||||
|
this.setAncestorOverflow(active);
|
||||||
|
requestAnimationFrame(() => this.resizeMap());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async ngAfterViewInit(): Promise<void> {
|
||||||
|
this.resizeObserver = new ResizeObserver(() => this.resizeMap());
|
||||||
|
this.resizeObserver.observe(this.mapElement.nativeElement);
|
||||||
|
|
||||||
|
const api = await loadRasterApi();
|
||||||
|
this.raster = api;
|
||||||
|
|
||||||
|
if (this.destroyed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.zone.runOutsideAngular(() => {
|
||||||
|
const raster = this.raster;
|
||||||
|
|
||||||
|
if (this.destroyed || !raster) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const map = raster.map(this.mapElement.nativeElement, {
|
||||||
|
center: this.toLatLng(this.focusCenter(this.attractions())),
|
||||||
|
zoom: CITY_ZOOM,
|
||||||
|
key: MAP_KEY,
|
||||||
|
currentLang: 'ru',
|
||||||
|
zoomControl: false,
|
||||||
|
fullscreenControl: false,
|
||||||
|
poi: false,
|
||||||
|
geoclicker: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this.destroyed) {
|
||||||
|
map.remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.map = map;
|
||||||
|
map.on('dragstart', this.stopFollowing);
|
||||||
|
map.on('zoomstart', this.onZoomStart);
|
||||||
|
map.on('moveend', this.onMoveEnd);
|
||||||
|
|
||||||
|
this.zone.run(() => this.mapReady.set(true));
|
||||||
|
requestAnimationFrame(() => this.resizeMap());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
this.destroyed = true;
|
||||||
|
this.setAncestorOverflow(false);
|
||||||
|
this.resizeObserver?.disconnect();
|
||||||
|
void this.stopWatching();
|
||||||
|
this.map?.off('dragstart', this.stopFollowing);
|
||||||
|
this.map?.off('zoomstart', this.onZoomStart);
|
||||||
|
this.map?.off('moveend', this.onMoveEnd);
|
||||||
|
this.map?.remove();
|
||||||
|
this.map = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected toggleFullscreen(): void {
|
||||||
|
this.fullscreen.update((active) => !active);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected exitFullscreen(): void {
|
||||||
|
this.fullscreen.set(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@HostListener('document:keydown.escape')
|
||||||
|
protected onEscape(): void {
|
||||||
|
this.exitFullscreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected focusCity(): void {
|
||||||
|
this.following.set(false);
|
||||||
|
this.clearSelection();
|
||||||
|
this.moveMap(this.focusCenter(this.attractions()), CITY_ZOOM, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async locate(): Promise<void> {
|
||||||
|
if (!this.map) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.following()) {
|
||||||
|
this.following.set(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.watchId && this.lastPosition) {
|
||||||
|
this.zoomOnNextPan = true;
|
||||||
|
this.following.set(true);
|
||||||
|
this.updateUserPosition(this.lastPosition, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const position = await Geolocation.getCurrentPosition({
|
||||||
|
enableHighAccuracy: true,
|
||||||
|
timeout: 30_000,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.zoomOnNextPan = true;
|
||||||
|
this.following.set(true);
|
||||||
|
this.updateUserPosition(position, true);
|
||||||
|
this.watchId = await Geolocation.watchPosition(
|
||||||
|
{ enableHighAccuracy: true },
|
||||||
|
(next, error) => {
|
||||||
|
if (error || !next) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.zone.run(() => this.updateUserPosition(next, this.following()));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
this.following.set(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private updateUserPosition(position: Position, pan: boolean): void {
|
||||||
|
const map = this.map;
|
||||||
|
|
||||||
|
if (!map) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lastPosition = position;
|
||||||
|
const coordinates: [number, number] = [position.coords.longitude, position.coords.latitude];
|
||||||
|
const heading = position.coords.heading;
|
||||||
|
|
||||||
|
const raster = this.raster;
|
||||||
|
|
||||||
|
if (!this.userMarker && raster) {
|
||||||
|
const markerElement = document.createElement('div');
|
||||||
|
markerElement.className = 'city-map__user';
|
||||||
|
markerElement.innerHTML =
|
||||||
|
'<span class="city-map__user-body"><span class="city-map__user-heading"></span><span class="city-map__user-dot"></span></span>';
|
||||||
|
this.userMarkerElement = markerElement;
|
||||||
|
this.userMarker = this.addHtmlMarker(
|
||||||
|
raster,
|
||||||
|
map,
|
||||||
|
coordinates,
|
||||||
|
markerElement,
|
||||||
|
USER_SIZE,
|
||||||
|
3,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.userMarker?.setLatLng(this.toLatLng(coordinates));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (heading != null && !Number.isNaN(heading) && this.userMarkerElement) {
|
||||||
|
this.userMarkerElement.style.setProperty('--heading', `${heading}deg`);
|
||||||
|
this.userMarkerElement.classList.add('city-map__user--headed');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pan) {
|
||||||
|
this.moveMap(coordinates, this.zoomOnNextPan ? USER_ZOOM : null, 400);
|
||||||
|
this.zoomOnNextPan = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async stopWatching(): Promise<void> {
|
||||||
|
if (!this.watchId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await Geolocation.clearWatch({ id: this.watchId });
|
||||||
|
this.watchId = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private placeMarkers(items: Attraction[]): void {
|
||||||
|
const map = this.map;
|
||||||
|
const api = this.raster;
|
||||||
|
|
||||||
|
if (!map || !api) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const key = items.map((item) => `${item.id}:${item.latitude}:${item.longitude}`).join('|');
|
||||||
|
|
||||||
|
if (key === this.placedKey) {
|
||||||
|
for (const item of items) {
|
||||||
|
const element = this.markerElements.get(item.id);
|
||||||
|
|
||||||
|
if (element) {
|
||||||
|
this.setMarkerIcon(element, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const marker of this.markers.values()) {
|
||||||
|
marker.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.markers.clear();
|
||||||
|
this.markerElements.clear();
|
||||||
|
this.placedKey = key;
|
||||||
|
|
||||||
|
for (const item of items) {
|
||||||
|
if (typeof item.latitude !== 'number' || typeof item.longitude !== 'number') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.markers.set(item.id, this.createMarker(api, map, item));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.markers.size > 0) {
|
||||||
|
this.moveMap(this.focusCenter(items), CITY_ZOOM, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private createMarker(api: DgApi, map: DgMap, item: Attraction): DgMarker {
|
||||||
|
const markerElement = document.createElement('button');
|
||||||
|
markerElement.type = 'button';
|
||||||
|
markerElement.className = 'city-map__marker';
|
||||||
|
markerElement.setAttribute('aria-label', item.name);
|
||||||
|
markerElement.innerHTML = `<span></span><img width="40" height="40" alt="" /><span class="city-map__label"></span>`;
|
||||||
|
// '<span class="city-map__radius"></span><img width="40" height="40" alt="" /><span class="city-map__label"></span>';
|
||||||
|
// Marker with radius
|
||||||
|
// markerElement.innerHTML =
|
||||||
|
// '<span class="city-map__radius"></span><img width="40" height="40" alt="" /><span class="city-map__label"></span>';
|
||||||
|
const label = markerElement.querySelector('.city-map__label');
|
||||||
|
|
||||||
|
if (label) {
|
||||||
|
label.textContent = item.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.markerElements.set(item.id, markerElement);
|
||||||
|
this.setMarkerIcon(markerElement, item);
|
||||||
|
|
||||||
|
const marker = this.addHtmlMarker(
|
||||||
|
api,
|
||||||
|
map,
|
||||||
|
[item.longitude, item.latitude],
|
||||||
|
markerElement,
|
||||||
|
LANDMARK_SIZE,
|
||||||
|
1,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
|
||||||
|
marker.on('click', () => {
|
||||||
|
this.zone.run(() => this.selectLandmark(item));
|
||||||
|
});
|
||||||
|
|
||||||
|
return marker;
|
||||||
|
}
|
||||||
|
|
||||||
|
private focusCenter(items: Attraction[]): [number, number] {
|
||||||
|
const points = items.filter(
|
||||||
|
(item) => typeof item.latitude === 'number' && typeof item.longitude === 'number',
|
||||||
|
);
|
||||||
|
|
||||||
|
if (points.length === 0) {
|
||||||
|
return CITY_CENTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
const longitude = points.reduce((sum, item) => sum + item.longitude, 0) / points.length;
|
||||||
|
const latitude = points.reduce((sum, item) => sum + item.latitude, 0) / points.length;
|
||||||
|
|
||||||
|
return [longitude, latitude];
|
||||||
|
}
|
||||||
|
|
||||||
|
private addHtmlMarker(
|
||||||
|
api: DgApi,
|
||||||
|
map: DgMap,
|
||||||
|
coordinates: [number, number],
|
||||||
|
element: HTMLElement,
|
||||||
|
size: number,
|
||||||
|
zIndexOffset: number,
|
||||||
|
interactive: boolean,
|
||||||
|
): DgMarker {
|
||||||
|
const marker = api.marker(this.toLatLng(coordinates), {
|
||||||
|
icon: api.divIcon({
|
||||||
|
className: 'city-map__pin',
|
||||||
|
html: element,
|
||||||
|
iconSize: [size, size],
|
||||||
|
iconAnchor: [size / 2, size / 2],
|
||||||
|
}),
|
||||||
|
interactive,
|
||||||
|
keyboard: false,
|
||||||
|
zIndexOffset,
|
||||||
|
});
|
||||||
|
|
||||||
|
marker.addTo(map);
|
||||||
|
const root = marker.getElement();
|
||||||
|
|
||||||
|
if (root) {
|
||||||
|
root.style.overflow = 'visible';
|
||||||
|
}
|
||||||
|
|
||||||
|
return marker;
|
||||||
|
}
|
||||||
|
|
||||||
|
private setMarkerIcon(element: HTMLElement, item: Attraction): void {
|
||||||
|
const img = element.querySelector('img');
|
||||||
|
|
||||||
|
if (!img) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const src = item.visited ? '/assets/icons/check-marker.svg' : '/assets/icons/lock-marker.svg';
|
||||||
|
|
||||||
|
if (img.getAttribute('src') !== src) {
|
||||||
|
img.setAttribute('src', src);
|
||||||
|
}
|
||||||
|
|
||||||
|
element.classList.toggle('city-map__marker--open', item.visited);
|
||||||
|
}
|
||||||
|
|
||||||
|
private selectLandmark(landmark: Attraction): void {
|
||||||
|
const alreadySelected = this.selected()?.id === landmark.id;
|
||||||
|
this.selected.set(alreadySelected ? null : landmark);
|
||||||
|
this.syncSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
private clearSelection(): void {
|
||||||
|
this.selected.set(null);
|
||||||
|
this.syncSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
private syncSelection(): void {
|
||||||
|
const selectedId = this.selected()?.id;
|
||||||
|
|
||||||
|
for (const [id, element] of this.markerElements) {
|
||||||
|
const active = id === selectedId;
|
||||||
|
element.classList.toggle('city-map__marker--active', active);
|
||||||
|
this.markers.get(id)?.setZIndexOffset(active ? 2 : 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private moveMap(center: [number, number], zoom: number | null, durationMs: number): void {
|
||||||
|
const map = this.map;
|
||||||
|
|
||||||
|
if (!map) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.programmaticMove = true;
|
||||||
|
map.setView(this.toLatLng(center), zoom ?? map.getZoom(), {
|
||||||
|
animate: true,
|
||||||
|
duration: durationMs / 1000,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private toLatLng(coordinates: [number, number]): [number, number] {
|
||||||
|
return [coordinates[1], coordinates[0]];
|
||||||
|
}
|
||||||
|
|
||||||
|
private resizeMap(): void {
|
||||||
|
this.map?.invalidateSize?.();
|
||||||
|
}
|
||||||
|
|
||||||
|
private setAncestorOverflow(active: boolean): void {
|
||||||
|
for (const element of this.clippedAncestors) {
|
||||||
|
element.style.overflow = '';
|
||||||
|
}
|
||||||
|
this.clippedAncestors.length = 0;
|
||||||
|
document.body.style.overflow = '';
|
||||||
|
|
||||||
|
if (!active) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let node = this.hostRef.nativeElement.parentElement;
|
||||||
|
|
||||||
|
while (node && node !== document.body) {
|
||||||
|
this.clippedAncestors.push(node);
|
||||||
|
node.style.overflow = 'visible';
|
||||||
|
node = node.parentElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.body.style.overflow = 'hidden';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<article class="card">
|
||||||
|
@let lockIcon = '/assets/icons/cell-lock.svg';
|
||||||
|
<div class="card__row" [style.margin-bottom]="attraction().visited ? '0' : '16px'">
|
||||||
|
<img
|
||||||
|
class="card__stamp"
|
||||||
|
[src]="!attraction().visited ? lockIcon : attraction().iconUrl || lockIcon"
|
||||||
|
alt="icon"
|
||||||
|
width="72"
|
||||||
|
height="72"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="card__info">
|
||||||
|
<h2>{{ attraction().name }}</h2>
|
||||||
|
|
||||||
|
<p class="card__status">
|
||||||
|
<app-icon [name]="attraction().visited ? 'check' : 'lock'" [size]="16" />
|
||||||
|
{{ attraction().visited ? 'Получен' : 'Не получен' }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (!attraction().visited) {
|
||||||
|
<a class="btn" [routerLink]="['/city', areaId(), attraction().id]">Открыть карточку</a>
|
||||||
|
}
|
||||||
|
</article>
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
padding: 16px;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: 24px;
|
||||||
|
background: rgb(28 26 23 / 96%);
|
||||||
|
box-shadow: 0 16px 40px rgb(0 0 0 / 40%);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__row {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__stamp {
|
||||||
|
flex: none;
|
||||||
|
width: 72px;
|
||||||
|
height: 72px;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__info h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.2;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__status,
|
||||||
|
.card__geo {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
margin: 8px 0 0;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.35;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__status {
|
||||||
|
color: var(--color-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__geo {
|
||||||
|
color: var(--color-success);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
||||||
|
import { RouterLink } from '@angular/router';
|
||||||
|
|
||||||
|
import type { Attraction } from '../../areas/area.models';
|
||||||
|
import { Icon } from '../../shared/icon/icon';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-map-item-sheet',
|
||||||
|
imports: [Icon, RouterLink],
|
||||||
|
templateUrl: './map-item-sheet.html',
|
||||||
|
styleUrl: './map-item-sheet.scss',
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
})
|
||||||
|
export class MapItemSheet {
|
||||||
|
readonly attraction = input.required<Attraction>();
|
||||||
|
readonly areaId = input('');
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
<section class="page">
|
||||||
|
<div class="page__intro">
|
||||||
|
<h1>Города</h1>
|
||||||
|
<p>Приезжайте на место, снимайте — объект попадёт в вашу коллекцию.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (status() === 'loading' && areas().length === 0) {
|
||||||
|
<p class="cities__status">Загружаем города…</p>
|
||||||
|
} @else if (status() === 'error' && areas().length === 0) {
|
||||||
|
<p class="cities__status">{{ error() }}</p>
|
||||||
|
<button type="button" (click)="reload()">Повторить</button>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="cities">
|
||||||
|
@for (area of areas(); track area.id) {
|
||||||
|
@if (area.attractions.length === 0) {
|
||||||
|
<article class="city-card city-card--soon">
|
||||||
|
<h2>{{ area.name }}</h2>
|
||||||
|
<p>Скоро появится</p>
|
||||||
|
</article>
|
||||||
|
} @else {
|
||||||
|
<a class="city-card" [routerLink]="['/city', area.id]" [attr.aria-label]="area.name">
|
||||||
|
<div class="city-card__top">
|
||||||
|
<div>
|
||||||
|
<h2>{{ area.name }}</h2>
|
||||||
|
<p>
|
||||||
|
Открыто
|
||||||
|
<strong>{{ openedCount(area) }} из {{ totalCount(area) }}</strong>
|
||||||
|
объектов
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="pack__percent anim-percent"
|
||||||
|
[style.--to-p]="progress(area)"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<span>{{ progress(area) }}%</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pack__bar" aria-hidden="true">
|
||||||
|
<span
|
||||||
|
class="anim-grow"
|
||||||
|
[style.--from]="'0%'"
|
||||||
|
[style.--to]="progress(area) + '%'"
|
||||||
|
></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="city-card__cells">
|
||||||
|
@for (attraction of area.attractions; track attraction.id) {
|
||||||
|
<span
|
||||||
|
class="cell"
|
||||||
|
[class.cell--open]="obtained(attraction)"
|
||||||
|
[attr.aria-label]="
|
||||||
|
attraction.name + (obtained(attraction) ? ', получено' : ', не получен')
|
||||||
|
"
|
||||||
|
>
|
||||||
|
@if (obtained(attraction) && attraction.iconUrl) {
|
||||||
|
<img [src]="attraction?.iconUrl" alt="" />
|
||||||
|
} @else {
|
||||||
|
<div
|
||||||
|
class="icon-wrapper"
|
||||||
|
[class.disable-icon]="!obtained(attraction) && attraction.iconUrl"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
class="main-icon"
|
||||||
|
[src]="attraction?.iconUrl || '/assets/icons/cell-lock.svg'"
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
|
|
||||||
|
<img class="lock-icon" src="/assets/icons/cell-lock-line.svg" alt="" />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,227 @@
|
|||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page {
|
||||||
|
width: min(100%, var(--page-max-width));
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 20px 16px 24px;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__header,
|
||||||
|
.page__brand,
|
||||||
|
.page__all,
|
||||||
|
.page__all-label,
|
||||||
|
.city-card__top {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__header {
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__brand {
|
||||||
|
gap: 10px;
|
||||||
|
color: var(--color-accent);
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__mark {
|
||||||
|
display: block;
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__intro {
|
||||||
|
margin: 20px 0 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__intro h1,
|
||||||
|
.city-card h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-family: var(--font-display);
|
||||||
|
font-size: clamp(28px, 6vw, 34px);
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.15;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__intro p,
|
||||||
|
.city-card p {
|
||||||
|
margin: 6px 0 0;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__all,
|
||||||
|
.city-card {
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
background: var(--color-surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__all {
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
min-height: 56px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
padding: 0 16px;
|
||||||
|
border-radius: 16px;
|
||||||
|
color: var(--color-text);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cities {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-card {
|
||||||
|
display: block;
|
||||||
|
padding: 16px;
|
||||||
|
border-radius: 24px;
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-card--soon {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-card--soon h2 {
|
||||||
|
color: var(--color-text-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-card__top {
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-card strong {
|
||||||
|
color: var(--color-text);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-card .pack__bar {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-card__cells {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||||
|
gap: 6px;
|
||||||
|
margin: 16px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell {
|
||||||
|
display: block;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #171512;
|
||||||
|
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell img {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell--open {
|
||||||
|
background: rgb(224 184 79 / 10%) !important;
|
||||||
|
box-shadow: inset 0 0 0 1.5px var(--color-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell--open img {
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-card__actions {
|
||||||
|
gap: 10px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-card__actions a {
|
||||||
|
flex: 1 1 0;
|
||||||
|
min-width: 0;
|
||||||
|
min-height: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-card__actions a[matButton='filled'] {
|
||||||
|
gap: 8px;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 420px) {
|
||||||
|
.city-card__actions {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-card__actions a {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 720px) {
|
||||||
|
.page {
|
||||||
|
padding-top: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-card__cells {
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-wrapper {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
|
||||||
|
.main-icon {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
|
||||||
|
width: 70.833%;
|
||||||
|
height: 70.833%;
|
||||||
|
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lock-icon {
|
||||||
|
position: absolute;
|
||||||
|
top: 49%;
|
||||||
|
left: 50.4%;
|
||||||
|
width: 95%;
|
||||||
|
height: 96%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.disable-icon {
|
||||||
|
.main-icon {
|
||||||
|
filter: brightness(0);
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lock-icon {
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
|
||||||
|
import { RouterLink } from '@angular/router';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
|
import {
|
||||||
|
areaOpenedCount,
|
||||||
|
areaProgress,
|
||||||
|
areaTotalCount,
|
||||||
|
type Area,
|
||||||
|
type Attraction,
|
||||||
|
} from '../../areas/area.models';
|
||||||
|
import { GorodarActions, selectAreas, selectAreasError, selectAreasStatus } from '../../state';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-cities-page',
|
||||||
|
imports: [RouterLink],
|
||||||
|
templateUrl: './cities-page.html',
|
||||||
|
styleUrl: './cities-page.scss',
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
})
|
||||||
|
export class CitiesPage {
|
||||||
|
private readonly store = inject(Store);
|
||||||
|
|
||||||
|
protected readonly areas = this.store.selectSignal(selectAreas);
|
||||||
|
protected readonly status = this.store.selectSignal(selectAreasStatus);
|
||||||
|
protected readonly error = this.store.selectSignal(selectAreasError);
|
||||||
|
protected openedCount(area: Area): number {
|
||||||
|
return areaOpenedCount(area);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected totalCount(area: Area): number {
|
||||||
|
return areaTotalCount(area);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected progress(area: Area): number {
|
||||||
|
return areaProgress(area);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected obtained(attraction: Attraction): boolean {
|
||||||
|
return attraction.visited;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected reload(): void {
|
||||||
|
this.store.dispatch(GorodarActions.areasRequested());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
<section class="page" [class.page--map]="tab() === 'map'">
|
||||||
|
<header class="page__top">
|
||||||
|
<a class="page__back" routerLink="/" aria-label="Назад">
|
||||||
|
<app-icon name="chevron-left" [size]="22" />
|
||||||
|
</a>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
@if (area(); as city) {
|
||||||
|
<div class="page__city">
|
||||||
|
<img src="/assets/icons/gorodar-mark.svg" alt="" width="96" height="96" />
|
||||||
|
<div>
|
||||||
|
<h1>{{ city.name }}</h1>
|
||||||
|
<p>
|
||||||
|
<app-icon name="pin" [size]="18" />
|
||||||
|
<span>
|
||||||
|
<b>{{ openedCount() }}/{{ totalCount() }}</b>
|
||||||
|
объектов
|
||||||
|
</span>
|
||||||
|
<span>·</span>
|
||||||
|
<b>{{ progress() }}%</b>
|
||||||
|
</p>
|
||||||
|
<div class="page__progress" aria-hidden="true">
|
||||||
|
<span [style.width.%]="progress()"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<nav class="tabs" aria-label="Разделы города">
|
||||||
|
<button
|
||||||
|
class="tabs__item"
|
||||||
|
type="button"
|
||||||
|
[class.tabs__item--active]="tab() === 'objects'"
|
||||||
|
(click)="openObjects()"
|
||||||
|
>
|
||||||
|
Объекты
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="tabs__item"
|
||||||
|
type="button"
|
||||||
|
[class.tabs__item--active]="tab() === 'map'"
|
||||||
|
(click)="openMap()"
|
||||||
|
>
|
||||||
|
На карте
|
||||||
|
</button>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
@if (tab() === 'objects' && totalCount() === 0) {
|
||||||
|
<p class="page__status">В этом городе пока нет объектов.</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (tab() === 'objects' && totalCount() > 0) {
|
||||||
|
<div class="filters">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
[class.filters__item--active]="filter() === 'all'"
|
||||||
|
(click)="filter.set('all')"
|
||||||
|
>
|
||||||
|
Все · {{ totalCount() }}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
[class.filters__item--active]="filter() === 'open'"
|
||||||
|
(click)="filter.set('open')"
|
||||||
|
>
|
||||||
|
Открыты · {{ openedCount() }}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
[class.filters__item--active]="filter() === 'closed'"
|
||||||
|
(click)="filter.set('closed')"
|
||||||
|
>
|
||||||
|
Закрыты · {{ closedCount() }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid">
|
||||||
|
@for (landmark of landmarks(); track landmark.id) {
|
||||||
|
<a class="card" [routerLink]="objectRoute(landmark.id)">
|
||||||
|
<div class="card__preview" [class.card__preview--open]="isOpen(landmark)">
|
||||||
|
@if (isOpen(landmark)) {
|
||||||
|
<svg class="card__rays" viewBox="0 0 112 112" aria-hidden="true">
|
||||||
|
@for (ray of rays; track $index) {
|
||||||
|
<line
|
||||||
|
[attr.x1]="ray.x1"
|
||||||
|
[attr.y1]="ray.y1"
|
||||||
|
[attr.x2]="ray.x2"
|
||||||
|
[attr.y2]="ray.y2"
|
||||||
|
stroke="#E0B84F"
|
||||||
|
[attr.stroke-width]="ray.strong ? 2 : 1.2"
|
||||||
|
[attr.opacity]="ray.strong ? 0.55 : 0.28"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
</svg>
|
||||||
|
<span class="card__spark card__spark--a"></span>
|
||||||
|
<span class="card__spark card__spark--b"></span>
|
||||||
|
<span class="card__spark card__spark--c"></span>
|
||||||
|
<span class="card__spark card__spark--d"></span>
|
||||||
|
}
|
||||||
|
@if (isOpen(landmark) && landmark?.iconUrl) {
|
||||||
|
<img [src]="landmark?.iconUrl" alt="" />
|
||||||
|
} @else {
|
||||||
|
<div
|
||||||
|
class="icon-wrapper"
|
||||||
|
[class.disable-icon]="!isOpen(landmark) && landmark?.iconUrl"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
class="main-icon"
|
||||||
|
[src]="landmark?.iconUrl || '/assets/icons/cell-lock.svg'"
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
|
|
||||||
|
<img class="lock-icon" src="/assets/icons/cell-lock-line.svg" alt="" />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div class="card__body">
|
||||||
|
<h2>{{ landmark.name }}</h2>
|
||||||
|
<span class="card__status" [class.card__status--open]="isOpen(landmark)">
|
||||||
|
<app-icon [name]="isOpen(landmark) ? 'check' : 'lock'" [size]="15" />
|
||||||
|
{{ isOpen(landmark) ? 'Получен' : 'Не получен' }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<span class="card__bar" [class.card__bar--open]="isOpen(landmark)"></span>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (mapReady()) {
|
||||||
|
<div class="page__map" [class.page__map--off]="tab() !== 'map'">
|
||||||
|
<app-city-map
|
||||||
|
[embedded]="true"
|
||||||
|
[cityName]="city.name"
|
||||||
|
[areaId]="areaId()"
|
||||||
|
[attractions]="mapAttractions()"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
} @else if (status() === 'loading') {
|
||||||
|
<p class="page__status">Загружаем город…</p>
|
||||||
|
} @else {
|
||||||
|
<p class="page__status">{{ error() || 'Город не найден.' }}</p>
|
||||||
|
}
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,362 @@
|
|||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
:host:has(.page--map) {
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page {
|
||||||
|
width: min(100%, 720px);
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 16px 16px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page--map {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__top,
|
||||||
|
.page__city,
|
||||||
|
.page__city p,
|
||||||
|
.filters,
|
||||||
|
.card__status {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__top {
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__back {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 44px;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
color: var(--color-text);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__back {
|
||||||
|
justify-content: center;
|
||||||
|
width: 44px;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: rgb(28 26 23 / 86%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__all {
|
||||||
|
gap: 4px;
|
||||||
|
padding: 0 12px 0 16px;
|
||||||
|
border-color: var(--color-accent-strong);
|
||||||
|
border-radius: 22px;
|
||||||
|
background: var(--color-surface);
|
||||||
|
color: var(--color-accent-soft);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__city {
|
||||||
|
gap: 16px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__city img {
|
||||||
|
flex: none;
|
||||||
|
width: 96px;
|
||||||
|
height: 96px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__city > div {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__city h1 {
|
||||||
|
margin: 0;
|
||||||
|
font-family: var(--font-display);
|
||||||
|
font-size: clamp(26px, 7vw, 34px);
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__city p {
|
||||||
|
gap: 8px;
|
||||||
|
margin: 8px 0 0;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__city b {
|
||||||
|
color: var(--color-text);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__progress {
|
||||||
|
height: 6px;
|
||||||
|
margin-top: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 3px;
|
||||||
|
background: #3a352d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__progress span {
|
||||||
|
display: block;
|
||||||
|
height: 100%;
|
||||||
|
background: var(--color-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabs {
|
||||||
|
display: flex;
|
||||||
|
gap: 28px;
|
||||||
|
margin-top: 22px;
|
||||||
|
border-bottom: 1px solid var(--color-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabs__item {
|
||||||
|
padding: 10px 0;
|
||||||
|
border: 0;
|
||||||
|
background: none;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font: inherit;
|
||||||
|
font-weight: 500;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabs__item--active {
|
||||||
|
margin-bottom: -1px;
|
||||||
|
border-bottom: 3px solid var(--color-accent);
|
||||||
|
color: var(--color-text);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__map {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 280px;
|
||||||
|
margin: 0 -16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__map > app-city-map {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__map--off {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filters {
|
||||||
|
gap: 8px;
|
||||||
|
margin-top: 16px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filters button {
|
||||||
|
flex: none;
|
||||||
|
min-height: 44px;
|
||||||
|
padding: 0 16px;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: 22px;
|
||||||
|
background: var(--color-surface);
|
||||||
|
color: var(--color-text);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filters button.filters__item--active {
|
||||||
|
border-color: var(--color-primary);
|
||||||
|
background: var(--color-primary);
|
||||||
|
color: var(--color-label);
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: 12px;
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: 16px;
|
||||||
|
background: var(--color-surface);
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__preview {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 112px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__preview img {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
width: 96px;
|
||||||
|
height: 96px;
|
||||||
|
object-fit: contain;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__rays {
|
||||||
|
position: absolute;
|
||||||
|
inset: -12px;
|
||||||
|
width: calc(100% + 24px);
|
||||||
|
height: calc(100% + 24px);
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__spark {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 2;
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
opacity: 0;
|
||||||
|
background: var(--color-accent-soft);
|
||||||
|
clip-path: polygon(50% 0, 65% 35%, 100% 50%, 65% 65%, 50% 100%, 35% 65%, 0 50%, 35% 35%);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__spark--a {
|
||||||
|
top: 10px;
|
||||||
|
left: 12px;
|
||||||
|
}
|
||||||
|
.card__spark--b {
|
||||||
|
top: 14px;
|
||||||
|
right: 14px;
|
||||||
|
}
|
||||||
|
.card__spark--c {
|
||||||
|
bottom: 12px;
|
||||||
|
left: 16px;
|
||||||
|
}
|
||||||
|
.card__spark--d {
|
||||||
|
bottom: 14px;
|
||||||
|
right: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__preview--open {
|
||||||
|
background: rgb(224 184 79 / 10%);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (hover: hover) {
|
||||||
|
.card:hover .card__preview--open .card__rays {
|
||||||
|
opacity: 1;
|
||||||
|
animation: spin 12s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover .card__preview--open img {
|
||||||
|
animation: pop 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover .card__preview--open .card__spark {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__body {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__body h2 {
|
||||||
|
margin: 0;
|
||||||
|
min-height: 38px;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__status {
|
||||||
|
gap: 6px;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__status--open {
|
||||||
|
color: var(--color-accent-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__bar {
|
||||||
|
height: 4px;
|
||||||
|
background: #2e2a24;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__bar--open {
|
||||||
|
background: var(--color-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 380px) {
|
||||||
|
.grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-wrapper {
|
||||||
|
position: relative;
|
||||||
|
width: 112px;
|
||||||
|
height: 112px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
.main-icon {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
|
||||||
|
width: 80px;
|
||||||
|
height: 80px;
|
||||||
|
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lock-icon {
|
||||||
|
position: absolute;
|
||||||
|
top: 47%;
|
||||||
|
left: 48%;
|
||||||
|
|
||||||
|
width: 103px;
|
||||||
|
height: 108px;
|
||||||
|
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.disable-icon {
|
||||||
|
.main-icon {
|
||||||
|
filter: brightness(0);
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lock-icon {
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:not(.disable-icon) .main-icon {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
import {
|
||||||
|
ChangeDetectionStrategy,
|
||||||
|
Component,
|
||||||
|
computed,
|
||||||
|
effect,
|
||||||
|
inject,
|
||||||
|
input,
|
||||||
|
signal,
|
||||||
|
} from '@angular/core';
|
||||||
|
import { RouterLink } from '@angular/router';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
|
import {
|
||||||
|
areaAttractions,
|
||||||
|
areaOpenedCount,
|
||||||
|
areaProgress,
|
||||||
|
areaTotalCount,
|
||||||
|
findAttraction,
|
||||||
|
type Attraction,
|
||||||
|
} from '../../areas/area.models';
|
||||||
|
import { CityMap } from '../../map/city-map/city-map';
|
||||||
|
import { Icon } from '../../shared/icon/icon';
|
||||||
|
import {
|
||||||
|
GorodarActions,
|
||||||
|
selectAreaDetailError,
|
||||||
|
selectAreaDetails,
|
||||||
|
selectAreaDetailStatus,
|
||||||
|
} from '../../state';
|
||||||
|
|
||||||
|
type CollectionFilter = 'all' | 'open' | 'closed';
|
||||||
|
type CityTab = 'objects' | 'map';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-city-page',
|
||||||
|
imports: [Icon, RouterLink, CityMap],
|
||||||
|
templateUrl: './city-page.html',
|
||||||
|
styleUrl: './city-page.scss',
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
})
|
||||||
|
export class CityPage {
|
||||||
|
private readonly store = inject(Store);
|
||||||
|
|
||||||
|
readonly areaId = input.required<string>();
|
||||||
|
|
||||||
|
private readonly details = this.store.selectSignal(selectAreaDetails);
|
||||||
|
private readonly detailStatus = this.store.selectSignal(selectAreaDetailStatus);
|
||||||
|
private readonly detailError = this.store.selectSignal(selectAreaDetailError);
|
||||||
|
protected readonly status = computed(() => this.detailStatus()[this.areaId()] ?? 'loading');
|
||||||
|
protected readonly error = computed(() => this.detailError()[this.areaId()] ?? '');
|
||||||
|
protected readonly area = computed(() => this.details()[this.areaId()] ?? null);
|
||||||
|
protected readonly tab = signal<CityTab>('objects');
|
||||||
|
protected readonly mapReady = signal(false);
|
||||||
|
protected readonly filter = signal<CollectionFilter>('all');
|
||||||
|
protected readonly openedCount = computed(() => {
|
||||||
|
const area = this.area();
|
||||||
|
return area ? areaOpenedCount(area) : 0;
|
||||||
|
});
|
||||||
|
protected readonly totalCount = computed(() => {
|
||||||
|
const area = this.area();
|
||||||
|
return area ? areaTotalCount(area) : 0;
|
||||||
|
});
|
||||||
|
protected readonly progress = computed(() => {
|
||||||
|
const area = this.area();
|
||||||
|
return area ? areaProgress(area) : 0;
|
||||||
|
});
|
||||||
|
protected readonly closedCount = computed(() => this.totalCount() - this.openedCount());
|
||||||
|
protected readonly mapAttractions = computed(() => {
|
||||||
|
const area = this.area();
|
||||||
|
return area ? areaAttractions(area) : [];
|
||||||
|
});
|
||||||
|
protected readonly landmarks = computed(() => {
|
||||||
|
const current = this.area();
|
||||||
|
const items = current ? areaAttractions(current) : [];
|
||||||
|
|
||||||
|
switch (this.filter()) {
|
||||||
|
case 'open':
|
||||||
|
return items.filter((item) => item.visited);
|
||||||
|
case 'closed':
|
||||||
|
return items.filter((item) => !item.visited);
|
||||||
|
default:
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
protected readonly rays = Array.from({ length: 16 }, (_, index) => {
|
||||||
|
const angle = (index / 16) * Math.PI * 2;
|
||||||
|
const inner = 30;
|
||||||
|
const outer = index % 2 === 0 ? 54 : 46;
|
||||||
|
const center = 56;
|
||||||
|
|
||||||
|
return {
|
||||||
|
x1: center + Math.cos(angle) * inner,
|
||||||
|
y1: center + Math.sin(angle) * inner,
|
||||||
|
x2: center + Math.cos(angle) * outer,
|
||||||
|
y2: center + Math.sin(angle) * outer,
|
||||||
|
strong: index % 2 === 0,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
effect(() => {
|
||||||
|
this.store.dispatch(GorodarActions.areaRequested({ id: this.areaId() }));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected openObjects(): void {
|
||||||
|
this.tab.set('objects');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected openMap(): void {
|
||||||
|
this.mapReady.set(true);
|
||||||
|
this.tab.set('map');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected isOpen(attraction: Attraction): boolean {
|
||||||
|
return attraction.visited;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected objectRoute(id: string): string[] {
|
||||||
|
const current = this.area();
|
||||||
|
const attraction = current ? findAttraction(current, id) : null;
|
||||||
|
return attraction?.visited
|
||||||
|
? ['/city', this.areaId(), id, 'icon']
|
||||||
|
: ['/city', this.areaId(), id];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
<section class="page">
|
||||||
|
@if (authenticated()) {
|
||||||
|
<header class="account">
|
||||||
|
<p class="account__email">{{ accountEmail() }}</p>
|
||||||
|
<div class="account__actions">
|
||||||
|
<button
|
||||||
|
class="account__action"
|
||||||
|
type="button"
|
||||||
|
aria-label="Документы"
|
||||||
|
(click)="openDocuments()"
|
||||||
|
>
|
||||||
|
<app-icon name="document" [size]="22" />
|
||||||
|
</button>
|
||||||
|
<button class="account__action" type="button" aria-label="Выйти" (click)="logout()">
|
||||||
|
<app-icon name="logout" [size]="22" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
} @else {
|
||||||
|
<header class="account">
|
||||||
|
<button class="account__login" type="button" (click)="login()">Войти</button>
|
||||||
|
</header>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="page__intro">
|
||||||
|
<h1>Моя коллекция</h1>
|
||||||
|
<p>Достопримечательности которые вы открыли</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<section class="summary" style="margin-bottom: 16px">
|
||||||
|
<div>
|
||||||
|
<b>{{ openedCount() }}</b>
|
||||||
|
<span>{{ objectsLabel() }}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<b>{{ packs().length }}</b>
|
||||||
|
<span>{{ citiesLabel() }}</span>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
@if (packs().length > 0) {
|
||||||
|
@for (pack of packs(); track pack.area.id) {
|
||||||
|
<article class="pack">
|
||||||
|
<a
|
||||||
|
class="pack__head"
|
||||||
|
[routerLink]="['/city', pack.area.id]"
|
||||||
|
[attr.aria-label]="'Объекты: ' + pack.area.name"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<h2>{{ pack.area.name }}</h2>
|
||||||
|
<p>Собрано {{ pack.opened }} из {{ pack.total }}</p>
|
||||||
|
</div>
|
||||||
|
<div class="pack__percent anim-percent" [style.--to-p]="pack.progress" aria-hidden="true">
|
||||||
|
<span>{{ pack.progress }}%</span>
|
||||||
|
</div>
|
||||||
|
<span class="pack__go" aria-hidden="true">
|
||||||
|
<app-icon name="chevron-right" [size]="20" />
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="pack__bar" aria-hidden="true">
|
||||||
|
<span class="anim-grow" [style.--from]="'0%'" [style.--to]="pack.progress + '%'"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="picked">
|
||||||
|
@for (landmark of pack.items; track landmark.id) {
|
||||||
|
<a class="picked__card" [routerLink]="objectRoute(pack.area.id, landmark)">
|
||||||
|
<div class="picked__preview">
|
||||||
|
<img [src]="landmark.iconUrl" alt="" />
|
||||||
|
</div>
|
||||||
|
<div class="picked__body">
|
||||||
|
<h3>{{ landmark.name }}</h3>
|
||||||
|
</div>
|
||||||
|
<span class="picked__bar" aria-hidden="true"></span>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
}
|
||||||
|
} @else {
|
||||||
|
<p class="empty">Пока нет полученных объектов.</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (documentsOpen()) {
|
||||||
|
<app-documents-sheet (dismissed)="closeDocuments()" />
|
||||||
|
}
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,176 @@
|
|||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page {
|
||||||
|
width: min(100%, var(--page-max-width));
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 16px 16px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
min-height: 44px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account__email {
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
color: var(--color-text);
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 500;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account__actions {
|
||||||
|
display: flex;
|
||||||
|
flex: none;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account__action {
|
||||||
|
display: flex;
|
||||||
|
flex: none;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--color-text);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account__login {
|
||||||
|
margin-left: auto;
|
||||||
|
height: 44px;
|
||||||
|
padding: 0 16px;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: var(--color-primary);
|
||||||
|
color: var(--color-label);
|
||||||
|
font: inherit;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__intro {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__intro h1,
|
||||||
|
.summary b {
|
||||||
|
margin: 0;
|
||||||
|
font-family: var(--font-display);
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary {
|
||||||
|
b {
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__intro h1 {
|
||||||
|
font-size: clamp(28px, 7vw, 34px);
|
||||||
|
line-height: 1.15;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__intro p,
|
||||||
|
.section-label,
|
||||||
|
.empty,
|
||||||
|
.summary span {
|
||||||
|
margin: 6px 0 0;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary {
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
background: var(--color-surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: 8px;
|
||||||
|
margin-top: 16px;
|
||||||
|
padding: 18px 16px;
|
||||||
|
border-radius: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary b {
|
||||||
|
color: var(--color-accent-soft);
|
||||||
|
font-size: 30px;
|
||||||
|
line-height: 1.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-label {
|
||||||
|
margin: 20px 0 8px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picked {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: 12px;
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picked__card {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: 16px;
|
||||||
|
background: #141210;
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picked__preview {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 148px;
|
||||||
|
background: rgb(224 184 79 / 8%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.picked__preview img {
|
||||||
|
width: 112px;
|
||||||
|
height: 112px;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picked__body {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picked__body h3 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picked__bar {
|
||||||
|
height: 4px;
|
||||||
|
background: var(--color-accent);
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
import {
|
||||||
|
afterNextRender,
|
||||||
|
ChangeDetectionStrategy,
|
||||||
|
Component,
|
||||||
|
computed,
|
||||||
|
inject,
|
||||||
|
signal,
|
||||||
|
} from '@angular/core';
|
||||||
|
import { RouterLink } from '@angular/router';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
|
import {
|
||||||
|
areaAttractions,
|
||||||
|
areaOpenedCount,
|
||||||
|
areaProgress,
|
||||||
|
areaTotalCount,
|
||||||
|
type Attraction,
|
||||||
|
} from '../../areas/area.models';
|
||||||
|
import { DocumentsSheet } from '../../shared/documents-sheet/documents-sheet';
|
||||||
|
import { Icon } from '../../shared/icon/icon';
|
||||||
|
import {
|
||||||
|
GorodarActions,
|
||||||
|
selectAreas,
|
||||||
|
selectAuthEmail,
|
||||||
|
selectAuthenticated,
|
||||||
|
selectOpenedCount,
|
||||||
|
selectProfile,
|
||||||
|
} from '../../state';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-collections-page',
|
||||||
|
imports: [Icon, RouterLink, DocumentsSheet],
|
||||||
|
templateUrl: './collections-page.html',
|
||||||
|
styleUrl: './collections-page.scss',
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
})
|
||||||
|
export class CollectionsPage {
|
||||||
|
private readonly store = inject(Store);
|
||||||
|
|
||||||
|
private readonly areas = this.store.selectSignal(selectAreas);
|
||||||
|
protected readonly profile = this.store.selectSignal(selectProfile);
|
||||||
|
protected readonly openedCount = this.store.selectSignal(selectOpenedCount);
|
||||||
|
protected readonly authenticated = this.store.selectSignal(selectAuthenticated);
|
||||||
|
private readonly authEmail = this.store.selectSignal(selectAuthEmail);
|
||||||
|
protected readonly accountEmail = computed(() =>
|
||||||
|
this.authenticated() ? this.authEmail() : this.profile().email,
|
||||||
|
);
|
||||||
|
protected readonly documentsOpen = signal(false);
|
||||||
|
protected readonly packs = computed(() =>
|
||||||
|
this.areas()
|
||||||
|
.map((area) => ({
|
||||||
|
area,
|
||||||
|
items: areaAttractions(area).filter((item) => item.visited),
|
||||||
|
opened: areaOpenedCount(area),
|
||||||
|
total: areaTotalCount(area),
|
||||||
|
progress: areaProgress(area),
|
||||||
|
}))
|
||||||
|
.filter((pack) => pack.items.length > 0),
|
||||||
|
);
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
afterNextRender(() => {
|
||||||
|
this.store.dispatch(GorodarActions.authSheetOpened({ intent: 'collection' }));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected readonly objectsLabel = computed(() =>
|
||||||
|
this.plural(this.openedCount(), ['объект', 'объекта', 'объектов']),
|
||||||
|
);
|
||||||
|
|
||||||
|
protected readonly citiesLabel = computed(() =>
|
||||||
|
this.plural(this.packs().length, ['город', 'города', 'городов']),
|
||||||
|
);
|
||||||
|
|
||||||
|
protected objectRoute(areaId: string, attraction: Attraction): string[] {
|
||||||
|
return attraction.visited
|
||||||
|
? ['/city', areaId, attraction.id, 'icon']
|
||||||
|
: ['/city', areaId, attraction.id];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected openDocuments(): void {
|
||||||
|
this.documentsOpen.set(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected closeDocuments(): void {
|
||||||
|
this.documentsOpen.set(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected login(): void {
|
||||||
|
this.store.dispatch(GorodarActions.authSheetOpened({ intent: 'collection' }));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected logout(): void {
|
||||||
|
this.documentsOpen.set(false);
|
||||||
|
this.store.dispatch(GorodarActions.logout());
|
||||||
|
}
|
||||||
|
|
||||||
|
private plural(count: number, forms: [string, string, string]): string {
|
||||||
|
const abs = Math.abs(count) % 100;
|
||||||
|
const last = abs % 10;
|
||||||
|
if (abs > 10 && abs < 20) {
|
||||||
|
return forms[2];
|
||||||
|
}
|
||||||
|
if (last === 1) {
|
||||||
|
return forms[0];
|
||||||
|
}
|
||||||
|
if (last >= 2 && last <= 4) {
|
||||||
|
return forms[1];
|
||||||
|
}
|
||||||
|
return forms[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
@if (landmark(); as item) {
|
||||||
|
@if (collected()) {
|
||||||
|
<app-collect-success
|
||||||
|
mode="preview"
|
||||||
|
[title]="item.name"
|
||||||
|
[image]="item.iconUrl"
|
||||||
|
[model]="item.modelUrl || undefined"
|
||||||
|
[areaId]="areaId()"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
} @else if (status() === 'loading') {
|
||||||
|
<section class="missing">
|
||||||
|
<p>Загружаем…</p>
|
||||||
|
</section>
|
||||||
|
} @else {
|
||||||
|
<section class="missing">
|
||||||
|
<p>Объект не найден.</p>
|
||||||
|
<a [routerLink]="['/city', areaId()]">К списку объектов</a>
|
||||||
|
</section>
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.missing {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
align-items: flex-start;
|
||||||
|
width: min(100%, var(--page-max-width));
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 24px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.missing p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.missing a {
|
||||||
|
color: var(--color-accent-soft);
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import { ChangeDetectionStrategy, Component, computed, effect, inject, input } from '@angular/core';
|
||||||
|
import { Router, RouterLink } from '@angular/router';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
|
import { findAttraction } from '../../areas/area.models';
|
||||||
|
import { CollectSuccess } from '../../claim/collect-success/collect-success';
|
||||||
|
import { GorodarActions, selectAreaDetails, selectAreaDetailStatus } from '../../state';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-icon-preview-page',
|
||||||
|
imports: [CollectSuccess, RouterLink],
|
||||||
|
templateUrl: './icon-preview-page.html',
|
||||||
|
styleUrl: './icon-preview-page.scss',
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
})
|
||||||
|
export class IconPreviewPage {
|
||||||
|
private readonly store = inject(Store);
|
||||||
|
private readonly router = inject(Router);
|
||||||
|
private readonly details = this.store.selectSignal(selectAreaDetails);
|
||||||
|
private readonly detailStatus = this.store.selectSignal(selectAreaDetailStatus);
|
||||||
|
protected readonly status = computed(() => this.detailStatus()[this.areaId()] ?? 'loading');
|
||||||
|
|
||||||
|
readonly areaId = input.required<string>();
|
||||||
|
readonly id = input.required<string>();
|
||||||
|
|
||||||
|
protected readonly landmark = computed(() => {
|
||||||
|
const area = this.details()[this.areaId()];
|
||||||
|
return area ? findAttraction(area, this.id()) : null;
|
||||||
|
});
|
||||||
|
protected readonly collected = computed(() => this.landmark()?.visited ?? false);
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
effect(() => {
|
||||||
|
const areaId = this.areaId();
|
||||||
|
const status = this.detailStatus()[areaId];
|
||||||
|
|
||||||
|
if (this.details()[areaId] || status === 'loading' || status === 'ready') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.store.dispatch(GorodarActions.areaRequested({ id: areaId }));
|
||||||
|
});
|
||||||
|
|
||||||
|
effect(() => {
|
||||||
|
const item = this.landmark();
|
||||||
|
|
||||||
|
if (this.status() !== 'ready' || !item || item.visited) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void this.router.navigate(['/city', this.areaId(), item.id], { replaceUrl: true });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||