update style
This commit is contained in:
+6
-7
@@ -1,6 +1,9 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
|
||||
"index": "/index.html",
|
||||
|
||||
"navigationUrls": ["/**", "!/admin", "!/admin/**"],
|
||||
|
||||
"assetGroups": [
|
||||
{
|
||||
"name": "app",
|
||||
@@ -22,19 +25,15 @@
|
||||
"installMode": "lazy",
|
||||
"updateMode": "prefetch",
|
||||
"resources": {
|
||||
"files": [
|
||||
"/**/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"
|
||||
]
|
||||
"files": ["/**/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"]
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"dataGroups": [
|
||||
{
|
||||
"name": "fonts",
|
||||
"urls": [
|
||||
"https://fonts.googleapis.com/**",
|
||||
"https://fonts.gstatic.com/**"
|
||||
],
|
||||
"urls": ["https://fonts.googleapis.com/**", "https://fonts.gstatic.com/**"],
|
||||
"cacheConfig": {
|
||||
"maxSize": 20,
|
||||
"maxAge": "30d",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@if (sheetVisible()) {
|
||||
<div class="sheet-root">
|
||||
<div class="sheet-root" [style.--drag-y.px]="dragY()">
|
||||
<button
|
||||
class="sheet-root__backdrop"
|
||||
type="button"
|
||||
@@ -7,7 +7,18 @@
|
||||
(click)="dismiss()"
|
||||
></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
|
||||
class="sheet__handle"
|
||||
type="button"
|
||||
@@ -42,7 +53,7 @@
|
||||
}
|
||||
|
||||
<button
|
||||
class="sheet__submit"
|
||||
class="btn sheet__submit"
|
||||
type="button"
|
||||
[disabled]="!emailValid() || pending()"
|
||||
(click)="requestCode()"
|
||||
@@ -76,7 +87,7 @@
|
||||
<button
|
||||
class="sheet__resend"
|
||||
type="button"
|
||||
[disabled]="resendSeconds() > 0 || pending()"
|
||||
[disabled]="secondsLeft() > 0 || pending()"
|
||||
(click)="resend()"
|
||||
>
|
||||
{{ resendLabel() }}
|
||||
@@ -87,7 +98,7 @@
|
||||
}
|
||||
|
||||
<button
|
||||
class="sheet__submit"
|
||||
class="btn sheet__submit"
|
||||
type="button"
|
||||
[disabled]="!codeReady() || pending()"
|
||||
(click)="confirm()"
|
||||
@@ -97,5 +108,6 @@
|
||||
<button class="sheet__ghost" type="button" (click)="changeEmail()">Изменить почту</button>
|
||||
}
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
:host {
|
||||
display: contents;
|
||||
}
|
||||
|
||||
.sheet-root {
|
||||
position: fixed;
|
||||
z-index: 70;
|
||||
@@ -13,32 +17,57 @@
|
||||
border: 0;
|
||||
background: rgb(8 7 6 / 64%);
|
||||
cursor: pointer;
|
||||
opacity: calc(1 - min(var(--drag-y, 0px), 280px) / 280px);
|
||||
}
|
||||
|
||||
.sheet {
|
||||
.sheet-pop {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: min(100%, 480px);
|
||||
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));
|
||||
border: 1px solid var(--color-border);
|
||||
border-bottom: 0;
|
||||
border-radius: 28px 28px 0 0;
|
||||
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 {
|
||||
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: 6px auto 12px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
margin: 0 auto;
|
||||
border-radius: 4px;
|
||||
background: #4a453c;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.sheet__lock {
|
||||
@@ -129,14 +158,19 @@
|
||||
.sheet__resend {
|
||||
display: block;
|
||||
width: 100%;
|
||||
min-height: 20px;
|
||||
margin-top: 14px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
border: 0;
|
||||
background: none;
|
||||
color: var(--color-muted);
|
||||
font: inherit;
|
||||
font-size: 14px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -153,22 +187,7 @@
|
||||
}
|
||||
|
||||
.sheet__submit {
|
||||
width: 100%;
|
||||
min-height: 52px;
|
||||
margin-top: 16px;
|
||||
border: 0;
|
||||
border-radius: 16px;
|
||||
background: var(--color-accent);
|
||||
color: var(--color-on-accent);
|
||||
font: inherit;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.sheet__submit:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.sheet__ghost {
|
||||
@@ -196,7 +215,11 @@
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.sheet {
|
||||
.sheet-pop {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.sheet {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
ChangeDetectionStrategy,
|
||||
Component,
|
||||
DestroyRef,
|
||||
ElementRef,
|
||||
HostListener,
|
||||
computed,
|
||||
@@ -13,6 +14,7 @@ import {
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { Icon } from '../../../shared/icon/icon';
|
||||
import { RESEND_SECONDS } from '../../../state/gorodar.models';
|
||||
import {
|
||||
GorodarActions,
|
||||
selectAuthCodeRequestId,
|
||||
@@ -20,12 +22,13 @@ import {
|
||||
selectAuthError,
|
||||
selectAuthIntent,
|
||||
selectAuthPending,
|
||||
selectAuthResendSeconds,
|
||||
selectAuthSheetVisible,
|
||||
selectAuthStep,
|
||||
} from '../../../state';
|
||||
|
||||
const CODE_LENGTH = 6;
|
||||
const DISMISS_DISTANCE = 120;
|
||||
const DISMISS_VELOCITY = 0.55;
|
||||
|
||||
function emptyDigits(): string[] {
|
||||
return Array.from({ length: CODE_LENGTH }, () => '');
|
||||
@@ -40,17 +43,31 @@ function emptyDigits(): string[] {
|
||||
})
|
||||
export class AuthSheet {
|
||||
private readonly store = inject(Store);
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
private readonly digitFields = viewChildren<ElementRef<HTMLInputElement>>('digit');
|
||||
private pointerId: number | null = null;
|
||||
private dragOriginY = 0;
|
||||
private dragOriginX = 0;
|
||||
private dragScrollTop = 0;
|
||||
private dragFromHandle = false;
|
||||
private dragTracking = false;
|
||||
private dragMoved = false;
|
||||
private dragLastY = 0;
|
||||
private dragLastTime = 0;
|
||||
private dragVelocity = 0;
|
||||
private closeTimer = 0;
|
||||
|
||||
protected readonly emailDraft = signal('');
|
||||
protected readonly digits = signal<string[]>(emptyDigits());
|
||||
protected readonly secondsLeft = signal(0);
|
||||
protected readonly dragY = signal(0);
|
||||
protected readonly dragging = signal(false);
|
||||
|
||||
protected readonly sheetVisible = this.store.selectSignal(selectAuthSheetVisible);
|
||||
protected readonly step = this.store.selectSignal(selectAuthStep);
|
||||
protected readonly email = this.store.selectSignal(selectAuthEmail);
|
||||
protected readonly error = this.store.selectSignal(selectAuthError);
|
||||
protected readonly pending = this.store.selectSignal(selectAuthPending);
|
||||
protected readonly resendSeconds = this.store.selectSignal(selectAuthResendSeconds);
|
||||
protected readonly intent = this.store.selectSignal(selectAuthIntent);
|
||||
private readonly codeRequestId = this.store.selectSignal(selectAuthCodeRequestId);
|
||||
|
||||
@@ -71,7 +88,7 @@ export class AuthSheet {
|
||||
});
|
||||
|
||||
protected readonly resendLabel = computed(() => {
|
||||
const seconds = this.resendSeconds();
|
||||
const seconds = this.secondsLeft();
|
||||
|
||||
if (seconds <= 0) {
|
||||
return 'Отправить код ещё раз';
|
||||
@@ -106,8 +123,35 @@ export class AuthSheet {
|
||||
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 {
|
||||
@@ -125,7 +169,7 @@ export class AuthSheet {
|
||||
}
|
||||
|
||||
protected resend(): void {
|
||||
if (this.resendSeconds() > 0 || this.pending()) {
|
||||
if (this.secondsLeft() > 0 || this.pending()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -137,9 +181,121 @@ export class AuthSheet {
|
||||
}
|
||||
|
||||
protected dismiss(): void {
|
||||
window.clearTimeout(this.closeTimer);
|
||||
this.closeTimer = 0;
|
||||
this.dragY.set(0);
|
||||
this.dragging.set(false);
|
||||
this.store.dispatch(GorodarActions.authSheetDismissed());
|
||||
}
|
||||
|
||||
protected onDragStart(event: PointerEvent): void {
|
||||
if (!event.isPrimary || event.button !== 0 || !this.canDragFrom(event.target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sheet = event.currentTarget as HTMLElement;
|
||||
this.pointerId = event.pointerId;
|
||||
this.dragOriginY = event.clientY;
|
||||
this.dragOriginX = event.clientX;
|
||||
this.dragScrollTop = sheet.scrollTop;
|
||||
this.dragFromHandle = this.isHandle(event.target);
|
||||
this.dragTracking = false;
|
||||
this.dragMoved = false;
|
||||
this.dragLastY = event.clientY;
|
||||
this.dragLastTime = event.timeStamp;
|
||||
this.dragVelocity = 0;
|
||||
}
|
||||
|
||||
protected onDragMove(event: PointerEvent): void {
|
||||
if (event.pointerId !== this.pointerId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const dy = event.clientY - this.dragOriginY;
|
||||
const dx = event.clientX - this.dragOriginX;
|
||||
const sheet = event.currentTarget as HTMLElement;
|
||||
|
||||
if (!this.dragTracking) {
|
||||
if (Math.abs(dy) < 8 && Math.abs(dx) < 8) {
|
||||
return;
|
||||
}
|
||||
|
||||
const pullingDown = dy > 0 && Math.abs(dy) > Math.abs(dx);
|
||||
const atTop = this.dragScrollTop <= 0;
|
||||
|
||||
if (!pullingDown || (!atTop && !this.dragFromHandle)) {
|
||||
this.pointerId = null;
|
||||
return;
|
||||
}
|
||||
|
||||
this.dragTracking = true;
|
||||
this.dragMoved = true;
|
||||
this.dragging.set(true);
|
||||
sheet.setPointerCapture(event.pointerId);
|
||||
}
|
||||
|
||||
const elapsed = event.timeStamp - this.dragLastTime;
|
||||
|
||||
if (elapsed > 0) {
|
||||
this.dragVelocity = (event.clientY - this.dragLastY) / elapsed;
|
||||
}
|
||||
|
||||
this.dragLastY = event.clientY;
|
||||
this.dragLastTime = event.timeStamp;
|
||||
this.dragY.set(Math.max(0, dy));
|
||||
}
|
||||
|
||||
protected onDragEnd(event: PointerEvent): void {
|
||||
if (event.pointerId !== this.pointerId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sheet = event.currentTarget as HTMLElement;
|
||||
const offset = this.dragY();
|
||||
const close =
|
||||
event.type !== 'pointercancel' &&
|
||||
this.dragTracking &&
|
||||
(offset > DISMISS_DISTANCE || (offset > 48 && this.dragVelocity > DISMISS_VELOCITY));
|
||||
|
||||
this.pointerId = null;
|
||||
this.dragTracking = false;
|
||||
this.dragging.set(false);
|
||||
|
||||
if (this.dragMoved) {
|
||||
const stopClick = (clickEvent: Event): void => {
|
||||
clickEvent.preventDefault();
|
||||
clickEvent.stopPropagation();
|
||||
};
|
||||
sheet.addEventListener('click', stopClick, { capture: true, once: true });
|
||||
this.dragMoved = false;
|
||||
}
|
||||
|
||||
if (!close) {
|
||||
this.dragY.set(0);
|
||||
return;
|
||||
}
|
||||
|
||||
this.dragY.set(sheet.getBoundingClientRect().height);
|
||||
window.clearTimeout(this.closeTimer);
|
||||
this.closeTimer = window.setTimeout(() => this.dismiss(), 200);
|
||||
}
|
||||
|
||||
private canDragFrom(target: EventTarget | null): boolean {
|
||||
if (!(target instanceof Element)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.isHandle(target)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return target.closest('input, textarea, button, a, label') == null;
|
||||
}
|
||||
|
||||
private isHandle(target: EventTarget | null): boolean {
|
||||
return target instanceof Element && target.closest('.sheet__handle') != null;
|
||||
}
|
||||
|
||||
protected onDigit(index: number, event: Event): void {
|
||||
const input = event.target as HTMLInputElement;
|
||||
const value = input.value.replace(/\D/g, '').slice(-1);
|
||||
|
||||
@@ -11,14 +11,6 @@
|
||||
|
||||
@if (model()) {
|
||||
<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
|
||||
type="button"
|
||||
[class.is-active]="view() === 'image'"
|
||||
@@ -27,6 +19,14 @@
|
||||
>
|
||||
Картинка
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
[class.is-active]="view() === 'model'"
|
||||
[attr.aria-pressed]="view() === 'model'"
|
||||
(click)="showModel()"
|
||||
>
|
||||
3D
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
</div>
|
||||
|
||||
<div class="success__actions">
|
||||
<a matButton="filled" routerLink="/collections" (click)="leave()">Открыть коллекцию</a>
|
||||
<a class="btn" routerLink="/collections" (click)="leave()">Открыть коллекцию</a>
|
||||
<a
|
||||
class="success__ghost"
|
||||
[routerLink]="areaId() ? ['/city', areaId()] : ['/']"
|
||||
|
||||
@@ -309,15 +309,6 @@
|
||||
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 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
untracked,
|
||||
viewChild,
|
||||
} from '@angular/core';
|
||||
import { MatButton } from '@angular/material/button';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
@@ -22,7 +21,7 @@ import { GorodarActions } from '../../state';
|
||||
|
||||
@Component({
|
||||
selector: 'app-collect-success',
|
||||
imports: [Icon, RouterLink, MatButton],
|
||||
imports: [Icon, RouterLink],
|
||||
templateUrl: './collect-success.html',
|
||||
styleUrl: './collect-success.scss',
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
@@ -45,7 +44,7 @@ export class CollectSuccess {
|
||||
readonly areaId = input('');
|
||||
readonly alreadyVisited = input(false);
|
||||
|
||||
protected readonly view = signal<'model' | 'image'>('model');
|
||||
protected readonly view = signal<'model' | 'image'>('image');
|
||||
protected readonly modelLoaded = signal(false);
|
||||
|
||||
constructor() {
|
||||
@@ -53,7 +52,7 @@ export class CollectSuccess {
|
||||
const src = this.model();
|
||||
|
||||
untracked(() => {
|
||||
this.view.set('model');
|
||||
this.view.set('image');
|
||||
this.modelLoaded.set(false);
|
||||
});
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
</div>
|
||||
|
||||
<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" />
|
||||
Сделать новое фото
|
||||
</button>
|
||||
|
||||
@@ -159,27 +159,15 @@
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.fail__retry,
|
||||
.fail__leave {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
min-height: 48px;
|
||||
border: 0;
|
||||
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;
|
||||
color: var(--color-muted);
|
||||
font-size: 15px;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a class="card__action" matButton="filled" [routerLink]="['/city', areaId(), attraction().id]">
|
||||
<a class="btn" [routerLink]="['/city', areaId(), attraction().id]">
|
||||
Открыть карточку
|
||||
</a>
|
||||
</article>
|
||||
|
||||
@@ -52,8 +52,3 @@
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.card__action {
|
||||
width: 100%;
|
||||
min-height: 52px;
|
||||
--mat-button-filled-container-shape: 16px;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
||||
import { MatButton } from '@angular/material/button';
|
||||
import { RouterLink } from '@angular/router';
|
||||
|
||||
import type { Attraction } from '../../areas/area.models';
|
||||
@@ -7,7 +6,7 @@ import { Icon } from '../../shared/icon/icon';
|
||||
|
||||
@Component({
|
||||
selector: 'app-map-item-sheet',
|
||||
imports: [MatButton, Icon, RouterLink],
|
||||
imports: [Icon, RouterLink],
|
||||
templateUrl: './map-item-sheet.html',
|
||||
styleUrl: './map-item-sheet.scss',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
|
||||
@@ -30,10 +30,14 @@
|
||||
</p>
|
||||
</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>
|
||||
|
||||
<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">
|
||||
@for (attraction of area.attractions; track attraction.id) {
|
||||
|
||||
@@ -105,27 +105,13 @@
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.city-card strong,
|
||||
.city-card__percent {
|
||||
.city-card strong {
|
||||
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 .pack__bar {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.city-card__cells {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
|
||||
import { MatProgressBar } from '@angular/material/progress-bar';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
@@ -20,7 +19,7 @@ import {
|
||||
|
||||
@Component({
|
||||
selector: 'app-cities-page',
|
||||
imports: [RouterLink, MatProgressBar],
|
||||
imports: [RouterLink],
|
||||
templateUrl: './cities-page.html',
|
||||
styleUrl: './cities-page.scss',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
|
||||
@@ -175,9 +175,9 @@
|
||||
}
|
||||
|
||||
.filters button.filters__item--active {
|
||||
border-color: var(--color-accent);
|
||||
background: var(--color-accent);
|
||||
color: var(--color-on-accent);
|
||||
border-color: var(--color-primary);
|
||||
background: var(--color-primary);
|
||||
color: var(--color-label);
|
||||
}
|
||||
|
||||
.grid {
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
|
||||
@if (!collected()) {
|
||||
<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" />
|
||||
Забрать
|
||||
</button>
|
||||
|
||||
@@ -274,17 +274,6 @@
|
||||
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 {
|
||||
margin: 8px 0 0;
|
||||
font-size: 13px;
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 50%;
|
||||
background: var(--color-accent);
|
||||
color: var(--color-on-accent);
|
||||
background: var(--color-primary);
|
||||
color: var(--color-label);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
.guide__wave {
|
||||
width: 100%;
|
||||
height: 28px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.guide__meta {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import {
|
||||
afterNextRender,
|
||||
ChangeDetectionStrategy,
|
||||
Component,
|
||||
DestroyRef,
|
||||
ElementRef,
|
||||
NgZone,
|
||||
effect,
|
||||
inject,
|
||||
input,
|
||||
signal,
|
||||
@@ -18,6 +19,7 @@ import WaveSurfer from 'wavesurfer.js';
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class AudioGuide {
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
private readonly zone = inject(NgZone);
|
||||
private readonly waveHost = viewChild<ElementRef<HTMLDivElement>>('wave');
|
||||
private player: WaveSurfer | null = null;
|
||||
@@ -29,14 +31,25 @@ export class AudioGuide {
|
||||
protected readonly duration = signal(0);
|
||||
|
||||
constructor() {
|
||||
effect((onCleanup) => {
|
||||
afterNextRender(() => {
|
||||
const element = this.waveHost()?.nativeElement;
|
||||
const parent = element?.parentElement;
|
||||
const src = this.src();
|
||||
|
||||
if (!element) {
|
||||
if (!element || !parent || !src) {
|
||||
return;
|
||||
}
|
||||
|
||||
const lockWidth = (): void => {
|
||||
const width = Math.floor(parent.clientWidth);
|
||||
|
||||
if (width > 0) {
|
||||
element.style.width = `${width}px`;
|
||||
}
|
||||
};
|
||||
|
||||
lockWidth();
|
||||
|
||||
const player = this.zone.runOutsideAngular(() =>
|
||||
WaveSurfer.create({
|
||||
container: element,
|
||||
@@ -70,7 +83,11 @@ export class AudioGuide {
|
||||
player.on('pause', () => 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();
|
||||
|
||||
if (this.player === player) {
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
||||
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 { authErrorMessage } from '../auth/auth-error';
|
||||
import { clearAuthSession, writeAuthSession } from '../auth/auth-session';
|
||||
import type { AuthSession } from '../auth/auth.models';
|
||||
import { GorodarActions } from './gorodar.actions';
|
||||
import { RESEND_SECONDS } from './gorodar.models';
|
||||
import { selectAuth, selectAuthenticated } from './gorodar.selectors';
|
||||
|
||||
@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(
|
||||
() =>
|
||||
this.actions$.pipe(
|
||||
|
||||
@@ -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,9 +1,9 @@
|
||||
.mat-mdc-unelevated-button,
|
||||
.mdc-button--unelevated {
|
||||
--mat-button-filled-container-color: var(--color-accent);
|
||||
--mat-button-filled-label-text-color: var(--color-on-accent);
|
||||
--mat-sys-primary: var(--color-accent);
|
||||
--mat-sys-on-primary: var(--color-on-accent);
|
||||
--mat-button-filled-container-color: var(--color-primary);
|
||||
--mat-button-filled-label-text-color: var(--color-label);
|
||||
--mat-sys-primary: var(--color-primary);
|
||||
--mat-sys-on-primary: var(--color-label);
|
||||
}
|
||||
|
||||
.mat-mdc-outlined-button,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
@use 'typography';
|
||||
@use 'base';
|
||||
@use 'material';
|
||||
@use 'button';
|
||||
@use 'motion';
|
||||
@use 'map';
|
||||
@use 'object';
|
||||
|
||||
Reference in New Issue
Block a user