add mp with icons and update after review
This commit is contained in:
@@ -1,32 +1,10 @@
|
||||
<section class="page">
|
||||
<header class="page__header">
|
||||
<div class="page__brand">
|
||||
<img class="page__mark" src="/assets/icons/gorodar-mark.svg" alt="" width="36" height="36" />
|
||||
<span>Городар</span>
|
||||
</div>
|
||||
|
||||
<a class="page__profile" routerLink="/profile" aria-label="Профиль">
|
||||
<app-icon name="profile" [size]="22" />
|
||||
</a>
|
||||
</header>
|
||||
|
||||
<div class="page__intro">
|
||||
<h1>Коллекции городов</h1>
|
||||
<h1>Города</h1>
|
||||
<p>Приезжайте на место, снимайте — объект попадёт в вашу коллекцию.</p>
|
||||
</div>
|
||||
|
||||
<a class="page__all" routerLink="/collections">
|
||||
<span class="page__all-label">
|
||||
<app-icon name="collection" [size]="22" />
|
||||
<span>
|
||||
<b>Вся коллекция</b>
|
||||
<span class="page__all-meta"> · {{ openedCount() }} объектов · 1 город</span>
|
||||
</span>
|
||||
</span>
|
||||
<app-icon name="chevron-right" [size]="20" />
|
||||
</a>
|
||||
|
||||
<article class="city-card" [attr.aria-label]="city.name">
|
||||
<a class="city-card" routerLink="/city" [attr.aria-label]="city.name">
|
||||
<div class="city-card__top">
|
||||
<div>
|
||||
<h2>{{ city.name }}</h2>
|
||||
@@ -44,26 +22,23 @@
|
||||
|
||||
<div class="city-card__cells">
|
||||
@for (landmark of city.objects; track landmark.id) {
|
||||
<a
|
||||
<span
|
||||
class="cell"
|
||||
[routerLink]="['/items', landmark.id]"
|
||||
[class.cell--open]="collectedIds().has(landmark.id)"
|
||||
[attr.aria-label]="landmark.title + (collectedIds().has(landmark.id) ? ', получено' : ', не получен')"
|
||||
[attr.aria-label]="
|
||||
landmark.title + (collectedIds().has(landmark.id) ? ', получено' : ', не получен')
|
||||
"
|
||||
>
|
||||
<img
|
||||
[src]="collectedIds().has(landmark.id) ? '/assets/icons/gorodar-mark.svg' : '/assets/icons/cell-lock.svg'"
|
||||
[src]="
|
||||
collectedIds().has(landmark.id)
|
||||
? landmark.achievement
|
||||
: '/assets/icons/cell-lock.svg'
|
||||
"
|
||||
[alt]=""
|
||||
/>
|
||||
</a>
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="city-card__actions">
|
||||
<a matButton="outlined" routerLink="/collection">Коллекция</a>
|
||||
<a matButton="filled" routerLink="/map">
|
||||
<app-icon name="pin" [size]="20" />
|
||||
На карте
|
||||
</a>
|
||||
</div>
|
||||
</article>
|
||||
</a>
|
||||
</section>
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
.page__brand,
|
||||
.page__all,
|
||||
.page__all-label,
|
||||
.city-card__top,
|
||||
.city-card__actions {
|
||||
.city-card__top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
@@ -39,19 +38,6 @@
|
||||
height: 36px;
|
||||
}
|
||||
|
||||
.page__profile {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 22px;
|
||||
background: var(--color-surface-2);
|
||||
color: var(--color-text);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.page__intro {
|
||||
margin: 20px 0 16px;
|
||||
}
|
||||
@@ -90,24 +76,13 @@
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.page__all-label {
|
||||
gap: 10px;
|
||||
color: var(--color-accent);
|
||||
}
|
||||
|
||||
.page__all-label b {
|
||||
color: var(--color-text);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.page__all-meta {
|
||||
color: var(--color-muted);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.city-card {
|
||||
display: block;
|
||||
padding: 16px;
|
||||
border-radius: 24px;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.city-card__top {
|
||||
@@ -171,6 +146,10 @@
|
||||
box-shadow: inset 0 0 0 1.5px var(--color-accent);
|
||||
}
|
||||
|
||||
.cell--open img {
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.city-card__actions {
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
|
||||
import { MatButton } from '@angular/material/button';
|
||||
import { MatProgressBar } from '@angular/material/progress-bar';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { CityCatalogService } from '../../root/services/city-catalog.service';
|
||||
import { Icon } from '../../shared/icon/icon';
|
||||
import { selectCollectedIdSet, selectOpenedCount, selectProgress } from '../../state';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cities-page',
|
||||
imports: [RouterLink, MatButton, MatProgressBar, Icon],
|
||||
imports: [RouterLink, MatProgressBar],
|
||||
templateUrl: './cities-page.html',
|
||||
styleUrl: './cities-page.scss',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
|
||||
+31
-9
@@ -1,12 +1,8 @@
|
||||
<section class="page">
|
||||
<section class="page" [class.page--map]="tab() === 'map'">
|
||||
<header class="page__top">
|
||||
<a class="page__back" routerLink="/" aria-label="Назад">
|
||||
<app-icon name="chevron-left" [size]="22" />
|
||||
</a>
|
||||
<a class="page__all" routerLink="/collections">
|
||||
Вся коллекция
|
||||
<app-icon name="chevron-right" [size]="16" />
|
||||
</a>
|
||||
</header>
|
||||
|
||||
<div class="page__city">
|
||||
@@ -29,10 +25,25 @@
|
||||
</div>
|
||||
|
||||
<nav class="tabs" aria-label="Разделы города">
|
||||
<span class="tabs__item tabs__item--active">Объекты</span>
|
||||
<a class="tabs__item" routerLink="/map">На карте</a>
|
||||
<button
|
||||
class="tabs__item"
|
||||
type="button"
|
||||
[class.tabs__item--active]="tab() === 'objects'"
|
||||
(click)="openObjects()"
|
||||
>
|
||||
Объекты
|
||||
</button>
|
||||
<button
|
||||
class="tabs__item"
|
||||
type="button"
|
||||
[class.tabs__item--active]="tab() === 'map'"
|
||||
(click)="openMap()"
|
||||
>
|
||||
На карте
|
||||
</button>
|
||||
</nav>
|
||||
|
||||
@if (tab() === 'objects') {
|
||||
<div class="filters">
|
||||
<button
|
||||
type="button"
|
||||
@@ -59,7 +70,7 @@
|
||||
|
||||
<div class="grid">
|
||||
@for (landmark of landmarks(); track landmark.id) {
|
||||
<a class="card" [routerLink]="['/items', landmark.id]">
|
||||
<a class="card" [routerLink]="objectRoute(landmark.id)">
|
||||
<div class="card__preview" [class.card__preview--open]="collectedIds().has(landmark.id)">
|
||||
@if (collectedIds().has(landmark.id)) {
|
||||
<svg class="card__rays" viewBox="0 0 112 112" aria-hidden="true">
|
||||
@@ -82,7 +93,11 @@
|
||||
<span class="card__spark card__spark--d"></span>
|
||||
}
|
||||
<img
|
||||
[src]="collectedIds().has(landmark.id) ? '/assets/icons/gorodar-mark.svg' : '/assets/icons/cell-lock.svg'"
|
||||
[src]="
|
||||
collectedIds().has(landmark.id)
|
||||
? landmark.achievement
|
||||
: '/assets/icons/cell-lock.svg'
|
||||
"
|
||||
alt=""
|
||||
/>
|
||||
</div>
|
||||
@@ -97,4 +112,11 @@
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (mapReady()) {
|
||||
<div class="page__map" [class.page__map--off]="tab() !== 'map'">
|
||||
<app-city-map [embedded]="true" />
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
+53
-8
@@ -3,12 +3,25 @@
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
:host:has(.page--map) {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.page {
|
||||
width: min(100%, 720px);
|
||||
margin: 0 auto;
|
||||
padding: 16px 16px 24px;
|
||||
}
|
||||
|
||||
.page--map {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.page__top,
|
||||
.page__city,
|
||||
.page__city p,
|
||||
@@ -23,8 +36,7 @@
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.page__back,
|
||||
.page__all {
|
||||
.page__back {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 44px;
|
||||
@@ -110,9 +122,13 @@
|
||||
|
||||
.tabs__item {
|
||||
padding: 10px 0;
|
||||
border: 0;
|
||||
background: none;
|
||||
color: var(--color-muted);
|
||||
font: inherit;
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tabs__item--active {
|
||||
@@ -122,6 +138,23 @@
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.page__map {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
min-height: 280px;
|
||||
margin: 0 -16px;
|
||||
}
|
||||
|
||||
.page__map > app-city-map {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.page__map--off {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.filters {
|
||||
gap: 8px;
|
||||
margin-top: 16px;
|
||||
@@ -173,8 +206,7 @@
|
||||
height: 112px;
|
||||
overflow: hidden;
|
||||
background:
|
||||
radial-gradient(circle at 50% 42%, rgb(255 255 255 / 5%), rgb(255 255 255 / 0%) 70%),
|
||||
#1a1815;
|
||||
radial-gradient(circle at 50% 42%, rgb(255 255 255 / 5%), rgb(255 255 255 / 0%) 70%), #1a1815;
|
||||
}
|
||||
|
||||
.card__preview img {
|
||||
@@ -182,6 +214,7 @@
|
||||
z-index: 1;
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.card__rays {
|
||||
@@ -204,10 +237,22 @@
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.card__spark--a { top: 10px; left: 12px; }
|
||||
.card__spark--b { top: 14px; right: 14px; }
|
||||
.card__spark--c { bottom: 12px; left: 16px; }
|
||||
.card__spark--d { bottom: 14px; right: 12px; }
|
||||
.card__spark--a {
|
||||
top: 10px;
|
||||
left: 12px;
|
||||
}
|
||||
.card__spark--b {
|
||||
top: 14px;
|
||||
right: 14px;
|
||||
}
|
||||
.card__spark--c {
|
||||
bottom: 12px;
|
||||
left: 16px;
|
||||
}
|
||||
.card__spark--d {
|
||||
bottom: 14px;
|
||||
right: 12px;
|
||||
}
|
||||
|
||||
.card__preview--open {
|
||||
background: rgb(224 184 79 / 10%);
|
||||
+22
-5
@@ -2,24 +2,28 @@ import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@a
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { CityMap } from '../../map/city-map/city-map';
|
||||
import { CityCatalogService } from '../../root/services/city-catalog.service';
|
||||
import { Icon } from '../../shared/icon/icon';
|
||||
import { selectCollectedIdSet, selectOpenedCount, selectProgress } from '../../state';
|
||||
|
||||
type CollectionFilter = 'all' | 'open' | 'closed';
|
||||
type CityTab = 'objects' | 'map';
|
||||
|
||||
@Component({
|
||||
selector: 'app-collection-page',
|
||||
imports: [Icon, RouterLink],
|
||||
templateUrl: './collection-page.html',
|
||||
styleUrl: './collection-page.scss',
|
||||
selector: 'app-city-page',
|
||||
imports: [Icon, RouterLink, CityMap],
|
||||
templateUrl: './city-page.html',
|
||||
styleUrl: './city-page.scss',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class CollectionPage {
|
||||
export class CityPage {
|
||||
private readonly catalog = inject(CityCatalogService);
|
||||
private readonly store = inject(Store);
|
||||
|
||||
protected readonly city = this.catalog.city;
|
||||
protected readonly tab = signal<CityTab>('objects');
|
||||
protected readonly mapReady = signal(false);
|
||||
protected readonly filter = signal<CollectionFilter>('all');
|
||||
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
|
||||
protected readonly openedCount = this.store.selectSignal(selectOpenedCount);
|
||||
@@ -55,4 +59,17 @@ export class CollectionPage {
|
||||
strong: index % 2 === 0,
|
||||
};
|
||||
});
|
||||
|
||||
protected openObjects(): void {
|
||||
this.tab.set('objects');
|
||||
}
|
||||
|
||||
protected openMap(): void {
|
||||
this.mapReady.set(true);
|
||||
this.tab.set('map');
|
||||
}
|
||||
|
||||
protected objectRoute(id: string): string[] {
|
||||
return this.collectedIds().has(id) ? ['/items', id, 'icon'] : ['/items', id];
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
<section class="page">
|
||||
<header class="page__top">
|
||||
<a class="page__back" routerLink="/" aria-label="Назад">
|
||||
<app-icon name="chevron-left" [size]="22" />
|
||||
</a>
|
||||
<span class="page__title">Коллекция</span>
|
||||
<header class="account">
|
||||
<p class="account__email">{{ accountEmail() }}</p>
|
||||
<button class="account__logout" type="button" aria-label="Выйти" (click)="logout()">
|
||||
<app-icon name="logout" [size]="22" />
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<div class="page__intro">
|
||||
@@ -20,94 +20,48 @@
|
||||
<b>1</b>
|
||||
<span>город</span>
|
||||
</div>
|
||||
<div>
|
||||
<b>1</b>
|
||||
<span>страна</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="tabs">
|
||||
<button type="button" [class.tabs__item--active]="tab() === 'russia'" (click)="tab.set('russia')">
|
||||
Россия
|
||||
</button>
|
||||
<button type="button" [class.tabs__item--active]="tab() === 'world'" (click)="tab.set('world')">
|
||||
Страны мира
|
||||
</button>
|
||||
</div>
|
||||
<p class="section-label">Мои города</p>
|
||||
|
||||
@if (tab() === 'russia') {
|
||||
<label class="search">
|
||||
<app-icon name="search" [size]="22" />
|
||||
<input
|
||||
type="search"
|
||||
placeholder="Найти город"
|
||||
[value]="query()"
|
||||
(input)="onQuery($event)"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<p class="section-label">Мои города</p>
|
||||
|
||||
@if (cityVisible()) {
|
||||
<a class="pack" routerLink="/collection">
|
||||
<div class="pack__head">
|
||||
<div>
|
||||
<h2>{{ city.name }}</h2>
|
||||
<p>Собрано {{ openedCount() }} из {{ totalCount }}</p>
|
||||
</div>
|
||||
<div
|
||||
class="pack__percent anim-percent"
|
||||
[style.--to-p]="progress()"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<span>{{ progress() }}%</span>
|
||||
</div>
|
||||
<span class="pack__go" aria-hidden="true">
|
||||
<app-icon name="chevron-right" [size]="20" />
|
||||
</span>
|
||||
@if (collectedLandmarks().length > 0) {
|
||||
<article class="pack">
|
||||
<a class="pack__head" routerLink="/city" [attr.aria-label]="'Объекты: ' + city.name">
|
||||
<div>
|
||||
<h2>{{ city.name }}</h2>
|
||||
<p>Собрано {{ openedCount() }} из {{ totalCount }}</p>
|
||||
</div>
|
||||
|
||||
<div class="pack__bar" aria-hidden="true">
|
||||
<span
|
||||
class="anim-grow"
|
||||
[style.--from]="'0%'"
|
||||
[style.--to]="progress() + '%'"
|
||||
></span>
|
||||
</div>
|
||||
|
||||
<div class="pack__cells">
|
||||
@for (landmark of city.objects; track landmark.id) {
|
||||
<span class="pack__stamp" [class.pack__stamp--open]="collectedIds().has(landmark.id)">
|
||||
<img
|
||||
[src]="collectedIds().has(landmark.id) ? '/assets/icons/gorodar-mark.svg' : '/assets/icons/cell-lock.svg'"
|
||||
alt=""
|
||||
/>
|
||||
</span>
|
||||
}
|
||||
<div class="pack__percent anim-percent" [style.--to-p]="progress()" aria-hidden="true">
|
||||
<span>{{ progress() }}%</span>
|
||||
</div>
|
||||
<span class="pack__go" aria-hidden="true">
|
||||
<app-icon name="chevron-right" [size]="20" />
|
||||
</span>
|
||||
</a>
|
||||
} @else {
|
||||
<p class="empty">Город не найден.</p>
|
||||
}
|
||||
|
||||
<div class="pack__bar" aria-hidden="true">
|
||||
<span class="anim-grow" [style.--from]="'0%'" [style.--to]="progress() + '%'"></span>
|
||||
</div>
|
||||
|
||||
<div class="picked">
|
||||
@for (landmark of collectedLandmarks(); track landmark.id) {
|
||||
<a class="picked__card" [routerLink]="objectRoute(landmark.id)">
|
||||
<div class="picked__preview">
|
||||
<img [src]="landmark.achievement" alt="" />
|
||||
</div>
|
||||
<div class="picked__body">
|
||||
<h3>{{ landmark.title }}</h3>
|
||||
<span>
|
||||
<app-icon name="check" [size]="15" />
|
||||
Получен
|
||||
</span>
|
||||
</div>
|
||||
<span class="picked__bar" aria-hidden="true"></span>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</article>
|
||||
} @else {
|
||||
<label class="search">
|
||||
<app-icon name="search" [size]="22" />
|
||||
<input type="search" placeholder="Найти страну" disabled />
|
||||
</label>
|
||||
|
||||
<button type="button" class="country" (click)="tab.set('russia')">
|
||||
<span class="country__mark" aria-hidden="true">
|
||||
<app-icon name="globe" [size]="28" />
|
||||
</span>
|
||||
<span class="country__body">
|
||||
<b>Россия</b>
|
||||
<span>Городов: 1 · Собрано {{ openedCount() }} из {{ totalCount }}</span>
|
||||
</span>
|
||||
<span class="pack__go" aria-hidden="true">
|
||||
<app-icon name="chevron-right" [size]="20" />
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<p class="empty">Пока в Городаре одна страна — Россия. Коллекции других стран появятся позже.</p>
|
||||
<p class="empty">Пока нет полученных объектов.</p>
|
||||
}
|
||||
</section>
|
||||
|
||||
@@ -9,33 +9,37 @@
|
||||
padding: 16px 16px 24px;
|
||||
}
|
||||
|
||||
.page__top {
|
||||
position: relative;
|
||||
.account {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
min-height: 44px;
|
||||
}
|
||||
|
||||
.page__back {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
.account__email {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
color: var(--color-text);
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.account__logout {
|
||||
display: flex;
|
||||
flex: none;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
padding: 0;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 14px;
|
||||
background: rgb(28 26 23 / 86%);
|
||||
background: var(--color-surface);
|
||||
color: var(--color-text);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.page__title {
|
||||
color: var(--color-muted);
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.page__intro {
|
||||
@@ -43,8 +47,7 @@
|
||||
}
|
||||
|
||||
.page__intro h1,
|
||||
.summary b,
|
||||
.country b {
|
||||
.summary b {
|
||||
margin: 0;
|
||||
font-family: var(--font-display);
|
||||
font-weight: 700;
|
||||
@@ -70,16 +73,14 @@
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.summary,
|
||||
.search,
|
||||
.country {
|
||||
.summary {
|
||||
border: 1px solid var(--color-border);
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
.summary {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 8px;
|
||||
margin-top: 16px;
|
||||
padding: 18px 16px;
|
||||
@@ -92,106 +93,73 @@
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.tabs,
|
||||
.search,
|
||||
.country {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.tabs {
|
||||
gap: 8px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.tabs button {
|
||||
min-height: 44px;
|
||||
padding: 0 20px;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 22px;
|
||||
background: var(--color-surface);
|
||||
color: var(--color-text);
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tabs button.tabs__item--active {
|
||||
border-color: var(--color-accent);
|
||||
background: var(--color-accent);
|
||||
color: var(--color-on-accent);
|
||||
}
|
||||
|
||||
.search {
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
height: 52px;
|
||||
margin-top: 16px;
|
||||
padding: 0 18px;
|
||||
border-radius: 26px;
|
||||
color: var(--color-muted);
|
||||
}
|
||||
|
||||
.search input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 100%;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--color-text);
|
||||
font: inherit;
|
||||
font-size: 16px;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.section-label {
|
||||
margin: 20px 0 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.country {
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
width: 100%;
|
||||
margin-top: 16px;
|
||||
padding: 18px 16px;
|
||||
border-radius: 24px;
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.country__mark {
|
||||
display: flex;
|
||||
flex: none;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border: 1.5px solid var(--color-accent);
|
||||
background: rgb(224 184 79 / 7%);
|
||||
color: var(--color-accent-soft);
|
||||
}
|
||||
|
||||
.country__body {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.country__body b {
|
||||
display: block;
|
||||
font-size: 22px;
|
||||
line-height: 1.15;
|
||||
}
|
||||
|
||||
.country__body span {
|
||||
display: block;
|
||||
margin-top: 4px;
|
||||
color: var(--color-muted);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.empty {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.picked {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.picked__card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 16px;
|
||||
background: #141210;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.picked__preview {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 148px;
|
||||
background: rgb(224 184 79 / 8%);
|
||||
}
|
||||
|
||||
.picked__preview img {
|
||||
width: 112px;
|
||||
height: 112px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.picked__body {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.picked__body h3 {
|
||||
margin: 0;
|
||||
min-height: 38px;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.picked__body span {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
color: var(--color-accent-soft);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.picked__bar {
|
||||
height: 4px;
|
||||
background: var(--color-accent);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';
|
||||
import { afterNextRender, ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { AuthPromptService } from '../../auth/auth-prompt.service';
|
||||
import { AuthService } from '../../auth/auth.service';
|
||||
import { CityCatalogService } from '../../root/services/city-catalog.service';
|
||||
import { Icon } from '../../shared/icon/icon';
|
||||
import { selectCollectedIdSet, selectOpenedCount, selectProgress } from '../../state';
|
||||
import { selectCollectedIdSet, selectOpenedCount, selectProfile, selectProgress } from '../../state';
|
||||
|
||||
@Component({
|
||||
selector: 'app-collections-page',
|
||||
@@ -16,24 +18,38 @@ import { selectCollectedIdSet, selectOpenedCount, selectProgress } from '../../s
|
||||
export class CollectionsPage {
|
||||
private readonly catalog = inject(CityCatalogService);
|
||||
private readonly store = inject(Store);
|
||||
private readonly auth = inject(AuthService);
|
||||
private readonly authPrompt = inject(AuthPromptService);
|
||||
|
||||
protected readonly city = this.catalog.city;
|
||||
protected readonly profile = this.store.selectSignal(selectProfile);
|
||||
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
|
||||
protected readonly openedCount = this.store.selectSignal(selectOpenedCount);
|
||||
protected readonly totalCount = this.city.objects.length;
|
||||
protected readonly query = signal('');
|
||||
protected readonly tab = signal<'russia' | 'world'>('russia');
|
||||
protected readonly progress = this.store.selectSignal(selectProgress);
|
||||
protected readonly cityVisible = computed(() => {
|
||||
const query = this.query().trim().toLowerCase();
|
||||
return !query || this.city.name.toLowerCase().includes(query);
|
||||
});
|
||||
protected readonly accountEmail = computed(() =>
|
||||
this.auth.authenticated() ? this.auth.email() : this.profile().email,
|
||||
);
|
||||
protected readonly collectedLandmarks = computed(() =>
|
||||
this.city.objects.filter((item) => this.collectedIds().has(item.id)),
|
||||
);
|
||||
|
||||
constructor() {
|
||||
afterNextRender(() => {
|
||||
void this.authPrompt.prompt('collection');
|
||||
});
|
||||
}
|
||||
|
||||
protected readonly objectsLabel = computed(() =>
|
||||
this.plural(this.openedCount(), ['объект', 'объекта', 'объектов']),
|
||||
);
|
||||
|
||||
protected onQuery(event: Event): void {
|
||||
this.query.set((event.target as HTMLInputElement).value);
|
||||
protected objectRoute(id: string): string[] {
|
||||
return this.collectedIds().has(id) ? ['/items', id, 'icon'] : ['/items', id];
|
||||
}
|
||||
|
||||
protected logout(): void {
|
||||
this.auth.logout();
|
||||
}
|
||||
|
||||
private plural(count: number, forms: [string, string, string]): string {
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
@if (landmark(); as item) {
|
||||
@if (collected()) {
|
||||
<app-collect-success
|
||||
mode="preview"
|
||||
[title]="item.title"
|
||||
[image]="item.achievement"
|
||||
[model]="item.model"
|
||||
/>
|
||||
}
|
||||
} @else {
|
||||
<section class="missing">
|
||||
<p>Объект не найден.</p>
|
||||
<a routerLink="/city">К списку объектов</a>
|
||||
</section>
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
:host {
|
||||
display: block;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.missing {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
align-items: flex-start;
|
||||
width: min(100%, var(--page-max-width));
|
||||
margin: 0 auto;
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.missing p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.missing a {
|
||||
color: var(--color-accent-soft);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { ChangeDetectionStrategy, Component, computed, effect, inject, input } from '@angular/core';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { CollectSuccess } from '../../claim/collect-success/collect-success';
|
||||
import { CityCatalogService } from '../../root/services/city-catalog.service';
|
||||
import { selectCollectedIdSet } from '../../state';
|
||||
|
||||
@Component({
|
||||
selector: 'app-icon-preview-page',
|
||||
imports: [CollectSuccess, RouterLink],
|
||||
templateUrl: './icon-preview-page.html',
|
||||
styleUrl: './icon-preview-page.scss',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class IconPreviewPage {
|
||||
private readonly catalog = inject(CityCatalogService);
|
||||
private readonly store = inject(Store);
|
||||
private readonly router = inject(Router);
|
||||
private readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
|
||||
|
||||
readonly id = input.required<string>();
|
||||
|
||||
protected readonly landmark = computed(() => this.catalog.landmarkById(this.id()));
|
||||
protected readonly collected = computed(() => {
|
||||
const item = this.landmark();
|
||||
return item ? this.collectedIds().has(item.id) : false;
|
||||
});
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const item = this.landmark();
|
||||
|
||||
if (!item || this.collectedIds().has(item.id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
void this.router.navigate(['/items', item.id], { replaceUrl: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
} @else {
|
||||
<article class="object" [class.object--owned]="collected()">
|
||||
<header class="object__hero">
|
||||
<img class="object__hero-img" src="/assets/illustrations/object-hero.svg" alt="" />
|
||||
<img class="object__hero-img" [src]="item.background" alt="" />
|
||||
<button class="object__back" type="button" aria-label="Назад" (click)="goBack()">
|
||||
<app-icon name="chevron-left" [size]="22" />
|
||||
</button>
|
||||
@@ -36,6 +36,11 @@
|
||||
<p>{{ item.description }}</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Аудиогид</h2>
|
||||
<app-audio-guide [src]="item.audio" />
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Интересные факты</h2>
|
||||
<ol class="facts">
|
||||
@@ -67,25 +72,7 @@
|
||||
Этот объект уже в вашей коллекции. Повторно его получить нельзя.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<a class="object__map" routerLink="/map">
|
||||
<app-icon name="pin" [size]="20" />
|
||||
Показать на карте
|
||||
</a>
|
||||
} @else {
|
||||
<section>
|
||||
<h2>Примеры фото</h2>
|
||||
<div class="photos">
|
||||
@for (photo of photoExamples; track photo.label) {
|
||||
<figure>
|
||||
<img [src]="photo.src" [alt]="photo.label" />
|
||||
<span>{{ photo.label }}</span>
|
||||
</figure>
|
||||
}
|
||||
</div>
|
||||
<p class="object__hint">{{ item.photoHint }}</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Как забрать</h2>
|
||||
<ol class="steps">
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
import { Location } from '@angular/common';
|
||||
import { ChangeDetectionStrategy, Component, computed, HostListener, inject, input, signal } from '@angular/core';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import {
|
||||
ChangeDetectionStrategy,
|
||||
Component,
|
||||
computed,
|
||||
HostListener,
|
||||
inject,
|
||||
input,
|
||||
signal,
|
||||
} from '@angular/core';
|
||||
import { MatButton } from '@angular/material/button';
|
||||
import { Router } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { AuthPromptService } from '../../auth/auth-prompt.service';
|
||||
import { ClaimFlow } from '../../claim/claim-flow/claim-flow';
|
||||
import { CityCatalogService } from '../../root/services/city-catalog.service';
|
||||
import { AudioGuide } from '../../shared/audio-guide/audio-guide';
|
||||
import { Icon } from '../../shared/icon/icon';
|
||||
import {
|
||||
GorodarActions,
|
||||
@@ -17,7 +27,7 @@ import {
|
||||
|
||||
@Component({
|
||||
selector: 'app-map-item-page',
|
||||
imports: [MatButton, Icon, ClaimFlow, RouterLink],
|
||||
imports: [MatButton, Icon, ClaimFlow, AudioGuide],
|
||||
templateUrl: './map-item-page.html',
|
||||
styleUrl: './map-item-page.scss',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
@@ -27,6 +37,7 @@ export class MapItemPage {
|
||||
private readonly store = inject(Store);
|
||||
private readonly location = inject(Location);
|
||||
private readonly router = inject(Router);
|
||||
private readonly authPrompt = inject(AuthPromptService);
|
||||
|
||||
readonly id = input.required<string>();
|
||||
|
||||
@@ -72,11 +83,6 @@ export class MapItemPage {
|
||||
return claim.landmarkId === this.id() && claim.stage !== 'idle';
|
||||
});
|
||||
|
||||
protected readonly photoExamples = [
|
||||
{ label: 'Днём', src: '/assets/illustrations/photo-day.svg' },
|
||||
{ label: 'Вечером', src: '/assets/illustrations/photo-evening.svg' },
|
||||
{ label: 'Зимой', src: '/assets/illustrations/photo-winter.svg' },
|
||||
];
|
||||
protected readonly photoOpen = signal(false);
|
||||
|
||||
protected goBack(): void {
|
||||
@@ -85,11 +91,17 @@ export class MapItemPage {
|
||||
return;
|
||||
}
|
||||
|
||||
void this.router.navigateByUrl('/map');
|
||||
void this.router.navigateByUrl('/city');
|
||||
}
|
||||
|
||||
protected claimItem(): void {
|
||||
this.store.dispatch(GorodarActions.takePhoto({ landmarkId: this.id() }));
|
||||
void this.authPrompt.prompt('claim').then((result) => {
|
||||
if (result !== 'authenticated') {
|
||||
return;
|
||||
}
|
||||
|
||||
this.store.dispatch(GorodarActions.takePhoto({ landmarkId: this.id() }));
|
||||
});
|
||||
}
|
||||
|
||||
protected openPhoto(): void {
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
<section class="page">
|
||||
<header class="page__top">
|
||||
<a class="page__back" routerLink="/" aria-label="Назад">
|
||||
<app-icon name="chevron-left" [size]="22" />
|
||||
</a>
|
||||
<span class="page__title">Профиль</span>
|
||||
</header>
|
||||
|
||||
<div class="hero">
|
||||
<div class="hero__avatar" aria-hidden="true">{{ initial() }}</div>
|
||||
<h1>{{ profile().displayName }}</h1>
|
||||
<p>
|
||||
<app-icon name="pin" [size]="18" />
|
||||
{{ profile().city }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<section class="collections">
|
||||
<h2>Коллекции</h2>
|
||||
<p>Пока доступна коллекция Нижнего Новгорода. Другие города появятся позже.</p>
|
||||
|
||||
<a class="pack" routerLink="/collection">
|
||||
<div class="pack__head">
|
||||
<div>
|
||||
<h3>{{ city.name }}</h3>
|
||||
<p>Собрано {{ openedCount() }} из {{ totalCount }}</p>
|
||||
</div>
|
||||
<div
|
||||
class="pack__percent anim-percent"
|
||||
[style.--to-p]="progress()"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<span>{{ progress() }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pack__bar" aria-hidden="true">
|
||||
<span
|
||||
class="anim-grow"
|
||||
[style.--from]="'0%'"
|
||||
[style.--to]="progress() + '%'"
|
||||
></span>
|
||||
</div>
|
||||
|
||||
<div class="pack__cells">
|
||||
@for (landmark of city.objects; track landmark.id) {
|
||||
<span class="pack__stamp" [class.pack__stamp--open]="collectedIds().has(landmark.id)">
|
||||
<img
|
||||
[src]="collectedIds().has(landmark.id) ? '/assets/icons/gorodar-mark.svg' : '/assets/icons/cell-lock.svg'"
|
||||
alt=""
|
||||
/>
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
</a>
|
||||
</section>
|
||||
|
||||
<ul class="info">
|
||||
<li>
|
||||
<span>Имя</span>
|
||||
<b>{{ profile().firstName }} {{ profile().lastName }}</b>
|
||||
</li>
|
||||
<li>
|
||||
<span>Город</span>
|
||||
<b>{{ profile().city }}</b>
|
||||
</li>
|
||||
<li>
|
||||
<span>Почта</span>
|
||||
<b>{{ profile().email }}</b>
|
||||
</li>
|
||||
<li>
|
||||
<span>Телефон</span>
|
||||
<b>{{ profile().phone }}</b>
|
||||
</li>
|
||||
<li>
|
||||
<span>В Городаре с</span>
|
||||
<b>{{ profile().joinedLabel }}</b>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
@@ -1,147 +0,0 @@
|
||||
:host {
|
||||
display: block;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.page {
|
||||
width: 100%;
|
||||
max-width: var(--page-max-width);
|
||||
margin: 0 auto;
|
||||
padding: 16px 16px 24px;
|
||||
}
|
||||
|
||||
.page__top,
|
||||
.hero p {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.page__top {
|
||||
position: relative;
|
||||
justify-content: center;
|
||||
min-height: 44px;
|
||||
}
|
||||
|
||||
.page__back {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 14px;
|
||||
background: rgb(28 26 23 / 86%);
|
||||
color: var(--color-text);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.page__title {
|
||||
color: var(--color-text-soft);
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.hero {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-top: 28px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.hero__avatar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
border: 1.5px solid var(--color-accent);
|
||||
border-radius: 48px;
|
||||
background: radial-gradient(circle at 50% 38%, rgb(224 184 79 / 22%), rgb(224 184 79 / 4%) 72%),
|
||||
var(--color-surface);
|
||||
color: var(--color-accent-soft);
|
||||
font-family: var(--font-display);
|
||||
font-size: 40px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.hero h1 {
|
||||
margin: 16px 0 0;
|
||||
font-family: var(--font-display);
|
||||
font-size: clamp(28px, 7vw, 34px);
|
||||
font-weight: 700;
|
||||
line-height: 1.12;
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
|
||||
.hero p {
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
margin: 10px 0 0;
|
||||
color: var(--color-muted);
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.hero p app-icon {
|
||||
color: var(--color-accent);
|
||||
}
|
||||
|
||||
.collections {
|
||||
margin-top: 28px;
|
||||
}
|
||||
|
||||
.collections h2 {
|
||||
margin: 0;
|
||||
font-family: var(--font-display);
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.collections > p {
|
||||
margin: 6px 0 0;
|
||||
color: var(--color-muted);
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.pack {
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
margin: 16px 0 0;
|
||||
padding: 4px 16px;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 20px;
|
||||
background: var(--color-surface);
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.info li {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
padding: 14px 0;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
.info li:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.info span {
|
||||
color: var(--color-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.info b {
|
||||
color: var(--color-text);
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { CityCatalogService } from '../../root/services/city-catalog.service';
|
||||
import { Icon } from '../../shared/icon/icon';
|
||||
import { selectCollectedIdSet, selectOpenedCount, selectProfile, selectProgress } from '../../state';
|
||||
|
||||
@Component({
|
||||
selector: 'app-profile-page',
|
||||
imports: [Icon, RouterLink],
|
||||
templateUrl: './profile-page.html',
|
||||
styleUrl: './profile-page.scss',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class ProfilePage {
|
||||
private readonly catalog = inject(CityCatalogService);
|
||||
private readonly store = inject(Store);
|
||||
|
||||
protected readonly city = this.catalog.city;
|
||||
protected readonly profile = this.store.selectSignal(selectProfile);
|
||||
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
|
||||
protected readonly openedCount = this.store.selectSignal(selectOpenedCount);
|
||||
protected readonly totalCount = this.city.objects.length;
|
||||
protected readonly progress = this.store.selectSignal(selectProgress);
|
||||
protected readonly initial = computed(() => this.profile().firstName.slice(0, 1));
|
||||
}
|
||||
Reference in New Issue
Block a user