Compare commits

...
11 Commits
Author SHA1 Message Date
Artem a738fbc729 update style for lock 2026-11-19 18:39:19 +03:00
Artem 33cc27797e update lock img 2026-11-19 17:40:07 +03:00
Artem 0119ac291f update key 2026-11-14 13:31:46 +03:00
Artem c62136481b update key and add web metrics 2026-10-14 19:09:57 +03:00
Artem 26b8459121 add icons 2026-10-13 14:08:22 +03:00
Artem dbf6e05f29 update steps description 2026-10-11 19:21:21 +03:00
Artem 053d83245f add style 2026-10-11 17:01:20 +03:00
Artem 5e266c0ebd add fix after review 2026-10-11 16:30:04 +03:00
Artem 41c5f81027 fix config with nav url 2026-10-08 14:44:52 +03:00
Artem a65d4185f3 fix and add documents view 2026-10-08 14:39:17 +03:00
Artem 548ba43dc2 update style 2026-10-07 18:25:55 +03:00
80 changed files with 1366 additions and 611 deletions
+14 -7
View File
@@ -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",
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.
Binary file not shown.
+15
View File
@@ -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

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1007 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

+25 -13
View File
@@ -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"
+2 -1
View File
@@ -5,6 +5,7 @@ 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 { 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';
export const routes: Routes = [ export const routes: Routes = [
@@ -13,7 +14,7 @@ export const routes: Routes = [
{ path: 'collections', component: CollectionsPage }, { path: 'collections', component: CollectionsPage },
{ path: 'collection', pathMatch: 'full', redirectTo: '' }, { path: 'collection', pathMatch: 'full', redirectTo: '' },
{ path: 'city/:areaId/:id/icon', component: IconPreviewPage }, { path: 'city/:areaId/:id/icon', component: IconPreviewPage },
{ path: 'city/:areaId/:id', component: MapItemPage }, { path: 'city/:areaId/:id', component: MapItemPage, canActivate: [visitedItemGuard] },
{ path: 'city/:areaId', component: CityPage }, { path: 'city/:areaId', component: CityPage },
{ path: '**', redirectTo: '' }, { path: '**', redirectTo: '' },
]; ];
+6
View File
@@ -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;
+4 -8
View File
@@ -65,15 +65,11 @@ export function findAttraction(area: Area | AreaDetails, id: string): Attraction
return areaAttractions(area).find((item) => item.id === id) ?? null; return areaAttractions(area).find((item) => item.id === id) ?? null;
} }
export function isObtained(attraction: Attraction, collectedIds: ReadonlySet<string>): boolean { export function areaOpenedCount(area: Area | AreaDetails): number {
return attraction.visited || collectedIds.has(attraction.id);
}
export function areaOpenedCount(area: Area | AreaDetails, collectedIds: ReadonlySet<string>): number {
const attractions = areaAttractions(area); const attractions = areaAttractions(area);
if (attractions.length > 0) { if (attractions.length > 0) {
return attractions.filter((item) => isObtained(item, collectedIds)).length; return attractions.filter((item) => item.visited).length;
} }
return area.progress?.visited ?? 0; return area.progress?.visited ?? 0;
@@ -89,12 +85,12 @@ export function areaTotalCount(area: Area | AreaDetails): number {
return area.progress?.total ?? 0; return area.progress?.total ?? 0;
} }
export function areaProgress(area: Area | AreaDetails, collectedIds: ReadonlySet<string>): number { export function areaProgress(area: Area | AreaDetails): number {
const total = areaTotalCount(area); const total = areaTotalCount(area);
if (!total) { if (!total) {
return 0; return 0;
} }
return Math.round((areaOpenedCount(area, collectedIds) / total) * 100); return Math.round((areaOpenedCount(area) / total) * 100);
} }
+23 -5
View File
@@ -1,5 +1,5 @@
@if (sheetVisible()) { @if (sheetVisible()) {
<div class="sheet-root"> <div class="sheet-root" [style.--drag-y.px]="dragY()">
<button <button
class="sheet-root__backdrop" class="sheet-root__backdrop"
type="button" type="button"
@@ -7,7 +7,18 @@
(click)="dismiss()" (click)="dismiss()"
></button> ></button>
<section class="sheet" role="dialog" aria-modal="true" aria-labelledby="auth-sheet-title"> <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 <button
class="sheet__handle" class="sheet__handle"
type="button" type="button"
@@ -42,7 +53,7 @@
} }
<button <button
class="sheet__submit" class="btn sheet__submit"
type="button" type="button"
[disabled]="!emailValid() || pending()" [disabled]="!emailValid() || pending()"
(click)="requestCode()" (click)="requestCode()"
@@ -50,6 +61,12 @@
{{ pending() ? 'Отправляем…' : 'Получить код' }} {{ pending() ? 'Отправляем…' : 'Получить код' }}
</button> </button>
<button class="sheet__ghost" type="button" (click)="dismiss()">Пока просто посмотрю</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 { } @else {
<h2 id="auth-sheet-title">{{ title() }}</h2> <h2 id="auth-sheet-title">{{ title() }}</h2>
<p class="sheet__lead"> <p class="sheet__lead">
@@ -76,7 +93,7 @@
<button <button
class="sheet__resend" class="sheet__resend"
type="button" type="button"
[disabled]="resendSeconds() > 0 || pending()" [disabled]="secondsLeft() > 0 || pending()"
(click)="resend()" (click)="resend()"
> >
{{ resendLabel() }} {{ resendLabel() }}
@@ -87,7 +104,7 @@
} }
<button <button
class="sheet__submit" class="btn sheet__submit"
type="button" type="button"
[disabled]="!codeReady() || pending()" [disabled]="!codeReady() || pending()"
(click)="confirm()" (click)="confirm()"
@@ -98,4 +115,5 @@
} }
</section> </section>
</div> </div>
</div>
} }
+60 -27
View File
@@ -1,3 +1,7 @@
:host {
display: contents;
}
.sheet-root { .sheet-root {
position: fixed; position: fixed;
z-index: 70; z-index: 70;
@@ -13,42 +17,63 @@
border: 0; border: 0;
background: rgb(8 7 6 / 64%); background: rgb(8 7 6 / 64%);
cursor: pointer; cursor: pointer;
opacity: calc(1 - min(var(--drag-y, 0px), 280px) / 280px);
} }
.sheet { .sheet-pop {
position: relative; position: relative;
z-index: 1; z-index: 1;
width: min(100%, 480px); width: min(100%, 480px);
max-height: min(92dvh, 760px); max-height: min(92dvh, 760px);
overflow: auto; 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)); padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
border: 1px solid var(--color-border); border: 1px solid var(--color-border);
border-bottom: 0; border-bottom: 0;
border-radius: 28px 28px 0 0; border-radius: 28px 28px 0 0;
background: #1a1815; background: #1a1815;
animation: sheet-in 0.28s ease-out; 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 { .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; display: block;
width: 42px; width: 42px;
height: 4px; height: 4px;
margin: 6px auto 12px; margin: 0 auto;
padding: 0;
border: 0;
border-radius: 4px; border-radius: 4px;
background: #4a453c; background: #4a453c;
cursor: pointer;
} }
.sheet__lock { .sheet__lock {
display: grid; display: grid;
place-items: center; place-items: center;
width: 68px;
height: 68px;
margin: 8px auto 16px; margin: 8px auto 16px;
border: 1.5px solid var(--color-accent);
border-radius: 18px;
color: var(--color-accent); color: var(--color-accent);
} }
@@ -129,14 +154,19 @@
.sheet__resend { .sheet__resend {
display: block; display: block;
width: 100%; width: 100%;
min-height: 20px;
margin-top: 14px; margin-top: 14px;
padding: 0; padding: 0;
overflow: hidden;
border: 0; border: 0;
background: none; background: none;
color: var(--color-muted); color: var(--color-muted);
font: inherit; font: inherit;
font-size: 14px; font-size: 14px;
font-variant-numeric: tabular-nums;
text-align: center; text-align: center;
white-space: nowrap;
text-overflow: ellipsis;
cursor: pointer; cursor: pointer;
} }
@@ -153,22 +183,7 @@
} }
.sheet__submit { .sheet__submit {
width: 100%;
min-height: 52px;
margin-top: 16px; 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 { .sheet__ghost {
@@ -186,6 +201,20 @@
cursor: pointer; 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 { @keyframes sheet-in {
from { from {
transform: translateY(24px); transform: translateY(24px);
@@ -196,7 +225,11 @@
} }
@media (prefers-reduced-motion: reduce) { @media (prefers-reduced-motion: reduce) {
.sheet { .sheet-pop {
animation: none; animation: none;
} }
.sheet {
transition: none;
}
} }
+164 -5
View File
@@ -1,6 +1,7 @@
import { import {
ChangeDetectionStrategy, ChangeDetectionStrategy,
Component, Component,
DestroyRef,
ElementRef, ElementRef,
HostListener, HostListener,
computed, computed,
@@ -13,6 +14,8 @@ import {
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { Icon } from '../../../shared/icon/icon'; import { Icon } from '../../../shared/icon/icon';
import { privacyDocumentUrl, termsDocumentUrl } from '../../../shared/legal-documents';
import { RESEND_SECONDS } from '../../../state/gorodar.models';
import { import {
GorodarActions, GorodarActions,
selectAuthCodeRequestId, selectAuthCodeRequestId,
@@ -20,12 +23,13 @@ import {
selectAuthError, selectAuthError,
selectAuthIntent, selectAuthIntent,
selectAuthPending, selectAuthPending,
selectAuthResendSeconds,
selectAuthSheetVisible, selectAuthSheetVisible,
selectAuthStep, selectAuthStep,
} from '../../../state'; } from '../../../state';
const CODE_LENGTH = 6; const CODE_LENGTH = 6;
const DISMISS_DISTANCE = 120;
const DISMISS_VELOCITY = 0.55;
function emptyDigits(): string[] { function emptyDigits(): string[] {
return Array.from({ length: CODE_LENGTH }, () => ''); return Array.from({ length: CODE_LENGTH }, () => '');
@@ -40,17 +44,33 @@ function emptyDigits(): string[] {
}) })
export class AuthSheet { export class AuthSheet {
private readonly store = inject(Store); private readonly store = inject(Store);
private readonly destroyRef = inject(DestroyRef);
private readonly digitFields = viewChildren<ElementRef<HTMLInputElement>>('digit'); 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 emailDraft = signal('');
protected readonly digits = signal<string[]>(emptyDigits()); 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 sheetVisible = this.store.selectSignal(selectAuthSheetVisible);
protected readonly step = this.store.selectSignal(selectAuthStep); protected readonly step = this.store.selectSignal(selectAuthStep);
protected readonly email = this.store.selectSignal(selectAuthEmail); protected readonly email = this.store.selectSignal(selectAuthEmail);
protected readonly error = this.store.selectSignal(selectAuthError); protected readonly error = this.store.selectSignal(selectAuthError);
protected readonly pending = this.store.selectSignal(selectAuthPending); protected readonly pending = this.store.selectSignal(selectAuthPending);
protected readonly resendSeconds = this.store.selectSignal(selectAuthResendSeconds);
protected readonly intent = this.store.selectSignal(selectAuthIntent); protected readonly intent = this.store.selectSignal(selectAuthIntent);
private readonly codeRequestId = this.store.selectSignal(selectAuthCodeRequestId); private readonly codeRequestId = this.store.selectSignal(selectAuthCodeRequestId);
@@ -71,7 +91,7 @@ export class AuthSheet {
}); });
protected readonly resendLabel = computed(() => { protected readonly resendLabel = computed(() => {
const seconds = this.resendSeconds(); const seconds = this.secondsLeft();
if (seconds <= 0) { if (seconds <= 0) {
return 'Отправить код ещё раз'; return 'Отправить код ещё раз';
@@ -106,8 +126,35 @@ export class AuthSheet {
return; return;
} }
requestAnimationFrame(() => this.digitFields()[0]?.nativeElement.focus()); 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 { protected onEmail(event: Event): void {
@@ -125,7 +172,7 @@ export class AuthSheet {
} }
protected resend(): void { protected resend(): void {
if (this.resendSeconds() > 0 || this.pending()) { if (this.secondsLeft() > 0 || this.pending()) {
return; return;
} }
@@ -137,9 +184,121 @@ export class AuthSheet {
} }
protected dismiss(): void { protected dismiss(): void {
window.clearTimeout(this.closeTimer);
this.closeTimer = 0;
this.dragY.set(0);
this.dragging.set(false);
this.store.dispatch(GorodarActions.authSheetDismissed()); 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 { protected onDigit(index: number, event: Event): void {
const input = event.target as HTMLInputElement; const input = event.target as HTMLInputElement;
const value = input.value.replace(/\D/g, '').slice(-1); const value = input.value.replace(/\D/g, '').slice(-1);
@@ -11,14 +11,6 @@
@if (model()) { @if (model()) {
<div class="success__switch" role="group" aria-label="Вид объекта"> <div class="success__switch" role="group" aria-label="Вид объекта">
<button
type="button"
[class.is-active]="view() === 'model'"
[attr.aria-pressed]="view() === 'model'"
(click)="showModel()"
>
3D
</button>
<button <button
type="button" type="button"
[class.is-active]="view() === 'image'" [class.is-active]="view() === 'image'"
@@ -27,6 +19,14 @@
> >
Картинка Картинка
</button> </button>
<button
type="button"
[class.is-active]="view() === 'model'"
[attr.aria-pressed]="view() === 'model'"
(click)="showModel()"
>
3D
</button>
</div> </div>
} }
@@ -111,7 +111,7 @@
</div> </div>
<div class="success__actions"> <div class="success__actions">
<a matButton="filled" routerLink="/collections" (click)="leave()">Открыть коллекцию</a> <a class="btn" routerLink="/collections" (click)="leave()">Открыть коллекцию</a>
<a <a
class="success__ghost" class="success__ghost"
[routerLink]="areaId() ? ['/city', areaId()] : ['/']" [routerLink]="areaId() ? ['/city', areaId()] : ['/']"
@@ -309,15 +309,6 @@
margin-top: 24px; margin-top: 24px;
} }
.success__actions a[matButton='filled'] {
width: 100%;
min-height: 56px;
--mat-button-filled-container-color: #d4143f;
--mat-button-filled-label-text-color: #fff;
background-color: #d4143f;
color: #fff;
}
.success__ghost { .success__ghost {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -13,7 +13,6 @@ import {
untracked, untracked,
viewChild, viewChild,
} from '@angular/core'; } from '@angular/core';
import { MatButton } from '@angular/material/button';
import { Router, RouterLink } from '@angular/router'; import { Router, RouterLink } from '@angular/router';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
@@ -22,7 +21,7 @@ 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], schemas: [CUSTOM_ELEMENTS_SCHEMA],
@@ -45,7 +44,7 @@ export class CollectSuccess {
readonly areaId = input(''); readonly areaId = input('');
readonly alreadyVisited = input(false); readonly alreadyVisited = input(false);
protected readonly view = signal<'model' | 'image'>('model'); protected readonly view = signal<'model' | 'image'>('image');
protected readonly modelLoaded = signal(false); protected readonly modelLoaded = signal(false);
constructor() { constructor() {
@@ -53,7 +52,7 @@ export class CollectSuccess {
const src = this.model(); const src = this.model();
untracked(() => { untracked(() => {
this.view.set('model'); this.view.set('image');
this.modelLoaded.set(false); this.modelLoaded.set(false);
}); });
+1 -1
View File
@@ -40,7 +40,7 @@
</div> </div>
<footer class="fail__actions"> <footer class="fail__actions">
<button class="fail__retry" type="button" (click)="retake.emit()"> <button class="btn" type="button" (click)="retake.emit()">
<app-icon name="camera" [size]="24" /> <app-icon name="camera" [size]="24" />
Сделать новое фото Сделать новое фото
</button> </button>
+1 -13
View File
@@ -159,27 +159,15 @@
gap: 10px; gap: 10px;
} }
.fail__retry,
.fail__leave { .fail__leave {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 10px; gap: 10px;
width: 100%; width: 100%;
min-height: 48px;
border: 0; border: 0;
border-radius: 16px; border-radius: 16px;
}
.fail__retry {
min-height: 56px;
background: var(--color-accent);
color: #1a1508;
font-size: 17px;
font-weight: 600;
}
.fail__leave {
min-height: 48px;
background: transparent; background: transparent;
color: var(--color-muted); color: var(--color-muted);
font-size: 15px; font-size: 15px;
+12 -4
View File
@@ -1,4 +1,12 @@
import { afterNextRender, ChangeDetectionStrategy, Component, computed, input, output, signal } from '@angular/core'; import {
afterNextRender,
ChangeDetectionStrategy,
Component,
computed,
input,
output,
signal,
} from '@angular/core';
import { Icon } from '../../shared/icon/icon'; import { Icon } from '../../shared/icon/icon';
@@ -22,9 +30,9 @@ export class PhotoFail {
protected readonly shownPercent = signal(0); protected readonly shownPercent = signal(0);
protected readonly tips = [ protected readonly tips = [
'Встаньте так, чтобы собор попал в кадр целиком.', 'Фотографируйте из точки указанной карте.',
'Снимайте при хорошем свете, без пальцев в кадре.', 'Постарайтесь чтобы объект попал в кадр полностью.',
'Ориентируйтесь на примеры фото в карточке объекта.', 'Снимайте при хорошем свете, без пальце в кадре.',
]; ];
constructor() { constructor() {
+13
View File
@@ -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;
}
}
+20 -25
View File
@@ -13,14 +13,12 @@ import {
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 type { Attraction } from '../../areas/area.models'; import type { Attraction } from '../../areas/area.models';
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'; 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_CENTER: [number, number] = [43.99934, 56.329399];
const CITY_ZOOM = 16; const CITY_ZOOM = 16;
const USER_ZOOM = 20; const USER_ZOOM = 20;
@@ -136,7 +134,6 @@ export class CityMap implements AfterViewInit, OnDestroy {
@ViewChild('map', { static: true }) @ViewChild('map', { static: true })
private mapElement!: ElementRef<HTMLElement>; private mapElement!: ElementRef<HTMLElement>;
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;
@@ -154,7 +151,6 @@ export class CityMap implements AfterViewInit, OnDestroy {
private readonly markers = new Map<string, DgMarker>(); private readonly markers = new Map<string, DgMarker>();
private readonly mapReady = signal(false); private readonly mapReady = signal(false);
private placedKey = ''; private placedKey = '';
private readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
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));
@@ -182,13 +178,12 @@ export class CityMap implements AfterViewInit, OnDestroy {
constructor() { constructor() {
effect(() => { effect(() => {
const items = this.attractions(); const items = this.attractions();
const ids = this.collectedIds();
if (!this.mapReady()) { if (!this.mapReady()) {
return; return;
} }
this.placeMarkers(items, ids); this.placeMarkers(items);
}); });
effect(() => { effect(() => {
@@ -366,7 +361,7 @@ export class CityMap implements AfterViewInit, OnDestroy {
this.watchId = null; this.watchId = null;
} }
private placeMarkers(items: Attraction[], collectedIds: Set<string>): void { private placeMarkers(items: Attraction[]): void {
const map = this.map; const map = this.map;
const api = this.raster; const api = this.raster;
@@ -381,7 +376,7 @@ export class CityMap implements AfterViewInit, OnDestroy {
const element = this.markerElements.get(item.id); const element = this.markerElements.get(item.id);
if (element) { if (element) {
this.setMarkerIcon(element, collectedIds.has(item.id) || item.visited); this.setMarkerIcon(element, item);
} }
} }
@@ -401,10 +396,7 @@ export class CityMap implements AfterViewInit, OnDestroy {
continue; continue;
} }
this.markers.set( this.markers.set(item.id, this.createMarker(api, map, item));
item.id,
this.createMarker(api, map, item, collectedIds.has(item.id) || item.visited),
);
} }
if (this.markers.size > 0) { if (this.markers.size > 0) {
@@ -412,26 +404,29 @@ export class CityMap implements AfterViewInit, OnDestroy {
} }
} }
private createMarker(api: DgApi, map: DgMap, landmark: Attraction, collected: boolean): DgMarker { 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.name); markerElement.setAttribute('aria-label', item.name);
markerElement.innerHTML = 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>'; // '<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.name; label.textContent = item.name;
} }
this.markerElements.set(landmark.id, markerElement); this.markerElements.set(item.id, markerElement);
this.setMarkerIcon(markerElement, collected); this.setMarkerIcon(markerElement, item);
const marker = this.addHtmlMarker( const marker = this.addHtmlMarker(
api, api,
map, map,
[landmark.longitude, landmark.latitude], [item.longitude, item.latitude],
markerElement, markerElement,
LANDMARK_SIZE, LANDMARK_SIZE,
1, 1,
@@ -439,7 +434,7 @@ 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;
@@ -491,20 +486,20 @@ 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: Attraction): void { private selectLandmark(landmark: Attraction): void {
@@ -1,9 +1,10 @@
<article class="card"> <article class="card">
<div class="card__row"> @let lockIcon = '/assets/icons/cell-lock.svg';
<div class="card__row" [style.margin-bottom]="attraction().visited ? '0' : '16px'">
<img <img
class="card__stamp" class="card__stamp"
[src]="attraction().iconUrl || '/assets/icons/cell-lock.svg'" [src]="!attraction().visited ? lockIcon : attraction().iconUrl || lockIcon"
alt="" alt="icon"
width="72" width="72"
height="72" height="72"
/> />
@@ -18,7 +19,7 @@
</div> </div>
</div> </div>
<a class="card__action" matButton="filled" [routerLink]="['/city', areaId(), attraction().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 -2
View File
@@ -1,5 +1,4 @@
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 { Attraction } from '../../areas/area.models'; import type { Attraction } from '../../areas/area.models';
@@ -7,7 +6,7 @@ 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,
+28 -8
View File
@@ -30,10 +30,22 @@
</p> </p>
</div> </div>
<div class="city-card__percent" aria-hidden="true">{{ progress(area) }}%</div> <div
class="pack__percent anim-percent"
[style.--to-p]="progress(area)"
aria-hidden="true"
>
<span>{{ progress(area) }}%</span>
</div>
</div> </div>
<mat-progress-bar mode="determinate" [value]="progress(area)" /> <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 (attraction of area.attractions; track attraction.id) { @for (attraction of area.attractions; track attraction.id) {
@@ -43,15 +55,23 @@
[attr.aria-label]=" [attr.aria-label]="
attraction.name + (obtained(attraction) ? ', получено' : ', не получен') attraction.name + (obtained(attraction) ? ', получено' : ', не получен')
" "
>
@if (obtained(attraction) && attraction.iconUrl) {
<img [src]="attraction?.iconUrl" alt="" />
} @else {
<div
class="icon-wrapper"
[class.disable-icon]="!obtained(attraction) && attraction.iconUrl"
> >
<img <img
[src]=" class="main-icon"
obtained(attraction) && attraction.iconUrl [src]="attraction?.iconUrl || '/assets/icons/cell-lock.svg'"
? attraction.iconUrl alt=""
: '/assets/icons/cell-lock.svg'
"
[alt]=""
/> />
<img class="lock-icon" src="/assets/icons/cell-lock-line.svg" alt="" />
</div>
}
</span> </span>
} }
</div> </div>
+44 -18
View File
@@ -105,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 {
@@ -143,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;
@@ -156,7 +143,7 @@
} }
.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);
} }
@@ -199,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;
}
}
}
+5 -14
View File
@@ -1,5 +1,4 @@
import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
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';
@@ -10,17 +9,11 @@ import {
type Area, type Area,
type Attraction, type Attraction,
} from '../../areas/area.models'; } from '../../areas/area.models';
import { import { GorodarActions, selectAreas, selectAreasError, selectAreasStatus } from '../../state';
GorodarActions,
selectAreas,
selectAreasError,
selectAreasStatus,
selectCollectedIdSet,
} from '../../state';
@Component({ @Component({
selector: 'app-cities-page', selector: 'app-cities-page',
imports: [RouterLink, MatProgressBar], imports: [RouterLink],
templateUrl: './cities-page.html', templateUrl: './cities-page.html',
styleUrl: './cities-page.scss', styleUrl: './cities-page.scss',
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
@@ -31,10 +24,8 @@ export class CitiesPage {
protected readonly areas = this.store.selectSignal(selectAreas); protected readonly areas = this.store.selectSignal(selectAreas);
protected readonly status = this.store.selectSignal(selectAreasStatus); protected readonly status = this.store.selectSignal(selectAreasStatus);
protected readonly error = this.store.selectSignal(selectAreasError); protected readonly error = this.store.selectSignal(selectAreasError);
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
protected openedCount(area: Area): number { protected openedCount(area: Area): number {
return areaOpenedCount(area, this.collectedIds()); return areaOpenedCount(area);
} }
protected totalCount(area: Area): number { protected totalCount(area: Area): number {
@@ -42,11 +33,11 @@ export class CitiesPage {
} }
protected progress(area: Area): number { protected progress(area: Area): number {
return areaProgress(area, this.collectedIds()); return areaProgress(area);
} }
protected obtained(attraction: Attraction): boolean { protected obtained(attraction: Attraction): boolean {
return attraction.visited || this.collectedIds().has(attraction.id); return attraction.visited;
} }
protected reload(): void { protected reload(): void {
+13 -1
View File
@@ -97,10 +97,22 @@
<span class="card__spark card__spark--c"></span> <span class="card__spark card__spark--c"></span>
<span class="card__spark card__spark--d"></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 <img
[src]="isOpen(landmark) && landmark.iconUrl ? landmark.iconUrl : '/assets/icons/cell-lock.svg'" class="main-icon"
[src]="landmark?.iconUrl || '/assets/icons/cell-lock.svg'"
alt="" alt=""
/> />
<img class="lock-icon" src="/assets/icons/cell-lock-line.svg" alt="" />
</div>
}
</div> </div>
<div class="card__body"> <div class="card__body">
<h2>{{ landmark.name }}</h2> <h2>{{ landmark.name }}</h2>
+51 -20
View File
@@ -175,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 {
@@ -205,8 +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 {
@@ -215,6 +213,7 @@
width: 96px; width: 96px;
height: 96px; height: 96px;
object-fit: contain; object-fit: contain;
pointer-events: none;
} }
.card__rays { .card__rays {
@@ -273,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;
@@ -329,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%;
}
}
+8 -11
View File
@@ -16,7 +16,6 @@ import {
areaProgress, areaProgress,
areaTotalCount, areaTotalCount,
findAttraction, findAttraction,
isObtained,
type Attraction, type Attraction,
} from '../../areas/area.models'; } from '../../areas/area.models';
import { CityMap } from '../../map/city-map/city-map'; import { CityMap } from '../../map/city-map/city-map';
@@ -26,7 +25,6 @@ import {
selectAreaDetailError, selectAreaDetailError,
selectAreaDetails, selectAreaDetails,
selectAreaDetailStatus, selectAreaDetailStatus,
selectCollectedIdSet,
} from '../../state'; } from '../../state';
type CollectionFilter = 'all' | 'open' | 'closed'; type CollectionFilter = 'all' | 'open' | 'closed';
@@ -53,10 +51,9 @@ export class CityPage {
protected readonly tab = signal<CityTab>('objects'); protected readonly tab = signal<CityTab>('objects');
protected readonly mapReady = signal(false); protected readonly mapReady = signal(false);
protected readonly filter = signal<CollectionFilter>('all'); protected readonly filter = signal<CollectionFilter>('all');
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
protected readonly openedCount = computed(() => { protected readonly openedCount = computed(() => {
const area = this.area(); const area = this.area();
return area ? areaOpenedCount(area, this.collectedIds()) : 0; return area ? areaOpenedCount(area) : 0;
}); });
protected readonly totalCount = computed(() => { protected readonly totalCount = computed(() => {
const area = this.area(); const area = this.area();
@@ -64,7 +61,7 @@ export class CityPage {
}); });
protected readonly progress = computed(() => { protected readonly progress = computed(() => {
const area = this.area(); const area = this.area();
return area ? areaProgress(area, this.collectedIds()) : 0; return area ? areaProgress(area) : 0;
}); });
protected readonly closedCount = computed(() => this.totalCount() - this.openedCount()); protected readonly closedCount = computed(() => this.totalCount() - this.openedCount());
protected readonly mapAttractions = computed(() => { protected readonly mapAttractions = computed(() => {
@@ -74,13 +71,12 @@ export class CityPage {
protected readonly landmarks = computed(() => { protected readonly landmarks = computed(() => {
const current = this.area(); const current = this.area();
const items = current ? areaAttractions(current) : []; const items = current ? areaAttractions(current) : [];
const ids = this.collectedIds();
switch (this.filter()) { switch (this.filter()) {
case 'open': case 'open':
return items.filter((item) => isObtained(item, ids)); return items.filter((item) => item.visited);
case 'closed': case 'closed':
return items.filter((item) => !isObtained(item, ids)); return items.filter((item) => !item.visited);
default: default:
return items; return items;
} }
@@ -117,13 +113,14 @@ export class CityPage {
} }
protected isOpen(attraction: Attraction): boolean { protected isOpen(attraction: Attraction): boolean {
return isObtained(attraction, this.collectedIds()); return attraction.visited;
} }
protected objectRoute(id: string): string[] { protected objectRoute(id: string): string[] {
const current = this.area(); const current = this.area();
const attraction = current ? findAttraction(current, id) : null; const attraction = current ? findAttraction(current, id) : null;
const open = attraction ? isObtained(attraction, this.collectedIds()) : false; return attraction?.visited
return open ? ['/city', this.areaId(), id, 'icon'] : ['/city', this.areaId(), id]; ? ['/city', this.areaId(), id, 'icon']
: ['/city', this.areaId(), id];
} }
} }
@@ -2,18 +2,32 @@
@if (authenticated()) { @if (authenticated()) {
<header class="account"> <header class="account">
<p class="account__email">{{ accountEmail() }}</p> <p class="account__email">{{ accountEmail() }}</p>
<button class="account__logout" type="button" aria-label="Выйти" (click)="logout()"> <div class="account__actions">
<button
class="account__action"
type="button"
aria-label="Документы"
(click)="openDocuments()"
>
<app-icon name="document" [size]="22" />
</button>
<button class="account__action" type="button" aria-label="Выйти" (click)="logout()">
<app-icon name="logout" [size]="22" /> <app-icon name="logout" [size]="22" />
</button> </button>
</div>
</header>
} @else {
<header class="account">
<button class="account__login" type="button" (click)="login()">Войти</button>
</header> </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>
@@ -24,12 +38,14 @@
</div> </div>
</section> </section>
<p class="section-label">Мои города</p>
@if (packs().length > 0) { @if (packs().length > 0) {
@for (pack of packs(); track pack.area.id) { @for (pack of packs(); track pack.area.id) {
<article class="pack"> <article class="pack">
<a class="pack__head" [routerLink]="['/city', pack.area.id]" [attr.aria-label]="'Объекты: ' + pack.area.name"> <a
class="pack__head"
[routerLink]="['/city', pack.area.id]"
[attr.aria-label]="'Объекты: ' + pack.area.name"
>
<div> <div>
<h2>{{ pack.area.name }}</h2> <h2>{{ pack.area.name }}</h2>
<p>Собрано {{ pack.opened }} из {{ pack.total }}</p> <p>Собрано {{ pack.opened }} из {{ pack.total }}</p>
@@ -64,4 +80,8 @@
} @else { } @else {
<p class="empty">Пока нет полученных объектов.</p> <p class="empty">Пока нет полученных объектов.</p>
} }
@if (documentsOpen()) {
<app-documents-sheet (dismissed)="closeDocuments()" />
}
</section> </section>
@@ -27,7 +27,13 @@
white-space: nowrap; white-space: nowrap;
} }
.account__logout { .account__actions {
display: flex;
flex: none;
gap: 8px;
}
.account__action {
display: flex; display: flex;
flex: none; flex: none;
align-items: center; align-items: center;
@@ -35,13 +41,27 @@
width: 44px; width: 44px;
height: 44px; height: 44px;
padding: 0; padding: 0;
border: 1px solid var(--color-border); border: 0;
border-radius: 14px; border-radius: 14px;
background: var(--color-surface); background: transparent;
color: var(--color-text); color: var(--color-text);
cursor: pointer; cursor: pointer;
} }
.account__login {
margin-left: auto;
height: 44px;
padding: 0 16px;
border: 0;
border-radius: 14px;
background: var(--color-primary);
color: var(--color-label);
font: inherit;
font-size: 15px;
font-weight: 600;
cursor: pointer;
}
.page__intro { .page__intro {
margin-top: 20px; margin-top: 20px;
} }
@@ -1,4 +1,11 @@
import { afterNextRender, ChangeDetectionStrategy, Component, computed, inject } 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';
@@ -7,23 +14,22 @@ import {
areaOpenedCount, areaOpenedCount,
areaProgress, areaProgress,
areaTotalCount, areaTotalCount,
isObtained,
type Attraction, type Attraction,
} from '../../areas/area.models'; } 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 { import {
GorodarActions, GorodarActions,
selectAreas, selectAreas,
selectAuthEmail, selectAuthEmail,
selectAuthenticated, selectAuthenticated,
selectCollectedIdSet,
selectOpenedCount, selectOpenedCount,
selectProfile, selectProfile,
} from '../../state'; } 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,
@@ -33,26 +39,24 @@ export class CollectionsPage {
private readonly areas = this.store.selectSignal(selectAreas); private readonly areas = this.store.selectSignal(selectAreas);
protected readonly profile = this.store.selectSignal(selectProfile); protected readonly profile = this.store.selectSignal(selectProfile);
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
protected readonly openedCount = this.store.selectSignal(selectOpenedCount); protected readonly openedCount = this.store.selectSignal(selectOpenedCount);
protected readonly authenticated = this.store.selectSignal(selectAuthenticated); protected readonly authenticated = this.store.selectSignal(selectAuthenticated);
private readonly authEmail = this.store.selectSignal(selectAuthEmail); private readonly authEmail = this.store.selectSignal(selectAuthEmail);
protected readonly accountEmail = computed(() => protected readonly accountEmail = computed(() =>
this.authenticated() ? this.authEmail() : this.profile().email, this.authenticated() ? this.authEmail() : this.profile().email,
); );
protected readonly packs = computed(() => { protected readonly documentsOpen = signal(false);
const ids = this.collectedIds(); protected readonly packs = computed(() =>
this.areas()
return this.areas()
.map((area) => ({ .map((area) => ({
area, area,
items: areaAttractions(area).filter((item) => isObtained(item, ids)), items: areaAttractions(area).filter((item) => item.visited),
opened: areaOpenedCount(area, ids), opened: areaOpenedCount(area),
total: areaTotalCount(area), total: areaTotalCount(area),
progress: areaProgress(area, ids), progress: areaProgress(area),
})) }))
.filter((pack) => pack.items.length > 0); .filter((pack) => pack.items.length > 0),
}); );
constructor() { constructor() {
afterNextRender(() => { afterNextRender(() => {
@@ -69,12 +73,25 @@ export class CollectionsPage {
); );
protected objectRoute(areaId: string, attraction: Attraction): string[] { protected objectRoute(areaId: string, attraction: Attraction): string[] {
return isObtained(attraction, this.collectedIds()) return attraction.visited
? ['/city', areaId, attraction.id, 'icon'] ? ['/city', areaId, attraction.id, 'icon']
: ['/city', areaId, attraction.id]; : ['/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 { protected logout(): void {
this.documentsOpen.set(false);
this.store.dispatch(GorodarActions.logout()); this.store.dispatch(GorodarActions.logout());
} }
@@ -2,14 +2,9 @@ import { ChangeDetectionStrategy, Component, computed, effect, inject, input } f
import { Router, RouterLink } from '@angular/router'; import { Router, RouterLink } from '@angular/router';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { findAttraction, isObtained } from '../../areas/area.models'; import { findAttraction } from '../../areas/area.models';
import { CollectSuccess } from '../../claim/collect-success/collect-success'; import { CollectSuccess } from '../../claim/collect-success/collect-success';
import { import { GorodarActions, selectAreaDetails, selectAreaDetailStatus } from '../../state';
GorodarActions,
selectAreaDetails,
selectAreaDetailStatus,
selectCollectedIdSet,
} from '../../state';
@Component({ @Component({
selector: 'app-icon-preview-page', selector: 'app-icon-preview-page',
@@ -24,7 +19,6 @@ export class IconPreviewPage {
private readonly details = this.store.selectSignal(selectAreaDetails); private readonly details = this.store.selectSignal(selectAreaDetails);
private readonly detailStatus = this.store.selectSignal(selectAreaDetailStatus); private readonly detailStatus = this.store.selectSignal(selectAreaDetailStatus);
protected readonly status = computed(() => this.detailStatus()[this.areaId()] ?? 'loading'); protected readonly status = computed(() => this.detailStatus()[this.areaId()] ?? 'loading');
private readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
readonly areaId = input.required<string>(); readonly areaId = input.required<string>();
readonly id = input.required<string>(); readonly id = input.required<string>();
@@ -33,10 +27,7 @@ export class IconPreviewPage {
const area = this.details()[this.areaId()]; const area = this.details()[this.areaId()];
return area ? findAttraction(area, this.id()) : null; return area ? findAttraction(area, this.id()) : null;
}); });
protected readonly collected = computed(() => { protected readonly collected = computed(() => this.landmark()?.visited ?? false);
const item = this.landmark();
return item ? isObtained(item, this.collectedIds()) : false;
});
constructor() { constructor() {
effect(() => { effect(() => {
@@ -53,7 +44,7 @@ export class IconPreviewPage {
effect(() => { effect(() => {
const item = this.landmark(); const item = this.landmark();
if (this.status() !== 'ready' || !item || isObtained(item, this.collectedIds())) { if (this.status() !== 'ready' || !item || item.visited) {
return; return;
} }
+5 -39
View File
@@ -68,38 +68,20 @@
</section> </section>
} }
@if (collected()) {
<section>
<h2>Ваше фото</h2>
<button class="owned-photo" type="button" (click)="openPhoto()">
<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>
} @else {
<section> <section>
<h2>Как забрать</h2> <h2>Как забрать</h2>
<ol class="steps"> <ol class="steps">
<li>Приезжайте на место и найдите объект</li> <li>Приезжайте на место и найдите объект.</li>
<li>Нажмите «Забрать» и сфотографируйте объект</li> <li>Встаньте на точку отмеченную на карте.</li>
<li>Получите объект в свою коллекцию</li> <li>Нажмите «Забрать» и сфотографируйте объект.</li>
<li>Получите объект в свою коллекцию.</li>
</ol> </ol>
</section> </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,22 +90,6 @@
} }
</article> </article>
} }
@if (photoOpen()) {
@if (userPhoto(); as image) {
<div class="photo-viewer" (click)="closePhoto()">
<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 if (status() === 'loading') { } @else if (status() === 'loading') {
<section class="object object--empty"> <section class="object object--empty">
<p>Загружаем…</p> <p>Загружаем…</p>
@@ -274,17 +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-color: #d4143f;
--mat-button-filled-label-text-color: #fff;
--mat-button-filled-container-shape: 16px;
background-color: #d4143f;
color: #fff;
}
.object__bar p { .object__bar p {
margin: 8px 0 0; margin: 8px 0 0;
font-size: 13px; font-size: 13px;
+3 -35
View File
@@ -13,12 +13,7 @@ import { MatButton } from '@angular/material/button';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { import { areaOpenedCount, areaTotalCount, type AreaDetails } from '../../areas/area.models';
areaOpenedCount,
areaTotalCount,
isObtained,
type AreaDetails,
} from '../../areas/area.models';
import { ClaimFlow } from '../../claim/claim-flow/claim-flow'; import { ClaimFlow } from '../../claim/claim-flow/claim-flow';
import { AudioGuide } from '../../shared/audio-guide/audio-guide'; import { AudioGuide } from '../../shared/audio-guide/audio-guide';
import { Icon } from '../../shared/icon/icon'; import { Icon } from '../../shared/icon/icon';
@@ -32,7 +27,6 @@ import {
selectAuthenticated, selectAuthenticated,
selectClaim, selectClaim,
selectCollectedAt, selectCollectedAt,
selectCollectedIdSet,
selectPhotos, selectPhotos,
} from '../../state'; } from '../../state';
@@ -63,28 +57,19 @@ export class MapItemPage {
(): AreaDetails | null => this.details()[this.areaId()] ?? null, (): AreaDetails | null => this.details()[this.areaId()] ?? null,
); );
protected readonly landmark = computed(() => this.attractions()[this.id()] ?? null); protected readonly landmark = computed(() => this.attractions()[this.id()] ?? null);
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
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 openedCount = computed(() => {
const area = this.area(); const area = this.area();
return area ? areaOpenedCount(area, this.collectedIds()) : 0; return area ? areaOpenedCount(area) : 0;
}); });
protected readonly totalCount = computed(() => { protected readonly totalCount = computed(() => {
const area = this.area(); const area = this.area();
return area ? areaTotalCount(area) : 0; return area ? areaTotalCount(area) : 0;
}); });
protected readonly collected = computed(() => { protected readonly collected = computed(() => this.landmark()?.visited ?? false);
const item = this.landmark();
return item ? isObtained(item, this.collectedIds()) : false;
});
protected readonly userPhoto = computed(() => {
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()) {
@@ -111,8 +96,6 @@ export class MapItemPage {
return claim.landmarkId === this.id() && claim.stage !== 'idle'; return claim.landmarkId === this.id() && claim.stage !== 'idle';
}); });
protected readonly photoOpen = signal(false);
constructor() { constructor() {
effect(() => { effect(() => {
const areaId = this.areaId(); const areaId = this.areaId();
@@ -147,19 +130,4 @@ export class MapItemPage {
this.store.dispatch(GorodarActions.authSheetOpened({ intent: 'claim', landmarkId: this.id() })); this.store.dispatch(GorodarActions.authSheetOpened({ intent: 'claim', landmarkId: this.id() }));
} }
protected openPhoto(): void {
if (this.userPhoto()) {
this.photoOpen.set(true);
}
}
protected closePhoto(): void {
this.photoOpen.set(false);
}
@HostListener('document:keydown.escape')
protected onEscape(): void {
this.closePhoto();
}
} }
@@ -0,0 +1,26 @@
import { inject } from '@angular/core';
import { type CanActivateFn, Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { filter, map, take } from 'rxjs';
import { findAttraction } from '../../areas/area.models';
import { GorodarActions, selectAreaDetails } from '../../state';
export const visitedItemGuard: CanActivateFn = (route) => {
const store = inject(Store);
const router = inject(Router);
const areaId = route.paramMap.get('areaId') ?? '';
const id = route.paramMap.get('id') ?? '';
store.dispatch(GorodarActions.areaRequested({ id: areaId }));
return store.select(selectAreaDetails).pipe(
map((details) => {
const area = details[areaId];
return area ? findAttraction(area, id) : undefined;
}),
filter((item) => item !== undefined),
take(1),
map((item) => (item?.visited ? router.createUrlTree(['/city', areaId]) : true)),
);
};
+3 -2
View File
@@ -21,8 +21,8 @@
padding: 0; padding: 0;
border: 0; border: 0;
border-radius: 50%; border-radius: 50%;
background: var(--color-accent); background: var(--color-primary);
color: var(--color-on-accent); color: var(--color-label);
cursor: pointer; cursor: pointer;
} }
@@ -40,6 +40,7 @@
.guide__wave { .guide__wave {
width: 100%; width: 100%;
height: 28px; height: 28px;
overflow: hidden;
} }
.guide__meta { .guide__meta {
+21 -4
View File
@@ -1,9 +1,10 @@
import { import {
afterNextRender,
ChangeDetectionStrategy, ChangeDetectionStrategy,
Component, Component,
DestroyRef,
ElementRef, ElementRef,
NgZone, NgZone,
effect,
inject, inject,
input, input,
signal, signal,
@@ -18,6 +19,7 @@ import WaveSurfer from 'wavesurfer.js';
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class AudioGuide { export class AudioGuide {
private readonly destroyRef = inject(DestroyRef);
private readonly zone = inject(NgZone); private readonly zone = inject(NgZone);
private readonly waveHost = viewChild<ElementRef<HTMLDivElement>>('wave'); private readonly waveHost = viewChild<ElementRef<HTMLDivElement>>('wave');
private player: WaveSurfer | null = null; private player: WaveSurfer | null = null;
@@ -29,14 +31,25 @@ export class AudioGuide {
protected readonly duration = signal(0); protected readonly duration = signal(0);
constructor() { constructor() {
effect((onCleanup) => { afterNextRender(() => {
const element = this.waveHost()?.nativeElement; const element = this.waveHost()?.nativeElement;
const parent = element?.parentElement;
const src = this.src(); const src = this.src();
if (!element) { if (!element || !parent || !src) {
return; return;
} }
const lockWidth = (): void => {
const width = Math.floor(parent.clientWidth);
if (width > 0) {
element.style.width = `${width}px`;
}
};
lockWidth();
const player = this.zone.runOutsideAngular(() => const player = this.zone.runOutsideAngular(() =>
WaveSurfer.create({ WaveSurfer.create({
container: element, container: element,
@@ -70,7 +83,11 @@ export class AudioGuide {
player.on('pause', () => this.zone.run(() => this.playing.set(false))); player.on('pause', () => this.zone.run(() => this.playing.set(false)));
player.on('finish', () => this.zone.run(() => this.playing.set(false))); player.on('finish', () => this.zone.run(() => this.playing.set(false)));
onCleanup(() => { const onResize = (): void => lockWidth();
window.addEventListener('resize', onResize);
this.destroyRef.onDestroy(() => {
window.removeEventListener('resize', onResize);
player.destroy(); player.destroy();
if (this.player === player) { if (this.player === player) {
@@ -0,0 +1,41 @@
<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="documents-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>
<div class="sheet__mark" aria-hidden="true">
<app-icon name="document" [size]="28" />
</div>
<h2 id="documents-sheet-title">Документы</h2>
<ul class="docs">
@for (document of documents; track document.href) {
<li>
<a [href]="document.href" target="_blank" rel="noopener noreferrer">
<span>{{ document.title }}</span>
<app-icon name="chevron-right" [size]="20" />
</a>
</li>
}
</ul>
</section>
</div>
</div>
@@ -0,0 +1,132 @@
: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(20px + 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__mark {
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;
}
.docs {
display: flex;
flex-direction: column;
gap: 10px;
margin: 20px 0 0;
padding: 0;
list-style: none;
}
.docs a {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
min-height: 56px;
padding: 12px 14px;
border: 1px solid var(--color-border);
border-radius: 16px;
background: #12110f;
color: var(--color-text);
font-size: 15px;
font-weight: 600;
line-height: 1.3;
text-decoration: none;
}
@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,168 @@
import {
ChangeDetectionStrategy,
Component,
DestroyRef,
HostListener,
inject,
output,
signal,
} from '@angular/core';
import { Icon } from '../icon/icon';
import { legalDocuments } from '../legal-documents';
const DISMISS_DISTANCE = 120;
const DISMISS_VELOCITY = 0.55;
@Component({
selector: 'app-documents-sheet',
imports: [Icon],
templateUrl: './documents-sheet.html',
styleUrl: './documents-sheet.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DocumentsSheet {
private readonly destroyRef = inject(DestroyRef);
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 documents = legalDocuments;
protected readonly dragY = signal(0);
protected readonly dragging = signal(false);
readonly dismissed = output<void>();
constructor() {
this.destroyRef.onDestroy(() => window.clearTimeout(this.closeTimer));
}
protected dismiss(): void {
window.clearTimeout(this.closeTimer);
this.closeTimer = 0;
this.dragY.set(0);
this.dragging.set(false);
this.dismissed.emit();
}
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);
}
@HostListener('document:keydown.escape')
protected onEscape(): void {
this.dismiss();
}
private canDragFrom(target: EventTarget | null): boolean {
if (!(target instanceof Element)) {
return true;
}
if (this.isHandle(target)) {
return true;
}
return target.closest('a, button') == null;
}
private isHandle(target: EventTarget | null): boolean {
return target instanceof Element && target.closest('.sheet__handle') != null;
}
}
+7
View File
@@ -0,0 +1,7 @@
export const termsDocumentUrl = '/assets/documents/terms-of-use.pdf';
export const privacyDocumentUrl = '/assets/documents/privacy-policy.pdf';
export const legalDocuments = [
{ title: 'Пользовательское соглашение', href: termsDocumentUrl },
{ title: 'Политика обработки персональных данных', href: privacyDocumentUrl },
] as const;
+1 -23
View File
@@ -1,14 +1,13 @@
import { Injectable, inject } from '@angular/core'; import { Injectable, inject } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects'; import { Actions, createEffect, ofType } from '@ngrx/effects';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { catchError, exhaustMap, filter, map, of, switchMap, take, takeUntil, tap, timer, withLatestFrom } from 'rxjs'; import { catchError, exhaustMap, filter, map, of, tap, withLatestFrom } from 'rxjs';
import { AuthApiService } from '../auth/auth-api.service'; import { AuthApiService } from '../auth/auth-api.service';
import { authErrorMessage } from '../auth/auth-error'; import { authErrorMessage } from '../auth/auth-error';
import { clearAuthSession, writeAuthSession } from '../auth/auth-session'; import { clearAuthSession, writeAuthSession } from '../auth/auth-session';
import type { AuthSession } from '../auth/auth.models'; import type { AuthSession } from '../auth/auth.models';
import { GorodarActions } from './gorodar.actions'; import { GorodarActions } from './gorodar.actions';
import { RESEND_SECONDS } from './gorodar.models';
import { selectAuth, selectAuthenticated } from './gorodar.selectors'; import { selectAuth, selectAuthenticated } from './gorodar.selectors';
@Injectable() @Injectable()
@@ -90,27 +89,6 @@ export class AuthEffects {
), ),
); );
readonly resendTimer$ = createEffect(() =>
this.actions$.pipe(
ofType(GorodarActions.authCodeRequestSucceeded),
switchMap(() =>
timer(1000, 1000).pipe(
take(RESEND_SECONDS),
map((tick) => GorodarActions.authResendTicked({ seconds: RESEND_SECONDS - tick - 1 })),
takeUntil(
this.actions$.pipe(
ofType(
GorodarActions.authEmailChangeRequested,
GorodarActions.logout,
GorodarActions.authCodeConfirmSucceeded,
),
),
),
),
),
),
);
readonly persistSession$ = createEffect( readonly persistSession$ = createEffect(
() => () =>
this.actions$.pipe( this.actions$.pipe(
-1
View File
@@ -42,7 +42,6 @@ export interface AuthState {
} }
export interface GorodarState { export interface GorodarState {
collectedIds: string[];
photos: Record<string, string>; photos: Record<string, string>;
collectedAt: Record<string, string>; collectedAt: Record<string, string>;
claim: ClaimState; claim: ClaimState;
+18 -5
View File
@@ -2,6 +2,7 @@ import { createFeature, createReducer, on } from '@ngrx/store';
import { import {
areaAttractions, areaAttractions,
type Area,
type AreaDetails, type AreaDetails,
type AreaProgress, type AreaProgress,
type Attraction, type Attraction,
@@ -42,7 +43,6 @@ const restoredAuth: AuthState = {
}; };
export const initialState: GorodarState = { export const initialState: GorodarState = {
collectedIds: [],
photos: {}, photos: {},
collectedAt: {}, collectedAt: {},
claim: initialClaim, claim: initialClaim,
@@ -87,9 +87,7 @@ const gorodarReducer = createReducer(
GorodarActions.claimCompleted, GorodarActions.claimCompleted,
(state, { landmarkId, photo, collectedAt, alreadyVisited, progress }): GorodarState => ({ (state, { landmarkId, photo, collectedAt, alreadyVisited, progress }): GorodarState => ({
...state, ...state,
collectedIds: state.collectedIds.includes(landmarkId) areas: markListVisited(state.areas, landmarkId, progress),
? state.collectedIds
: [...state.collectedIds, landmarkId],
photos: { photos: {
...state.photos, ...state.photos,
[landmarkId]: photo, [landmarkId]: photo,
@@ -268,7 +266,6 @@ const gorodarReducer = createReducer(
GorodarActions.logout, GorodarActions.logout,
(state): GorodarState => ({ (state): GorodarState => ({
...state, ...state,
collectedIds: [],
photos: {}, photos: {},
collectedAt: {}, collectedAt: {},
claim: initialClaim, claim: initialClaim,
@@ -408,6 +405,22 @@ function markVisited(item: Attraction, id: string): Attraction {
return item.id === id ? { ...item, visited: true } : item; return item.id === id ? { ...item, visited: true } : item;
} }
function markListVisited(areas: Area[], landmarkId: string, progress: AreaProgress): Area[] {
return areas.map((area) => {
const attractions = area.attractions ?? [];
if (!attractions.some((item) => item.id === landmarkId)) {
return area;
}
return {
...area,
progress: progress ?? area.progress,
attractions: attractions.map((item) => markVisited(item, landmarkId)),
};
});
}
function markAreaVisited( function markAreaVisited(
details: Record<string, AreaDetails>, details: Record<string, AreaDetails>,
landmarkId: string, landmarkId: string,
+2 -9
View File
@@ -4,7 +4,6 @@ import { areaOpenedCount, areaTotalCount, type Area, type AreaDetails } from '..
import { gorodarFeature } from './gorodar.reducer'; import { gorodarFeature } from './gorodar.reducer';
export const { export const {
selectCollectedIds,
selectPhotos, selectPhotos,
selectCollectedAt, selectCollectedAt,
selectClaim, selectClaim,
@@ -21,14 +20,8 @@ export const {
selectAttractionError, selectAttractionError,
} = gorodarFeature; } = gorodarFeature;
export const selectCollectedIdSet = createSelector(selectCollectedIds, (ids) => new Set(ids)); export const selectOpenedCount = createSelector(selectAreas, selectAreaDetails, (areas, details) =>
areas.reduce((sum, area) => sum + areaOpenedCount(resolveArea(area, details)), 0),
export const selectOpenedCount = createSelector(
selectAreas,
selectAreaDetails,
selectCollectedIdSet,
(areas, details, ids) =>
areas.reduce((sum, area) => sum + areaOpenedCount(resolveArea(area, details), ids), 0),
); );
export const selectTotalCount = createSelector(selectAreas, selectAreaDetails, (areas, details) => export const selectTotalCount = createSelector(selectAreas, selectAreaDetails, (areas, details) =>
+1
View File
@@ -7,6 +7,7 @@
html, html,
body { body {
height: 100%; height: 100%;
overflow: hidden;
} }
html { html {
+24
View File
@@ -0,0 +1,24 @@
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
width: 100%;
min-height: 52px;
padding: 0 16px;
border: 0;
border-radius: 16px;
background: var(--color-primary);
color: var(--color-label);
font: inherit;
font-size: 16px;
font-weight: 600;
line-height: 1.2;
text-decoration: none;
cursor: pointer;
}
.btn:disabled {
opacity: 0.45;
cursor: default;
}
-1
View File
@@ -24,7 +24,6 @@
.pack h2, .pack h2,
.pack h3 { .pack h3 {
margin: 0; margin: 0;
font-family: var(--font-display);
font-size: 24px; font-size: 24px;
font-weight: 700; font-weight: 700;
line-height: 1.15; line-height: 1.15;
+1 -1
View File
@@ -54,7 +54,7 @@
.city-map__label { .city-map__label {
position: absolute; position: absolute;
left: 50%; left: 50%;
bottom: calc(50% + (var(--radius-px, 80px) / 2) + 6px); bottom: calc(20% + (var(--radius-px, 80px) / 2) + 6px);
display: none; display: none;
padding: 0 4px; padding: 0 4px;
color: var(--color-text); color: var(--color-text);
+4 -4
View File
@@ -1,9 +1,9 @@
.mat-mdc-unelevated-button, .mat-mdc-unelevated-button,
.mdc-button--unelevated { .mdc-button--unelevated {
--mat-button-filled-container-color: var(--color-accent); --mat-button-filled-container-color: var(--color-primary);
--mat-button-filled-label-text-color: var(--color-on-accent); --mat-button-filled-label-text-color: var(--color-label);
--mat-sys-primary: var(--color-accent); --mat-sys-primary: var(--color-primary);
--mat-sys-on-primary: var(--color-on-accent); --mat-sys-on-primary: var(--color-label);
} }
.mat-mdc-outlined-button, .mat-mdc-outlined-button,
-72
View File
@@ -26,75 +26,3 @@
height: 120px; height: 120px;
background: linear-gradient(to bottom, transparent, var(--color-bg)); background: linear-gradient(to bottom, transparent, var(--color-bg));
} }
.owned-photo {
position: relative;
display: block;
width: 100%;
height: 220px;
padding: 0;
overflow: hidden;
border: 1px solid var(--color-accent-strong);
border-radius: 16px;
background: var(--color-surface);
cursor: zoom-in;
}
.owned-photo img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
.owned-photo__badge {
position: absolute;
left: 12px;
bottom: 12px;
display: inline-flex;
align-items: center;
gap: 6px;
padding: 5px 11px;
overflow: visible;
border-radius: 10px;
background: rgb(18 17 15 / 82%);
color: var(--color-accent-soft);
font-size: 13px;
font-weight: 500;
line-height: 1;
}
.photo-viewer {
position: fixed;
inset: 0;
z-index: 40;
display: flex;
align-items: center;
justify-content: center;
padding: 56px 16px 24px;
background: rgb(18 17 15 / 94%);
}
.photo-viewer img {
display: block;
max-width: 100%;
max-height: 100%;
object-fit: contain;
border-radius: 12px;
}
.photo-viewer__close {
position: absolute;
top: 16px;
left: 16px;
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);
cursor: pointer;
}
+1
View File
@@ -2,6 +2,7 @@
@use 'typography'; @use 'typography';
@use 'base'; @use 'base';
@use 'material'; @use 'material';
@use 'button';
@use 'motion'; @use 'motion';
@use 'map'; @use 'map';
@use 'object'; @use 'object';
+35 -4
View File
@@ -2,18 +2,44 @@
<html lang="ru"> <html lang="ru">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>Городар</title> <title>Городар — собирайте достопримечательности в коллекцию</title>
<base href="/" /> <base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" /> <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<meta
name="description"
content="Открывайте города с Городаром: находите достопримечательности на карте, посещайте их и фотографируйте, чтобы пополнять личную коллекцию."
/>
<meta name="theme-color" content="#12110F" /> <meta name="theme-color" content="#12110F" />
<meta name="mobile-web-app-capable" content="yes" /> <meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-mobile-web-app-title" content="Городар" /> <meta name="apple-mobile-web-app-title" content="Городар" />
<link rel="canonical" href="https://gorodar.ru/" />
<meta property="og:type" content="website" />
<meta property="og:locale" content="ru_RU" />
<meta property="og:site_name" content="Городар" />
<meta property="og:url" content="https://gorodar.ru/" />
<meta property="og:title" content="Городар — собирайте достопримечательности в коллекцию" />
<meta
property="og:description"
content="Открывайте города с Городаром: находите достопримечательности на карте, посещайте их и фотографируйте, чтобы пополнять личную коллекцию."
/>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebSite",
"name": "Городар",
"alternateName": "Gorodar",
"url": "https://gorodar.ru/",
"inLanguage": "ru",
"description": "Городар — сервис для исследования городов и коллекционирования достопримечательностей. Посещайте места, фотографируйте их и пополняйте личную коллекцию."
}
</script>
<link rel="icon" type="image/svg+xml" href="favicon.svg" /> <link rel="icon" type="image/svg+xml" href="favicon.svg" />
<link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png" /> <link rel="icon" type="image/png" sizes="32x32" href="assets/logo/32.png" />
<link rel="icon" type="image/png" sizes="64x64" href="assets/logo/64.png" />
<link rel="icon" type="image/x-icon" href="favicon.ico" /> <link rel="icon" type="image/x-icon" href="favicon.ico" />
<link rel="apple-touch-icon" href="icons/apple-touch-icon.png" /> <link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png" />
<link rel="manifest" href="manifest.webmanifest" /> <link rel="manifest" href="manifest.webmanifest" />
<link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
@@ -21,6 +47,11 @@
href="https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700&family=Playfair+Display:wght@700&display=swap" href="https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700&family=Playfair+Display:wght@700&display=swap"
rel="stylesheet" rel="stylesheet"
/> />
<script
defer
src="https://app.web-metrics.ru/em.js"
data-website-id="5f97fae9-e38a-4ba2-968a-094b85e2e4d1"
></script>
</head> </head>
<body> <body>
<app-root></app-root> <app-root></app-root>