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