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 |
@@ -6,7 +6,7 @@ COPY package.json package-lock.json ./
|
|||||||
RUN npm i
|
RUN npm i
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM nginx:1.27-alpine
|
FROM nginx:1.27-alpine
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,22 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"outputHashing": "all",
|
"outputHashing": "all",
|
||||||
"serviceWorker": "ngsw-config.json"
|
"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,10 +74,16 @@
|
|||||||
},
|
},
|
||||||
"serve": {
|
"serve": {
|
||||||
"builder": "@angular/build:dev-server",
|
"builder": "@angular/build:dev-server",
|
||||||
|
"options": {
|
||||||
|
"proxyConfig": "proxy.conf.json"
|
||||||
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
"buildTarget": "gorodar-front:build:production"
|
"buildTarget": "gorodar-front:build:production"
|
||||||
},
|
},
|
||||||
|
"test": {
|
||||||
|
"buildTarget": "gorodar-front:build:test"
|
||||||
|
},
|
||||||
"development": {
|
"development": {
|
||||||
"buildTarget": "gorodar-front:build:development"
|
"buildTarget": "gorodar-front:build:development"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
front:
|
front:
|
||||||
image: front:latest
|
image: git.gorodar.ru/gorodar/front:latest
|
||||||
build: .
|
|
||||||
ports:
|
ports:
|
||||||
- '82:80'
|
- '82:80'
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
@@ -1,12 +1,23 @@
|
|||||||
{
|
{
|
||||||
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
|
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
|
||||||
"index": "/index.html",
|
"index": "/index.html",
|
||||||
|
|
||||||
|
"navigationUrls": [
|
||||||
|
"/**",
|
||||||
|
"!/**/*.*",
|
||||||
|
"!/**/*__*",
|
||||||
|
"!/**/*__*/**",
|
||||||
|
"!/admin",
|
||||||
|
"!/admin/**"
|
||||||
|
],
|
||||||
|
|
||||||
"assetGroups": [
|
"assetGroups": [
|
||||||
{
|
{
|
||||||
"name": "app",
|
"name": "app",
|
||||||
"installMode": "prefetch",
|
"installMode": "prefetch",
|
||||||
"resources": {
|
"resources": {
|
||||||
"files": [
|
"files": [
|
||||||
|
"/apple-touch-icon.png",
|
||||||
"/favicon.ico",
|
"/favicon.ico",
|
||||||
"/favicon.svg",
|
"/favicon.svg",
|
||||||
"/index.csr.html",
|
"/index.csr.html",
|
||||||
@@ -22,19 +33,15 @@
|
|||||||
"installMode": "lazy",
|
"installMode": "lazy",
|
||||||
"updateMode": "prefetch",
|
"updateMode": "prefetch",
|
||||||
"resources": {
|
"resources": {
|
||||||
"files": [
|
"files": ["/**/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"]
|
||||||
"/**/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
"dataGroups": [
|
"dataGroups": [
|
||||||
{
|
{
|
||||||
"name": "fonts",
|
"name": "fonts",
|
||||||
"urls": [
|
"urls": ["https://fonts.googleapis.com/**", "https://fonts.gstatic.com/**"],
|
||||||
"https://fonts.googleapis.com/**",
|
|
||||||
"https://fonts.gstatic.com/**"
|
|
||||||
],
|
|
||||||
"cacheConfig": {
|
"cacheConfig": {
|
||||||
"maxSize": 20,
|
"maxSize": 20,
|
||||||
"maxAge": "30d",
|
"maxAge": "30d",
|
||||||
|
|||||||
@@ -21,12 +21,15 @@
|
|||||||
"@capacitor/camera": "^8.2.4",
|
"@capacitor/camera": "^8.2.4",
|
||||||
"@capacitor/core": "^8.5.2",
|
"@capacitor/core": "^8.5.2",
|
||||||
"@capacitor/geolocation": "^8.2.2",
|
"@capacitor/geolocation": "^8.2.2",
|
||||||
|
"@google/model-viewer": "^4.3.1",
|
||||||
"@ionic/pwa-elements": "^3.4.0",
|
"@ionic/pwa-elements": "^3.4.0",
|
||||||
|
"@ngneat/until-destroy": "^10.0.0",
|
||||||
"@ngrx/effects": "^20.1.0",
|
"@ngrx/effects": "^20.1.0",
|
||||||
"@ngrx/store": "^20.1.0",
|
"@ngrx/store": "^20.1.0",
|
||||||
"@ngrx/store-devtools": "^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": {
|
||||||
@@ -1720,6 +1723,22 @@
|
|||||||
"node": "^20.17.0 || >=22.9.0"
|
"node": "^20.17.0 || >=22.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@google/model-viewer": {
|
||||||
|
"version": "4.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@google/model-viewer/-/model-viewer-4.3.1.tgz",
|
||||||
|
"integrity": "sha512-GP+inXhAtY31E8rILVmByA6z8CZZjdlNajddppyI1/j1eIaSQiZcMRaUqTFe7+jv4mzRzwKIOiKBud0apiv+WQ==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@monogrid/gainmap-js": "^3.1.0",
|
||||||
|
"lit": "^3.2.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"three": "^0.183.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@hono/node-server": {
|
"node_modules/@hono/node-server": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.1.tgz",
|
||||||
@@ -2793,6 +2812,21 @@
|
|||||||
"listr2": "9.0.1"
|
"listr2": "9.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@lit-labs/ssr-dom-shim": {
|
||||||
|
"version": "1.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.6.0.tgz",
|
||||||
|
"integrity": "sha512-VHb0ALPMTlgKjM6yIxxoQNnpKyUKLD04VzeQdsiXkMqkvYlAHxq9glGLmgbb889/1GsohSOAjvQYoiBppXFqrQ==",
|
||||||
|
"license": "BSD-3-Clause"
|
||||||
|
},
|
||||||
|
"node_modules/@lit/reactive-element": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-pbCDiVMnne1lYUIaYNN5wrwQXDtHaYtg7YEFPeW+hws6U47WeFvISGUWekPGKWOP1ygrs0ef0o1VJMk1exos5A==",
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"dependencies": {
|
||||||
|
"@lit-labs/ssr-dom-shim": "^1.5.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@lmdb/lmdb-darwin-arm64": {
|
"node_modules/@lmdb/lmdb-darwin-arm64": {
|
||||||
"version": "3.4.2",
|
"version": "3.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-arm64/-/lmdb-darwin-arm64-3.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-arm64/-/lmdb-darwin-arm64-3.4.2.tgz",
|
||||||
@@ -2932,6 +2966,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@monogrid/gainmap-js": {
|
||||||
|
"version": "3.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@monogrid/gainmap-js/-/gainmap-js-3.4.0.tgz",
|
||||||
|
"integrity": "sha512-2Z0FATFHaoYJ8b+Y4y4Hgfn3FRFwuU5zRrk+9dFWp4uGAdHGqVEdP7HP+gLA3X469KXHmfupJaUbKo1b/aDKIg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"promise-worker-transferable": "^1.0.4"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"three": ">= 0.159.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@msgpackr-extract/msgpackr-extract-darwin-arm64": {
|
"node_modules/@msgpackr-extract/msgpackr-extract-darwin-arm64": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.4.tgz",
|
||||||
@@ -3339,6 +3385,19 @@
|
|||||||
"node": ">= 10"
|
"node": ">= 10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@ngneat/until-destroy": {
|
||||||
|
"version": "10.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@ngneat/until-destroy/-/until-destroy-10.0.0.tgz",
|
||||||
|
"integrity": "sha512-xXFAabQ4YVJ82LYxdgUlaKZyR3dSbxqG3woSyaclzxfCgWMEDweCcM/GGYbNiHJa0WwklI98RXHvca+UyCxpeg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": "^2.3.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@angular/core": ">=13",
|
||||||
|
"rxjs": "^6.4.0 || ^7.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@ngrx/effects": {
|
"node_modules/@ngrx/effects": {
|
||||||
"version": "20.1.0",
|
"version": "20.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@ngrx/effects/-/effects-20.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@ngrx/effects/-/effects-20.1.0.tgz",
|
||||||
@@ -4559,6 +4618,12 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/trusted-types": {
|
||||||
|
"version": "2.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
|
||||||
|
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@types/ws": {
|
"node_modules/@types/ws": {
|
||||||
"version": "8.18.1",
|
"version": "8.18.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz",
|
||||||
@@ -6679,6 +6744,12 @@
|
|||||||
"url": "https://github.com/sponsors/isaacs"
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/immediate": {
|
||||||
|
"version": "3.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
|
||||||
|
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/immutable": {
|
"node_modules/immutable": {
|
||||||
"version": "5.1.9",
|
"version": "5.1.9",
|
||||||
"resolved": "https://registry.npmjs.org/immutable/-/immutable-5.1.9.tgz",
|
"resolved": "https://registry.npmjs.org/immutable/-/immutable-5.1.9.tgz",
|
||||||
@@ -7554,6 +7625,15 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/lie": {
|
||||||
|
"version": "3.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
|
||||||
|
"integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"immediate": "~3.0.5"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/listr2": {
|
"node_modules/listr2": {
|
||||||
"version": "9.0.1",
|
"version": "9.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/listr2/-/listr2-9.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/listr2/-/listr2-9.0.1.tgz",
|
||||||
@@ -7597,6 +7677,37 @@
|
|||||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/lit": {
|
||||||
|
"version": "3.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/lit/-/lit-3.3.3.tgz",
|
||||||
|
"integrity": "sha512-fycuvZg/hkpozL00lm1pEJH5nN/lr9ZXd6mJI2HSN4+Bzc+LDNdEApJ6HFbPkdFNHLvOplIIuJvxkS4XUxqirw==",
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"dependencies": {
|
||||||
|
"@lit/reactive-element": "^2.1.0",
|
||||||
|
"lit-element": "^4.2.0",
|
||||||
|
"lit-html": "^3.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lit-element": {
|
||||||
|
"version": "4.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/lit-element/-/lit-element-4.2.2.tgz",
|
||||||
|
"integrity": "sha512-aFKhNToWxoyhkNDmWZwEva2SlQia+jfG0fjIWV//YeTaWrVnOxD89dPKfigCUspXFmjzOEUQpOkejH5Ly6sG0w==",
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"dependencies": {
|
||||||
|
"@lit-labs/ssr-dom-shim": "^1.5.0",
|
||||||
|
"@lit/reactive-element": "^2.1.0",
|
||||||
|
"lit-html": "^3.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lit-html": {
|
||||||
|
"version": "3.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/lit-html/-/lit-html-3.3.3.tgz",
|
||||||
|
"integrity": "sha512-el8M6jK2o3RXBnrSHX3ZKrsN8zEV63pSExTO1wYJz7QndGYZ8353e2a5PPX+qHe2aGayfnchQmkAojaWAREOIA==",
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/trusted-types": "^2.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/lmdb": {
|
"node_modules/lmdb": {
|
||||||
"version": "3.4.2",
|
"version": "3.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/lmdb/-/lmdb-3.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/lmdb/-/lmdb-3.4.2.tgz",
|
||||||
@@ -8900,6 +9011,22 @@
|
|||||||
"node": "^18.17.0 || >=20.5.0"
|
"node": "^18.17.0 || >=20.5.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/promise-worker-transferable": {
|
||||||
|
"version": "1.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/promise-worker-transferable/-/promise-worker-transferable-1.0.4.tgz",
|
||||||
|
"integrity": "sha512-bN+0ehEnrXfxV2ZQvU2PetO0n4gqBD4ulq3MI1WOPLgr7/Mg9yRQkX5+0v1vagr74ZTsl7XtzlaYDo2EuCeYJw==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"is-promise": "^2.1.0",
|
||||||
|
"lie": "^3.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/promise-worker-transferable/node_modules/is-promise": {
|
||||||
|
"version": "2.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz",
|
||||||
|
"integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/prompts": {
|
"node_modules/prompts": {
|
||||||
"version": "2.4.2",
|
"version": "2.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz",
|
||||||
@@ -9852,6 +9979,13 @@
|
|||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/three": {
|
||||||
|
"version": "0.183.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/three/-/three-0.183.2.tgz",
|
||||||
|
"integrity": "sha512-di3BsL2FEQ1PA7Hcvn4fyJOlxRRgFYBpMTcyOgkwJIaDOdJMebEFPA+t98EvjuljDx4hNulAGwF6KIjtwI5jgQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true
|
||||||
|
},
|
||||||
"node_modules/through2": {
|
"node_modules/through2": {
|
||||||
"version": "4.0.2",
|
"version": "4.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz",
|
||||||
@@ -10248,6 +10382,12 @@
|
|||||||
"node": ">=10.13.0"
|
"node": ">=10.13.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/wavesurfer.js": {
|
||||||
|
"version": "8.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/wavesurfer.js/-/wavesurfer.js-8.0.1.tgz",
|
||||||
|
"integrity": "sha512-h0OnRWSVTqIYLSw3/IVrBtsun/xw9L5u4FA3bjfSDTFMX/xswVWS1JwK4fFu3ulmxRUSHg8zQORl6zENG983eg==",
|
||||||
|
"license": "BSD-3-Clause"
|
||||||
|
},
|
||||||
"node_modules/weak-lru-cache": {
|
"node_modules/weak-lru-cache": {
|
||||||
"version": "1.2.2",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/weak-lru-cache/-/weak-lru-cache-1.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/weak-lru-cache/-/weak-lru-cache-1.2.2.tgz",
|
||||||
|
|||||||
@@ -35,12 +35,15 @@
|
|||||||
"@capacitor/camera": "^8.2.4",
|
"@capacitor/camera": "^8.2.4",
|
||||||
"@capacitor/core": "^8.5.2",
|
"@capacitor/core": "^8.5.2",
|
||||||
"@capacitor/geolocation": "^8.2.2",
|
"@capacitor/geolocation": "^8.2.2",
|
||||||
|
"@google/model-viewer": "^4.3.1",
|
||||||
"@ionic/pwa-elements": "^3.4.0",
|
"@ionic/pwa-elements": "^3.4.0",
|
||||||
|
"@ngneat/until-destroy": "^10.0.0",
|
||||||
"@ngrx/effects": "^20.1.0",
|
"@ngrx/effects": "^20.1.0",
|
||||||
"@ngrx/store": "^20.1.0",
|
"@ngrx/store": "^20.1.0",
|
||||||
"@ngrx/store-devtools": "^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": {
|
||||||
|
|||||||
@@ -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,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,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="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="-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 |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="390" height="320" viewBox="0 0 390 320"><defs><linearGradient id="nn1" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#161B38"></stop><stop offset="0.55" stop-color="#4A3A63"></stop><stop offset="1" stop-color="#C9764C"></stop></linearGradient></defs><rect width="390" height="320" fill="url(#nn1)"></rect><circle cx="46.8" cy="20.5" r="1.1" fill="#FFFFFF" opacity="0.65"></circle><circle cx="117.0" cy="35.8" r="1.1" fill="#FFFFFF" opacity="0.65"></circle><circle cx="280.8" cy="17.9" r="1.1" fill="#FFFFFF" opacity="0.65"></circle><circle cx="335.4" cy="43.5" r="1.1" fill="#FFFFFF" opacity="0.65"></circle><circle cx="78.0" cy="66.6" r="1.1" fill="#FFFFFF" opacity="0.65"></circle><circle cx="358.8" cy="76.8" r="1.1" fill="#FFFFFF" opacity="0.65"></circle><circle cx="31.2" cy="92.2" r="1.1" fill="#FFFFFF" opacity="0.65"></circle><circle cx="304.2" cy="102.4" r="1.1" fill="#FFFFFF" opacity="0.65"></circle><rect x="113.8" y="203.4" width="162.4" height="98.6" fill="#0C0B0A"></rect><rect x="73.2" y="244.0" width="40.6" height="58.0" fill="#0C0B0A"></rect><rect x="276.2" y="244.0" width="40.6" height="58.0" fill="#0C0B0A"></rect><rect x="166.0" y="168.6" width="58.0" height="34.8" fill="#0C0B0A"></rect><path d="M160.2 168.6 C144.9 143.0 183.9 126.4 195.0 93.2 C206.1 126.4 245.1 143.0 229.8 168.6 Z" fill="#0C0B0A"></path><path d="M195.0 64.2 V93.2 M186.3 73.8 H203.7" stroke="#0C0B0A" stroke-width="2.9" fill="none"></path><path d="M76.1 244.0 C68.4 231.2 87.9 222.9 93.5 206.3 C99.1 222.9 118.6 231.2 110.9 244.0 Z" fill="#0C0B0A"></path><path d="M93.5 186.0 V206.3 M87.4 192.7 H99.6" stroke="#0C0B0A" stroke-width="2.0" fill="none"></path><path d="M279.1 244.0 C271.4 231.2 290.9 222.9 296.5 206.3 C302.1 222.9 321.6 231.2 313.9 244.0 Z" fill="#0C0B0A"></path><path d="M296.5 186.0 V206.3 M290.4 192.7 H302.6" stroke="#0C0B0A" stroke-width="2.0" fill="none"></path><ellipse cx="0.0" cy="318.0" rx="29.3" ry="14.4" fill="#0C0B0A"></ellipse><ellipse cx="48.8" cy="318.0" rx="29.3" ry="20.5" fill="#0C0B0A"></ellipse><ellipse cx="97.5" cy="318.0" rx="29.3" ry="26.4" fill="#0C0B0A"></ellipse><ellipse cx="146.2" cy="318.0" rx="29.3" ry="14.4" fill="#0C0B0A"></ellipse><ellipse cx="195.0" cy="318.0" rx="29.3" ry="20.5" fill="#0C0B0A"></ellipse><ellipse cx="243.8" cy="318.0" rx="29.3" ry="26.4" fill="#0C0B0A"></ellipse><ellipse cx="292.5" cy="318.0" rx="29.3" ry="14.4" fill="#0C0B0A"></ellipse><ellipse cx="341.2" cy="318.0" rx="29.3" ry="20.5" fill="#0C0B0A"></ellipse><ellipse cx="390.0" cy="318.0" rx="29.3" ry="26.4" fill="#0C0B0A"></ellipse><rect x="0" y="310.0" width="390" height="10" fill="#0C0B0A"></rect></svg>
|
|
||||||
|
Before Width: | Height: | Size: 2.6 KiB |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="168" viewBox="0 0 128 168"><defs><linearGradient id="nn2" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#6FA8E0"></stop><stop offset="0.55" stop-color="#A9CDEE"></stop><stop offset="1" stop-color="#F0E4CF"></stop></linearGradient></defs><rect width="128" height="168" fill="url(#nn2)"></rect><rect x="27.6" y="109.8" width="72.8" height="44.2" fill="#39444F"></rect><rect x="9.4" y="128.0" width="18.2" height="26.0" fill="#39444F"></rect><rect x="100.4" y="128.0" width="18.2" height="26.0" fill="#39444F"></rect><rect x="51.0" y="94.2" width="26.0" height="15.6" fill="#39444F"></rect><path d="M48.4 94.2 C41.5 82.7 59.0 75.3 64.0 60.4 C69.0 75.3 86.5 82.7 79.6 94.2 Z" fill="#39444F"></path><path d="M64.0 47.4 V60.4 M60.1 51.7 H67.9" stroke="#39444F" stroke-width="1.3" fill="none"></path><path d="M10.7 128.0 C7.3 122.3 16.0 118.5 18.5 111.1 C21.0 118.5 29.7 122.3 26.3 128.0 Z" fill="#39444F"></path><path d="M18.5 102.0 V111.1 M15.8 105.0 H21.2" stroke="#39444F" stroke-width="1.0" fill="none"></path><path d="M101.7 128.0 C98.3 122.3 107.0 118.5 109.5 111.1 C112.0 118.5 120.7 122.3 117.3 128.0 Z" fill="#39444F"></path><path d="M109.5 102.0 V111.1 M106.8 105.0 H112.2" stroke="#39444F" stroke-width="1.0" fill="none"></path><ellipse cx="0.0" cy="166.0" rx="9.6" ry="7.6" fill="#39444F"></ellipse><ellipse cx="16.0" cy="166.0" rx="9.6" ry="10.8" fill="#39444F"></ellipse><ellipse cx="32.0" cy="166.0" rx="9.6" ry="13.9" fill="#39444F"></ellipse><ellipse cx="48.0" cy="166.0" rx="9.6" ry="7.6" fill="#39444F"></ellipse><ellipse cx="64.0" cy="166.0" rx="9.6" ry="10.8" fill="#39444F"></ellipse><ellipse cx="80.0" cy="166.0" rx="9.6" ry="13.9" fill="#39444F"></ellipse><ellipse cx="96.0" cy="166.0" rx="9.6" ry="7.6" fill="#39444F"></ellipse><ellipse cx="112.0" cy="166.0" rx="9.6" ry="10.8" fill="#39444F"></ellipse><ellipse cx="128.0" cy="166.0" rx="9.6" ry="13.9" fill="#39444F"></ellipse><rect x="0" y="158.0" width="128" height="10" fill="#39444F"></rect></svg>
|
|
||||||
|
Before Width: | Height: | Size: 2.0 KiB |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="168" viewBox="0 0 128 168"><defs><linearGradient id="nn3" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#161B38"></stop><stop offset="0.55" stop-color="#4A3A63"></stop><stop offset="1" stop-color="#C9764C"></stop></linearGradient></defs><rect width="128" height="168" fill="url(#nn3)"></rect><circle cx="15.4" cy="10.8" r="1.1" fill="#FFFFFF" opacity="0.65"></circle><circle cx="38.4" cy="18.8" r="1.1" fill="#FFFFFF" opacity="0.65"></circle><circle cx="92.2" cy="9.4" r="1.1" fill="#FFFFFF" opacity="0.65"></circle><circle cx="110.1" cy="22.8" r="1.1" fill="#FFFFFF" opacity="0.65"></circle><circle cx="25.6" cy="34.9" r="1.1" fill="#FFFFFF" opacity="0.65"></circle><circle cx="117.8" cy="40.3" r="1.1" fill="#FFFFFF" opacity="0.65"></circle><circle cx="10.2" cy="48.4" r="1.1" fill="#FFFFFF" opacity="0.65"></circle><circle cx="99.8" cy="53.8" r="1.1" fill="#FFFFFF" opacity="0.65"></circle><rect x="29.0" y="107.5" width="70.0" height="42.5" fill="#0C0B0A"></rect><rect x="11.5" y="125.0" width="17.5" height="25.0" fill="#0C0B0A"></rect><rect x="99.0" y="125.0" width="17.5" height="25.0" fill="#0C0B0A"></rect><rect x="51.5" y="92.5" width="25.0" height="15.0" fill="#0C0B0A"></rect><path d="M49.0 92.5 C42.4 81.5 59.2 74.3 64.0 60.0 C68.8 74.3 85.6 81.5 79.0 92.5 Z" fill="#0C0B0A"></path><path d="M64.0 47.5 V60.0 M60.2 51.6 H67.8" stroke="#0C0B0A" stroke-width="1.2" fill="none"></path><path d="M12.8 125.0 C9.5 119.5 17.9 115.9 20.2 108.8 C22.6 115.9 31.0 119.5 27.8 125.0 Z" fill="#0C0B0A"></path><path d="M20.2 100.0 V108.8 M17.6 102.9 H22.9" stroke="#0C0B0A" stroke-width="1.0" fill="none"></path><path d="M100.2 125.0 C97.0 119.5 105.3 115.9 107.8 108.8 C110.2 115.9 118.5 119.5 115.2 125.0 Z" fill="#0C0B0A"></path><path d="M107.8 100.0 V108.8 M105.1 102.9 H110.4" stroke="#0C0B0A" stroke-width="1.0" fill="none"></path><ellipse cx="0.0" cy="166.0" rx="9.6" ry="7.6" fill="#0C0B0A"></ellipse><ellipse cx="16.0" cy="166.0" rx="9.6" ry="10.8" fill="#0C0B0A"></ellipse><ellipse cx="32.0" cy="166.0" rx="9.6" ry="13.9" fill="#0C0B0A"></ellipse><ellipse cx="48.0" cy="166.0" rx="9.6" ry="7.6" fill="#0C0B0A"></ellipse><ellipse cx="64.0" cy="166.0" rx="9.6" ry="10.8" fill="#0C0B0A"></ellipse><ellipse cx="80.0" cy="166.0" rx="9.6" ry="13.9" fill="#0C0B0A"></ellipse><ellipse cx="96.0" cy="166.0" rx="9.6" ry="7.6" fill="#0C0B0A"></ellipse><ellipse cx="112.0" cy="166.0" rx="9.6" ry="10.8" fill="#0C0B0A"></ellipse><ellipse cx="128.0" cy="166.0" rx="9.6" ry="13.9" fill="#0C0B0A"></ellipse><rect x="0" y="158.0" width="128" height="10" fill="#0C0B0A"></rect></svg>
|
|
||||||
|
Before Width: | Height: | Size: 2.6 KiB |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="168" viewBox="0 0 128 168"><defs><linearGradient id="nn4" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#8F9BA8"></stop><stop offset="0.55" stop-color="#C8CFD6"></stop><stop offset="1" stop-color="#EDEFF1"></stop></linearGradient></defs><rect width="128" height="168" fill="url(#nn4)"></rect><rect x="27.6" y="109.8" width="72.8" height="44.2" fill="#2F353B"></rect><rect x="9.4" y="128.0" width="18.2" height="26.0" fill="#2F353B"></rect><rect x="100.4" y="128.0" width="18.2" height="26.0" fill="#2F353B"></rect><rect x="51.0" y="94.2" width="26.0" height="15.6" fill="#2F353B"></rect><path d="M48.4 94.2 C41.5 82.7 59.0 75.3 64.0 60.4 C69.0 75.3 86.5 82.7 79.6 94.2 Z" fill="#2F353B"></path><path d="M64.0 47.4 V60.4 M60.1 51.7 H67.9" stroke="#2F353B" stroke-width="1.3" fill="none"></path><path d="M10.7 128.0 C7.3 122.3 16.0 118.5 18.5 111.1 C21.0 118.5 29.7 122.3 26.3 128.0 Z" fill="#2F353B"></path><path d="M18.5 102.0 V111.1 M15.8 105.0 H21.2" stroke="#2F353B" stroke-width="1.0" fill="none"></path><path d="M101.7 128.0 C98.3 122.3 107.0 118.5 109.5 111.1 C112.0 118.5 120.7 122.3 117.3 128.0 Z" fill="#2F353B"></path><path d="M109.5 102.0 V111.1 M106.8 105.0 H112.2" stroke="#2F353B" stroke-width="1.0" fill="none"></path><ellipse cx="0.0" cy="166.0" rx="9.6" ry="7.6" fill="#2F353B"></ellipse><ellipse cx="16.0" cy="166.0" rx="9.6" ry="10.8" fill="#2F353B"></ellipse><ellipse cx="32.0" cy="166.0" rx="9.6" ry="13.9" fill="#2F353B"></ellipse><ellipse cx="48.0" cy="166.0" rx="9.6" ry="7.6" fill="#2F353B"></ellipse><ellipse cx="64.0" cy="166.0" rx="9.6" ry="10.8" fill="#2F353B"></ellipse><ellipse cx="80.0" cy="166.0" rx="9.6" ry="13.9" fill="#2F353B"></ellipse><ellipse cx="96.0" cy="166.0" rx="9.6" ry="7.6" fill="#2F353B"></ellipse><ellipse cx="112.0" cy="166.0" rx="9.6" ry="10.8" fill="#2F353B"></ellipse><ellipse cx="128.0" cy="166.0" rx="9.6" ry="13.9" fill="#2F353B"></ellipse><rect x="0" y="158.0" width="128" height="10" fill="#2F353B"></rect></svg>
|
|
||||||
|
Before Width: | Height: | Size: 2.0 KiB |
|
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: 4.6 KiB After Width: | Height: | Size: 7.4 KiB |
@@ -1,25 +1,133 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<rect width="100" height="100" rx="18" fill="#12110F"/>
|
<svg
|
||||||
<rect x="7" y="7" width="86" height="86" fill="rgba(224,184,79,0.07)" stroke="#E0B84F" stroke-width="2.2"/>
|
viewBox="0 0 1920 1920"
|
||||||
<rect x="11.5" y="11.5" width="77" height="77" stroke="#E0B84F" stroke-width="0.6" opacity="0.6"/>
|
version="1.1"
|
||||||
<g transform="translate(18 18)" stroke="#F2D98E" stroke-width="1.7" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
id="svg10"
|
||||||
<path d="M8 56 H56"/>
|
sodipodi:docname="logo_color_transparent — копия.svg"
|
||||||
<path d="M26 56 V34 M38 56 V34"/>
|
inkscape:version="1.3.2 (091e20e, 2023-11-25)"
|
||||||
<path d="M25 34 L32 12 L39 34 Z"/>
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
<path d="M32 12 V5 M30 8 H34"/>
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
<path d="M10 56 V42 M18 56 V42"/>
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
<path d="M10 42 C8 34 14 32 14 26 C14 32 20 34 18 42 Z"/>
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
<path d="M14 26 V22"/>
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
<path d="M46 56 V42 M54 56 V42"/>
|
<sodipodi:namedview
|
||||||
<path d="M46 42 C44 34 50 32 50 26 C50 32 56 34 54 42 Z"/>
|
id="namedview10"
|
||||||
<path d="M50 26 V22"/>
|
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>
|
</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>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 1007 B |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Городар",
|
"name": "Городар",
|
||||||
"short_name": "Городар",
|
"short_name": "Городар",
|
||||||
"description": "Коллекция городских объектов. Приезжайте на место, снимайте — объект попадёт в вашу коллекцию.",
|
"description": "Открывайте города с Городаром: находите достопримечательности на карте, посещайте их и фотографируйте, чтобы пополнять личную коллекцию.",
|
||||||
"lang": "ru",
|
"lang": "ru",
|
||||||
"dir": "ltr",
|
"dir": "ltr",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
@@ -12,61 +12,73 @@
|
|||||||
"theme_color": "#12110F",
|
"theme_color": "#12110F",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "icons/icon-72x72.png",
|
"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",
|
"sizes": "72x72",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any"
|
"purpose": "any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "icons/icon-96x96.png",
|
"src": "assets/logo/96.png",
|
||||||
"sizes": "96x96",
|
"sizes": "96x96",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any"
|
"purpose": "any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "icons/icon-128x128.png",
|
"src": "assets/logo/128.png",
|
||||||
"sizes": "128x128",
|
"sizes": "128x128",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any"
|
"purpose": "any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "icons/icon-144x144.png",
|
"src": "assets/logo/144.png",
|
||||||
"sizes": "144x144",
|
"sizes": "144x144",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any"
|
"purpose": "any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "icons/icon-152x152.png",
|
"src": "assets/logo/152.png",
|
||||||
"sizes": "152x152",
|
"sizes": "152x152",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any"
|
"purpose": "any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "icons/icon-192x192.png",
|
"src": "assets/logo/196.png",
|
||||||
"sizes": "192x192",
|
"sizes": "196x196",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any"
|
"purpose": "any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "icons/icon-384x384.png",
|
"src": "assets/logo/384.png",
|
||||||
"sizes": "384x384",
|
"sizes": "384x384",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any"
|
"purpose": "any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "icons/icon-512x512.png",
|
"src": "assets/logo/512.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any"
|
"purpose": "any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "icons/icon-192x192.png",
|
"src": "assets/logo/196.png",
|
||||||
"sizes": "192x192",
|
"sizes": "196x196",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "maskable"
|
"purpose": "maskable"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "icons/icon-512x512.png",
|
"src": "assets/logo/512.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "maskable"
|
"purpose": "maskable"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { ApplicationConfig, isDevMode, provideBrowserGlobalErrorListeners, provideZoneChangeDetection } from '@angular/core';
|
import { ApplicationConfig, isDevMode, provideBrowserGlobalErrorListeners, provideZoneChangeDetection } from '@angular/core';
|
||||||
|
import { provideHttpClient, withInterceptors } from '@angular/common/http';
|
||||||
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
||||||
import { provideRouter, withComponentInputBinding } from '@angular/router';
|
import { provideRouter, withComponentInputBinding } from '@angular/router';
|
||||||
import { provideServiceWorker } from '@angular/service-worker';
|
import { provideServiceWorker } from '@angular/service-worker';
|
||||||
@@ -6,18 +7,20 @@ import { provideEffects } from '@ngrx/effects';
|
|||||||
import { provideState, provideStore } from '@ngrx/store';
|
import { provideState, provideStore } from '@ngrx/store';
|
||||||
import { provideStoreDevtools } from '@ngrx/store-devtools';
|
import { provideStoreDevtools } from '@ngrx/store-devtools';
|
||||||
|
|
||||||
|
import { authInterceptor } from './auth/auth.interceptor';
|
||||||
import { routes } from './app.routes';
|
import { routes } from './app.routes';
|
||||||
import { GorodarEffects, gorodarFeature } from './state';
|
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 }),
|
||||||
|
provideHttpClient(withInterceptors([authInterceptor])),
|
||||||
provideRouter(routes, withComponentInputBinding()),
|
provideRouter(routes, withComponentInputBinding()),
|
||||||
provideAnimationsAsync(),
|
provideAnimationsAsync(),
|
||||||
provideStore(),
|
provideStore(),
|
||||||
provideState(gorodarFeature),
|
provideState(gorodarFeature),
|
||||||
provideEffects(GorodarEffects),
|
provideEffects(GorodarEffects, AuthEffects, AreasEffects),
|
||||||
provideStoreDevtools({ maxAge: 25, logOnly: !isDevMode() }),
|
provideStoreDevtools({ maxAge: 25, logOnly: !isDevMode() }),
|
||||||
provideServiceWorker('ngsw-worker.js', {
|
provideServiceWorker('ngsw-worker.js', {
|
||||||
enabled: !isDevMode(),
|
enabled: !isDevMode(),
|
||||||
|
|||||||
@@ -6,4 +6,6 @@
|
|||||||
@if (!hideNav()) {
|
@if (!hideNav()) {
|
||||||
<app-bottom-nav />
|
<app-bottom-nav />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<app-auth-sheet />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
import { Routes } from '@angular/router';
|
import { Routes } from '@angular/router';
|
||||||
|
|
||||||
import { CitiesPage } from './pages/cities-page/cities-page';
|
import { CitiesPage } from './pages/cities-page/cities-page';
|
||||||
import { CollectionPage } from './pages/collection-page/collection-page';
|
import { CityPage } from './pages/city-page/city-page';
|
||||||
import { CollectionsPage } from './pages/collections-page/collections-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 { 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';
|
import { MapPage } from './pages/map-page/map-page';
|
||||||
import { ProfilePage } from './pages/profile-page/profile-page';
|
|
||||||
|
|
||||||
export const routes: Routes = [
|
export const routes: Routes = [
|
||||||
{ path: '', component: CitiesPage },
|
{ path: '', component: CitiesPage },
|
||||||
{ path: 'map', component: MapPage },
|
{ path: 'map', component: MapPage },
|
||||||
{ path: 'collections', component: CollectionsPage },
|
{ path: 'collections', component: CollectionsPage },
|
||||||
{ path: 'collection', component: CollectionPage },
|
{ path: 'collection', pathMatch: 'full', redirectTo: '' },
|
||||||
{ path: 'profile', component: ProfilePage },
|
{ path: 'city/:areaId/:id/icon', component: IconPreviewPage },
|
||||||
{ path: 'items/:id', component: MapItemPage },
|
{ path: 'city/:areaId/:id', component: MapItemPage, canActivate: [visitedItemGuard] },
|
||||||
{ path: 'objects/:id', redirectTo: 'items/:id' },
|
{ path: 'city/:areaId', component: CityPage },
|
||||||
{ path: '**', redirectTo: '' },
|
{ path: '**', redirectTo: '' },
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -11,6 +11,12 @@
|
|||||||
background: var(--color-bg);
|
background: var(--color-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (display-mode: standalone) {
|
||||||
|
.app {
|
||||||
|
padding-top: env(safe-area-inset-top);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.app__main {
|
.app__main {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { provideHttpClient } from '@angular/common/http';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { provideRouter } from '@angular/router';
|
import { provideRouter } from '@angular/router';
|
||||||
import { provideServiceWorker } from '@angular/service-worker';
|
import { provideServiceWorker } from '@angular/service-worker';
|
||||||
@@ -5,17 +6,18 @@ import { provideEffects } from '@ngrx/effects';
|
|||||||
import { provideState, provideStore } from '@ngrx/store';
|
import { provideState, provideStore } from '@ngrx/store';
|
||||||
|
|
||||||
import { App } from './app';
|
import { App } from './app';
|
||||||
import { GorodarEffects, gorodarFeature } from './state';
|
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: [
|
providers: [
|
||||||
|
provideHttpClient(),
|
||||||
provideRouter([]),
|
provideRouter([]),
|
||||||
provideStore(),
|
provideStore(),
|
||||||
provideState(gorodarFeature),
|
provideState(gorodarFeature),
|
||||||
provideEffects(GorodarEffects),
|
provideEffects(GorodarEffects, AuthEffects),
|
||||||
provideServiceWorker('ngsw-worker.js', { enabled: false }),
|
provideServiceWorker('ngsw-worker.js', { enabled: false }),
|
||||||
],
|
],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
|
|||||||
@@ -2,17 +2,25 @@ import { Component, computed, inject } from '@angular/core';
|
|||||||
import { toSignal } from '@angular/core/rxjs-interop';
|
import { toSignal } from '@angular/core/rxjs-interop';
|
||||||
import { NavigationEnd, Router, RouterOutlet } from '@angular/router';
|
import { NavigationEnd, Router, RouterOutlet } from '@angular/router';
|
||||||
import { filter, map, startWith } from 'rxjs';
|
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 { BottomNav } from './layout/bottom-nav/bottom-nav';
|
||||||
|
import { GorodarActions } from './state';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
imports: [RouterOutlet, BottomNav],
|
imports: [RouterOutlet, BottomNav, AuthSheet],
|
||||||
templateUrl: './app.html',
|
templateUrl: './app.html',
|
||||||
styleUrl: './app.scss',
|
styleUrl: './app.scss',
|
||||||
})
|
})
|
||||||
export class App {
|
export class App {
|
||||||
private readonly router = inject(Router);
|
private readonly router = inject(Router);
|
||||||
|
private readonly store = inject(Store);
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.store.dispatch(GorodarActions.areasRequested());
|
||||||
|
}
|
||||||
|
|
||||||
private readonly url = toSignal(
|
private readonly url = toSignal(
|
||||||
this.router.events.pipe(
|
this.router.events.pipe(
|
||||||
@@ -23,7 +31,7 @@ export class App {
|
|||||||
{ initialValue: this.router.url },
|
{ initialValue: this.router.url },
|
||||||
);
|
);
|
||||||
|
|
||||||
protected readonly hideNav = computed(
|
protected readonly hideNav = computed(() =>
|
||||||
() => this.url().startsWith('/items') || this.url().startsWith('/objects'),
|
/^\/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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,21 @@
|
|||||||
@if (stage() === 'check' && photo(); as image) {
|
@if (claim().stage === 'check' && claim().photo; as image) {
|
||||||
<app-photo-check [photo]="image" [title]="landmark().title" [step]="step()" />
|
<app-photo-check [photo]="image" [title]="landmark().name" [step]="claim().step" />
|
||||||
} @else if (stage() === 'success') {
|
} @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
|
<app-collect-success
|
||||||
[title]="landmark().title"
|
[title]="landmark().name"
|
||||||
[cityName]="city.name"
|
[image]="landmark().iconUrl"
|
||||||
[opened]="openedCount()"
|
[model]="landmark().modelUrl || undefined"
|
||||||
[total]="totalCount"
|
[alreadyVisited]="claim().alreadyVisited"
|
||||||
|
[cityName]="cityName()"
|
||||||
|
[opened]="opened()"
|
||||||
|
[total]="total()"
|
||||||
|
[areaId]="areaId()"
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,34 @@
|
|||||||
import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
import type { Landmark } from '../../data/nizhny-novgorod';
|
import type { Attraction } from '../../areas/area.models';
|
||||||
import { CityCatalogService } from '../../root/services/city-catalog.service';
|
import { GorodarActions, selectClaim } from '../../state';
|
||||||
import {
|
|
||||||
selectClaimPhoto,
|
|
||||||
selectClaimStage,
|
|
||||||
selectClaimStep,
|
|
||||||
selectOpenedCount,
|
|
||||||
} from '../../state';
|
|
||||||
import { CollectSuccess } from '../collect-success/collect-success';
|
import { CollectSuccess } from '../collect-success/collect-success';
|
||||||
import { PhotoCheck } from '../photo-check/photo-check';
|
import { PhotoCheck } from '../photo-check/photo-check';
|
||||||
|
import { PhotoFail } from '../photo-fail/photo-fail';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-claim-flow',
|
selector: 'app-claim-flow',
|
||||||
imports: [PhotoCheck, CollectSuccess],
|
imports: [PhotoCheck, PhotoFail, CollectSuccess],
|
||||||
templateUrl: './claim-flow.html',
|
templateUrl: './claim-flow.html',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class ClaimFlow {
|
export class ClaimFlow {
|
||||||
private readonly store = inject(Store);
|
private readonly store = inject(Store);
|
||||||
private readonly catalog = inject(CityCatalogService);
|
|
||||||
|
|
||||||
readonly landmark = input.required<Landmark>();
|
readonly landmark = input.required<Attraction>();
|
||||||
|
readonly cityName = input('');
|
||||||
|
readonly opened = input(0);
|
||||||
|
readonly total = input(1);
|
||||||
|
readonly areaId = input('');
|
||||||
|
|
||||||
protected readonly city = this.catalog.city;
|
protected readonly claim = this.store.selectSignal(selectClaim);
|
||||||
protected readonly totalCount = this.city.objects.length;
|
|
||||||
protected readonly photo = this.store.selectSignal(selectClaimPhoto);
|
protected retake(): void {
|
||||||
protected readonly stage = this.store.selectSignal(selectClaimStage);
|
this.store.dispatch(GorodarActions.takePhoto({ landmarkId: this.landmark().id }));
|
||||||
protected readonly step = this.store.selectSignal(selectClaimStep);
|
}
|
||||||
protected readonly openedCount = this.store.selectSignal(selectOpenedCount);
|
|
||||||
|
protected leave(): void {
|
||||||
|
this.store.dispatch(GorodarActions.claimReset());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,35 @@
|
|||||||
<section class="success">
|
<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__glow"></div>
|
||||||
|
|
||||||
<div class="success__stamp">
|
<div class="success__stamp">
|
||||||
@@ -20,40 +51,73 @@
|
|||||||
<span class="success__spark success__spark--b"></span>
|
<span class="success__spark success__spark--b"></span>
|
||||||
<span class="success__spark success__spark--c"></span>
|
<span class="success__spark success__spark--c"></span>
|
||||||
<span class="success__spark success__spark--d"></span>
|
<span class="success__spark success__spark--d"></span>
|
||||||
<div class="success__mark anim-pop">
|
<div class="success__mark anim-pop" [class.success__mark--model]="model()">
|
||||||
<img src="/assets/icons/gorodar-mark.svg" alt="" />
|
@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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="success__copy">
|
@if (mode() === 'preview') {
|
||||||
<p class="success__eyebrow">Новое в коллекции</p>
|
<h1 class="success__title">{{ title() }}</h1>
|
||||||
<h1>{{ title() }}</h1>
|
} @else {
|
||||||
<p>Добавлено в коллекцию «{{ cityName() }}»</p>
|
<div class="success__copy">
|
||||||
</div>
|
<p class="success__eyebrow">
|
||||||
|
{{ alreadyVisited() ? 'Уже в коллекции' : 'Новое в коллекции' }}
|
||||||
<div class="success__card anim-rise">
|
</p>
|
||||||
<div class="success__row">
|
<h1>{{ title() }}</h1>
|
||||||
<span>{{ cityName() }}</span>
|
<p>
|
||||||
<span>
|
{{
|
||||||
<b>{{ opened() }} из {{ total() }}</b>
|
alreadyVisited()
|
||||||
· +1 сегодня
|
? 'Этот объект уже был в коллекции «' + cityName() + '»'
|
||||||
</span>
|
: 'Добавлено в коллекцию «' + cityName() + '»'
|
||||||
|
}}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="success__bar">
|
|
||||||
<span
|
|
||||||
class="anim-grow"
|
|
||||||
[style.--from]="from() + '%'"
|
|
||||||
[style.--to]="to() + '%'"
|
|
||||||
></span>
|
|
||||||
</div>
|
|
||||||
<p class="success__match">
|
|
||||||
<app-icon name="check" [size]="15" />
|
|
||||||
Совпадение фото {{ matchPercent() }}% (нужно от 78%)
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="success__actions">
|
<div class="success__card anim-rise">
|
||||||
<a matButton="filled" routerLink="/collection" (click)="leave()">Открыть коллекцию</a>
|
<div class="success__row">
|
||||||
<a class="success__ghost" routerLink="/map" (click)="leave()">Продолжить на карте</a>
|
<span>{{ cityName() }}</span>
|
||||||
</div>
|
<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>
|
</section>
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
inset: 0;
|
inset: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.success__mark {
|
.success__mark {
|
||||||
@@ -43,10 +44,91 @@
|
|||||||
height: 58%;
|
height: 58%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.success__mark img {
|
.success__mark img,
|
||||||
|
.success__model {
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 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 {
|
.success__spark {
|
||||||
@@ -55,12 +137,25 @@
|
|||||||
height: 10px;
|
height: 10px;
|
||||||
background: var(--color-accent-soft);
|
background: var(--color-accent-soft);
|
||||||
clip-path: polygon(50% 0, 65% 35%, 100% 50%, 65% 65%, 50% 100%, 35% 65%, 0 50%, 35% 35%);
|
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--a {
|
||||||
.success__spark--b { top: 22%; right: 14%; }
|
top: 18%;
|
||||||
.success__spark--c { bottom: 16%; left: 20%; }
|
left: 16%;
|
||||||
.success__spark--d { bottom: 18%; right: 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__copy,
|
||||||
.success__card,
|
.success__card,
|
||||||
@@ -85,7 +180,8 @@
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.success__copy h1 {
|
.success__copy h1,
|
||||||
|
.success__title {
|
||||||
margin: 8px 0 0;
|
margin: 8px 0 0;
|
||||||
font-family: var(--font-display);
|
font-family: var(--font-display);
|
||||||
font-size: clamp(28px, 8vw, 34px);
|
font-size: clamp(28px, 8vw, 34px);
|
||||||
@@ -93,6 +189,69 @@
|
|||||||
line-height: 1.15;
|
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 {
|
.success__copy p:last-child {
|
||||||
margin: 8px 0 0;
|
margin: 8px 0 0;
|
||||||
color: var(--color-muted);
|
color: var(--color-muted);
|
||||||
@@ -141,15 +300,6 @@
|
|||||||
background: var(--color-accent);
|
background: var(--color-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
.success__match {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 6px;
|
|
||||||
margin: 12px 0 0;
|
|
||||||
color: var(--color-success);
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.success__actions {
|
.success__actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@@ -159,11 +309,6 @@
|
|||||||
margin-top: 24px;
|
margin-top: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.success__actions a[matButton='filled'] {
|
|
||||||
width: 100%;
|
|
||||||
min-height: 56px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.success__ghost {
|
.success__ghost {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -1,6 +1,19 @@
|
|||||||
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
import { Location } from '@angular/common';
|
||||||
import { RouterLink } from '@angular/router';
|
import {
|
||||||
import { MatButton } from '@angular/material/button';
|
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 { Store } from '@ngrx/store';
|
||||||
|
|
||||||
import { Icon } from '../../shared/icon/icon';
|
import { Icon } from '../../shared/icon/icon';
|
||||||
@@ -8,24 +21,90 @@ import { GorodarActions } from '../../state';
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-collect-success',
|
selector: 'app-collect-success',
|
||||||
imports: [Icon, RouterLink, MatButton],
|
imports: [Icon, RouterLink],
|
||||||
templateUrl: './collect-success.html',
|
templateUrl: './collect-success.html',
|
||||||
styleUrl: './collect-success.scss',
|
styleUrl: './collect-success.scss',
|
||||||
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class CollectSuccess {
|
export class CollectSuccess {
|
||||||
private readonly store = inject(Store);
|
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 title = input.required<string>();
|
||||||
readonly cityName = input.required<string>();
|
readonly image = input.required<string>();
|
||||||
readonly opened = input.required<number>();
|
readonly model = input<string | undefined>(undefined);
|
||||||
readonly total = input.required<number>();
|
readonly cityName = input('');
|
||||||
readonly matchPercent = input(91);
|
readonly opened = input(0);
|
||||||
|
readonly total = input(1);
|
||||||
|
readonly areaId = input('');
|
||||||
|
readonly alreadyVisited = input(false);
|
||||||
|
|
||||||
protected readonly from = computed(() =>
|
protected readonly view = signal<'model' | 'image'>('image');
|
||||||
Math.max(0, Math.round(((this.opened() - 1) / this.total()) * 100)),
|
protected readonly modelLoaded = signal(false);
|
||||||
);
|
|
||||||
protected readonly to = computed(() => Math.round((this.opened() / this.total()) * 100));
|
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) => {
|
protected readonly rays = Array.from({ length: 24 }, (_, index) => {
|
||||||
const angle = (index / 24) * Math.PI * 2;
|
const angle = (index / 24) * Math.PI * 2;
|
||||||
@@ -44,4 +123,18 @@ export class CollectSuccess {
|
|||||||
protected leave(): void {
|
protected leave(): void {
|
||||||
this.store.dispatch(GorodarActions.claimReset());
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,47 +5,25 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1>Проверяем фото</h1>
|
<h1>Проверяем фото</h1>
|
||||||
<p>Обычно это занимает несколько секунд</p>
|
<p>Сверяем снимок с эталоном</p>
|
||||||
|
|
||||||
<ol class="steps">
|
<ol class="steps">
|
||||||
<li [class.steps__item--done]="step() >= 1">
|
@for (item of items(); track item.title) {
|
||||||
<span class="steps__mark steps__mark--done">
|
<li [class.steps__item--done]="item.state === 'done'" [class.steps__item--active]="item.state === 'active'">
|
||||||
<app-icon name="check" [size]="18" />
|
@if (item.state === 'done') {
|
||||||
</span>
|
<span class="steps__mark steps__mark--done">
|
||||||
<div>
|
<app-icon name="check" [size]="18" />
|
||||||
<b>Фото отправлено</b>
|
</span>
|
||||||
<span>Снимок получен сервисом</span>
|
} @else if (item.state === 'active') {
|
||||||
</div>
|
<span class="steps__mark steps__mark--spin anim-spinner"></span>
|
||||||
</li>
|
} @else {
|
||||||
|
<span class="steps__mark"></span>
|
||||||
<li [class.steps__item--done]="step() >= 2" [class.steps__item--active]="step() === 1">
|
}
|
||||||
@if (step() >= 2) {
|
<div>
|
||||||
<span class="steps__mark steps__mark--done">
|
<b>{{ item.title }}</b>
|
||||||
<app-icon name="check" [size]="18" />
|
<span>{{ item.text }}</span>
|
||||||
</span>
|
</div>
|
||||||
} @else {
|
</li>
|
||||||
<span class="steps__mark steps__mark--spin anim-spinner"></span>
|
}
|
||||||
}
|
|
||||||
<div>
|
|
||||||
<b>Сравниваем с эталонами</b>
|
|
||||||
<span>Ищем совпадение с {{ title() }}</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li [class.steps__item--done]="step() >= 3" [class.steps__item--active]="step() === 2">
|
|
||||||
@if (step() >= 3) {
|
|
||||||
<span class="steps__mark steps__mark--done">
|
|
||||||
<app-icon name="check" [size]="18" />
|
|
||||||
</span>
|
|
||||||
} @else if (step() === 2) {
|
|
||||||
<span class="steps__mark steps__mark--spin anim-spinner"></span>
|
|
||||||
} @else {
|
|
||||||
<span class="steps__mark"></span>
|
|
||||||
}
|
|
||||||
<div>
|
|
||||||
<b>Добавляем в коллекцию</b>
|
|
||||||
<span>Объект появится в вашей коллекции</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ol>
|
</ol>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -78,6 +78,13 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: 2px solid #312d27;
|
border: 2px solid #312d27;
|
||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
|
|
||||||
|
app-icon {
|
||||||
|
display: flex;
|
||||||
|
height: 100%;
|
||||||
|
align-items: center;
|
||||||
|
color: var(--color-surface);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.steps__mark--spin {
|
.steps__mark--spin {
|
||||||
@@ -92,6 +99,13 @@
|
|||||||
border: 0;
|
border: 0;
|
||||||
background: var(--color-accent);
|
background: var(--color-accent);
|
||||||
color: var(--color-on-accent);
|
color: var(--color-on-accent);
|
||||||
|
animation: step-pop 0.35s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes step-pop {
|
||||||
|
from {
|
||||||
|
transform: scale(0.4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.steps b,
|
.steps b,
|
||||||
@@ -114,3 +128,9 @@
|
|||||||
.steps__item--active b {
|
.steps__item--active b {
|
||||||
color: var(--color-text);
|
color: var(--color-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.steps__mark--done {
|
||||||
|
animation: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
||||||
|
|
||||||
import { Icon } from '../../shared/icon/icon';
|
import { Icon } from '../../shared/icon/icon';
|
||||||
|
|
||||||
|
type StepState = 'done' | 'active' | 'wait';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-photo-check',
|
selector: 'app-photo-check',
|
||||||
imports: [Icon],
|
imports: [Icon],
|
||||||
@@ -12,5 +14,35 @@ import { Icon } from '../../shared/icon/icon';
|
|||||||
export class PhotoCheck {
|
export class PhotoCheck {
|
||||||
readonly photo = input.required<string>();
|
readonly photo = input.required<string>();
|
||||||
readonly title = input.required<string>();
|
readonly title = input.required<string>();
|
||||||
readonly step = input(1);
|
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)));
|
||||||
|
}
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
export interface Landmark {
|
|
||||||
id: string;
|
|
||||||
title: string;
|
|
||||||
description: string;
|
|
||||||
address: string;
|
|
||||||
addressHint: string;
|
|
||||||
coordinates: [number, number];
|
|
||||||
collected: boolean;
|
|
||||||
geoCheckEnabled: boolean;
|
|
||||||
geoRadiusMeters: number;
|
|
||||||
facts: string[];
|
|
||||||
photoHint: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface City {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
center: [number, number];
|
|
||||||
objects: Landmark[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export const NIZHNY_NOVGOROD: City = {
|
|
||||||
id: 'nizhny-novgorod',
|
|
||||||
name: 'Нижний Новгород',
|
|
||||||
center: [44.0075, 56.3269],
|
|
||||||
objects: [
|
|
||||||
{
|
|
||||||
id: 'kremlin',
|
|
||||||
title: 'Нижегородский кремль',
|
|
||||||
description: 'Кирпичная крепость на высоком правом берегу, в месте слияния Оки и Волги. Исторический центр города.',
|
|
||||||
address: 'Кремль, Нижний Новгород',
|
|
||||||
addressHint: 'Над слиянием Оки и Волги',
|
|
||||||
coordinates: [44.0031, 56.3285],
|
|
||||||
collected: false,
|
|
||||||
geoCheckEnabled: true,
|
|
||||||
geoRadiusMeters: 300,
|
|
||||||
facts: [
|
|
||||||
'Каменный кремль строили в 1508–1516 годах.',
|
|
||||||
'В крепости 13 башен, а стены тянутся примерно на 2 км.',
|
|
||||||
'Внутри — Михайло-Архангельский собор XVI века и площадь Минина и Пожарского.',
|
|
||||||
],
|
|
||||||
photoHint: 'Снимайте так, чтобы были видны стены и башни кремля.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'chkalov-stairs',
|
|
||||||
title: 'Чкаловская лестница',
|
|
||||||
description: 'Лестница в форме восьмёрки соединяет верхнюю и нижнюю набережные Волги. Названа в честь лётчика Валерия Чкалова.',
|
|
||||||
address: 'Верхне-Волжская набережная, Нижний Новгород',
|
|
||||||
addressHint: 'Между верхней и нижней набережными',
|
|
||||||
coordinates: [44.0094, 56.3306],
|
|
||||||
collected: false,
|
|
||||||
geoCheckEnabled: true,
|
|
||||||
geoRadiusMeters: 300,
|
|
||||||
facts: [
|
|
||||||
'Официально в ней 560 ступеней.',
|
|
||||||
'Строить начали в 1943 году, открыли 8 августа 1949 года.',
|
|
||||||
'На верхней площадке стоит памятник Валерию Чкалову.',
|
|
||||||
],
|
|
||||||
photoHint: 'Снимайте так, чтобы лестница читалась целиком.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'pokrovka',
|
|
||||||
title: 'Большая Покровская улица',
|
|
||||||
description: 'Главная пешеходная улица города, «нижегородский Арбат». По сторонам — старинные здания, а на улице играют уличные музыканты.',
|
|
||||||
address: 'Большая Покровская ул., Нижний Новгород',
|
|
||||||
addressHint: 'От площади Минина и Пожарского к площади Горького',
|
|
||||||
coordinates: [44.0015, 56.3188],
|
|
||||||
collected: false,
|
|
||||||
geoCheckEnabled: true,
|
|
||||||
geoRadiusMeters: 400,
|
|
||||||
facts: [
|
|
||||||
'Улица идёт от площади Минина и Пожарского к площади Горького.',
|
|
||||||
'Пешеходной её сделали в начале 1980-х годов.',
|
|
||||||
'В советское время она называлась улицей Свердлова.',
|
|
||||||
],
|
|
||||||
photoHint: 'Снимайте так, чтобы узнавалась перспектива улицы.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'alexander-nevsky',
|
|
||||||
title: 'Александро-Невский собор',
|
|
||||||
description: 'Новоярмарочный собор на мысе Стрелка, где Ока впадает в Волгу. Стиль сочетает русские, романские и византийские черты.',
|
|
||||||
address: 'ул. Стрелка, 3А, Нижний Новгород',
|
|
||||||
addressHint: 'У слияния Оки и Волги',
|
|
||||||
coordinates: [44.0247, 56.3347],
|
|
||||||
collected: false,
|
|
||||||
geoCheckEnabled: true,
|
|
||||||
geoRadiusMeters: 300,
|
|
||||||
facts: [
|
|
||||||
'Построен в 1868–1881 годах, освящён 20 июля 1881 года.',
|
|
||||||
'Высота собора — 87 метров.',
|
|
||||||
'В 1929 году собор закрыли; с 1992 года он снова у Церкви, а с 2009-го — кафедральный.',
|
|
||||||
],
|
|
||||||
photoHint: 'Снимайте так, чтобы собор был виден целиком.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'pechersky',
|
|
||||||
title: 'Печерский монастырь',
|
|
||||||
description: 'Вознесенский Печерский монастырь на высоком берегу Волги, примерно в 3 км ниже по течению от кремля.',
|
|
||||||
address: 'Нижне-Волжская набережная, Нижний Новгород',
|
|
||||||
addressHint: 'На высоком берегу Волги, около 3 км от кремля',
|
|
||||||
coordinates: [44.0499, 56.3225],
|
|
||||||
collected: false,
|
|
||||||
geoCheckEnabled: true,
|
|
||||||
geoRadiusMeters: 100,
|
|
||||||
facts: [
|
|
||||||
'Основал обитель в XIV веке святитель Дионисий.',
|
|
||||||
'В 1597 году оползень разрушил монастырь, и его перенесли на версту выше по Волге.',
|
|
||||||
'Пятиглавый Вознесенский собор построен в 1631–1632 годах.',
|
|
||||||
],
|
|
||||||
photoHint: 'Снимайте так, чтобы были видны собор и колокольня.',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
@@ -36,3 +36,16 @@
|
|||||||
.nav__item--active {
|
.nav__item--active {
|
||||||
color: var(--color-accent);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -25,14 +25,13 @@ export class BottomNav {
|
|||||||
|
|
||||||
protected readonly items = [
|
protected readonly items = [
|
||||||
{ path: '/', icon: 'cities', label: 'Города', exact: true },
|
{ path: '/', icon: 'cities', label: 'Города', exact: true },
|
||||||
{ path: '/map', icon: 'map', label: 'Карта', exact: false },
|
|
||||||
{ path: '/collections', icon: 'collection', label: 'Коллекция', exact: false },
|
{ path: '/collections', icon: 'collection', label: 'Коллекция', exact: false },
|
||||||
];
|
];
|
||||||
|
|
||||||
protected isActive(path: string, exact: boolean): boolean {
|
protected isActive(path: string, exact: boolean): boolean {
|
||||||
const url = this.url();
|
const url = this.url();
|
||||||
if (path === '/collections') {
|
if (path === '/') {
|
||||||
return url === '/collections' || url === '/collection';
|
return url === '/' || /^\/city\/[^/]+$/.test(url);
|
||||||
}
|
}
|
||||||
if (exact) {
|
if (exact) {
|
||||||
return url === path;
|
return url === path;
|
||||||
|
|||||||
@@ -2,30 +2,45 @@
|
|||||||
<div #map class="city-map__canvas"></div>
|
<div #map class="city-map__canvas"></div>
|
||||||
|
|
||||||
<div class="city-map__hud">
|
<div class="city-map__hud">
|
||||||
<button
|
@if (!embedded() && !fullscreen()) {
|
||||||
class="city-map__chip"
|
<button
|
||||||
type="button"
|
class="city-map__chip"
|
||||||
[attr.aria-label]="'Показать центр: ' + city.name"
|
type="button"
|
||||||
(click)="focusCity()"
|
[attr.aria-label]="'Показать центр: ' + (cityName() || 'Город')"
|
||||||
>
|
(click)="focusCity()"
|
||||||
<app-icon name="pin" [size]="18" />
|
>
|
||||||
<span>{{ city.name }}</span>
|
<app-icon name="pin" [size]="18" />
|
||||||
</button>
|
<span>{{ cityName() || 'Город' }}</span>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
|
||||||
<button
|
<div class="city-map__tools">
|
||||||
class="city-map__locate"
|
@if (embedded()) {
|
||||||
type="button"
|
<button
|
||||||
[class.city-map__locate--active]="following()"
|
class="city-map__locate"
|
||||||
[attr.aria-label]="following() ? 'Остановить навигацию' : 'Моя геопозиция'"
|
type="button"
|
||||||
(click)="locate()"
|
[attr.aria-label]="fullscreen() ? 'Свернуть карту' : 'На весь экран'"
|
||||||
>
|
(click)="toggleFullscreen()"
|
||||||
<app-icon name="my-location" [size]="22" />
|
>
|
||||||
</button>
|
<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>
|
</div>
|
||||||
|
|
||||||
@if (selected(); as landmark) {
|
@if (selected(); as landmark) {
|
||||||
<div class="city-map__sheet">
|
<div class="city-map__sheet">
|
||||||
<app-map-item-sheet [landmark]="landmark" />
|
<app-map-item-sheet [attraction]="landmark" [areaId]="areaId()" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:host.is-fullscreen {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 40;
|
||||||
|
inset: 0;
|
||||||
|
height: 100%;
|
||||||
|
background: var(--color-bg);
|
||||||
|
}
|
||||||
|
|
||||||
.city-map {
|
.city-map {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -26,12 +34,19 @@
|
|||||||
z-index: 2;
|
z-index: 2;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: flex-end;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.city-map__tools {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.city-map__chip,
|
.city-map__chip,
|
||||||
.city-map__locate {
|
.city-map__locate,
|
||||||
|
.city-map__back {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
min-height: 48px;
|
min-height: 48px;
|
||||||
@@ -41,6 +56,19 @@
|
|||||||
color: var(--color-text);
|
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 {
|
.city-map__chip {
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
padding: 0 16px;
|
padding: 0 16px;
|
||||||
|
|||||||
@@ -3,23 +3,23 @@ import {
|
|||||||
ChangeDetectionStrategy,
|
ChangeDetectionStrategy,
|
||||||
Component,
|
Component,
|
||||||
ElementRef,
|
ElementRef,
|
||||||
|
HostListener,
|
||||||
NgZone,
|
NgZone,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
ViewChild,
|
ViewChild,
|
||||||
effect,
|
effect,
|
||||||
inject,
|
inject,
|
||||||
|
input,
|
||||||
signal,
|
signal,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { Geolocation, type Position } from '@capacitor/geolocation';
|
import { Geolocation, type Position } from '@capacitor/geolocation';
|
||||||
import { Store } from '@ngrx/store';
|
|
||||||
|
|
||||||
import { MapItemSheet } from '../map-item-sheet/map-item-sheet';
|
import type { Attraction } from '../../areas/area.models';
|
||||||
import { CityCatalogService } from '../../root/services/city-catalog.service';
|
|
||||||
import type { Landmark } from '../../data/nizhny-novgorod';
|
|
||||||
import { Icon } from '../../shared/icon/icon';
|
import { Icon } from '../../shared/icon/icon';
|
||||||
import { selectCollectedIdSet } from '../../state';
|
import { MapItemSheet } from '../map-item-sheet/map-item-sheet';
|
||||||
|
|
||||||
const MAP_KEY = 'bf0a466f-43a6-48c7-b274-7fea5952957b';
|
const MAP_KEY = '35e12bfe-922e-4ec1-bb89-ad404cbf8378';
|
||||||
|
const CITY_CENTER: [number, number] = [43.99934, 56.329399];
|
||||||
const CITY_ZOOM = 16;
|
const CITY_ZOOM = 16;
|
||||||
const USER_ZOOM = 20;
|
const USER_ZOOM = 20;
|
||||||
const LANDMARK_SIZE = 40;
|
const LANDMARK_SIZE = 40;
|
||||||
@@ -32,6 +32,7 @@ interface DgPoint {
|
|||||||
|
|
||||||
interface DgMarker {
|
interface DgMarker {
|
||||||
addTo(map: DgMap): this;
|
addTo(map: DgMap): this;
|
||||||
|
remove(): void;
|
||||||
setLatLng(latLng: [number, number]): this;
|
setLatLng(latLng: [number, number]): this;
|
||||||
setZIndexOffset(offset: number): this;
|
setZIndexOffset(offset: number): this;
|
||||||
getElement(): HTMLElement | undefined;
|
getElement(): HTMLElement | undefined;
|
||||||
@@ -48,6 +49,7 @@ interface DgMap {
|
|||||||
): this;
|
): this;
|
||||||
getZoom(): number;
|
getZoom(): number;
|
||||||
latLngToContainerPoint(latLng: [number, number]): DgPoint;
|
latLngToContainerPoint(latLng: [number, number]): DgPoint;
|
||||||
|
invalidateSize?(): void;
|
||||||
remove(): void;
|
remove(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,13 +126,14 @@ function loadRasterApi(): Promise<DgApi> {
|
|||||||
templateUrl: './city-map.html',
|
templateUrl: './city-map.html',
|
||||||
styleUrl: './city-map.scss',
|
styleUrl: './city-map.scss',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
host: {
|
||||||
|
'[class.is-fullscreen]': 'fullscreen()',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
export class CityMap implements AfterViewInit, OnDestroy {
|
export class CityMap implements AfterViewInit, OnDestroy {
|
||||||
@ViewChild('map', { static: true })
|
@ViewChild('map', { static: true })
|
||||||
private mapElement!: ElementRef<HTMLElement>;
|
private mapElement!: ElementRef<HTMLElement>;
|
||||||
|
|
||||||
private readonly catalog = inject(CityCatalogService);
|
|
||||||
private readonly store = inject(Store);
|
|
||||||
private readonly zone = inject(NgZone);
|
private readonly zone = inject(NgZone);
|
||||||
private raster: DgApi | null = null;
|
private raster: DgApi | null = null;
|
||||||
private map: DgMap | null = null;
|
private map: DgMap | null = null;
|
||||||
@@ -141,9 +144,13 @@ export class CityMap implements AfterViewInit, OnDestroy {
|
|||||||
private zoomOnNextPan = true;
|
private zoomOnNextPan = true;
|
||||||
private destroyed = false;
|
private destroyed = false;
|
||||||
private programmaticMove = 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 markerElements = new Map<string, HTMLElement>();
|
||||||
private readonly markers = new Map<string, DgMarker>();
|
private readonly markers = new Map<string, DgMarker>();
|
||||||
private readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
|
private readonly mapReady = signal(false);
|
||||||
|
private placedKey = '';
|
||||||
private readonly stopFollowing = (): void => {
|
private readonly stopFollowing = (): void => {
|
||||||
this.programmaticMove = false;
|
this.programmaticMove = false;
|
||||||
this.zone.run(() => this.following.set(false));
|
this.zone.run(() => this.following.set(false));
|
||||||
@@ -159,21 +166,37 @@ export class CityMap implements AfterViewInit, OnDestroy {
|
|||||||
this.programmaticMove = false;
|
this.programmaticMove = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
protected readonly city = this.catalog.city;
|
readonly embedded = input(false);
|
||||||
protected readonly selected = signal<Landmark | null>(null);
|
readonly cityName = input('');
|
||||||
|
readonly areaId = input('');
|
||||||
|
readonly attractions = input<Attraction[]>([]);
|
||||||
|
|
||||||
|
protected readonly selected = signal<Attraction | null>(null);
|
||||||
protected readonly following = signal(false);
|
protected readonly following = signal(false);
|
||||||
|
protected readonly fullscreen = signal(false);
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
effect(() => {
|
effect(() => {
|
||||||
const ids = this.collectedIds();
|
const items = this.attractions();
|
||||||
|
|
||||||
for (const [id, element] of this.markerElements) {
|
if (!this.mapReady()) {
|
||||||
this.setMarkerIcon(element, ids.has(id));
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.placeMarkers(items);
|
||||||
|
});
|
||||||
|
|
||||||
|
effect(() => {
|
||||||
|
const active = this.fullscreen();
|
||||||
|
this.setAncestorOverflow(active);
|
||||||
|
requestAnimationFrame(() => this.resizeMap());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngAfterViewInit(): Promise<void> {
|
async ngAfterViewInit(): Promise<void> {
|
||||||
|
this.resizeObserver = new ResizeObserver(() => this.resizeMap());
|
||||||
|
this.resizeObserver.observe(this.mapElement.nativeElement);
|
||||||
|
|
||||||
const api = await loadRasterApi();
|
const api = await loadRasterApi();
|
||||||
this.raster = api;
|
this.raster = api;
|
||||||
|
|
||||||
@@ -189,7 +212,7 @@ export class CityMap implements AfterViewInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const map = raster.map(this.mapElement.nativeElement, {
|
const map = raster.map(this.mapElement.nativeElement, {
|
||||||
center: this.toLatLng(this.city.center),
|
center: this.toLatLng(this.focusCenter(this.attractions())),
|
||||||
zoom: CITY_ZOOM,
|
zoom: CITY_ZOOM,
|
||||||
key: MAP_KEY,
|
key: MAP_KEY,
|
||||||
currentLang: 'ru',
|
currentLang: 'ru',
|
||||||
@@ -207,18 +230,17 @@ export class CityMap implements AfterViewInit, OnDestroy {
|
|||||||
this.map = map;
|
this.map = map;
|
||||||
map.on('dragstart', this.stopFollowing);
|
map.on('dragstart', this.stopFollowing);
|
||||||
map.on('zoomstart', this.onZoomStart);
|
map.on('zoomstart', this.onZoomStart);
|
||||||
map.on('zoom', () => this.syncRadiusSize());
|
|
||||||
map.on('move', () => this.syncRadiusSize());
|
|
||||||
map.on('moveend', this.onMoveEnd);
|
map.on('moveend', this.onMoveEnd);
|
||||||
|
|
||||||
for (const landmark of this.city.objects) {
|
this.zone.run(() => this.mapReady.set(true));
|
||||||
this.markers.set(landmark.id, this.createMarker(raster, map, landmark));
|
requestAnimationFrame(() => this.resizeMap());
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.destroyed = true;
|
this.destroyed = true;
|
||||||
|
this.setAncestorOverflow(false);
|
||||||
|
this.resizeObserver?.disconnect();
|
||||||
void this.stopWatching();
|
void this.stopWatching();
|
||||||
this.map?.off('dragstart', this.stopFollowing);
|
this.map?.off('dragstart', this.stopFollowing);
|
||||||
this.map?.off('zoomstart', this.onZoomStart);
|
this.map?.off('zoomstart', this.onZoomStart);
|
||||||
@@ -227,10 +249,23 @@ export class CityMap implements AfterViewInit, OnDestroy {
|
|||||||
this.map = null;
|
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 {
|
protected focusCity(): void {
|
||||||
this.following.set(false);
|
this.following.set(false);
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
this.moveMap(this.city.center, CITY_ZOOM, 500);
|
this.moveMap(this.focusCenter(this.attractions()), CITY_ZOOM, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async locate(): Promise<void> {
|
protected async locate(): Promise<void> {
|
||||||
@@ -326,25 +361,72 @@ export class CityMap implements AfterViewInit, OnDestroy {
|
|||||||
this.watchId = null;
|
this.watchId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private createMarker(api: DgApi, map: DgMap, landmark: Landmark): DgMarker {
|
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');
|
const markerElement = document.createElement('button');
|
||||||
markerElement.type = 'button';
|
markerElement.type = 'button';
|
||||||
markerElement.className = 'city-map__marker';
|
markerElement.className = 'city-map__marker';
|
||||||
markerElement.setAttribute('aria-label', landmark.title);
|
markerElement.setAttribute('aria-label', item.name);
|
||||||
markerElement.innerHTML = `<span class="city-map__radius"></span><img width="40" height="40" alt="" /><span class="city-map__label"></span>`;
|
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');
|
const label = markerElement.querySelector('.city-map__label');
|
||||||
|
|
||||||
if (label) {
|
if (label) {
|
||||||
label.textContent = landmark.title;
|
label.textContent = item.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.markerElements.set(landmark.id, markerElement);
|
this.markerElements.set(item.id, markerElement);
|
||||||
this.setMarkerIcon(markerElement, this.collectedIds().has(landmark.id));
|
this.setMarkerIcon(markerElement, item);
|
||||||
|
|
||||||
const marker = this.addHtmlMarker(
|
const marker = this.addHtmlMarker(
|
||||||
api,
|
api,
|
||||||
map,
|
map,
|
||||||
landmark.coordinates,
|
[item.longitude, item.latitude],
|
||||||
markerElement,
|
markerElement,
|
||||||
LANDMARK_SIZE,
|
LANDMARK_SIZE,
|
||||||
1,
|
1,
|
||||||
@@ -352,12 +434,27 @@ export class CityMap implements AfterViewInit, OnDestroy {
|
|||||||
);
|
);
|
||||||
|
|
||||||
marker.on('click', () => {
|
marker.on('click', () => {
|
||||||
this.zone.run(() => this.selectLandmark(landmark));
|
this.zone.run(() => this.selectLandmark(item));
|
||||||
});
|
});
|
||||||
|
|
||||||
return marker;
|
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(
|
private addHtmlMarker(
|
||||||
api: DgApi,
|
api: DgApi,
|
||||||
map: DgMap,
|
map: DgMap,
|
||||||
@@ -389,27 +486,26 @@ export class CityMap implements AfterViewInit, OnDestroy {
|
|||||||
return marker;
|
return marker;
|
||||||
}
|
}
|
||||||
|
|
||||||
private setMarkerIcon(element: HTMLElement, collected: boolean): void {
|
private setMarkerIcon(element: HTMLElement, item: Attraction): void {
|
||||||
const img = element.querySelector('img');
|
const img = element.querySelector('img');
|
||||||
|
|
||||||
if (!img) {
|
if (!img) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const src = collected ? '/assets/icons/check-marker.svg' : '/assets/icons/lock-marker.svg';
|
const src = item.visited ? '/assets/icons/check-marker.svg' : '/assets/icons/lock-marker.svg';
|
||||||
|
|
||||||
if (img.getAttribute('src') !== src) {
|
if (img.getAttribute('src') !== src) {
|
||||||
img.setAttribute('src', src);
|
img.setAttribute('src', src);
|
||||||
}
|
}
|
||||||
|
|
||||||
element.classList.toggle('city-map__marker--open', collected);
|
element.classList.toggle('city-map__marker--open', item.visited);
|
||||||
}
|
}
|
||||||
|
|
||||||
private selectLandmark(landmark: Landmark): void {
|
private selectLandmark(landmark: Attraction): void {
|
||||||
const alreadySelected = this.selected()?.id === landmark.id;
|
const alreadySelected = this.selected()?.id === landmark.id;
|
||||||
this.selected.set(alreadySelected ? null : landmark);
|
this.selected.set(alreadySelected ? null : landmark);
|
||||||
this.syncSelection();
|
this.syncSelection();
|
||||||
this.syncRadiusSize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private clearSelection(): void {
|
private clearSelection(): void {
|
||||||
@@ -427,36 +523,6 @@ export class CityMap implements AfterViewInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private syncRadiusSize(): void {
|
|
||||||
const selected = this.selected();
|
|
||||||
const map = this.map;
|
|
||||||
|
|
||||||
if (!selected || !map) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const element = this.markerElements.get(selected.id);
|
|
||||||
|
|
||||||
if (!element) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const diameter = this.metersToPixels(map, selected.geoRadiusMeters, selected.coordinates) * 2;
|
|
||||||
element.style.setProperty('--radius-px', `${diameter}px`);
|
|
||||||
}
|
|
||||||
|
|
||||||
private metersToPixels(map: DgMap, meters: number, coordinates: [number, number]): number {
|
|
||||||
const [longitude, latitude] = coordinates;
|
|
||||||
const origin = map.latLngToContainerPoint(this.toLatLng(coordinates));
|
|
||||||
const metersPerDegree = 111_320 * Math.cos((latitude * Math.PI) / 180);
|
|
||||||
const shifted = map.latLngToContainerPoint([
|
|
||||||
latitude,
|
|
||||||
longitude + meters / Math.max(metersPerDegree, 1),
|
|
||||||
]);
|
|
||||||
|
|
||||||
return Math.hypot(shifted.x - origin.x, shifted.y - origin.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
private moveMap(center: [number, number], zoom: number | null, durationMs: number): void {
|
private moveMap(center: [number, number], zoom: number | null, durationMs: number): void {
|
||||||
const map = this.map;
|
const map = this.map;
|
||||||
|
|
||||||
@@ -474,4 +540,30 @@ export class CityMap implements AfterViewInit, OnDestroy {
|
|||||||
private toLatLng(coordinates: [number, number]): [number, number] {
|
private toLatLng(coordinates: [number, number]): [number, number] {
|
||||||
return [coordinates[1], coordinates[0]];
|
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';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,25 @@
|
|||||||
<article class="card">
|
<article class="card">
|
||||||
<div class="card__row">
|
@let lockIcon = '/assets/icons/cell-lock.svg';
|
||||||
<img class="card__stamp" src="/assets/icons/cell-lock.svg" alt="" width="72" height="72" />
|
<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">
|
<div class="card__info">
|
||||||
<h2>{{ landmark().title }}</h2>
|
<h2>{{ attraction().name }}</h2>
|
||||||
|
|
||||||
<p class="card__status">
|
<p class="card__status">
|
||||||
<app-icon name="lock" [size]="16" />
|
<app-icon [name]="attraction().visited ? 'check' : 'lock'" [size]="16" />
|
||||||
Не получен
|
{{ attraction().visited ? 'Получен' : 'Не получен' }}
|
||||||
</p>
|
|
||||||
|
|
||||||
<p class="card__geo">
|
|
||||||
<app-icon name="check" [size]="16" />
|
|
||||||
Вы в радиусе {{ landmark().geoRadiusMeters }} м — можно забирать
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a class="card__action" matButton="filled" [routerLink]="['/items', landmark().id]">
|
@if (!attraction().visited) {
|
||||||
Открыть карточку
|
<a class="btn" [routerLink]="['/city', areaId(), attraction().id]">Открыть карточку</a>
|
||||||
</a>
|
}
|
||||||
</article>
|
</article>
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
gap: 14px;
|
gap: 14px;
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.card__stamp {
|
.card__stamp {
|
||||||
@@ -51,9 +50,3 @@
|
|||||||
color: var(--color-success);
|
color: var(--color-success);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card__action {
|
|
||||||
width: 100%;
|
|
||||||
min-height: 52px;
|
|
||||||
--mat-button-filled-container-shape: 16px;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
||||||
import { MatButton } from '@angular/material/button';
|
|
||||||
import { RouterLink } from '@angular/router';
|
import { RouterLink } from '@angular/router';
|
||||||
|
|
||||||
import type { Landmark } from '../../data/nizhny-novgorod';
|
import type { Attraction } from '../../areas/area.models';
|
||||||
import { Icon } from '../../shared/icon/icon';
|
import { Icon } from '../../shared/icon/icon';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-map-item-sheet',
|
selector: 'app-map-item-sheet',
|
||||||
imports: [MatButton, Icon, RouterLink],
|
imports: [Icon, RouterLink],
|
||||||
templateUrl: './map-item-sheet.html',
|
templateUrl: './map-item-sheet.html',
|
||||||
styleUrl: './map-item-sheet.scss',
|
styleUrl: './map-item-sheet.scss',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class MapItemSheet {
|
export class MapItemSheet {
|
||||||
readonly landmark = input.required<Landmark>();
|
readonly attraction = input.required<Attraction>();
|
||||||
|
readonly areaId = input('');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,69 +1,82 @@
|
|||||||
<section class="page">
|
<section class="page">
|
||||||
<header class="page__header">
|
|
||||||
<div class="page__brand">
|
|
||||||
<img class="page__mark" src="/assets/icons/gorodar-mark.svg" alt="" width="36" height="36" />
|
|
||||||
<span>Городар</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<a class="page__profile" routerLink="/profile" aria-label="Профиль">
|
|
||||||
<app-icon name="profile" [size]="22" />
|
|
||||||
</a>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<div class="page__intro">
|
<div class="page__intro">
|
||||||
<h1>Коллекции городов</h1>
|
<h1>Города</h1>
|
||||||
<p>Приезжайте на место, снимайте — объект попадёт в вашу коллекцию.</p>
|
<p>Приезжайте на место, снимайте — объект попадёт в вашу коллекцию.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a class="page__all" routerLink="/collections">
|
@if (status() === 'loading' && areas().length === 0) {
|
||||||
<span class="page__all-label">
|
<p class="cities__status">Загружаем города…</p>
|
||||||
<app-icon name="collection" [size]="22" />
|
} @else if (status() === 'error' && areas().length === 0) {
|
||||||
<span>
|
<p class="cities__status">{{ error() }}</p>
|
||||||
<b>Вся коллекция</b>
|
<button type="button" (click)="reload()">Повторить</button>
|
||||||
<span class="page__all-meta"> · {{ openedCount() }} объектов · 1 город</span>
|
}
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
<app-icon name="chevron-right" [size]="20" />
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<article class="city-card" [attr.aria-label]="city.name">
|
<div class="cities">
|
||||||
<div class="city-card__top">
|
@for (area of areas(); track area.id) {
|
||||||
<div>
|
@if (area.attractions.length === 0) {
|
||||||
<h2>{{ city.name }}</h2>
|
<article class="city-card city-card--soon">
|
||||||
<p>
|
<h2>{{ area.name }}</h2>
|
||||||
Открыто
|
<p>Скоро появится</p>
|
||||||
<strong>{{ openedCount() }} из {{ totalCount }}</strong>
|
</article>
|
||||||
объектов
|
} @else {
|
||||||
</p>
|
<a class="city-card" [routerLink]="['/city', area.id]" [attr.aria-label]="area.name">
|
||||||
</div>
|
<div class="city-card__top">
|
||||||
|
<div>
|
||||||
|
<h2>{{ area.name }}</h2>
|
||||||
|
<p>
|
||||||
|
Открыто
|
||||||
|
<strong>{{ openedCount(area) }} из {{ totalCount(area) }}</strong>
|
||||||
|
объектов
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="city-card__percent" aria-hidden="true">{{ progress() }}%</div>
|
<div
|
||||||
</div>
|
class="pack__percent anim-percent"
|
||||||
|
[style.--to-p]="progress(area)"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<span>{{ progress(area) }}%</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<mat-progress-bar mode="determinate" [value]="progress()" />
|
<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">
|
<div class="city-card__cells">
|
||||||
@for (landmark of city.objects; track landmark.id) {
|
@for (attraction of area.attractions; track attraction.id) {
|
||||||
<a
|
<span
|
||||||
class="cell"
|
class="cell"
|
||||||
[routerLink]="['/items', landmark.id]"
|
[class.cell--open]="obtained(attraction)"
|
||||||
[class.cell--open]="collectedIds().has(landmark.id)"
|
[attr.aria-label]="
|
||||||
[attr.aria-label]="landmark.title + (collectedIds().has(landmark.id) ? ', получено' : ', не получен')"
|
attraction.name + (obtained(attraction) ? ', получено' : ', не получен')
|
||||||
>
|
"
|
||||||
<img
|
>
|
||||||
[src]="collectedIds().has(landmark.id) ? '/assets/icons/gorodar-mark.svg' : '/assets/icons/cell-lock.svg'"
|
@if (obtained(attraction) && attraction.iconUrl) {
|
||||||
[alt]=""
|
<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>
|
</a>
|
||||||
}
|
}
|
||||||
</div>
|
}
|
||||||
|
</div>
|
||||||
<div class="city-card__actions">
|
|
||||||
<a matButton="outlined" routerLink="/collection">Коллекция</a>
|
|
||||||
<a matButton="filled" routerLink="/map">
|
|
||||||
<app-icon name="pin" [size]="20" />
|
|
||||||
На карте
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -14,8 +14,7 @@
|
|||||||
.page__brand,
|
.page__brand,
|
||||||
.page__all,
|
.page__all,
|
||||||
.page__all-label,
|
.page__all-label,
|
||||||
.city-card__top,
|
.city-card__top {
|
||||||
.city-card__actions {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
@@ -39,19 +38,6 @@
|
|||||||
height: 36px;
|
height: 36px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page__profile {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 44px;
|
|
||||||
height: 44px;
|
|
||||||
border: 1px solid var(--color-border);
|
|
||||||
border-radius: 22px;
|
|
||||||
background: var(--color-surface-2);
|
|
||||||
color: var(--color-text);
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page__intro {
|
.page__intro {
|
||||||
margin: 20px 0 16px;
|
margin: 20px 0 16px;
|
||||||
}
|
}
|
||||||
@@ -90,24 +76,27 @@
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page__all-label {
|
.cities {
|
||||||
gap: 10px;
|
display: flex;
|
||||||
color: var(--color-accent);
|
flex-direction: column;
|
||||||
}
|
gap: 12px;
|
||||||
|
|
||||||
.page__all-label b {
|
|
||||||
color: var(--color-text);
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page__all-meta {
|
|
||||||
color: var(--color-muted);
|
|
||||||
font-weight: 400;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.city-card {
|
.city-card {
|
||||||
|
display: block;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
border-radius: 24px;
|
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 {
|
.city-card__top {
|
||||||
@@ -116,27 +105,13 @@
|
|||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.city-card strong,
|
.city-card strong {
|
||||||
.city-card__percent {
|
|
||||||
color: var(--color-text);
|
color: var(--color-text);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.city-card__percent {
|
.city-card .pack__bar {
|
||||||
display: flex;
|
margin-top: 0;
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 60px;
|
|
||||||
height: 60px;
|
|
||||||
border: 5px solid var(--color-surface-2);
|
|
||||||
border-radius: 50%;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.city-card mat-progress-bar {
|
|
||||||
--mdc-linear-progress-active-indicator-color: var(--color-accent);
|
|
||||||
--mdc-linear-progress-track-color: var(--color-surface-2);
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.city-card__cells {
|
.city-card__cells {
|
||||||
@@ -154,6 +129,7 @@
|
|||||||
border: 0;
|
border: 0;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
background: #171512;
|
background: #171512;
|
||||||
|
|
||||||
color: inherit;
|
color: inherit;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -167,10 +143,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.cell--open {
|
.cell--open {
|
||||||
background: rgb(224 184 79 / 10%);
|
background: rgb(224 184 79 / 10%) !important;
|
||||||
box-shadow: inset 0 0 0 1.5px var(--color-accent);
|
box-shadow: inset 0 0 0 1.5px var(--color-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cell--open img {
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
.city-card__actions {
|
.city-card__actions {
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -206,3 +186,42 @@
|
|||||||
gap: 10px;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,27 +1,46 @@
|
|||||||
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
|
||||||
import { MatButton } from '@angular/material/button';
|
|
||||||
import { MatProgressBar } from '@angular/material/progress-bar';
|
|
||||||
import { RouterLink } from '@angular/router';
|
import { RouterLink } from '@angular/router';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
import { CityCatalogService } from '../../root/services/city-catalog.service';
|
import {
|
||||||
import { Icon } from '../../shared/icon/icon';
|
areaOpenedCount,
|
||||||
import { selectCollectedIdSet, selectOpenedCount, selectProgress } from '../../state';
|
areaProgress,
|
||||||
|
areaTotalCount,
|
||||||
|
type Area,
|
||||||
|
type Attraction,
|
||||||
|
} from '../../areas/area.models';
|
||||||
|
import { GorodarActions, selectAreas, selectAreasError, selectAreasStatus } from '../../state';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-cities-page',
|
selector: 'app-cities-page',
|
||||||
imports: [RouterLink, MatButton, MatProgressBar, Icon],
|
imports: [RouterLink],
|
||||||
templateUrl: './cities-page.html',
|
templateUrl: './cities-page.html',
|
||||||
styleUrl: './cities-page.scss',
|
styleUrl: './cities-page.scss',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class CitiesPage {
|
export class CitiesPage {
|
||||||
private readonly catalog = inject(CityCatalogService);
|
|
||||||
private readonly store = inject(Store);
|
private readonly store = inject(Store);
|
||||||
|
|
||||||
protected readonly city = this.catalog.city;
|
protected readonly areas = this.store.selectSignal(selectAreas);
|
||||||
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
|
protected readonly status = this.store.selectSignal(selectAreasStatus);
|
||||||
protected readonly openedCount = this.store.selectSignal(selectOpenedCount);
|
protected readonly error = this.store.selectSignal(selectAreasError);
|
||||||
protected readonly totalCount = this.city.objects.length;
|
protected openedCount(area: Area): number {
|
||||||
protected readonly progress = this.store.selectSignal(selectProgress);
|
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>
|
||||||
@@ -3,12 +3,25 @@
|
|||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:host:has(.page--map) {
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.page {
|
.page {
|
||||||
width: min(100%, 720px);
|
width: min(100%, 720px);
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 16px 16px 24px;
|
padding: 16px 16px 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.page--map {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.page__top,
|
.page__top,
|
||||||
.page__city,
|
.page__city,
|
||||||
.page__city p,
|
.page__city p,
|
||||||
@@ -23,8 +36,7 @@
|
|||||||
gap: 12px;
|
gap: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page__back,
|
.page__back {
|
||||||
.page__all {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
min-height: 44px;
|
min-height: 44px;
|
||||||
@@ -110,9 +122,13 @@
|
|||||||
|
|
||||||
.tabs__item {
|
.tabs__item {
|
||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
|
border: 0;
|
||||||
|
background: none;
|
||||||
color: var(--color-muted);
|
color: var(--color-muted);
|
||||||
|
font: inherit;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabs__item--active {
|
.tabs__item--active {
|
||||||
@@ -122,6 +138,23 @@
|
|||||||
font-weight: 600;
|
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 {
|
.filters {
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
@@ -142,9 +175,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.filters button.filters__item--active {
|
.filters button.filters__item--active {
|
||||||
border-color: var(--color-accent);
|
border-color: var(--color-primary);
|
||||||
background: var(--color-accent);
|
background: var(--color-primary);
|
||||||
color: var(--color-on-accent);
|
color: var(--color-label);
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid {
|
.grid {
|
||||||
@@ -172,9 +205,6 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
height: 112px;
|
height: 112px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background:
|
|
||||||
radial-gradient(circle at 50% 42%, rgb(255 255 255 / 5%), rgb(255 255 255 / 0%) 70%),
|
|
||||||
#1a1815;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.card__preview img {
|
.card__preview img {
|
||||||
@@ -182,6 +212,8 @@
|
|||||||
z-index: 1;
|
z-index: 1;
|
||||||
width: 96px;
|
width: 96px;
|
||||||
height: 96px;
|
height: 96px;
|
||||||
|
object-fit: contain;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card__rays {
|
.card__rays {
|
||||||
@@ -204,10 +236,22 @@
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card__spark--a { top: 10px; left: 12px; }
|
.card__spark--a {
|
||||||
.card__spark--b { top: 14px; right: 14px; }
|
top: 10px;
|
||||||
.card__spark--c { bottom: 12px; left: 16px; }
|
left: 12px;
|
||||||
.card__spark--d { bottom: 14px; right: 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 {
|
.card__preview--open {
|
||||||
background: rgb(224 184 79 / 10%);
|
background: rgb(224 184 79 / 10%);
|
||||||
@@ -228,21 +272,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (hover: none) {
|
|
||||||
.card:active .card__preview--open .card__rays {
|
|
||||||
opacity: 1;
|
|
||||||
animation: spin 12s linear infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card:active .card__preview--open img {
|
|
||||||
animation: pop 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.card:active .card__preview--open .card__spark {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.card__body {
|
.card__body {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@@ -284,3 +313,50 @@
|
|||||||
grid-template-columns: 1fr;
|
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];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
<section class="page">
|
|
||||||
<header class="page__top">
|
|
||||||
<a class="page__back" routerLink="/" aria-label="Назад">
|
|
||||||
<app-icon name="chevron-left" [size]="22" />
|
|
||||||
</a>
|
|
||||||
<a class="page__all" routerLink="/collections">
|
|
||||||
Вся коллекция
|
|
||||||
<app-icon name="chevron-right" [size]="16" />
|
|
||||||
</a>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<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() }}/{{ city.objects.length }}</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="Разделы города">
|
|
||||||
<span class="tabs__item tabs__item--active">Объекты</span>
|
|
||||||
<a class="tabs__item" routerLink="/map">На карте</a>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="filters">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
[class.filters__item--active]="filter() === 'all'"
|
|
||||||
(click)="filter.set('all')"
|
|
||||||
>
|
|
||||||
Все · {{ city.objects.length }}
|
|
||||||
</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]="['/items', landmark.id]">
|
|
||||||
<div class="card__preview" [class.card__preview--open]="collectedIds().has(landmark.id)">
|
|
||||||
@if (collectedIds().has(landmark.id)) {
|
|
||||||
<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>
|
|
||||||
}
|
|
||||||
<img
|
|
||||||
[src]="collectedIds().has(landmark.id) ? '/assets/icons/gorodar-mark.svg' : '/assets/icons/cell-lock.svg'"
|
|
||||||
alt=""
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="card__body">
|
|
||||||
<h2>{{ landmark.title }}</h2>
|
|
||||||
<span class="card__status" [class.card__status--open]="collectedIds().has(landmark.id)">
|
|
||||||
<app-icon [name]="collectedIds().has(landmark.id) ? 'check' : 'lock'" [size]="15" />
|
|
||||||
{{ collectedIds().has(landmark.id) ? 'Получен' : 'Не получен' }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<span class="card__bar" [class.card__bar--open]="collectedIds().has(landmark.id)"></span>
|
|
||||||
</a>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';
|
|
||||||
import { RouterLink } from '@angular/router';
|
|
||||||
import { Store } from '@ngrx/store';
|
|
||||||
|
|
||||||
import { CityCatalogService } from '../../root/services/city-catalog.service';
|
|
||||||
import { Icon } from '../../shared/icon/icon';
|
|
||||||
import { selectCollectedIdSet, selectOpenedCount, selectProgress } from '../../state';
|
|
||||||
|
|
||||||
type CollectionFilter = 'all' | 'open' | 'closed';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-collection-page',
|
|
||||||
imports: [Icon, RouterLink],
|
|
||||||
templateUrl: './collection-page.html',
|
|
||||||
styleUrl: './collection-page.scss',
|
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
||||||
})
|
|
||||||
export class CollectionPage {
|
|
||||||
private readonly catalog = inject(CityCatalogService);
|
|
||||||
private readonly store = inject(Store);
|
|
||||||
|
|
||||||
protected readonly city = this.catalog.city;
|
|
||||||
protected readonly filter = signal<CollectionFilter>('all');
|
|
||||||
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
|
|
||||||
protected readonly openedCount = this.store.selectSignal(selectOpenedCount);
|
|
||||||
protected readonly progress = this.store.selectSignal(selectProgress);
|
|
||||||
protected readonly closedCount = computed(
|
|
||||||
() => this.city.objects.length - this.openedCount(),
|
|
||||||
);
|
|
||||||
protected readonly landmarks = computed(() => {
|
|
||||||
const items = this.city.objects;
|
|
||||||
const ids = this.collectedIds();
|
|
||||||
|
|
||||||
switch (this.filter()) {
|
|
||||||
case 'open':
|
|
||||||
return items.filter((item) => ids.has(item.id));
|
|
||||||
case 'closed':
|
|
||||||
return items.filter((item) => !ids.has(item.id));
|
|
||||||
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,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,113 +1,87 @@
|
|||||||
<section class="page">
|
<section class="page">
|
||||||
<header class="page__top">
|
@if (authenticated()) {
|
||||||
<a class="page__back" routerLink="/" aria-label="Назад">
|
<header class="account">
|
||||||
<app-icon name="chevron-left" [size]="22" />
|
<p class="account__email">{{ accountEmail() }}</p>
|
||||||
</a>
|
<div class="account__actions">
|
||||||
<span class="page__title">Коллекция</span>
|
<button
|
||||||
</header>
|
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">
|
<div class="page__intro">
|
||||||
<h1>Вся коллекция</h1>
|
<h1>Моя коллекция</h1>
|
||||||
<p>Достопримечательности по городам и странам</p>
|
<p>Достопримечательности которые вы открыли</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section class="summary">
|
<section class="summary" style="margin-bottom: 16px">
|
||||||
<div>
|
<div>
|
||||||
<b>{{ openedCount() }}</b>
|
<b>{{ openedCount() }}</b>
|
||||||
<span>{{ objectsLabel() }}</span>
|
<span>{{ objectsLabel() }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<b>1</b>
|
<b>{{ packs().length }}</b>
|
||||||
<span>город</span>
|
<span>{{ citiesLabel() }}</span>
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<b>1</b>
|
|
||||||
<span>страна</span>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<div class="tabs">
|
@if (packs().length > 0) {
|
||||||
<button type="button" [class.tabs__item--active]="tab() === 'russia'" (click)="tab.set('russia')">
|
@for (pack of packs(); track pack.area.id) {
|
||||||
Россия
|
<article class="pack">
|
||||||
</button>
|
<a
|
||||||
<button type="button" [class.tabs__item--active]="tab() === 'world'" (click)="tab.set('world')">
|
class="pack__head"
|
||||||
Страны мира
|
[routerLink]="['/city', pack.area.id]"
|
||||||
</button>
|
[attr.aria-label]="'Объекты: ' + pack.area.name"
|
||||||
</div>
|
>
|
||||||
|
|
||||||
@if (tab() === 'russia') {
|
|
||||||
<label class="search">
|
|
||||||
<app-icon name="search" [size]="22" />
|
|
||||||
<input
|
|
||||||
type="search"
|
|
||||||
placeholder="Найти город"
|
|
||||||
[value]="query()"
|
|
||||||
(input)="onQuery($event)"
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<p class="section-label">Мои города</p>
|
|
||||||
|
|
||||||
@if (cityVisible()) {
|
|
||||||
<a class="pack" routerLink="/collection">
|
|
||||||
<div class="pack__head">
|
|
||||||
<div>
|
<div>
|
||||||
<h2>{{ city.name }}</h2>
|
<h2>{{ pack.area.name }}</h2>
|
||||||
<p>Собрано {{ openedCount() }} из {{ totalCount }}</p>
|
<p>Собрано {{ pack.opened }} из {{ pack.total }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div class="pack__percent anim-percent" [style.--to-p]="pack.progress" aria-hidden="true">
|
||||||
class="pack__percent anim-percent"
|
<span>{{ pack.progress }}%</span>
|
||||||
[style.--to-p]="progress()"
|
|
||||||
aria-hidden="true"
|
|
||||||
>
|
|
||||||
<span>{{ progress() }}%</span>
|
|
||||||
</div>
|
</div>
|
||||||
<span class="pack__go" aria-hidden="true">
|
<span class="pack__go" aria-hidden="true">
|
||||||
<app-icon name="chevron-right" [size]="20" />
|
<app-icon name="chevron-right" [size]="20" />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</a>
|
||||||
|
|
||||||
<div class="pack__bar" aria-hidden="true">
|
<div class="pack__bar" aria-hidden="true">
|
||||||
<span
|
<span class="anim-grow" [style.--from]="'0%'" [style.--to]="pack.progress + '%'"></span>
|
||||||
class="anim-grow"
|
|
||||||
[style.--from]="'0%'"
|
|
||||||
[style.--to]="progress() + '%'"
|
|
||||||
></span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pack__cells">
|
<div class="picked">
|
||||||
@for (landmark of city.objects; track landmark.id) {
|
@for (landmark of pack.items; track landmark.id) {
|
||||||
<span class="pack__stamp" [class.pack__stamp--open]="collectedIds().has(landmark.id)">
|
<a class="picked__card" [routerLink]="objectRoute(pack.area.id, landmark)">
|
||||||
<img
|
<div class="picked__preview">
|
||||||
[src]="collectedIds().has(landmark.id) ? '/assets/icons/gorodar-mark.svg' : '/assets/icons/cell-lock.svg'"
|
<img [src]="landmark.iconUrl" alt="" />
|
||||||
alt=""
|
</div>
|
||||||
/>
|
<div class="picked__body">
|
||||||
</span>
|
<h3>{{ landmark.name }}</h3>
|
||||||
|
</div>
|
||||||
|
<span class="picked__bar" aria-hidden="true"></span>
|
||||||
|
</a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</article>
|
||||||
} @else {
|
|
||||||
<p class="empty">Город не найден.</p>
|
|
||||||
}
|
}
|
||||||
} @else {
|
} @else {
|
||||||
<label class="search">
|
<p class="empty">Пока нет полученных объектов.</p>
|
||||||
<app-icon name="search" [size]="22" />
|
}
|
||||||
<input type="search" placeholder="Найти страну" disabled />
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<button type="button" class="country" (click)="tab.set('russia')">
|
@if (documentsOpen()) {
|
||||||
<span class="country__mark" aria-hidden="true">
|
<app-documents-sheet (dismissed)="closeDocuments()" />
|
||||||
<app-icon name="globe" [size]="28" />
|
|
||||||
</span>
|
|
||||||
<span class="country__body">
|
|
||||||
<b>Россия</b>
|
|
||||||
<span>Городов: 1 · Собрано {{ openedCount() }} из {{ totalCount }}</span>
|
|
||||||
</span>
|
|
||||||
<span class="pack__go" aria-hidden="true">
|
|
||||||
<app-icon name="chevron-right" [size]="20" />
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<p class="empty">Пока в Городаре одна страна — Россия. Коллекции других стран появятся позже.</p>
|
|
||||||
}
|
}
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -9,33 +9,57 @@
|
|||||||
padding: 16px 16px 24px;
|
padding: 16px 16px 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page__top {
|
.account {
|
||||||
position: relative;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
min-height: 44px;
|
min-height: 44px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page__back {
|
.account__email {
|
||||||
position: absolute;
|
margin: 0;
|
||||||
left: 0;
|
overflow: hidden;
|
||||||
|
color: var(--color-text);
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 500;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account__actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex: none;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account__action {
|
||||||
|
display: flex;
|
||||||
|
flex: none;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 44px;
|
width: 44px;
|
||||||
height: 44px;
|
height: 44px;
|
||||||
border: 1px solid var(--color-border);
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
border-radius: 14px;
|
border-radius: 14px;
|
||||||
background: rgb(28 26 23 / 86%);
|
background: transparent;
|
||||||
color: var(--color-text);
|
color: var(--color-text);
|
||||||
text-decoration: none;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page__title {
|
.account__login {
|
||||||
color: var(--color-muted);
|
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-size: 15px;
|
||||||
font-weight: 500;
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page__intro {
|
.page__intro {
|
||||||
@@ -43,8 +67,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.page__intro h1,
|
.page__intro h1,
|
||||||
.summary b,
|
.summary b {
|
||||||
.country b {
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: var(--font-display);
|
font-family: var(--font-display);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
@@ -70,16 +93,14 @@
|
|||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.summary,
|
.summary {
|
||||||
.search,
|
|
||||||
.country {
|
|
||||||
border: 1px solid var(--color-border);
|
border: 1px solid var(--color-border);
|
||||||
background: var(--color-surface);
|
background: var(--color-surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
.summary {
|
.summary {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
padding: 18px 16px;
|
padding: 18px 16px;
|
||||||
@@ -92,106 +113,64 @@
|
|||||||
line-height: 1.1;
|
line-height: 1.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabs,
|
|
||||||
.search,
|
|
||||||
.country {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tabs {
|
|
||||||
gap: 8px;
|
|
||||||
margin-top: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tabs button {
|
|
||||||
min-height: 44px;
|
|
||||||
padding: 0 20px;
|
|
||||||
border: 1px solid var(--color-border);
|
|
||||||
border-radius: 22px;
|
|
||||||
background: var(--color-surface);
|
|
||||||
color: var(--color-text);
|
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 500;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tabs button.tabs__item--active {
|
|
||||||
border-color: var(--color-accent);
|
|
||||||
background: var(--color-accent);
|
|
||||||
color: var(--color-on-accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.search {
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
height: 52px;
|
|
||||||
margin-top: 16px;
|
|
||||||
padding: 0 18px;
|
|
||||||
border-radius: 26px;
|
|
||||||
color: var(--color-muted);
|
|
||||||
}
|
|
||||||
|
|
||||||
.search input {
|
|
||||||
flex: 1;
|
|
||||||
min-width: 0;
|
|
||||||
height: 100%;
|
|
||||||
border: 0;
|
|
||||||
background: transparent;
|
|
||||||
color: var(--color-text);
|
|
||||||
font: inherit;
|
|
||||||
font-size: 16px;
|
|
||||||
outline: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section-label {
|
.section-label {
|
||||||
margin: 20px 0 8px;
|
margin: 20px 0 8px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.country {
|
|
||||||
align-items: center;
|
|
||||||
gap: 14px;
|
|
||||||
width: 100%;
|
|
||||||
margin-top: 16px;
|
|
||||||
padding: 18px 16px;
|
|
||||||
border-radius: 24px;
|
|
||||||
font: inherit;
|
|
||||||
color: inherit;
|
|
||||||
text-align: left;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.country__mark {
|
|
||||||
display: flex;
|
|
||||||
flex: none;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 56px;
|
|
||||||
height: 56px;
|
|
||||||
border: 1.5px solid var(--color-accent);
|
|
||||||
background: rgb(224 184 79 / 7%);
|
|
||||||
color: var(--color-accent-soft);
|
|
||||||
}
|
|
||||||
|
|
||||||
.country__body {
|
|
||||||
flex: 1;
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.country__body b {
|
|
||||||
display: block;
|
|
||||||
font-size: 22px;
|
|
||||||
line-height: 1.15;
|
|
||||||
}
|
|
||||||
|
|
||||||
.country__body span {
|
|
||||||
display: block;
|
|
||||||
margin-top: 4px;
|
|
||||||
color: var(--color-muted);
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty {
|
.empty {
|
||||||
margin-top: 20px;
|
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);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,39 +1,98 @@
|
|||||||
import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';
|
import {
|
||||||
|
afterNextRender,
|
||||||
|
ChangeDetectionStrategy,
|
||||||
|
Component,
|
||||||
|
computed,
|
||||||
|
inject,
|
||||||
|
signal,
|
||||||
|
} from '@angular/core';
|
||||||
import { RouterLink } from '@angular/router';
|
import { RouterLink } from '@angular/router';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
import { CityCatalogService } from '../../root/services/city-catalog.service';
|
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 { Icon } from '../../shared/icon/icon';
|
||||||
import { selectCollectedIdSet, selectOpenedCount, selectProgress } from '../../state';
|
import {
|
||||||
|
GorodarActions,
|
||||||
|
selectAreas,
|
||||||
|
selectAuthEmail,
|
||||||
|
selectAuthenticated,
|
||||||
|
selectOpenedCount,
|
||||||
|
selectProfile,
|
||||||
|
} from '../../state';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-collections-page',
|
selector: 'app-collections-page',
|
||||||
imports: [Icon, RouterLink],
|
imports: [Icon, RouterLink, DocumentsSheet],
|
||||||
templateUrl: './collections-page.html',
|
templateUrl: './collections-page.html',
|
||||||
styleUrl: './collections-page.scss',
|
styleUrl: './collections-page.scss',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class CollectionsPage {
|
export class CollectionsPage {
|
||||||
private readonly catalog = inject(CityCatalogService);
|
|
||||||
private readonly store = inject(Store);
|
private readonly store = inject(Store);
|
||||||
|
|
||||||
protected readonly city = this.catalog.city;
|
private readonly areas = this.store.selectSignal(selectAreas);
|
||||||
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
|
protected readonly profile = this.store.selectSignal(selectProfile);
|
||||||
protected readonly openedCount = this.store.selectSignal(selectOpenedCount);
|
protected readonly openedCount = this.store.selectSignal(selectOpenedCount);
|
||||||
protected readonly totalCount = this.city.objects.length;
|
protected readonly authenticated = this.store.selectSignal(selectAuthenticated);
|
||||||
protected readonly query = signal('');
|
private readonly authEmail = this.store.selectSignal(selectAuthEmail);
|
||||||
protected readonly tab = signal<'russia' | 'world'>('russia');
|
protected readonly accountEmail = computed(() =>
|
||||||
protected readonly progress = this.store.selectSignal(selectProgress);
|
this.authenticated() ? this.authEmail() : this.profile().email,
|
||||||
protected readonly cityVisible = computed(() => {
|
);
|
||||||
const query = this.query().trim().toLowerCase();
|
protected readonly documentsOpen = signal(false);
|
||||||
return !query || this.city.name.toLowerCase().includes(query);
|
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(() =>
|
protected readonly objectsLabel = computed(() =>
|
||||||
this.plural(this.openedCount(), ['объект', 'объекта', 'объектов']),
|
this.plural(this.openedCount(), ['объект', 'объекта', 'объектов']),
|
||||||
);
|
);
|
||||||
|
|
||||||
protected onQuery(event: Event): void {
|
protected readonly citiesLabel = computed(() =>
|
||||||
this.query.set((event.target as HTMLInputElement).value);
|
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 {
|
private plural(count: number, forms: [string, string, string]): string {
|
||||||
|
|||||||
@@ -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 });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,18 +1,26 @@
|
|||||||
@if (landmark(); as item) {
|
@if (landmark(); as item) {
|
||||||
@if (claiming()) {
|
@if (claiming()) {
|
||||||
<app-claim-flow [landmark]="item" />
|
<app-claim-flow
|
||||||
|
[landmark]="item"
|
||||||
|
[cityName]="area()?.name ?? ''"
|
||||||
|
[opened]="openedCount()"
|
||||||
|
[total]="totalCount()"
|
||||||
|
[areaId]="areaId()"
|
||||||
|
/>
|
||||||
} @else {
|
} @else {
|
||||||
<article class="object" [class.object--owned]="collected()">
|
<article class="object" [class.object--owned]="collected()">
|
||||||
<header class="object__hero">
|
<header class="object__hero">
|
||||||
<img class="object__hero-img" src="/assets/illustrations/object-hero.svg" alt="" />
|
@if (item.backgroundUrl || item.photoUrl) {
|
||||||
|
<img class="object__hero-img" [src]="item.backgroundUrl || item.photoUrl" alt="" />
|
||||||
|
}
|
||||||
<button class="object__back" type="button" aria-label="Назад" (click)="goBack()">
|
<button class="object__back" type="button" aria-label="Назад" (click)="goBack()">
|
||||||
<app-icon name="chevron-left" [size]="22" />
|
<app-icon name="chevron-left" [size]="22" />
|
||||||
</button>
|
</button>
|
||||||
<span class="object__city">{{ city.name }}</span>
|
<span class="object__city">{{ area()?.name }}</span>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="object__intro">
|
<div class="object__intro">
|
||||||
<h1>{{ item.title }}</h1>
|
<h1>{{ item.name }}</h1>
|
||||||
|
|
||||||
<div class="object__chips">
|
<div class="object__chips">
|
||||||
<span class="chip" [class.chip--open]="collected()">
|
<span class="chip" [class.chip--open]="collected()">
|
||||||
@@ -21,85 +29,59 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="object__address">
|
@if (item.address) {
|
||||||
<app-icon name="pin" [size]="18" />
|
<div class="object__address">
|
||||||
<div>
|
<app-icon name="pin" [size]="18" />
|
||||||
<p>{{ item.address }}</p>
|
<div>
|
||||||
<span>{{ item.addressHint }}</span>
|
<p>{{ item.address }}</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="object__body">
|
<div class="object__body">
|
||||||
<section>
|
@if (item.about) {
|
||||||
<h2>О месте</h2>
|
|
||||||
<p>{{ item.description }}</p>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<h2>Интересные факты</h2>
|
|
||||||
<ol class="facts">
|
|
||||||
@for (fact of item.facts; track fact; let index = $index) {
|
|
||||||
<li>
|
|
||||||
<span class="facts__number">{{ index + 1 }}</span>
|
|
||||||
<span class="facts__value">
|
|
||||||
{{ fact }}
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
</ol>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
@if (collected()) {
|
|
||||||
<section>
|
<section>
|
||||||
<h2>Ваше фото</h2>
|
<h2>О месте</h2>
|
||||||
<button class="owned-photo" type="button" (click)="openPhoto()">
|
<p>{{ item.about }}</p>
|
||||||
<img
|
|
||||||
[src]="userPhoto() ?? '/assets/illustrations/photo-day.svg'"
|
|
||||||
alt="Ваше фото объекта"
|
|
||||||
/>
|
|
||||||
<span class="owned-photo__badge">
|
|
||||||
<app-icon name="check" [size]="14" />
|
|
||||||
Подтверждено
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
<p class="object__hint">
|
|
||||||
Этот объект уже в вашей коллекции. Повторно его получить нельзя.
|
|
||||||
</p>
|
|
||||||
</section>
|
</section>
|
||||||
|
}
|
||||||
|
|
||||||
<a class="object__map" routerLink="/map">
|
@if (item.facts.length > 0) {
|
||||||
<app-icon name="pin" [size]="20" />
|
|
||||||
Показать на карте
|
|
||||||
</a>
|
|
||||||
} @else {
|
|
||||||
<section>
|
<section>
|
||||||
<h2>Примеры фото</h2>
|
<h2>Интересные факты</h2>
|
||||||
<div class="photos">
|
<ol class="facts">
|
||||||
@for (photo of photoExamples; track photo.label) {
|
@for (fact of item.facts; track fact; let index = $index) {
|
||||||
<figure>
|
<li>
|
||||||
<img [src]="photo.src" [alt]="photo.label" />
|
<span class="facts__number">{{ index + 1 }}</span>
|
||||||
<span>{{ photo.label }}</span>
|
<span class="facts__value">{{ fact }}</span>
|
||||||
</figure>
|
</li>
|
||||||
}
|
}
|
||||||
</div>
|
|
||||||
<p class="object__hint">{{ item.photoHint }}</p>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<h2>Как забрать</h2>
|
|
||||||
<ol class="steps">
|
|
||||||
<li>Приезжайте на место и найдите объект</li>
|
|
||||||
<li>Нажмите «Забрать» и сфотографируйте объект</li>
|
|
||||||
<li>Получите объект в свою коллекцию</li>
|
|
||||||
</ol>
|
</ol>
|
||||||
</section>
|
</section>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@if (item.audioUrl) {
|
||||||
|
<section>
|
||||||
|
<h2>Аудиогид</h2>
|
||||||
|
<app-audio-guide [src]="item.audioUrl" />
|
||||||
|
</section>
|
||||||
|
}
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Как забрать</h2>
|
||||||
|
<ol class="steps">
|
||||||
|
<li>Приезжайте на место и найдите объект.</li>
|
||||||
|
<li>Встаньте на точку отмеченную на карте.</li>
|
||||||
|
<li>Нажмите «Забрать» и сфотографируйте объект.</li>
|
||||||
|
<li>Получите объект в свою коллекцию.</li>
|
||||||
|
</ol>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (!collected()) {
|
@if (!collected()) {
|
||||||
<footer class="object__bar">
|
<footer class="object__bar">
|
||||||
<button class="object__claim" matButton="filled" type="button" (click)="claimItem()">
|
<button class="btn" type="button" (click)="claimItem()">
|
||||||
<app-icon name="camera" [size]="22" />
|
<app-icon name="camera" [size]="22" />
|
||||||
Забрать
|
Забрать
|
||||||
</button>
|
</button>
|
||||||
@@ -108,25 +90,13 @@
|
|||||||
}
|
}
|
||||||
</article>
|
</article>
|
||||||
}
|
}
|
||||||
|
} @else if (status() === 'loading') {
|
||||||
@if (photoOpen()) {
|
<section class="object object--empty">
|
||||||
@if (userPhoto(); as image) {
|
<p>Загружаем…</p>
|
||||||
<div class="photo-viewer" (click)="closePhoto()">
|
</section>
|
||||||
<button
|
|
||||||
class="photo-viewer__close"
|
|
||||||
type="button"
|
|
||||||
aria-label="Закрыть"
|
|
||||||
(click)="closePhoto()"
|
|
||||||
>
|
|
||||||
<app-icon name="chevron-left" [size]="22" />
|
|
||||||
</button>
|
|
||||||
<img [src]="image" alt="Ваше фото объекта" (click)="$event.stopPropagation()" />
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} @else {
|
} @else {
|
||||||
<section class="object object--empty">
|
<section class="object object--empty">
|
||||||
<p>Объект не найден.</p>
|
<p>{{ error() || 'Объект не найден.' }}</p>
|
||||||
<button matButton="outlined" type="button" (click)="goBack()">Назад</button>
|
<button matButton="outlined" type="button" (click)="goBack()">Назад</button>
|
||||||
</section>
|
</section>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,7 +160,7 @@
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 28px;
|
gap: 28px;
|
||||||
padding: 28px 16px 120px;
|
padding: 28px 16px 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.object--owned .object__body {
|
.object--owned .object__body {
|
||||||
@@ -274,13 +274,6 @@
|
|||||||
background: linear-gradient(to bottom, transparent, rgb(18 17 15 / 96%) 30%);
|
background: linear-gradient(to bottom, transparent, rgb(18 17 15 / 96%) 30%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.object__claim {
|
|
||||||
width: 100%;
|
|
||||||
min-height: 56px;
|
|
||||||
overflow: visible;
|
|
||||||
--mat-button-filled-container-shape: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.object__bar p {
|
.object__bar p {
|
||||||
margin: 8px 0 0;
|
margin: 8px 0 0;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
|
|||||||
@@ -1,51 +1,75 @@
|
|||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { ChangeDetectionStrategy, Component, computed, HostListener, inject, input, signal } from '@angular/core';
|
import {
|
||||||
import { Router, RouterLink } from '@angular/router';
|
ChangeDetectionStrategy,
|
||||||
|
Component,
|
||||||
|
computed,
|
||||||
|
effect,
|
||||||
|
HostListener,
|
||||||
|
inject,
|
||||||
|
input,
|
||||||
|
signal,
|
||||||
|
} from '@angular/core';
|
||||||
import { MatButton } from '@angular/material/button';
|
import { MatButton } from '@angular/material/button';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
|
import { areaOpenedCount, areaTotalCount, type AreaDetails } from '../../areas/area.models';
|
||||||
import { ClaimFlow } from '../../claim/claim-flow/claim-flow';
|
import { ClaimFlow } from '../../claim/claim-flow/claim-flow';
|
||||||
import { CityCatalogService } from '../../root/services/city-catalog.service';
|
import { AudioGuide } from '../../shared/audio-guide/audio-guide';
|
||||||
import { Icon } from '../../shared/icon/icon';
|
import { Icon } from '../../shared/icon/icon';
|
||||||
import {
|
import {
|
||||||
GorodarActions,
|
GorodarActions,
|
||||||
|
selectAreaDetails,
|
||||||
|
selectAreaDetailStatus,
|
||||||
|
selectAttractionError,
|
||||||
|
selectAttractions,
|
||||||
|
selectAttractionStatus,
|
||||||
|
selectAuthenticated,
|
||||||
selectClaim,
|
selectClaim,
|
||||||
selectCollectedAt,
|
selectCollectedAt,
|
||||||
selectCollectedIdSet,
|
|
||||||
selectPhotos,
|
selectPhotos,
|
||||||
} from '../../state';
|
} from '../../state';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-map-item-page',
|
selector: 'app-map-item-page',
|
||||||
imports: [MatButton, Icon, ClaimFlow, RouterLink],
|
imports: [MatButton, Icon, ClaimFlow, AudioGuide],
|
||||||
templateUrl: './map-item-page.html',
|
templateUrl: './map-item-page.html',
|
||||||
styleUrl: './map-item-page.scss',
|
styleUrl: './map-item-page.scss',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class MapItemPage {
|
export class MapItemPage {
|
||||||
private readonly catalog = inject(CityCatalogService);
|
|
||||||
private readonly store = inject(Store);
|
private readonly store = inject(Store);
|
||||||
private readonly location = inject(Location);
|
private readonly location = inject(Location);
|
||||||
private readonly router = inject(Router);
|
private readonly router = inject(Router);
|
||||||
|
private readonly authenticated = this.store.selectSignal(selectAuthenticated);
|
||||||
|
private readonly details = this.store.selectSignal(selectAreaDetails);
|
||||||
|
private readonly detailStatus = this.store.selectSignal(selectAreaDetailStatus);
|
||||||
|
private readonly attractions = this.store.selectSignal(selectAttractions);
|
||||||
|
private readonly attractionStatuses = this.store.selectSignal(selectAttractionStatus);
|
||||||
|
private readonly attractionErrors = this.store.selectSignal(selectAttractionError);
|
||||||
|
|
||||||
|
readonly areaId = input.required<string>();
|
||||||
readonly id = input.required<string>();
|
readonly id = input.required<string>();
|
||||||
|
|
||||||
protected readonly city = this.catalog.city;
|
protected readonly status = computed(() => this.attractionStatuses()[this.id()] ?? 'loading');
|
||||||
protected readonly landmark = computed(() => this.catalog.landmarkById(this.id()));
|
protected readonly error = computed(() => this.attractionErrors()[this.id()] ?? '');
|
||||||
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
|
protected readonly area = computed(
|
||||||
|
(): AreaDetails | null => this.details()[this.areaId()] ?? null,
|
||||||
|
);
|
||||||
|
protected readonly landmark = computed(() => this.attractions()[this.id()] ?? null);
|
||||||
protected readonly photos = this.store.selectSignal(selectPhotos);
|
protected readonly photos = this.store.selectSignal(selectPhotos);
|
||||||
protected readonly collectedAtMap = this.store.selectSignal(selectCollectedAt);
|
protected readonly collectedAtMap = this.store.selectSignal(selectCollectedAt);
|
||||||
protected readonly claim = this.store.selectSignal(selectClaim);
|
protected readonly claim = this.store.selectSignal(selectClaim);
|
||||||
|
protected readonly openedCount = computed(() => {
|
||||||
protected readonly collected = computed(() => {
|
const area = this.area();
|
||||||
const item = this.landmark();
|
return area ? areaOpenedCount(area) : 0;
|
||||||
return item ? this.collectedIds().has(item.id) || item.collected : false;
|
});
|
||||||
|
protected readonly totalCount = computed(() => {
|
||||||
|
const area = this.area();
|
||||||
|
return area ? areaTotalCount(area) : 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
protected readonly userPhoto = computed(() => {
|
protected readonly collected = computed(() => this.landmark()?.visited ?? false);
|
||||||
const item = this.landmark();
|
|
||||||
return item ? (this.photos()[item.id] ?? null) : null;
|
|
||||||
});
|
|
||||||
|
|
||||||
protected readonly collectedLabel = computed(() => {
|
protected readonly collectedLabel = computed(() => {
|
||||||
if (!this.collected()) {
|
if (!this.collected()) {
|
||||||
@@ -72,12 +96,22 @@ export class MapItemPage {
|
|||||||
return claim.landmarkId === this.id() && claim.stage !== 'idle';
|
return claim.landmarkId === this.id() && claim.stage !== 'idle';
|
||||||
});
|
});
|
||||||
|
|
||||||
protected readonly photoExamples = [
|
constructor() {
|
||||||
{ label: 'Днём', src: '/assets/illustrations/photo-day.svg' },
|
effect(() => {
|
||||||
{ label: 'Вечером', src: '/assets/illustrations/photo-evening.svg' },
|
const areaId = this.areaId();
|
||||||
{ label: 'Зимой', src: '/assets/illustrations/photo-winter.svg' },
|
const status = this.detailStatus()[areaId];
|
||||||
];
|
|
||||||
protected readonly photoOpen = signal(false);
|
if (this.details()[areaId] || status === 'loading' || status === 'ready') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.store.dispatch(GorodarActions.areaRequested({ id: areaId }));
|
||||||
|
});
|
||||||
|
|
||||||
|
effect(() => {
|
||||||
|
this.store.dispatch(GorodarActions.attractionRequested({ id: this.id() }));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
protected goBack(): void {
|
protected goBack(): void {
|
||||||
if (window.history.length > 1) {
|
if (window.history.length > 1) {
|
||||||
@@ -85,25 +119,15 @@ export class MapItemPage {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void this.router.navigateByUrl('/map');
|
void this.router.navigate(['/city', this.areaId()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected claimItem(): void {
|
protected claimItem(): void {
|
||||||
this.store.dispatch(GorodarActions.takePhoto({ landmarkId: this.id() }));
|
if (this.authenticated()) {
|
||||||
}
|
this.store.dispatch(GorodarActions.takePhoto({ landmarkId: this.id() }));
|
||||||
|
return;
|
||||||
protected openPhoto(): void {
|
|
||||||
if (this.userPhoto()) {
|
|
||||||
this.photoOpen.set(true);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected closePhoto(): void {
|
this.store.dispatch(GorodarActions.authSheetOpened({ intent: 'claim', landmarkId: this.id() }));
|
||||||
this.photoOpen.set(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@HostListener('document:keydown.escape')
|
|
||||||
protected onEscape(): void {
|
|
||||||
this.closePhoto();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||