add pages
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<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>
|
||||
<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">
|
||||
<div class="city-card__top">
|
||||
<div>
|
||||
<h2>{{ city.name }}</h2>
|
||||
<p>
|
||||
Открыто
|
||||
<strong>{{ openedCount() }} из {{ totalCount }}</strong>
|
||||
объектов
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="city-card__percent" aria-hidden="true">{{ progress() }}%</div>
|
||||
</div>
|
||||
|
||||
<mat-progress-bar mode="determinate" [value]="progress()" />
|
||||
|
||||
<div class="city-card__cells">
|
||||
@for (landmark of city.objects; track landmark.id) {
|
||||
<a
|
||||
class="cell"
|
||||
[routerLink]="['/items', landmark.id]"
|
||||
[class.cell--open]="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'"
|
||||
[alt]=""
|
||||
/>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="city-card__actions">
|
||||
<a matButton="outlined" routerLink="/collection">Коллекция</a>
|
||||
<a matButton="filled" routerLink="/map">
|
||||
<app-icon name="pin" [size]="20" />
|
||||
На карте
|
||||
</a>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
@@ -0,0 +1,208 @@
|
||||
:host {
|
||||
display: block;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.page {
|
||||
width: min(100%, var(--page-max-width));
|
||||
margin: 0 auto;
|
||||
padding: 20px 16px 24px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.page__header,
|
||||
.page__brand,
|
||||
.page__all,
|
||||
.page__all-label,
|
||||
.city-card__top,
|
||||
.city-card__actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.page__header {
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.page__brand {
|
||||
gap: 10px;
|
||||
color: var(--color-accent);
|
||||
font-size: 26px;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
|
||||
.page__mark {
|
||||
display: block;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
}
|
||||
|
||||
.page__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;
|
||||
}
|
||||
|
||||
.page__intro h1,
|
||||
.city-card h2 {
|
||||
margin: 0;
|
||||
font-family: var(--font-display);
|
||||
font-size: clamp(28px, 6vw, 34px);
|
||||
font-weight: 700;
|
||||
line-height: 1.15;
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
|
||||
.page__intro p,
|
||||
.city-card p {
|
||||
margin: 6px 0 0;
|
||||
color: var(--color-muted);
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.page__all,
|
||||
.city-card {
|
||||
border: 1px solid var(--color-border);
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
.page__all {
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
min-height: 56px;
|
||||
margin-bottom: 16px;
|
||||
padding: 0 16px;
|
||||
border-radius: 16px;
|
||||
color: var(--color-text);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.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 {
|
||||
padding: 16px;
|
||||
border-radius: 24px;
|
||||
}
|
||||
|
||||
.city-card__top {
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.city-card strong,
|
||||
.city-card__percent {
|
||||
color: var(--color-text);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.city-card__percent {
|
||||
display: flex;
|
||||
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 {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
gap: 6px;
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
.cell {
|
||||
display: block;
|
||||
aspect-ratio: 1;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 10px;
|
||||
background: #171512;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.cell img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.cell--open {
|
||||
background: rgb(224 184 79 / 10%);
|
||||
box-shadow: inset 0 0 0 1.5px var(--color-accent);
|
||||
}
|
||||
|
||||
.city-card__actions {
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.city-card__actions a {
|
||||
flex: 1 1 0;
|
||||
min-width: 0;
|
||||
min-height: 48px;
|
||||
}
|
||||
|
||||
.city-card__actions a[matButton='filled'] {
|
||||
gap: 8px;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
@media (max-width: 420px) {
|
||||
.city-card__actions {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.city-card__actions a {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 720px) {
|
||||
.page {
|
||||
padding-top: 32px;
|
||||
}
|
||||
|
||||
.city-card__cells {
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
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],
|
||||
templateUrl: './cities-page.html',
|
||||
styleUrl: './cities-page.scss',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class CitiesPage {
|
||||
private readonly catalog = inject(CityCatalogService);
|
||||
private readonly store = inject(Store);
|
||||
|
||||
protected readonly city = this.catalog.city;
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<section class="page">
|
||||
<header class="page__top">
|
||||
<a class="page__back" routerLink="/" aria-label="Назад">
|
||||
<app-icon name="chevron-left" [size]="22" />
|
||||
</a>
|
||||
<a class="page__all" routerLink="/collections">
|
||||
Вся коллекция
|
||||
<app-icon name="chevron-right" [size]="16" />
|
||||
</a>
|
||||
</header>
|
||||
|
||||
<div class="page__city">
|
||||
<img src="/assets/icons/gorodar-mark.svg" alt="" width="96" height="96" />
|
||||
<div>
|
||||
<h1>{{ city.name }}</h1>
|
||||
<p>
|
||||
<app-icon name="pin" [size]="18" />
|
||||
<span>
|
||||
<b>{{ openedCount() }}/{{ city.objects.length }}</b>
|
||||
объектов
|
||||
</span>
|
||||
<span>·</span>
|
||||
<b>{{ progress() }}%</b>
|
||||
</p>
|
||||
<div class="page__progress" aria-hidden="true">
|
||||
<span [style.width.%]="progress()"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<nav class="tabs" aria-label="Разделы города">
|
||||
<span class="tabs__item tabs__item--active">Объекты</span>
|
||||
<a class="tabs__item" routerLink="/map">На карте</a>
|
||||
</nav>
|
||||
|
||||
<div class="filters">
|
||||
<button
|
||||
type="button"
|
||||
[class.filters__item--active]="filter() === 'all'"
|
||||
(click)="filter.set('all')"
|
||||
>
|
||||
Все · {{ city.objects.length }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
[class.filters__item--active]="filter() === 'open'"
|
||||
(click)="filter.set('open')"
|
||||
>
|
||||
Открыты · {{ openedCount() }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
[class.filters__item--active]="filter() === 'closed'"
|
||||
(click)="filter.set('closed')"
|
||||
>
|
||||
Закрыты · {{ closedCount() }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="grid">
|
||||
@for (landmark of landmarks(); track landmark.id) {
|
||||
<a class="card" [routerLink]="['/items', landmark.id]">
|
||||
<div class="card__preview" [class.card__preview--open]="collectedIds().has(landmark.id)">
|
||||
@if (collectedIds().has(landmark.id)) {
|
||||
<svg class="card__rays" viewBox="0 0 112 112" aria-hidden="true">
|
||||
@for (ray of rays; track $index) {
|
||||
<line
|
||||
[attr.x1]="ray.x1"
|
||||
[attr.y1]="ray.y1"
|
||||
[attr.x2]="ray.x2"
|
||||
[attr.y2]="ray.y2"
|
||||
stroke="#E0B84F"
|
||||
[attr.stroke-width]="ray.strong ? 2 : 1.2"
|
||||
[attr.opacity]="ray.strong ? 0.55 : 0.28"
|
||||
stroke-linecap="round"
|
||||
/>
|
||||
}
|
||||
</svg>
|
||||
<span class="card__spark card__spark--a"></span>
|
||||
<span class="card__spark card__spark--b"></span>
|
||||
<span class="card__spark card__spark--c"></span>
|
||||
<span class="card__spark card__spark--d"></span>
|
||||
}
|
||||
<img
|
||||
[src]="collectedIds().has(landmark.id) ? '/assets/icons/gorodar-mark.svg' : '/assets/icons/cell-lock.svg'"
|
||||
alt=""
|
||||
/>
|
||||
</div>
|
||||
<div class="card__body">
|
||||
<h2>{{ landmark.title }}</h2>
|
||||
<span class="card__status" [class.card__status--open]="collectedIds().has(landmark.id)">
|
||||
<app-icon [name]="collectedIds().has(landmark.id) ? 'check' : 'lock'" [size]="15" />
|
||||
{{ collectedIds().has(landmark.id) ? 'Получен' : 'Не получен' }}
|
||||
</span>
|
||||
</div>
|
||||
<span class="card__bar" [class.card__bar--open]="collectedIds().has(landmark.id)"></span>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
@@ -0,0 +1,286 @@
|
||||
:host {
|
||||
display: block;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.page {
|
||||
width: min(100%, 720px);
|
||||
margin: 0 auto;
|
||||
padding: 16px 16px 24px;
|
||||
}
|
||||
|
||||
.page__top,
|
||||
.page__city,
|
||||
.page__city p,
|
||||
.filters,
|
||||
.card__status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.page__top {
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.page__back,
|
||||
.page__all {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 44px;
|
||||
border: 1px solid var(--color-border);
|
||||
color: var(--color-text);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.page__back {
|
||||
justify-content: center;
|
||||
width: 44px;
|
||||
border-radius: 14px;
|
||||
background: rgb(28 26 23 / 86%);
|
||||
}
|
||||
|
||||
.page__all {
|
||||
gap: 4px;
|
||||
padding: 0 12px 0 16px;
|
||||
border-color: var(--color-accent-strong);
|
||||
border-radius: 22px;
|
||||
background: var(--color-surface);
|
||||
color: var(--color-accent-soft);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.page__city {
|
||||
gap: 16px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.page__city img {
|
||||
flex: none;
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
}
|
||||
|
||||
.page__city > div {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.page__city h1 {
|
||||
margin: 0;
|
||||
font-family: var(--font-display);
|
||||
font-size: clamp(26px, 7vw, 34px);
|
||||
font-weight: 700;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.page__city p {
|
||||
gap: 8px;
|
||||
margin: 8px 0 0;
|
||||
color: var(--color-muted);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.page__city b {
|
||||
color: var(--color-text);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.page__progress {
|
||||
height: 6px;
|
||||
margin-top: 12px;
|
||||
overflow: hidden;
|
||||
border-radius: 3px;
|
||||
background: #3a352d;
|
||||
}
|
||||
|
||||
.page__progress span {
|
||||
display: block;
|
||||
height: 100%;
|
||||
background: var(--color-accent);
|
||||
}
|
||||
|
||||
.tabs {
|
||||
display: flex;
|
||||
gap: 28px;
|
||||
margin-top: 22px;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
.tabs__item {
|
||||
padding: 10px 0;
|
||||
color: var(--color-muted);
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.tabs__item--active {
|
||||
margin-bottom: -1px;
|
||||
border-bottom: 3px solid var(--color-accent);
|
||||
color: var(--color-text);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.filters {
|
||||
gap: 8px;
|
||||
margin-top: 16px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.filters button {
|
||||
flex: none;
|
||||
min-height: 44px;
|
||||
padding: 0 16px;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 22px;
|
||||
background: var(--color-surface);
|
||||
color: var(--color-text);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.filters button.filters__item--active {
|
||||
border-color: var(--color-accent);
|
||||
background: var(--color-accent);
|
||||
color: var(--color-on-accent);
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 16px;
|
||||
background: var(--color-surface);
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.card__preview {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 112px;
|
||||
overflow: hidden;
|
||||
background:
|
||||
radial-gradient(circle at 50% 42%, rgb(255 255 255 / 5%), rgb(255 255 255 / 0%) 70%),
|
||||
#1a1815;
|
||||
}
|
||||
|
||||
.card__preview img {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
}
|
||||
|
||||
.card__rays {
|
||||
position: absolute;
|
||||
inset: -12px;
|
||||
width: calc(100% + 24px);
|
||||
height: calc(100% + 24px);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.card__spark {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
opacity: 0;
|
||||
background: var(--color-accent-soft);
|
||||
clip-path: polygon(50% 0, 65% 35%, 100% 50%, 65% 65%, 50% 100%, 35% 65%, 0 50%, 35% 35%);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.card__spark--a { top: 10px; left: 12px; }
|
||||
.card__spark--b { top: 14px; right: 14px; }
|
||||
.card__spark--c { bottom: 12px; left: 16px; }
|
||||
.card__spark--d { bottom: 14px; right: 12px; }
|
||||
|
||||
.card__preview--open {
|
||||
background: rgb(224 184 79 / 10%);
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
.card:hover .card__preview--open .card__rays {
|
||||
opacity: 1;
|
||||
animation: spin 12s linear infinite;
|
||||
}
|
||||
|
||||
.card:hover .card__preview--open img {
|
||||
animation: pop 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.2);
|
||||
}
|
||||
|
||||
.card:hover .card__preview--open .card__spark {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@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 {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.card__body h2 {
|
||||
margin: 0;
|
||||
min-height: 38px;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.card__status {
|
||||
gap: 6px;
|
||||
color: var(--color-muted);
|
||||
font-size: 13px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.card__status--open {
|
||||
color: var(--color-accent-soft);
|
||||
}
|
||||
|
||||
.card__bar {
|
||||
height: 4px;
|
||||
background: #2e2a24;
|
||||
}
|
||||
|
||||
.card__bar--open {
|
||||
background: var(--color-accent);
|
||||
}
|
||||
|
||||
@media (max-width: 380px) {
|
||||
.grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { CityCatalogService } from '../../root/services/city-catalog.service';
|
||||
import { Icon } from '../../shared/icon/icon';
|
||||
import { selectCollectedIdSet, selectOpenedCount, selectProgress } from '../../state';
|
||||
|
||||
type CollectionFilter = 'all' | 'open' | 'closed';
|
||||
|
||||
@Component({
|
||||
selector: 'app-collection-page',
|
||||
imports: [Icon, RouterLink],
|
||||
templateUrl: './collection-page.html',
|
||||
styleUrl: './collection-page.scss',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class CollectionPage {
|
||||
private readonly catalog = inject(CityCatalogService);
|
||||
private readonly store = inject(Store);
|
||||
|
||||
protected readonly city = this.catalog.city;
|
||||
protected readonly filter = signal<CollectionFilter>('all');
|
||||
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
|
||||
protected readonly openedCount = this.store.selectSignal(selectOpenedCount);
|
||||
protected readonly progress = this.store.selectSignal(selectProgress);
|
||||
protected readonly closedCount = computed(
|
||||
() => this.city.objects.length - this.openedCount(),
|
||||
);
|
||||
protected readonly landmarks = computed(() => {
|
||||
const items = this.city.objects;
|
||||
const ids = this.collectedIds();
|
||||
|
||||
switch (this.filter()) {
|
||||
case 'open':
|
||||
return items.filter((item) => ids.has(item.id));
|
||||
case 'closed':
|
||||
return items.filter((item) => !ids.has(item.id));
|
||||
default:
|
||||
return items;
|
||||
}
|
||||
});
|
||||
|
||||
protected readonly rays = Array.from({ length: 16 }, (_, index) => {
|
||||
const angle = (index / 16) * Math.PI * 2;
|
||||
const inner = 30;
|
||||
const outer = index % 2 === 0 ? 54 : 46;
|
||||
const center = 56;
|
||||
|
||||
return {
|
||||
x1: center + Math.cos(angle) * inner,
|
||||
y1: center + Math.sin(angle) * inner,
|
||||
x2: center + Math.cos(angle) * outer,
|
||||
y2: center + Math.sin(angle) * outer,
|
||||
strong: index % 2 === 0,
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
<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="page__intro">
|
||||
<h1>Вся коллекция</h1>
|
||||
<p>Достопримечательности по городам и странам</p>
|
||||
</div>
|
||||
|
||||
<section class="summary">
|
||||
<div>
|
||||
<b>{{ openedCount() }}</b>
|
||||
<span>{{ objectsLabel() }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<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>
|
||||
|
||||
@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>
|
||||
</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>
|
||||
} @else {
|
||||
<p class="empty">Город не найден.</p>
|
||||
}
|
||||
} @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>
|
||||
}
|
||||
</section>
|
||||
@@ -0,0 +1,197 @@
|
||||
:host {
|
||||
display: block;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.page {
|
||||
width: min(100%, var(--page-max-width));
|
||||
margin: 0 auto;
|
||||
padding: 16px 16px 24px;
|
||||
}
|
||||
|
||||
.page__top {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
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-muted);
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.page__intro {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.page__intro h1,
|
||||
.summary b,
|
||||
.country b {
|
||||
margin: 0;
|
||||
font-family: var(--font-display);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.summary {
|
||||
b {
|
||||
margin-right: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
.page__intro h1 {
|
||||
font-size: clamp(28px, 7vw, 34px);
|
||||
line-height: 1.15;
|
||||
}
|
||||
|
||||
.page__intro p,
|
||||
.section-label,
|
||||
.empty,
|
||||
.summary span {
|
||||
margin: 6px 0 0;
|
||||
color: var(--color-muted);
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.summary,
|
||||
.search,
|
||||
.country {
|
||||
border: 1px solid var(--color-border);
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
.summary {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 8px;
|
||||
margin-top: 16px;
|
||||
padding: 18px 16px;
|
||||
border-radius: 24px;
|
||||
}
|
||||
|
||||
.summary b {
|
||||
color: var(--color-accent-soft);
|
||||
font-size: 30px;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { CityCatalogService } from '../../root/services/city-catalog.service';
|
||||
import { Icon } from '../../shared/icon/icon';
|
||||
import { selectCollectedIdSet, selectOpenedCount, selectProgress } from '../../state';
|
||||
|
||||
@Component({
|
||||
selector: 'app-collections-page',
|
||||
imports: [Icon, RouterLink],
|
||||
templateUrl: './collections-page.html',
|
||||
styleUrl: './collections-page.scss',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class CollectionsPage {
|
||||
private readonly catalog = inject(CityCatalogService);
|
||||
private readonly store = inject(Store);
|
||||
|
||||
protected readonly city = this.catalog.city;
|
||||
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 objectsLabel = computed(() =>
|
||||
this.plural(this.openedCount(), ['объект', 'объекта', 'объектов']),
|
||||
);
|
||||
|
||||
protected onQuery(event: Event): void {
|
||||
this.query.set((event.target as HTMLInputElement).value);
|
||||
}
|
||||
|
||||
private plural(count: number, forms: [string, string, string]): string {
|
||||
const abs = Math.abs(count) % 100;
|
||||
const last = abs % 10;
|
||||
if (abs > 10 && abs < 20) {
|
||||
return forms[2];
|
||||
}
|
||||
if (last === 1) {
|
||||
return forms[0];
|
||||
}
|
||||
if (last >= 2 && last <= 4) {
|
||||
return forms[1];
|
||||
}
|
||||
return forms[2];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
@if (landmark(); as item) {
|
||||
@if (claiming()) {
|
||||
<app-claim-flow [landmark]="item" />
|
||||
} @else {
|
||||
<article class="object" [class.object--owned]="collected()">
|
||||
<header class="object__hero">
|
||||
<img class="object__hero-img" src="/assets/illustrations/object-hero.svg" alt="" />
|
||||
<button class="object__back" type="button" aria-label="Назад" (click)="goBack()">
|
||||
<app-icon name="chevron-left" [size]="22" />
|
||||
</button>
|
||||
<span class="object__city">{{ city.name }}</span>
|
||||
</header>
|
||||
|
||||
<div class="object__intro">
|
||||
<h1>{{ item.title }}</h1>
|
||||
|
||||
<div class="object__chips">
|
||||
<span class="chip" [class.chip--open]="collected()">
|
||||
<app-icon [name]="collected() ? 'check' : 'lock'" [size]="15" />
|
||||
{{ collectedLabel() }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="object__address">
|
||||
<app-icon name="pin" [size]="18" />
|
||||
<div>
|
||||
<p>{{ item.address }}</p>
|
||||
<span>{{ item.addressHint }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="object__body">
|
||||
<section>
|
||||
<h2>О месте</h2>
|
||||
<p>{{ item.description }}</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Интересные факты</h2>
|
||||
<ol class="facts">
|
||||
@for (fact of item.facts; track fact; let index = $index) {
|
||||
<li>
|
||||
<span>{{ index + 1 }}</span>
|
||||
{{ fact }}
|
||||
</li>
|
||||
}
|
||||
</ol>
|
||||
</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>
|
||||
|
||||
<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">
|
||||
<li>Приезжайте на место и найдите объект</li>
|
||||
<li>Нажмите «Забрать» и сфотографируйте объект</li>
|
||||
<li>Получите объект в свою коллекцию</li>
|
||||
</ol>
|
||||
</section>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (!collected()) {
|
||||
<footer class="object__bar">
|
||||
<button class="object__claim" matButton="filled" type="button" (click)="claimItem()">
|
||||
<app-icon name="camera" [size]="22" />
|
||||
Забрать
|
||||
</button>
|
||||
<p>Понадобится доступ к камере</p>
|
||||
</footer>
|
||||
}
|
||||
</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 {
|
||||
<section class="object object--empty">
|
||||
<p>Объект не найден.</p>
|
||||
<button matButton="outlined" type="button" (click)="goBack()">Назад</button>
|
||||
</section>
|
||||
}
|
||||
@@ -0,0 +1,286 @@
|
||||
:host {
|
||||
display: block;
|
||||
width: 100%;
|
||||
min-height: 100%;
|
||||
background: var(--color-bg);
|
||||
}
|
||||
|
||||
.object {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
max-width: var(--page-max-width);
|
||||
min-height: 100%;
|
||||
margin-inline: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
@media (min-width: 720px) {
|
||||
:host {
|
||||
padding: 24px 16px 32px;
|
||||
}
|
||||
|
||||
.object {
|
||||
min-height: auto;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 24px;
|
||||
background: var(--color-bg);
|
||||
}
|
||||
|
||||
.object__bar {
|
||||
border-radius: 0 0 24px 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.object__back,
|
||||
.object__city {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 16px;
|
||||
min-height: 44px;
|
||||
border: 1px solid var(--color-border);
|
||||
background: rgb(28 26 23 / 86%);
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.object__back {
|
||||
left: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 44px;
|
||||
padding: 0;
|
||||
border-radius: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.object__city {
|
||||
right: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
max-width: min(58%, 220px);
|
||||
padding: 0 14px;
|
||||
overflow: hidden;
|
||||
border-radius: 20px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.object__intro {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
margin-top: -44px;
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
.object__intro h1,
|
||||
.object__body h2,
|
||||
.facts span {
|
||||
margin: 0;
|
||||
font-family: var(--font-display);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.object__intro h1 {
|
||||
font-size: clamp(26px, 6.5vw, 32px);
|
||||
line-height: 1.12;
|
||||
letter-spacing: -0.03em;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.object__chips,
|
||||
.object__address,
|
||||
.facts li,
|
||||
.steps li {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.object__chips {
|
||||
flex-wrap: wrap;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.chip,
|
||||
.facts li {
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 16px;
|
||||
background: var(--color-surface-2);
|
||||
}
|
||||
|
||||
.chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 6px 12px;
|
||||
overflow: visible;
|
||||
color: var(--color-muted);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.chip--open {
|
||||
background: rgb(224 184 79 / 14%);
|
||||
border-color: var(--color-accent-strong);
|
||||
color: var(--color-accent-soft);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.object__address {
|
||||
align-items: center;
|
||||
margin-top: 16px;
|
||||
color: var(--color-accent);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.object__address p {
|
||||
margin: 0;
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.object__address span,
|
||||
.object__hint,
|
||||
.object__bar p {
|
||||
color: var(--color-muted);
|
||||
}
|
||||
|
||||
.object__body {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
gap: 28px;
|
||||
padding: 28px 16px 120px;
|
||||
}
|
||||
|
||||
.object--owned .object__body {
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
.object__body h2 {
|
||||
margin-bottom: 12px;
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.object__body p {
|
||||
margin: 0;
|
||||
color: var(--color-text-soft);
|
||||
font-size: 16px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.steps,
|
||||
.facts {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.steps {
|
||||
counter-reset: step;
|
||||
}
|
||||
|
||||
.steps li {
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.steps li::before {
|
||||
counter-increment: step;
|
||||
content: counter(step);
|
||||
display: flex;
|
||||
flex: none;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 1px solid var(--color-accent-strong);
|
||||
border-radius: 16px;
|
||||
color: var(--color-accent);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.facts {
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.facts li {
|
||||
align-items: flex-start;
|
||||
gap: 14px;
|
||||
padding: 14px 16px;
|
||||
background: var(--color-surface);
|
||||
font-size: 15px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.facts span {
|
||||
min-width: 18px;
|
||||
color: var(--color-accent);
|
||||
font-size: 24px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.object__hint {
|
||||
margin: 10px 0 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.object__body .object__hint {
|
||||
color: var(--color-muted);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.object__map {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
min-height: 52px;
|
||||
overflow: visible;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 16px;
|
||||
background: var(--color-surface-2);
|
||||
color: var(--color-text);
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.object__map app-icon {
|
||||
color: var(--color-accent);
|
||||
}
|
||||
|
||||
.object__bar {
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
|
||||
background: linear-gradient(to bottom, transparent, rgb(18 17 15 / 96%) 30%);
|
||||
}
|
||||
|
||||
.object__claim {
|
||||
width: 100%;
|
||||
min-height: 56px;
|
||||
overflow: visible;
|
||||
--mat-button-filled-container-shape: 16px;
|
||||
}
|
||||
|
||||
.object__bar p {
|
||||
margin: 8px 0 0;
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.object--empty {
|
||||
gap: 16px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 48px 16px;
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
import { Location } from '@angular/common';
|
||||
import { ChangeDetectionStrategy, Component, computed, HostListener, inject, input, signal } from '@angular/core';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { MatButton } from '@angular/material/button';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { ClaimFlow } from '../../claim/claim-flow/claim-flow';
|
||||
import { CityCatalogService } from '../../root/services/city-catalog.service';
|
||||
import { Icon } from '../../shared/icon/icon';
|
||||
import {
|
||||
GorodarActions,
|
||||
selectClaim,
|
||||
selectCollectedAt,
|
||||
selectCollectedIdSet,
|
||||
selectPhotos,
|
||||
} from '../../state';
|
||||
|
||||
@Component({
|
||||
selector: 'app-map-item-page',
|
||||
imports: [MatButton, Icon, ClaimFlow, RouterLink],
|
||||
templateUrl: './map-item-page.html',
|
||||
styleUrl: './map-item-page.scss',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class MapItemPage {
|
||||
private readonly catalog = inject(CityCatalogService);
|
||||
private readonly store = inject(Store);
|
||||
private readonly location = inject(Location);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
readonly id = input.required<string>();
|
||||
|
||||
protected readonly city = this.catalog.city;
|
||||
protected readonly landmark = computed(() => this.catalog.landmarkById(this.id()));
|
||||
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
|
||||
protected readonly photos = this.store.selectSignal(selectPhotos);
|
||||
protected readonly collectedAtMap = this.store.selectSignal(selectCollectedAt);
|
||||
protected readonly claim = this.store.selectSignal(selectClaim);
|
||||
|
||||
protected readonly collected = computed(() => {
|
||||
const item = this.landmark();
|
||||
return item ? this.collectedIds().has(item.id) || item.collected : false;
|
||||
});
|
||||
|
||||
protected readonly userPhoto = computed(() => {
|
||||
const item = this.landmark();
|
||||
return item ? (this.photos()[item.id] ?? null) : null;
|
||||
});
|
||||
|
||||
protected readonly collectedLabel = computed(() => {
|
||||
if (!this.collected()) {
|
||||
return 'Не получен';
|
||||
}
|
||||
|
||||
const item = this.landmark();
|
||||
const at = item ? this.collectedAtMap()[item.id] : undefined;
|
||||
|
||||
if (!at) {
|
||||
return 'Получен';
|
||||
}
|
||||
|
||||
const formatted = new Intl.DateTimeFormat('ru-RU', {
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
}).format(new Date(at));
|
||||
|
||||
return `Получено · ${formatted}`;
|
||||
});
|
||||
|
||||
protected readonly claiming = computed(() => {
|
||||
const claim = this.claim();
|
||||
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 {
|
||||
if (window.history.length > 1) {
|
||||
this.location.back();
|
||||
return;
|
||||
}
|
||||
|
||||
void this.router.navigateByUrl('/map');
|
||||
}
|
||||
|
||||
protected claimItem(): void {
|
||||
this.store.dispatch(GorodarActions.takePhoto({ 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 @@
|
||||
<app-city-map />
|
||||
@@ -0,0 +1,4 @@
|
||||
:host {
|
||||
display: block;
|
||||
height: 100%;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
|
||||
import { CityMap } from '../../map/city-map/city-map';
|
||||
|
||||
@Component({
|
||||
selector: 'app-map-page',
|
||||
imports: [CityMap],
|
||||
templateUrl: './map-page.html',
|
||||
styleUrl: './map-page.scss',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class MapPage {}
|
||||
@@ -0,0 +1,80 @@
|
||||
<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>
|
||||
@@ -0,0 +1,147 @@
|
||||
: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;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
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