add mp with icons and update after review

This commit is contained in:
2026-10-05 13:05:36 +03:00
parent c17c97bd2b
commit 0e2bcf0380
69 changed files with 1907 additions and 813 deletions
+126
View File
@@ -21,12 +21,14 @@
"@capacitor/camera": "^8.2.4",
"@capacitor/core": "^8.5.2",
"@capacitor/geolocation": "^8.2.2",
"@google/model-viewer": "^4.3.1",
"@ionic/pwa-elements": "^3.4.0",
"@ngrx/effects": "^20.1.0",
"@ngrx/store": "^20.1.0",
"@ngrx/store-devtools": "^20.1.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"wavesurfer.js": "^8.0.1",
"zone.js": "~0.15.0"
},
"devDependencies": {
@@ -1720,6 +1722,22 @@
"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": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.1.tgz",
@@ -2793,6 +2811,21 @@
"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": {
"version": "3.4.2",
"resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-arm64/-/lmdb-darwin-arm64-3.4.2.tgz",
@@ -2932,6 +2965,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": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.4.tgz",
@@ -4559,6 +4604,12 @@
"dev": true,
"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": {
"version": "8.18.1",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz",
@@ -6679,6 +6730,12 @@
"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": {
"version": "5.1.9",
"resolved": "https://registry.npmjs.org/immutable/-/immutable-5.1.9.tgz",
@@ -7554,6 +7611,15 @@
"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": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/listr2/-/listr2-9.0.1.tgz",
@@ -7597,6 +7663,37 @@
"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": {
"version": "3.4.2",
"resolved": "https://registry.npmjs.org/lmdb/-/lmdb-3.4.2.tgz",
@@ -8900,6 +8997,22 @@
"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": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz",
@@ -9852,6 +9965,13 @@
"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": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz",
@@ -10248,6 +10368,12 @@
"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": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/weak-lru-cache/-/weak-lru-cache-1.2.2.tgz",
+2
View File
@@ -35,12 +35,14 @@
"@capacitor/camera": "^8.2.4",
"@capacitor/core": "^8.5.2",
"@capacitor/geolocation": "^8.2.2",
"@google/model-viewer": "^4.3.1",
"@ionic/pwa-elements": "^3.4.0",
"@ngrx/effects": "^20.1.0",
"@ngrx/store": "^20.1.0",
"@ngrx/store-devtools": "^20.1.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"wavesurfer.js": "^8.0.1",
"zone.js": "~0.15.0"
},
"devDependencies": {
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 19 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 16 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 13 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

+6
View File
@@ -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

+6
View File
@@ -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

+5
View File
@@ -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

+4
View File
@@ -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="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

Binary file not shown.
+2
View File
@@ -6,4 +6,6 @@
@if (!hideNav()) {
<app-bottom-nav />
}
<app-auth-sheet />
</div>
+5 -4
View File
@@ -1,18 +1,19 @@
import { Routes } from '@angular/router';
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 { IconPreviewPage } from './pages/icon-preview-page/icon-preview-page';
import { MapItemPage } from './pages/map-item-page/map-item-page';
import { MapPage } from './pages/map-page/map-page';
import { ProfilePage } from './pages/profile-page/profile-page';
export const routes: Routes = [
{ path: '', component: CitiesPage },
{ path: 'map', component: MapPage },
{ path: 'collections', component: CollectionsPage },
{ path: 'collection', component: CollectionPage },
{ path: 'profile', component: ProfilePage },
{ path: 'city', component: CityPage },
{ path: 'collection', pathMatch: 'full', redirectTo: '/city' },
{ path: 'items/:id/icon', component: IconPreviewPage },
{ path: 'items/:id', component: MapItemPage },
{ path: 'objects/:id', redirectTo: 'items/:id' },
{ path: '**', redirectTo: '' },
+2 -1
View File
@@ -3,11 +3,12 @@ import { toSignal } from '@angular/core/rxjs-interop';
import { NavigationEnd, Router, RouterOutlet } from '@angular/router';
import { filter, map, startWith } from 'rxjs';
import { AuthSheet } from './auth/ui/auth-sheet/auth-sheet';
import { BottomNav } from './layout/bottom-nav/bottom-nav';
@Component({
selector: 'app-root',
imports: [RouterOutlet, BottomNav],
imports: [RouterOutlet, BottomNav, AuthSheet],
templateUrl: './app.html',
styleUrl: './app.scss',
})
+54
View File
@@ -0,0 +1,54 @@
import { Injectable, inject, signal } from '@angular/core';
import type { AuthIntent, AuthPromptResult } from './auth.models';
import { AuthService } from './auth.service';
@Injectable({
providedIn: 'root',
})
export class AuthPromptService {
private readonly auth = inject(AuthService);
readonly visible = signal(false);
readonly intent = signal<AuthIntent>('collection');
private resolver: ((result: AuthPromptResult) => void) | null = null;
prompt(intent: AuthIntent): Promise<AuthPromptResult> {
if (this.auth.authenticated()) {
return Promise.resolve('authenticated');
}
if (this.visible() && this.resolver) {
this.intent.set(intent);
return new Promise((resolve) => {
const previous = this.resolver;
this.resolver = (result) => {
previous?.(result);
resolve(result);
};
});
}
this.intent.set(intent);
this.visible.set(true);
return new Promise((resolve) => {
this.resolver = resolve;
});
}
dismiss(): void {
this.close('dismissed');
}
finish(): void {
this.close('authenticated');
}
private close(result: AuthPromptResult): void {
this.visible.set(false);
this.resolver?.(result);
this.resolver = null;
}
}
+9
View File
@@ -0,0 +1,9 @@
export type AuthIntent = 'claim' | 'collection';
export type AuthPromptResult = 'authenticated' | 'dismissed';
export type AuthStep = 'email' | 'code';
export interface AuthSession {
email: string;
}
+111
View File
@@ -0,0 +1,111 @@
import { Injectable, signal } from '@angular/core';
import type { AuthSession, AuthStep } from './auth.models';
const SESSION_KEY = 'gorodar.session';
const RESEND_SECONDS = 60;
@Injectable({
providedIn: 'root',
})
export class AuthService {
readonly email = signal('');
readonly authenticated = signal(false);
readonly step = signal<AuthStep>('email');
readonly resendSeconds = signal(0);
private timerId: ReturnType<typeof setInterval> | null = null;
constructor() {
const session = this.readSession();
if (!session) {
return;
}
this.email.set(session.email);
this.authenticated.set(true);
}
requestCode(email: string): boolean {
const normalized = email.trim();
if (!this.isEmail(normalized)) {
return false;
}
this.email.set(normalized);
this.step.set('code');
this.startTimer();
return true;
}
confirmCode(code: string): boolean {
if (!/^\d{6}$/.test(code) || !this.email()) {
return false;
}
this.authenticated.set(true);
this.step.set('email');
this.clearTimer();
this.writeSession({ email: this.email() });
return true;
}
changeEmail(): void {
this.clearTimer();
this.step.set('email');
}
logout(): void {
this.authenticated.set(false);
this.step.set('email');
this.clearTimer();
sessionStorage.removeItem(SESSION_KEY);
}
private startTimer(): void {
this.clearTimer();
this.resendSeconds.set(RESEND_SECONDS);
this.timerId = setInterval(() => {
const next = this.resendSeconds() - 1;
this.resendSeconds.set(Math.max(0, next));
if (next <= 0) {
this.clearTimer();
}
}, 1000);
}
private clearTimer(): void {
if (this.timerId !== null) {
clearInterval(this.timerId);
this.timerId = null;
}
this.resendSeconds.set(0);
}
private isEmail(value: string): boolean {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
}
private readSession(): AuthSession | null {
const raw = sessionStorage.getItem(SESSION_KEY);
if (!raw) {
return null;
}
try {
const session = JSON.parse(raw) as AuthSession;
return this.isEmail(session.email) ? session : null;
} catch {
return null;
}
}
private writeSession(session: AuthSession): void {
sessionStorage.setItem(SESSION_KEY, JSON.stringify(session));
}
}
@@ -0,0 +1,88 @@
@if (prompt.visible()) {
<div class="sheet-root">
<button
class="sheet-root__backdrop"
type="button"
aria-label="Свернуть"
(click)="dismiss()"
></button>
<section class="sheet" role="dialog" aria-modal="true" aria-labelledby="auth-sheet-title">
<button
class="sheet__handle"
type="button"
aria-label="Свернуть"
(click)="dismiss()"
></button>
@if (auth.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>
<button
class="sheet__submit"
type="button"
[disabled]="!emailValid()"
(click)="requestCode()"
>
Получить код
</button>
<button class="sheet__ghost" type="button" (click)="dismiss()">Пока просто посмотрю</button>
} @else {
<h2 id="auth-sheet-title">{{ title() }}</h2>
<p class="sheet__lead">
Отправили 6 цифр на <b>{{ auth.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]="auth.resendSeconds() > 0"
(click)="resend()"
>
{{ resendLabel() }}
</button>
<button class="sheet__submit" type="button" [disabled]="!codeReady()" (click)="confirm()">
Подтвердить
</button>
<button class="sheet__ghost" type="button" (click)="changeEmail()">Изменить почту</button>
}
</section>
</div>
}
+194
View File
@@ -0,0 +1,194 @@
.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;
}
.sheet {
position: relative;
z-index: 1;
width: min(100%, 480px);
max-height: min(92dvh, 760px);
overflow: 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;
animation: sheet-in 0.28s ease-out;
}
.sheet__handle {
display: block;
width: 42px;
height: 4px;
margin: 6px auto 12px;
padding: 0;
border: 0;
border-radius: 4px;
background: #4a453c;
cursor: pointer;
}
.sheet__lock {
display: grid;
place-items: center;
width: 68px;
height: 68px;
margin: 8px auto 16px;
border: 1.5px solid var(--color-accent);
border-radius: 18px;
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%;
margin-top: 14px;
padding: 0;
border: 0;
background: none;
color: var(--color-muted);
font: inherit;
font-size: 14px;
text-align: center;
cursor: pointer;
}
.sheet__resend:disabled {
cursor: default;
}
.sheet__submit {
width: 100%;
min-height: 52px;
margin-top: 16px;
border: 0;
border-radius: 16px;
background: var(--color-accent);
color: var(--color-on-accent);
font: inherit;
font-size: 16px;
font-weight: 600;
cursor: pointer;
}
.sheet__submit:disabled {
opacity: 0.45;
cursor: default;
}
.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;
}
@keyframes sheet-in {
from {
transform: translateY(24px);
}
to {
transform: translateY(0);
}
}
@media (prefers-reduced-motion: reduce) {
.sheet {
animation: none;
}
}
+175
View File
@@ -0,0 +1,175 @@
import {
ChangeDetectionStrategy,
Component,
ElementRef,
HostListener,
computed,
effect,
inject,
signal,
untracked,
viewChildren,
} from '@angular/core';
import { AuthPromptService } from '../../auth-prompt.service';
import { AuthService } from '../../auth.service';
import { Icon } from '../../../shared/icon/icon';
@Component({
selector: 'app-auth-sheet',
imports: [Icon],
templateUrl: './auth-sheet.html',
styleUrl: './auth-sheet.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AuthSheet {
private readonly digitFields = viewChildren<ElementRef<HTMLInputElement>>('digit');
protected readonly auth = inject(AuthService);
protected readonly prompt = inject(AuthPromptService);
protected readonly emailDraft = signal('');
protected readonly digits = signal<string[]>(['', '', '', '', '', '']);
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.auth.step() === 'code') {
return 'Введите код из письма';
}
return this.prompt.intent() === 'claim'
? 'Войдите, чтобы забрать объект'
: 'Войдите, чтобы открыть коллекцию';
});
protected readonly resendLabel = computed(() => {
const seconds = this.auth.resendSeconds();
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.prompt.visible()) {
return;
}
untracked(() => {
this.emailDraft.set(this.auth.email());
this.digits.set(['', '', '', '', '', '']);
});
});
effect(() => {
if (this.auth.step() !== 'code' || !this.prompt.visible()) {
return;
}
requestAnimationFrame(() => this.digitFields()[0]?.nativeElement.focus());
});
}
protected onEmail(event: Event): void {
const input = event.target as HTMLInputElement;
this.emailDraft.set(input.value);
}
protected requestCode(): void {
this.digits.set(['', '', '', '', '', '']);
this.auth.requestCode(this.emailDraft());
}
protected confirm(): void {
if (!this.auth.confirmCode(this.digits().join(''))) {
return;
}
this.prompt.finish();
}
protected resend(): void {
if (this.auth.resendSeconds() > 0) {
return;
}
this.digits.set(['', '', '', '', '', '']);
this.auth.requestCode(this.auth.email());
}
protected changeEmail(): void {
this.auth.changeEmail();
}
protected dismiss(): void {
this.prompt.dismiss();
}
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.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, 6).split('');
if (parsed.length === 0) {
return;
}
event.preventDefault();
this.digits.set(Array.from({ length: 6 }, (_, index) => parsed[index] ?? ''));
const focusIndex = Math.min(parsed.length, 5);
this.digitFields()[focusIndex]?.nativeElement.focus();
}
@HostListener('document:keydown.escape')
protected onEscape(): void {
if (this.prompt.visible()) {
this.dismiss();
}
}
}
+2
View File
@@ -3,6 +3,8 @@
} @else if (stage() === 'success') {
<app-collect-success
[title]="landmark().title"
[image]="landmark().achievement"
[model]="landmark().model"
[cityName]="city.name"
[opened]="openedCount()"
[total]="totalCount"
@@ -1,4 +1,10 @@
<section class="success">
<section class="success" [class.success--preview]="mode() === 'preview'">
@if (mode() === 'preview') {
<button class="success__back" type="button" aria-label="Назад" (click)="goBack()">
<app-icon name="chevron-left" [size]="22" />
</button>
}
<div class="success__glow"></div>
<div class="success__stamp">
@@ -20,11 +26,29 @@
<span class="success__spark success__spark--b"></span>
<span class="success__spark success__spark--c"></span>
<span class="success__spark success__spark--d"></span>
<div class="success__mark anim-pop">
<img src="/assets/icons/gorodar-mark.svg" alt="" />
<div class="success__mark anim-pop" [class.success__mark--model]="model()">
@if (model(); as src) {
<model-viewer
class="success__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"
></model-viewer>
} @else {
<img [src]="image()" alt="" />
}
</div>
</div>
@if (mode() === 'preview') {
<h1 class="success__title">{{ title() }}</h1>
} @else {
<div class="success__copy">
<p class="success__eyebrow">Новое в коллекции</p>
<h1>{{ title() }}</h1>
@@ -36,24 +60,16 @@
<span>{{ cityName() }}</span>
<span>
<b>{{ opened() }} из {{ total() }}</b>
· +1 сегодня
</span>
</div>
<div class="success__bar">
<span
class="anim-grow"
[style.--from]="from() + '%'"
[style.--to]="to() + '%'"
></span>
<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">
<a matButton="filled" routerLink="/collection" (click)="leave()">Открыть коллекцию</a>
<a class="success__ghost" routerLink="/map" (click)="leave()">Продолжить на карте</a>
<a matButton="filled" routerLink="/collections" (click)="leave()">Открыть коллекцию</a>
<a class="success__ghost" routerLink="/city" (click)="leave()">Назад</a>
</div>
}
</section>
@@ -33,6 +33,7 @@
inset: 0;
width: 100%;
height: 100%;
pointer-events: none;
}
.success__mark {
@@ -43,10 +44,21 @@
height: 58%;
}
.success__mark img {
.success__mark img,
.success__model {
display: block;
width: 100%;
height: 100%;
object-fit: contain;
background: transparent;
--poster-color: transparent;
}
.success__mark--model {
top: 6%;
left: 6%;
width: 88%;
height: 88%;
}
.success__spark {
@@ -55,12 +67,25 @@
height: 10px;
background: var(--color-accent-soft);
clip-path: polygon(50% 0, 65% 35%, 100% 50%, 65% 65%, 50% 100%, 35% 65%, 0 50%, 35% 35%);
pointer-events: none;
}
.success__spark--a { top: 18%; left: 16%; }
.success__spark--b { top: 22%; right: 14%; }
.success__spark--c { bottom: 16%; left: 20%; }
.success__spark--d { bottom: 18%; right: 16%; }
.success__spark--a {
top: 18%;
left: 16%;
}
.success__spark--b {
top: 22%;
right: 14%;
}
.success__spark--c {
bottom: 16%;
left: 20%;
}
.success__spark--d {
bottom: 18%;
right: 16%;
}
.success__copy,
.success__card,
@@ -85,7 +110,8 @@
text-transform: uppercase;
}
.success__copy h1 {
.success__copy h1,
.success__title {
margin: 8px 0 0;
font-family: var(--font-display);
font-size: clamp(28px, 8vw, 34px);
@@ -93,6 +119,61 @@
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: 64px 0 20px;
}
.success--preview .success__stamp {
width: min(100vw, calc(100dvh - 148px));
max-width: 100%;
}
.success--preview .success__mark {
top: 14%;
left: 14%;
width: 72%;
height: 72%;
}
.success--preview .success__mark--model {
top: 2%;
left: 2%;
width: 96%;
height: 96%;
}
.success--preview .success__title {
margin-top: 4px;
padding: 0 20px;
}
.success__back {
position: absolute;
z-index: 2;
top: 16px;
left: 16px;
display: flex;
align-items: center;
justify-content: center;
width: 44px;
height: 44px;
padding: 0;
border: 1px solid var(--color-border);
border-radius: 14px;
background: rgb(28 26 23 / 86%);
color: var(--color-text);
cursor: pointer;
}
.success__copy p:last-child {
margin: 8px 0 0;
color: var(--color-muted);
@@ -141,15 +222,6 @@
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 {
display: flex;
flex: 1;
@@ -1,6 +1,15 @@
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
import { RouterLink } from '@angular/router';
import { Location } from '@angular/common';
import {
ChangeDetectionStrategy,
Component,
CUSTOM_ELEMENTS_SCHEMA,
computed,
effect,
inject,
input,
} from '@angular/core';
import { MatButton } from '@angular/material/button';
import { Router, RouterLink } from '@angular/router';
import { Store } from '@ngrx/store';
import { Icon } from '../../shared/icon/icon';
@@ -11,21 +20,46 @@ import { GorodarActions } from '../../state';
imports: [Icon, RouterLink, MatButton],
templateUrl: './collect-success.html',
styleUrl: './collect-success.scss',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CollectSuccess {
private readonly store = inject(Store);
private readonly location = inject(Location);
private readonly router = inject(Router);
readonly mode = input<'claim' | 'preview'>('claim');
readonly title = input.required<string>();
readonly cityName = input.required<string>();
readonly opened = input.required<number>();
readonly total = input.required<number>();
readonly matchPercent = input(91);
readonly image = input.required<string>();
readonly model = input<string | undefined>(undefined);
readonly cityName = input('');
readonly opened = input(0);
readonly total = input(1);
protected readonly from = computed(() =>
Math.max(0, Math.round(((this.opened() - 1) / this.total()) * 100)),
);
protected readonly to = computed(() => Math.round((this.opened() / this.total()) * 100));
constructor() {
effect(() => {
if (!this.model()) {
return;
}
void import('@google/model-viewer/dist/model-viewer.min.js');
});
}
protected readonly from = computed(() => {
const total = this.total();
if (total <= 0) {
return 0;
}
return Math.max(0, Math.round(((this.opened() - 1) / total) * 100));
});
protected readonly to = computed(() => {
const total = this.total();
if (total <= 0) {
return 0;
}
return Math.round((this.opened() / total) * 100);
});
protected readonly rays = Array.from({ length: 24 }, (_, index) => {
const angle = (index / 24) * Math.PI * 2;
@@ -44,4 +78,13 @@ export class CollectSuccess {
protected leave(): void {
this.store.dispatch(GorodarActions.claimReset());
}
protected goBack(): void {
if (window.history.length > 1) {
this.location.back();
return;
}
void this.router.navigateByUrl('/city');
}
}
+86 -61
View File
@@ -10,6 +10,10 @@ export interface Landmark {
geoRadiusMeters: number;
facts: string[];
photoHint: string;
background: string;
audio: string;
achievement: string;
model?: string;
}
export interface City {
@@ -22,92 +26,113 @@ export interface City {
export const NIZHNY_NOVGOROD: City = {
id: 'nizhny-novgorod',
name: 'Нижний Новгород',
center: [44.0075, 56.3269],
center: [43.99934, 56.329399],
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: 'Лестница в форме восьмёрки соединяет верхнюю и нижнюю набережные Волги. Названа в честь лётчика Валерия Чкалова.',
description:
'Главная лестница-серпантин города: она спускается пологими зигзагами от площади Минина и Пожарского к Волге, а на верхней площадке стоит памятник лётчику Валерию Чкалову, чьё имя лестница носит.',
address: 'Верхне-Волжская набережная, Нижний Новгород',
addressHint: 'Между верхней и нижней набережными',
coordinates: [44.0094, 56.3306],
addressHint: 'От площади Минина и Пожарского к Волге',
coordinates: [44.009444, 56.330833],
collected: false,
geoCheckEnabled: true,
geoRadiusMeters: 300,
facts: [
'Официально в ней 560 ступеней.',
'Строить начали в 1943 году, открыли 8 августа 1949 года.',
'На верхней площадке стоит памятник Валерию Чкалову.',
'Построена в 1943–1949 годах в честь победы в Сталинградской битве.',
'560 ступеней по внешнему контуру — одна из самых длинных лестниц в России.',
'Форма — цифра «8» с двумя смотровыми площадками с видом на Волгу и Стрелку.',
],
photoHint: 'Снимайте так, чтобы лестница читалась целиком.',
background: '/assets/background/nn-bg-chkalov-stairs.svg',
audio: '/assets/audio/chkalov-stairs.mp3',
achievement: '/assets/achivments/chkalov-stairs.png',
},
{
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],
id: 'kremlin',
title: 'Нижегородский кремль',
description:
'Каменная крепость на высоком берегу Волги и Оки — исторический центр и главный символ Нижнего Новгорода.',
address: 'Кремль, Нижний Новгород',
addressHint: 'Высокий берег Волги и Оки',
coordinates: [44.00235, 56.327244],
collected: false,
geoCheckEnabled: true,
geoRadiusMeters: 300,
facts: [
'Построен в 1868–1881 годах, освящён 20 июля 1881 года.',
'Высота собора — 87 метров.',
'В 1929 году собор закрыли; с 1992 года он снова у Церкви, а с 2009-го — кафедральный.',
'Построен в 1508–1515 годах.',
'13 башен (5 проездных, 8 глухих), общая длина стен — около 2045 метров.',
'Ни разу не был взят неприятелем за всю свою историю.',
],
photoHint: 'Снимайте так, чтобы собор был виден целиком.',
photoHint: 'Снимайте так, чтобы были видны стены и башни кремля.',
background: '/assets/background/nn-bg-kremlin.svg',
audio: '/assets/audio/kremlin.mp3',
achievement: '/assets/achivments/kremlin.png',
},
{
id: 'pechersky',
title: 'Печерский монастырь',
description: 'Вознесенский Печерский монастырь на высоком берегу Волги, примерно в 3 км ниже по течению от кремля.',
id: 'iron-deer',
title: 'Железный олень',
description:
'Пятиметровая скульптура оленя на Нижневолжской набережной — подарок городу от почётного консула Венгрии и одна из самых фотографируемых точек в городе.',
address: 'Нижне-Волжская набережная, Нижний Новгород',
addressHint: 'На высоком берегу Волги, около 3 км от кремля',
coordinates: [44.0499, 56.3225],
addressHint: 'На набережной Волги',
coordinates: [44.012083, 56.332055],
collected: false,
geoCheckEnabled: true,
geoRadiusMeters: 100,
geoRadiusMeters: 300,
facts: [
'Основал обитель в XIV веке святитель Дионисий.',
'В 1597 году оползень разрушил монастырь, и его перенесли на версту выше по Волге.',
'Пятиглавый Вознесенский собор построен в 1631–1632 годах.',
'Установлен в 2014 году к 793-летию основания Нижнего Новгорода.',
'Автор — венгерский скульптор Габор Миклош Жоке; фигура собрана из металлических пластин.',
'Олень — древний символ, изображён на гербе Нижегородской области.',
],
photoHint: 'Снимайте так, чтобы были видны собор и колокольня.',
photoHint: 'Снимайте так, чтобы олень был виден целиком.',
background: '/assets/background/nn-bg-iron-deer.svg',
audio: '/assets/audio/iron-deer.mp3',
achievement: '/assets/achivments/iron-deer.png',
},
{
id: 'rozhdestvenskaya',
title: 'Рождественская церковь',
description:
'Пятиглавый нарядный храм в стиле строгановского барокко на улице Рождественской — один из самых декоративных храмов города.',
address: 'ул. Рождественская, Нижний Новгород',
addressHint: 'Строгановское барокко',
coordinates: [43.985, 56.327222],
collected: false,
geoCheckEnabled: true,
geoRadiusMeters: 300,
facts: [
'Построена в 1696–1719 годах на средства купца Григория Строганова.',
'Украшена белокаменной резьбой и восьмигранной колокольней с часами.',
'Памятник архитектуры федерального значения; вновь освящена в 1993 году.',
],
photoHint: 'Снимайте так, чтобы храм был виден целиком.',
background: '/assets/background/nn-bg-rozhdestvenskaya.png',
audio: '/assets/audio/rozhdestvenskaya.mp3',
achievement: '/assets/achivments/rozhdestvenskaya.png',
},
{
id: 'river-station',
title: 'Речной вокзал',
description:
'Здание речного вокзала на площади Маркина, на самом слиянии Волги и Оки — когда-то главные «водные ворота» города для пассажирских рейсов.',
address: 'пл. Маркина, Нижний Новгород',
addressHint: 'Слияние Волги и Оки',
coordinates: [43.987823, 56.329641],
collected: false,
geoCheckEnabled: true,
geoRadiusMeters: 300,
facts: [
'Построен в 1964 году по проекту архитектора Чурилина.',
'Полностью застеклённый фасад напоминает аквариум; силуэт здания похож на корабль со шпилем вместо мачты.',
'Сегодня в здании работает выставочное пространство «Река-Река», вход свободный.',
],
photoHint: 'Снимайте так, чтобы силуэт вокзала читался целиком.',
background: '/assets/background/nn-bg-rechnoy-vokzal.svg',
audio: '/assets/audio/river-station.mp3',
achievement: '/assets/achivments/river-station.png',
model: '/assets/models/river-station.glb',
},
],
};
+2 -3
View File
@@ -25,14 +25,13 @@ export class BottomNav {
protected readonly items = [
{ path: '/', icon: 'cities', label: 'Города', exact: true },
{ path: '/map', icon: 'map', label: 'Карта', exact: false },
{ path: '/collections', icon: 'collection', label: 'Коллекция', exact: false },
];
protected isActive(path: string, exact: boolean): boolean {
const url = this.url();
if (path === '/collections') {
return url === '/collections' || url === '/collection';
if (path === '/') {
return url === '/' || url === '/city';
}
if (exact) {
return url === path;
+33 -18
View File
@@ -2,25 +2,40 @@
<div #map class="city-map__canvas"></div>
<div class="city-map__hud">
<button
class="city-map__chip"
type="button"
[attr.aria-label]="'Показать центр: ' + city.name"
(click)="focusCity()"
>
<app-icon name="pin" [size]="18" />
<span>{{ city.name }}</span>
</button>
@if (!embedded() && !fullscreen()) {
<button
class="city-map__chip"
type="button"
[attr.aria-label]="'Показать центр: ' + city.name"
(click)="focusCity()"
>
<app-icon name="pin" [size]="18" />
<span>{{ city.name }}</span>
</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 class="city-map__tools">
@if (embedded()) {
<button
class="city-map__locate"
type="button"
[attr.aria-label]="fullscreen() ? 'Свернуть карту' : 'На весь экран'"
(click)="toggleFullscreen()"
>
<app-icon [name]="fullscreen() ? 'collapse' : 'expand'" [size]="22" />
</button>
}
<button
class="city-map__locate"
type="button"
[class.city-map__locate--active]="following()"
[attr.aria-label]="following() ? 'Остановить навигацию' : 'Моя геопозиция'"
(click)="locate()"
>
<app-icon name="my-location" [size]="22" />
</button>
</div>
</div>
@if (selected(); as landmark) {
+30 -2
View File
@@ -3,6 +3,14 @@
height: 100%;
}
:host.is-fullscreen {
position: fixed;
z-index: 40;
inset: 0;
height: 100%;
background: var(--color-bg);
}
.city-map {
position: relative;
width: 100%;
@@ -26,12 +34,19 @@
z-index: 2;
display: flex;
align-items: center;
justify-content: space-between;
justify-content: flex-end;
gap: 10px;
}
.city-map__tools {
display: flex;
gap: 10px;
margin-left: auto;
}
.city-map__chip,
.city-map__locate {
.city-map__locate,
.city-map__back {
display: flex;
align-items: center;
min-height: 48px;
@@ -41,6 +56,19 @@
color: var(--color-text);
}
.city-map__chip,
.city-map__back {
margin-right: auto;
}
.city-map__back {
justify-content: center;
width: 48px;
padding: 0;
border-radius: 14px;
cursor: pointer;
}
.city-map__chip {
gap: 8px;
padding: 0 16px;
+64
View File
@@ -3,11 +3,13 @@ import {
ChangeDetectionStrategy,
Component,
ElementRef,
HostListener,
NgZone,
OnDestroy,
ViewChild,
effect,
inject,
input,
signal,
} from '@angular/core';
import { Geolocation, type Position } from '@capacitor/geolocation';
@@ -48,6 +50,7 @@ interface DgMap {
): this;
getZoom(): number;
latLngToContainerPoint(latLng: [number, number]): DgPoint;
invalidateSize?(): void;
remove(): void;
}
@@ -124,6 +127,9 @@ function loadRasterApi(): Promise<DgApi> {
templateUrl: './city-map.html',
styleUrl: './city-map.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
'[class.is-fullscreen]': 'fullscreen()',
},
})
export class CityMap implements AfterViewInit, OnDestroy {
@ViewChild('map', { static: true })
@@ -141,6 +147,9 @@ export class CityMap implements AfterViewInit, OnDestroy {
private zoomOnNextPan = true;
private destroyed = false;
private programmaticMove = false;
private resizeObserver: ResizeObserver | null = null;
private readonly hostRef = inject(ElementRef<HTMLElement>);
private readonly clippedAncestors: HTMLElement[] = [];
private readonly markerElements = new Map<string, HTMLElement>();
private readonly markers = new Map<string, DgMarker>();
private readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
@@ -159,9 +168,12 @@ export class CityMap implements AfterViewInit, OnDestroy {
this.programmaticMove = false;
};
readonly embedded = input(false);
protected readonly city = this.catalog.city;
protected readonly selected = signal<Landmark | null>(null);
protected readonly following = signal(false);
protected readonly fullscreen = signal(false);
constructor() {
effect(() => {
@@ -171,9 +183,18 @@ export class CityMap implements AfterViewInit, OnDestroy {
this.setMarkerIcon(element, ids.has(id));
}
});
effect(() => {
const active = this.fullscreen();
this.setAncestorOverflow(active);
requestAnimationFrame(() => this.resizeMap());
});
}
async ngAfterViewInit(): Promise<void> {
this.resizeObserver = new ResizeObserver(() => this.resizeMap());
this.resizeObserver.observe(this.mapElement.nativeElement);
const api = await loadRasterApi();
this.raster = api;
@@ -214,11 +235,15 @@ export class CityMap implements AfterViewInit, OnDestroy {
for (const landmark of this.city.objects) {
this.markers.set(landmark.id, this.createMarker(raster, map, landmark));
}
requestAnimationFrame(() => this.resizeMap());
});
}
ngOnDestroy(): void {
this.destroyed = true;
this.setAncestorOverflow(false);
this.resizeObserver?.disconnect();
void this.stopWatching();
this.map?.off('dragstart', this.stopFollowing);
this.map?.off('zoomstart', this.onZoomStart);
@@ -227,6 +252,19 @@ export class CityMap implements AfterViewInit, OnDestroy {
this.map = null;
}
protected toggleFullscreen(): void {
this.fullscreen.update((active) => !active);
}
protected exitFullscreen(): void {
this.fullscreen.set(false);
}
@HostListener('document:keydown.escape')
protected onEscape(): void {
this.exitFullscreen();
}
protected focusCity(): void {
this.following.set(false);
this.clearSelection();
@@ -474,4 +512,30 @@ export class CityMap implements AfterViewInit, OnDestroy {
private toLatLng(coordinates: [number, number]): [number, number] {
return [coordinates[1], coordinates[0]];
}
private resizeMap(): void {
this.map?.invalidateSize?.();
}
private setAncestorOverflow(active: boolean): void {
for (const element of this.clippedAncestors) {
element.style.overflow = '';
}
this.clippedAncestors.length = 0;
document.body.style.overflow = '';
if (!active) {
return;
}
let node = this.hostRef.nativeElement.parentElement;
while (node && node !== document.body) {
this.clippedAncestors.push(node);
node.style.overflow = 'visible';
node = node.parentElement;
}
document.body.style.overflow = 'hidden';
}
}
+13 -38
View File
@@ -1,32 +1,10 @@
<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">
<h1>Коллекции городов</h1>
<h1>Города</h1>
<p>Приезжайте на место, снимайте — объект попадёт в вашу коллекцию.</p>
</div>
<a class="page__all" routerLink="/collections">
<span class="page__all-label">
<app-icon name="collection" [size]="22" />
<span>
<b>Вся коллекция</b>
<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">
<a class="city-card" routerLink="/city" [attr.aria-label]="city.name">
<div class="city-card__top">
<div>
<h2>{{ city.name }}</h2>
@@ -44,26 +22,23 @@
<div class="city-card__cells">
@for (landmark of city.objects; track landmark.id) {
<a
<span
class="cell"
[routerLink]="['/items', landmark.id]"
[class.cell--open]="collectedIds().has(landmark.id)"
[attr.aria-label]="landmark.title + (collectedIds().has(landmark.id) ? ', получено' : ', не получен')"
[attr.aria-label]="
landmark.title + (collectedIds().has(landmark.id) ? ', получено' : ', не получен')
"
>
<img
[src]="collectedIds().has(landmark.id) ? '/assets/icons/gorodar-mark.svg' : '/assets/icons/cell-lock.svg'"
[src]="
collectedIds().has(landmark.id)
? landmark.achievement
: '/assets/icons/cell-lock.svg'
"
[alt]=""
/>
</a>
</span>
}
</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>
</a>
</section>
+9 -30
View File
@@ -14,8 +14,7 @@
.page__brand,
.page__all,
.page__all-label,
.city-card__top,
.city-card__actions {
.city-card__top {
display: flex;
align-items: center;
}
@@ -39,19 +38,6 @@
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 {
margin: 20px 0 16px;
}
@@ -90,24 +76,13 @@
text-decoration: none;
}
.page__all-label {
gap: 10px;
color: var(--color-accent);
}
.page__all-label b {
color: var(--color-text);
font-weight: 600;
}
.page__all-meta {
color: var(--color-muted);
font-weight: 400;
}
.city-card {
display: block;
padding: 16px;
border-radius: 24px;
color: inherit;
text-decoration: none;
cursor: pointer;
}
.city-card__top {
@@ -171,6 +146,10 @@
box-shadow: inset 0 0 0 1.5px var(--color-accent);
}
.cell--open img {
object-fit: contain;
}
.city-card__actions {
gap: 10px;
width: 100%;
+1 -3
View File
@@ -1,16 +1,14 @@
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 { Store } from '@ngrx/store';
import { CityCatalogService } from '../../root/services/city-catalog.service';
import { Icon } from '../../shared/icon/icon';
import { selectCollectedIdSet, selectOpenedCount, selectProgress } from '../../state';
@Component({
selector: 'app-cities-page',
imports: [RouterLink, MatButton, MatProgressBar, Icon],
imports: [RouterLink, MatProgressBar],
templateUrl: './cities-page.html',
styleUrl: './cities-page.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -1,12 +1,8 @@
<section class="page">
<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>
<a class="page__all" routerLink="/collections">
Вся коллекция
<app-icon name="chevron-right" [size]="16" />
</a>
</header>
<div class="page__city">
@@ -29,10 +25,25 @@
</div>
<nav class="tabs" aria-label="Разделы города">
<span class="tabs__item tabs__item--active">Объекты</span>
<a class="tabs__item" routerLink="/map">На карте</a>
<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') {
<div class="filters">
<button
type="button"
@@ -59,7 +70,7 @@
<div class="grid">
@for (landmark of landmarks(); track landmark.id) {
<a class="card" [routerLink]="['/items', landmark.id]">
<a class="card" [routerLink]="objectRoute(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">
@@ -82,7 +93,11 @@
<span class="card__spark card__spark--d"></span>
}
<img
[src]="collectedIds().has(landmark.id) ? '/assets/icons/gorodar-mark.svg' : '/assets/icons/cell-lock.svg'"
[src]="
collectedIds().has(landmark.id)
? landmark.achievement
: '/assets/icons/cell-lock.svg'
"
alt=""
/>
</div>
@@ -97,4 +112,11 @@
</a>
}
</div>
}
@if (mapReady()) {
<div class="page__map" [class.page__map--off]="tab() !== 'map'">
<app-city-map [embedded]="true" />
</div>
}
</section>
@@ -3,12 +3,25 @@
min-height: 100%;
}
:host:has(.page--map) {
height: 100%;
overflow: hidden;
}
.page {
width: min(100%, 720px);
margin: 0 auto;
padding: 16px 16px 24px;
}
.page--map {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
padding-bottom: 0;
}
.page__top,
.page__city,
.page__city p,
@@ -23,8 +36,7 @@
gap: 12px;
}
.page__back,
.page__all {
.page__back {
display: flex;
align-items: center;
min-height: 44px;
@@ -110,9 +122,13 @@
.tabs__item {
padding: 10px 0;
border: 0;
background: none;
color: var(--color-muted);
font: inherit;
font-weight: 500;
text-decoration: none;
cursor: pointer;
}
.tabs__item--active {
@@ -122,6 +138,23 @@
font-weight: 600;
}
.page__map {
display: flex;
flex: 1;
min-height: 280px;
margin: 0 -16px;
}
.page__map > app-city-map {
flex: 1;
min-width: 0;
min-height: 0;
}
.page__map--off {
display: none;
}
.filters {
gap: 8px;
margin-top: 16px;
@@ -173,8 +206,7 @@
height: 112px;
overflow: hidden;
background:
radial-gradient(circle at 50% 42%, rgb(255 255 255 / 5%), rgb(255 255 255 / 0%) 70%),
#1a1815;
radial-gradient(circle at 50% 42%, rgb(255 255 255 / 5%), rgb(255 255 255 / 0%) 70%), #1a1815;
}
.card__preview img {
@@ -182,6 +214,7 @@
z-index: 1;
width: 96px;
height: 96px;
object-fit: contain;
}
.card__rays {
@@ -204,10 +237,22 @@
pointer-events: none;
}
.card__spark--a { top: 10px; left: 12px; }
.card__spark--b { top: 14px; right: 14px; }
.card__spark--c { bottom: 12px; left: 16px; }
.card__spark--d { bottom: 14px; right: 12px; }
.card__spark--a {
top: 10px;
left: 12px;
}
.card__spark--b {
top: 14px;
right: 14px;
}
.card__spark--c {
bottom: 12px;
left: 16px;
}
.card__spark--d {
bottom: 14px;
right: 12px;
}
.card__preview--open {
background: rgb(224 184 79 / 10%);
@@ -2,24 +2,28 @@ import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@a
import { RouterLink } from '@angular/router';
import { Store } from '@ngrx/store';
import { CityMap } from '../../map/city-map/city-map';
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';
type CityTab = 'objects' | 'map';
@Component({
selector: 'app-collection-page',
imports: [Icon, RouterLink],
templateUrl: './collection-page.html',
styleUrl: './collection-page.scss',
selector: 'app-city-page',
imports: [Icon, RouterLink, CityMap],
templateUrl: './city-page.html',
styleUrl: './city-page.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CollectionPage {
export class CityPage {
private readonly catalog = inject(CityCatalogService);
private readonly store = inject(Store);
protected readonly city = this.catalog.city;
protected readonly tab = signal<CityTab>('objects');
protected readonly mapReady = signal(false);
protected readonly filter = signal<CollectionFilter>('all');
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
protected readonly openedCount = this.store.selectSignal(selectOpenedCount);
@@ -55,4 +59,17 @@ export class CollectionPage {
strong: index % 2 === 0,
};
});
protected openObjects(): void {
this.tab.set('objects');
}
protected openMap(): void {
this.mapReady.set(true);
this.tab.set('map');
}
protected objectRoute(id: string): string[] {
return this.collectedIds().has(id) ? ['/items', id, 'icon'] : ['/items', id];
}
}
@@ -1,9 +1,9 @@
<section class="page">
<header class="page__top">
<a class="page__back" routerLink="/" aria-label="Назад">
<app-icon name="chevron-left" [size]="22" />
</a>
<span class="page__title">Коллекция</span>
<header class="account">
<p class="account__email">{{ accountEmail() }}</p>
<button class="account__logout" type="button" aria-label="Выйти" (click)="logout()">
<app-icon name="logout" [size]="22" />
</button>
</header>
<div class="page__intro">
@@ -20,94 +20,48 @@
<b>1</b>
<span>город</span>
</div>
<div>
<b>1</b>
<span>страна</span>
</div>
</section>
<div class="tabs">
<button type="button" [class.tabs__item--active]="tab() === 'russia'" (click)="tab.set('russia')">
Россия
</button>
<button type="button" [class.tabs__item--active]="tab() === 'world'" (click)="tab.set('world')">
Страны мира
</button>
</div>
<p class="section-label">Мои города</p>
@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>
<h2>{{ city.name }}</h2>
<p>Собрано {{ openedCount() }} из {{ totalCount }}</p>
</div>
<div
class="pack__percent anim-percent"
[style.--to-p]="progress()"
aria-hidden="true"
>
<span>{{ progress() }}%</span>
</div>
<span class="pack__go" aria-hidden="true">
<app-icon name="chevron-right" [size]="20" />
</span>
@if (collectedLandmarks().length > 0) {
<article class="pack">
<a class="pack__head" routerLink="/city" [attr.aria-label]="'Объекты: ' + city.name">
<div>
<h2>{{ city.name }}</h2>
<p>Собрано {{ openedCount() }} из {{ totalCount }}</p>
</div>
<div class="pack__bar" aria-hidden="true">
<span
class="anim-grow"
[style.--from]="'0%'"
[style.--to]="progress() + '%'"
></span>
</div>
<div class="pack__cells">
@for (landmark of city.objects; track landmark.id) {
<span class="pack__stamp" [class.pack__stamp--open]="collectedIds().has(landmark.id)">
<img
[src]="collectedIds().has(landmark.id) ? '/assets/icons/gorodar-mark.svg' : '/assets/icons/cell-lock.svg'"
alt=""
/>
</span>
}
<div class="pack__percent anim-percent" [style.--to-p]="progress()" aria-hidden="true">
<span>{{ progress() }}%</span>
</div>
<span class="pack__go" aria-hidden="true">
<app-icon name="chevron-right" [size]="20" />
</span>
</a>
} @else {
<p class="empty">Город не найден.</p>
}
<div class="pack__bar" aria-hidden="true">
<span class="anim-grow" [style.--from]="'0%'" [style.--to]="progress() + '%'"></span>
</div>
<div class="picked">
@for (landmark of collectedLandmarks(); track landmark.id) {
<a class="picked__card" [routerLink]="objectRoute(landmark.id)">
<div class="picked__preview">
<img [src]="landmark.achievement" alt="" />
</div>
<div class="picked__body">
<h3>{{ landmark.title }}</h3>
<span>
<app-icon name="check" [size]="15" />
Получен
</span>
</div>
<span class="picked__bar" aria-hidden="true"></span>
</a>
}
</div>
</article>
} @else {
<label class="search">
<app-icon name="search" [size]="22" />
<input type="search" placeholder="Найти страну" disabled />
</label>
<button type="button" class="country" (click)="tab.set('russia')">
<span class="country__mark" aria-hidden="true">
<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>
<p class="empty">Пока нет полученных объектов.</p>
}
</section>
@@ -9,33 +9,37 @@
padding: 16px 16px 24px;
}
.page__top {
position: relative;
.account {
display: flex;
align-items: center;
justify-content: center;
justify-content: space-between;
gap: 12px;
min-height: 44px;
}
.page__back {
position: absolute;
left: 0;
.account__email {
margin: 0;
overflow: hidden;
color: var(--color-text);
font-size: 15px;
font-weight: 500;
text-overflow: ellipsis;
white-space: nowrap;
}
.account__logout {
display: flex;
flex: none;
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%);
background: var(--color-surface);
color: var(--color-text);
text-decoration: none;
}
.page__title {
color: var(--color-muted);
font-size: 15px;
font-weight: 500;
cursor: pointer;
}
.page__intro {
@@ -43,8 +47,7 @@
}
.page__intro h1,
.summary b,
.country b {
.summary b {
margin: 0;
font-family: var(--font-display);
font-weight: 700;
@@ -70,16 +73,14 @@
font-size: 15px;
}
.summary,
.search,
.country {
.summary {
border: 1px solid var(--color-border);
background: var(--color-surface);
}
.summary {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 8px;
margin-top: 16px;
padding: 18px 16px;
@@ -92,106 +93,73 @@
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 {
margin: 20px 0 8px;
font-size: 14px;
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 {
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;
min-height: 38px;
font-size: 15px;
font-weight: 600;
line-height: 1.25;
}
.picked__body span {
display: flex;
align-items: center;
gap: 6px;
color: var(--color-accent-soft);
font-size: 13px;
}
.picked__bar {
height: 4px;
background: var(--color-accent);
}
@@ -1,10 +1,12 @@
import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';
import { afterNextRender, ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';
import { RouterLink } from '@angular/router';
import { Store } from '@ngrx/store';
import { AuthPromptService } from '../../auth/auth-prompt.service';
import { AuthService } from '../../auth/auth.service';
import { CityCatalogService } from '../../root/services/city-catalog.service';
import { Icon } from '../../shared/icon/icon';
import { selectCollectedIdSet, selectOpenedCount, selectProgress } from '../../state';
import { selectCollectedIdSet, selectOpenedCount, selectProfile, selectProgress } from '../../state';
@Component({
selector: 'app-collections-page',
@@ -16,24 +18,38 @@ import { selectCollectedIdSet, selectOpenedCount, selectProgress } from '../../s
export class CollectionsPage {
private readonly catalog = inject(CityCatalogService);
private readonly store = inject(Store);
private readonly auth = inject(AuthService);
private readonly authPrompt = inject(AuthPromptService);
protected readonly city = this.catalog.city;
protected readonly profile = this.store.selectSignal(selectProfile);
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
protected readonly openedCount = this.store.selectSignal(selectOpenedCount);
protected readonly totalCount = this.city.objects.length;
protected readonly query = signal('');
protected readonly tab = signal<'russia' | 'world'>('russia');
protected readonly progress = this.store.selectSignal(selectProgress);
protected readonly cityVisible = computed(() => {
const query = this.query().trim().toLowerCase();
return !query || this.city.name.toLowerCase().includes(query);
});
protected readonly accountEmail = computed(() =>
this.auth.authenticated() ? this.auth.email() : this.profile().email,
);
protected readonly collectedLandmarks = computed(() =>
this.city.objects.filter((item) => this.collectedIds().has(item.id)),
);
constructor() {
afterNextRender(() => {
void this.authPrompt.prompt('collection');
});
}
protected readonly objectsLabel = computed(() =>
this.plural(this.openedCount(), ['объект', 'объекта', 'объектов']),
);
protected onQuery(event: Event): void {
this.query.set((event.target as HTMLInputElement).value);
protected objectRoute(id: string): string[] {
return this.collectedIds().has(id) ? ['/items', id, 'icon'] : ['/items', id];
}
protected logout(): void {
this.auth.logout();
}
private plural(count: number, forms: [string, string, string]): string {
@@ -0,0 +1,15 @@
@if (landmark(); as item) {
@if (collected()) {
<app-collect-success
mode="preview"
[title]="item.title"
[image]="item.achievement"
[model]="item.model"
/>
}
} @else {
<section class="missing">
<p>Объект не найден.</p>
<a routerLink="/city">К списку объектов</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,41 @@
import { ChangeDetectionStrategy, Component, computed, effect, inject, input } from '@angular/core';
import { Router, RouterLink } from '@angular/router';
import { Store } from '@ngrx/store';
import { CollectSuccess } from '../../claim/collect-success/collect-success';
import { CityCatalogService } from '../../root/services/city-catalog.service';
import { selectCollectedIdSet } 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 catalog = inject(CityCatalogService);
private readonly store = inject(Store);
private readonly router = inject(Router);
private readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
readonly id = input.required<string>();
protected readonly landmark = computed(() => this.catalog.landmarkById(this.id()));
protected readonly collected = computed(() => {
const item = this.landmark();
return item ? this.collectedIds().has(item.id) : false;
});
constructor() {
effect(() => {
const item = this.landmark();
if (!item || this.collectedIds().has(item.id)) {
return;
}
void this.router.navigate(['/items', item.id], { replaceUrl: true });
});
}
}
+6 -19
View File
@@ -4,7 +4,7 @@
} @else {
<article class="object" [class.object--owned]="collected()">
<header class="object__hero">
<img class="object__hero-img" src="/assets/illustrations/object-hero.svg" alt="" />
<img class="object__hero-img" [src]="item.background" alt="" />
<button class="object__back" type="button" aria-label="Назад" (click)="goBack()">
<app-icon name="chevron-left" [size]="22" />
</button>
@@ -36,6 +36,11 @@
<p>{{ item.description }}</p>
</section>
<section>
<h2>Аудиогид</h2>
<app-audio-guide [src]="item.audio" />
</section>
<section>
<h2>Интересные факты</h2>
<ol class="facts">
@@ -67,25 +72,7 @@
Этот объект уже в вашей коллекции. Повторно его получить нельзя.
</p>
</section>
<a class="object__map" routerLink="/map">
<app-icon name="pin" [size]="20" />
Показать на карте
</a>
} @else {
<section>
<h2>Примеры фото</h2>
<div class="photos">
@for (photo of photoExamples; track photo.label) {
<figure>
<img [src]="photo.src" [alt]="photo.label" />
<span>{{ photo.label }}</span>
</figure>
}
</div>
<p class="object__hint">{{ item.photoHint }}</p>
</section>
<section>
<h2>Как забрать</h2>
<ol class="steps">
+22 -10
View File
@@ -1,11 +1,21 @@
import { Location } from '@angular/common';
import { ChangeDetectionStrategy, Component, computed, HostListener, inject, input, signal } from '@angular/core';
import { Router, RouterLink } from '@angular/router';
import {
ChangeDetectionStrategy,
Component,
computed,
HostListener,
inject,
input,
signal,
} from '@angular/core';
import { MatButton } from '@angular/material/button';
import { Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { AuthPromptService } from '../../auth/auth-prompt.service';
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 {
GorodarActions,
@@ -17,7 +27,7 @@ import {
@Component({
selector: 'app-map-item-page',
imports: [MatButton, Icon, ClaimFlow, RouterLink],
imports: [MatButton, Icon, ClaimFlow, AudioGuide],
templateUrl: './map-item-page.html',
styleUrl: './map-item-page.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -27,6 +37,7 @@ export class MapItemPage {
private readonly store = inject(Store);
private readonly location = inject(Location);
private readonly router = inject(Router);
private readonly authPrompt = inject(AuthPromptService);
readonly id = input.required<string>();
@@ -72,11 +83,6 @@ export class MapItemPage {
return claim.landmarkId === this.id() && claim.stage !== 'idle';
});
protected readonly photoExamples = [
{ label: 'Днём', src: '/assets/illustrations/photo-day.svg' },
{ label: 'Вечером', src: '/assets/illustrations/photo-evening.svg' },
{ label: 'Зимой', src: '/assets/illustrations/photo-winter.svg' },
];
protected readonly photoOpen = signal(false);
protected goBack(): void {
@@ -85,11 +91,17 @@ export class MapItemPage {
return;
}
void this.router.navigateByUrl('/map');
void this.router.navigateByUrl('/city');
}
protected claimItem(): void {
this.store.dispatch(GorodarActions.takePhoto({ landmarkId: this.id() }));
void this.authPrompt.prompt('claim').then((result) => {
if (result !== 'authenticated') {
return;
}
this.store.dispatch(GorodarActions.takePhoto({ landmarkId: this.id() }));
});
}
protected openPhoto(): void {
@@ -1,80 +0,0 @@
<section class="page">
<header class="page__top">
<a class="page__back" routerLink="/" aria-label="Назад">
<app-icon name="chevron-left" [size]="22" />
</a>
<span class="page__title">Профиль</span>
</header>
<div class="hero">
<div class="hero__avatar" aria-hidden="true">{{ initial() }}</div>
<h1>{{ profile().displayName }}</h1>
<p>
<app-icon name="pin" [size]="18" />
{{ profile().city }}
</p>
</div>
<section class="collections">
<h2>Коллекции</h2>
<p>Пока доступна коллекция Нижнего Новгорода. Другие города появятся позже.</p>
<a class="pack" routerLink="/collection">
<div class="pack__head">
<div>
<h3>{{ city.name }}</h3>
<p>Собрано {{ openedCount() }} из {{ totalCount }}</p>
</div>
<div
class="pack__percent anim-percent"
[style.--to-p]="progress()"
aria-hidden="true"
>
<span>{{ progress() }}%</span>
</div>
</div>
<div class="pack__bar" aria-hidden="true">
<span
class="anim-grow"
[style.--from]="'0%'"
[style.--to]="progress() + '%'"
></span>
</div>
<div class="pack__cells">
@for (landmark of city.objects; track landmark.id) {
<span class="pack__stamp" [class.pack__stamp--open]="collectedIds().has(landmark.id)">
<img
[src]="collectedIds().has(landmark.id) ? '/assets/icons/gorodar-mark.svg' : '/assets/icons/cell-lock.svg'"
alt=""
/>
</span>
}
</div>
</a>
</section>
<ul class="info">
<li>
<span>Имя</span>
<b>{{ profile().firstName }} {{ profile().lastName }}</b>
</li>
<li>
<span>Город</span>
<b>{{ profile().city }}</b>
</li>
<li>
<span>Почта</span>
<b>{{ profile().email }}</b>
</li>
<li>
<span>Телефон</span>
<b>{{ profile().phone }}</b>
</li>
<li>
<span>В Городаре с</span>
<b>{{ profile().joinedLabel }}</b>
</li>
</ul>
</section>
@@ -1,147 +0,0 @@
:host {
display: block;
width: 100%;
max-width: 100%;
min-height: 100%;
}
.page {
width: 100%;
max-width: var(--page-max-width);
margin: 0 auto;
padding: 16px 16px 24px;
}
.page__top,
.hero p {
display: flex;
align-items: center;
}
.page__top {
position: relative;
justify-content: center;
min-height: 44px;
}
.page__back {
position: absolute;
left: 0;
display: flex;
align-items: center;
justify-content: center;
width: 44px;
height: 44px;
border: 1px solid var(--color-border);
border-radius: 14px;
background: rgb(28 26 23 / 86%);
color: var(--color-text);
text-decoration: none;
}
.page__title {
color: var(--color-text-soft);
font-size: 15px;
font-weight: 500;
}
.hero {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 28px;
text-align: center;
}
.hero__avatar {
display: flex;
align-items: center;
justify-content: center;
width: 96px;
height: 96px;
border: 1.5px solid var(--color-accent);
border-radius: 48px;
background: radial-gradient(circle at 50% 38%, rgb(224 184 79 / 22%), rgb(224 184 79 / 4%) 72%),
var(--color-surface);
color: var(--color-accent-soft);
font-family: var(--font-display);
font-size: 40px;
font-weight: 700;
}
.hero h1 {
margin: 16px 0 0;
font-family: var(--font-display);
font-size: clamp(28px, 7vw, 34px);
font-weight: 700;
line-height: 1.12;
letter-spacing: -0.03em;
}
.hero p {
justify-content: center;
gap: 8px;
margin: 10px 0 0;
color: var(--color-muted);
font-size: 15px;
}
.hero p app-icon {
color: var(--color-accent);
}
.collections {
margin-top: 28px;
}
.collections h2 {
margin: 0;
font-family: var(--font-display);
font-size: 22px;
font-weight: 700;
}
.collections > p {
margin: 6px 0 0;
color: var(--color-muted);
font-size: 15px;
}
.pack {
margin-top: 14px;
}
.info {
display: flex;
flex-direction: column;
gap: 0;
margin: 16px 0 0;
padding: 4px 16px;
border: 1px solid var(--color-border);
border-radius: 20px;
background: var(--color-surface);
list-style: none;
}
.info li {
display: flex;
flex-direction: column;
gap: 4px;
padding: 14px 0;
border-bottom: 1px solid var(--color-border);
}
.info li:last-child {
border-bottom: 0;
}
.info span {
color: var(--color-muted);
font-size: 13px;
}
.info b {
color: var(--color-text);
font-size: 16px;
font-weight: 500;
}
@@ -1,27 +0,0 @@
import { ChangeDetectionStrategy, Component, computed, inject } 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, selectProfile, selectProgress } from '../../state';
@Component({
selector: 'app-profile-page',
imports: [Icon, RouterLink],
templateUrl: './profile-page.html',
styleUrl: './profile-page.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ProfilePage {
private readonly catalog = inject(CityCatalogService);
private readonly store = inject(Store);
protected readonly city = this.catalog.city;
protected readonly profile = this.store.selectSignal(selectProfile);
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
protected readonly openedCount = this.store.selectSignal(selectOpenedCount);
protected readonly totalCount = this.city.objects.length;
protected readonly progress = this.store.selectSignal(selectProgress);
protected readonly initial = computed(() => this.profile().firstName.slice(0, 1));
}
@@ -0,0 +1,26 @@
<div class="guide">
<button
class="guide__play"
type="button"
[attr.aria-label]="playing() ? 'Пауза' : 'Слушать рассказ'"
(click)="toggle()"
>
@if (playing()) {
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M7 5.5 H10 V18.5 H7 Z M14 5.5 H17 V18.5 H14 Z" />
</svg>
} @else {
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M9 6.2 L18.2 12 L9 17.8 Z" />
</svg>
}
</button>
<div class="guide__track">
<div #wave class="guide__wave"></div>
<div class="guide__meta">
<span>Слушать рассказ</span>
<span class="guide__time">{{ format(currentTime()) }} / {{ format(duration()) }}</span>
</div>
</div>
</div>
@@ -0,0 +1,59 @@
:host {
display: block;
}
.guide {
display: flex;
align-items: center;
gap: 14px;
padding: 12px 14px 12px 12px;
border: 1px solid var(--color-border);
border-radius: 18px;
background: var(--color-surface);
}
.guide__play {
display: grid;
flex: none;
place-items: center;
width: 56px;
height: 56px;
padding: 0;
border: 0;
border-radius: 50%;
background: var(--color-accent);
color: var(--color-on-accent);
cursor: pointer;
}
.guide__play svg {
width: 22px;
height: 22px;
fill: currentColor;
}
.guide__track {
flex: 1 1 auto;
min-width: 0;
}
.guide__wave {
width: 100%;
height: 28px;
}
.guide__meta {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
margin-top: 2px;
color: var(--color-muted);
font-size: 14px;
line-height: 1.2;
}
.guide__time {
flex: none;
font-variant-numeric: tabular-nums;
}
+93
View File
@@ -0,0 +1,93 @@
import {
ChangeDetectionStrategy,
Component,
ElementRef,
NgZone,
effect,
inject,
input,
signal,
viewChild,
} from '@angular/core';
import WaveSurfer from 'wavesurfer.js';
@Component({
selector: 'app-audio-guide',
templateUrl: './audio-guide.html',
styleUrl: './audio-guide.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AudioGuide {
private readonly zone = inject(NgZone);
private readonly waveHost = viewChild<ElementRef<HTMLDivElement>>('wave');
private player: WaveSurfer | null = null;
readonly src = input.required<string>();
protected readonly playing = signal(false);
protected readonly currentTime = signal(0);
protected readonly duration = signal(0);
constructor() {
effect((onCleanup) => {
const element = this.waveHost()?.nativeElement;
const src = this.src();
if (!element) {
return;
}
const player = this.zone.runOutsideAngular(() =>
WaveSurfer.create({
container: element,
url: src,
height: 28,
waveColor: '#6a645b',
progressColor: '#e0b84f',
cursorWidth: 0,
barWidth: 3,
barGap: 2,
barRadius: 2,
normalize: true,
dragToSeek: true,
hideScrollbar: true,
interact: true,
}),
);
this.player = player;
const updateTime = (time: number): void => {
this.zone.run(() => this.currentTime.set(time));
};
player.on('timeupdate', updateTime);
player.on('seeking', updateTime);
player.on('ready', (length) => {
this.zone.run(() => this.duration.set(length));
});
player.on('play', () => this.zone.run(() => this.playing.set(true)));
player.on('pause', () => this.zone.run(() => this.playing.set(false)));
player.on('finish', () => this.zone.run(() => this.playing.set(false)));
onCleanup(() => {
player.destroy();
if (this.player === player) {
this.player = null;
}
});
});
}
protected toggle(): void {
void this.player?.playPause();
}
protected format(seconds: number): string {
const total = Math.max(0, Math.floor(seconds));
const minutes = Math.floor(total / 60);
const rest = total % 60;
return `${minutes}:${String(rest).padStart(2, '0')}`;
}
}
+53 -41
View File
@@ -20,7 +20,7 @@ export const initialState: GorodarState = {
firstName: 'Иван',
lastName: 'Иванов',
city: 'Нижний Новгород',
email: 'ivan.ivanovich@gorodar.app',
email: '',
phone: '+7 900 123-45-67',
joinedLabel: 'Сентябрь 2026',
},
@@ -28,46 +28,58 @@ export const initialState: GorodarState = {
const gorodarReducer = createReducer(
initialState,
on(GorodarActions.photoCaptured, (state, { landmarkId, photo }): GorodarState => ({
...state,
claim: {
landmarkId,
photo,
stage: 'check',
step: 1,
},
})),
on(GorodarActions.claimStepChanged, (state, { step }): GorodarState => ({
...state,
claim: {
...state.claim,
step,
},
})),
on(GorodarActions.claimCompleted, (state, { landmarkId, photo, collectedAt }): GorodarState => ({
...state,
collectedIds: state.collectedIds.includes(landmarkId)
? state.collectedIds
: [...state.collectedIds, landmarkId],
photos: {
...state.photos,
[landmarkId]: photo,
},
collectedAt: {
...state.collectedAt,
[landmarkId]: collectedAt,
},
claim: {
landmarkId,
photo,
stage: 'success',
step: 3,
},
})),
on(GorodarActions.claimReset, (state): GorodarState => ({
...state,
claim: initialClaim,
})),
on(
GorodarActions.photoCaptured,
(state, { landmarkId, photo }): GorodarState => ({
...state,
claim: {
landmarkId,
photo,
stage: 'check',
step: 1,
},
}),
),
on(
GorodarActions.claimStepChanged,
(state, { step }): GorodarState => ({
...state,
claim: {
...state.claim,
step,
},
}),
),
on(
GorodarActions.claimCompleted,
(state, { landmarkId, photo, collectedAt }): GorodarState => ({
...state,
collectedIds: state.collectedIds.includes(landmarkId)
? state.collectedIds
: [...state.collectedIds, landmarkId],
photos: {
...state.photos,
[landmarkId]: photo,
},
collectedAt: {
...state.collectedAt,
[landmarkId]: collectedAt,
},
claim: {
landmarkId,
photo,
stage: 'success',
step: 3,
},
}),
),
on(
GorodarActions.claimReset,
(state): GorodarState => ({
...state,
claim: initialClaim,
}),
),
);
export const gorodarFeature = createFeature({
+6 -13
View File
@@ -3,23 +3,16 @@ import { createSelector } from '@ngrx/store';
import { NIZHNY_NOVGOROD } from '../data/nizhny-novgorod';
import { gorodarFeature } from './gorodar.reducer';
export const {
selectCollectedIds,
selectPhotos,
selectCollectedAt,
selectClaim,
selectProfile,
} = gorodarFeature;
export const { selectCollectedIds, selectPhotos, selectCollectedAt, selectClaim, selectProfile } =
gorodarFeature;
export const selectCollectedIdSet = createSelector(
selectCollectedIds,
(ids) => new Set(ids),
);
export const selectCollectedIdSet = createSelector(selectCollectedIds, (ids) => new Set(ids));
export const selectTotalCount = NIZHNY_NOVGOROD.objects.length;
export const selectOpenedCount = createSelector(selectCollectedIdSet, (ids) =>
NIZHNY_NOVGOROD.objects.filter((item) => ids.has(item.id) || item.collected).length,
export const selectOpenedCount = createSelector(
selectCollectedIdSet,
(ids) => NIZHNY_NOVGOROD.objects.filter((item) => ids.has(item.id) || item.collected).length,
);
export const selectProgress = createSelector(selectOpenedCount, (opened) =>
+4
View File
@@ -17,6 +17,8 @@
align-items: center;
justify-content: space-between;
gap: 12px;
color: inherit;
text-decoration: none;
}
.pack h2,
@@ -102,6 +104,8 @@
overflow: hidden;
border-radius: 10px;
background: #171512;
color: inherit;
text-decoration: none;
}
.pack__stamp img {
+2 -39
View File
@@ -13,8 +13,8 @@
display: block;
width: 100%;
height: 100%;
object-fit: contain;
object-position: center bottom;
object-fit: cover;
object-position: center top;
}
.object__hero::after {
@@ -27,42 +27,6 @@
background: linear-gradient(to bottom, transparent, var(--color-bg));
}
.photos {
display: flex;
gap: 10px;
overflow: auto;
}
.photos figure {
position: relative;
flex: none;
width: 128px;
height: 168px;
margin: 0;
overflow: hidden;
border: 1px solid var(--color-border);
border-radius: 14px;
background: var(--color-surface);
}
.photos img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
.photos span {
position: absolute;
left: 8px;
bottom: 8px;
padding: 3px 9px;
border-radius: 8px;
background: rgb(18 17 15 / 78%);
font-size: 12px;
font-weight: 500;
}
.owned-photo {
position: relative;
display: block;
@@ -134,4 +98,3 @@
color: var(--color-text);
cursor: pointer;
}
+1
View File
@@ -0,0 +1 @@
declare module '@google/model-viewer/dist/model-viewer.min.js';
+2 -1
View File
@@ -7,7 +7,8 @@
"types": []
},
"include": [
"src/**/*.ts"
"src/**/*.ts",
"src/**/*.d.ts"
],
"exclude": [
"src/**/*.spec.ts"