add fix with glb view on tab
This commit is contained in:
@@ -1,10 +1,35 @@
|
||||
<section class="success" [class.success--preview]="mode() === 'preview'">
|
||||
<section
|
||||
class="success"
|
||||
[class.success--preview]="mode() === 'preview'"
|
||||
[class.success--model]="model()"
|
||||
>
|
||||
@if (mode() === 'preview') {
|
||||
<button class="success__back" type="button" aria-label="Назад" (click)="goBack()">
|
||||
<app-icon name="chevron-left" [size]="22" />
|
||||
</button>
|
||||
}
|
||||
|
||||
@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'"
|
||||
[attr.aria-pressed]="view() === 'image'"
|
||||
(click)="showImage()"
|
||||
>
|
||||
Картинка
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="success__glow"></div>
|
||||
|
||||
<div class="success__stamp">
|
||||
@@ -29,7 +54,9 @@
|
||||
<div class="success__mark anim-pop" [class.success__mark--model]="model()">
|
||||
@if (model(); as src) {
|
||||
<model-viewer
|
||||
#viewer
|
||||
class="success__model"
|
||||
[class.success__model--off]="view() !== 'model'"
|
||||
[attr.src]="src"
|
||||
[attr.alt]="title()"
|
||||
auto-rotate
|
||||
@@ -39,9 +66,17 @@
|
||||
shadow-intensity="0.7"
|
||||
exposure="1.05"
|
||||
interaction-prompt="auto"
|
||||
reveal="auto"
|
||||
></model-viewer>
|
||||
} @else {
|
||||
<img [src]="image()" alt="" />
|
||||
}
|
||||
@if (!model() || view() === 'image') {
|
||||
<img [src]="image()" [alt]="title()" />
|
||||
}
|
||||
@if (model() && view() === 'model' && !modelLoaded()) {
|
||||
<div class="success__loader" role="status" aria-live="polite">
|
||||
<span class="success__spinner anim-spinner" aria-hidden="true"></span>
|
||||
<span>Загрузка</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -54,6 +54,76 @@
|
||||
--poster-color: transparent;
|
||||
}
|
||||
|
||||
.success__model--off {
|
||||
position: absolute;
|
||||
visibility: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.success__model::part(default-progress-bar) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.success__loader {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
color: var(--color-text-soft);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.success__spinner {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
box-sizing: border-box;
|
||||
border: 3px solid #312d27;
|
||||
border-top-color: var(--color-accent);
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.success__switch {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
top: 16px;
|
||||
left: 50%;
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
padding: 4px;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 16px;
|
||||
background: rgb(28 26 23 / 92%);
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.success__switch button {
|
||||
min-width: 88px;
|
||||
height: 36px;
|
||||
padding: 0 14px;
|
||||
border: 0;
|
||||
border-radius: 12px;
|
||||
background: transparent;
|
||||
color: var(--color-muted);
|
||||
font: inherit;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.success__switch button.is-active {
|
||||
background: var(--color-primary);
|
||||
color: var(--color-label);
|
||||
}
|
||||
|
||||
.success--model {
|
||||
padding-top: 72px;
|
||||
}
|
||||
|
||||
.success__mark--model {
|
||||
top: 6%;
|
||||
left: 6%;
|
||||
@@ -129,7 +199,15 @@
|
||||
.success--preview {
|
||||
justify-content: center;
|
||||
min-height: 100dvh;
|
||||
padding: 64px 0 20px;
|
||||
padding: 20px 0 20px;
|
||||
}
|
||||
|
||||
.success--preview.success--model {
|
||||
padding-top: 72px;
|
||||
}
|
||||
|
||||
.success--preview.success--model .success__stamp {
|
||||
width: min(100vw, calc(100dvh - 210px));
|
||||
}
|
||||
|
||||
.success--preview .success__stamp {
|
||||
@@ -234,6 +312,10 @@
|
||||
.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 {
|
||||
|
||||
@@ -3,10 +3,15 @@ import {
|
||||
ChangeDetectionStrategy,
|
||||
Component,
|
||||
CUSTOM_ELEMENTS_SCHEMA,
|
||||
ElementRef,
|
||||
NgZone,
|
||||
computed,
|
||||
effect,
|
||||
inject,
|
||||
input,
|
||||
signal,
|
||||
untracked,
|
||||
viewChild,
|
||||
} from '@angular/core';
|
||||
import { MatButton } from '@angular/material/button';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
@@ -27,6 +32,8 @@ export class CollectSuccess {
|
||||
private readonly store = inject(Store);
|
||||
private readonly location = inject(Location);
|
||||
private readonly router = inject(Router);
|
||||
private readonly zone = inject(NgZone);
|
||||
private readonly viewer = viewChild<ElementRef<ModelViewerElement>>('viewer');
|
||||
|
||||
readonly mode = input<'claim' | 'preview'>('claim');
|
||||
readonly title = input.required<string>();
|
||||
@@ -36,14 +43,51 @@ export class CollectSuccess {
|
||||
readonly opened = input(0);
|
||||
readonly total = input(1);
|
||||
|
||||
protected readonly view = signal<'model' | 'image'>('model');
|
||||
protected readonly modelLoaded = signal(false);
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
if (!this.model()) {
|
||||
const src = this.model();
|
||||
|
||||
untracked(() => {
|
||||
this.view.set('model');
|
||||
this.modelLoaded.set(false);
|
||||
});
|
||||
|
||||
if (!src) {
|
||||
return;
|
||||
}
|
||||
|
||||
void import('@google/model-viewer/dist/model-viewer.min.js');
|
||||
});
|
||||
|
||||
effect((onCleanup) => {
|
||||
const element = this.viewer()?.nativeElement;
|
||||
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
const markLoaded = (): void => {
|
||||
this.zone.run(() => this.modelLoaded.set(true));
|
||||
};
|
||||
|
||||
if (element.loaded) {
|
||||
markLoaded();
|
||||
}
|
||||
|
||||
element.addEventListener('load', markLoaded);
|
||||
onCleanup(() => element.removeEventListener('load', markLoaded));
|
||||
});
|
||||
}
|
||||
|
||||
protected showModel(): void {
|
||||
this.view.set('model');
|
||||
}
|
||||
|
||||
protected showImage(): void {
|
||||
this.view.set('image');
|
||||
}
|
||||
|
||||
protected readonly from = computed(() => {
|
||||
@@ -88,3 +132,7 @@ export class CollectSuccess {
|
||||
void this.router.navigateByUrl('/city');
|
||||
}
|
||||
}
|
||||
|
||||
interface ModelViewerElement extends HTMLElement {
|
||||
loaded: boolean;
|
||||
}
|
||||
|
||||
@@ -78,6 +78,13 @@
|
||||
box-sizing: border-box;
|
||||
border: 2px solid #312d27;
|
||||
border-radius: 15px;
|
||||
|
||||
app-icon {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
color: var(--color-surface);
|
||||
}
|
||||
}
|
||||
|
||||
.steps__mark--spin {
|
||||
|
||||
@@ -48,6 +48,7 @@ export const NIZHNY_NOVGOROD: City = {
|
||||
background: '/assets/background/nn-bg-chkalov-stairs.svg',
|
||||
audio: '/assets/audio/chkalov-stairs.mp3',
|
||||
achievement: '/assets/achivments/chkalov-stairs.png',
|
||||
model: '/assets/models/chkalov-stairs.glb',
|
||||
},
|
||||
{
|
||||
id: 'kremlin',
|
||||
@@ -69,6 +70,7 @@ export const NIZHNY_NOVGOROD: City = {
|
||||
background: '/assets/background/nn-bg-kremlin.svg',
|
||||
audio: '/assets/audio/kremlin.mp3',
|
||||
achievement: '/assets/achivments/kremlin.png',
|
||||
model: '/assets/models/kremlin.glb',
|
||||
},
|
||||
{
|
||||
id: 'iron-deer',
|
||||
@@ -90,6 +92,7 @@ export const NIZHNY_NOVGOROD: City = {
|
||||
background: '/assets/background/nn-bg-iron-deer.svg',
|
||||
audio: '/assets/audio/iron-deer.mp3',
|
||||
achievement: '/assets/achivments/iron-deer.png',
|
||||
model: '/assets/models/iron-deer.glb',
|
||||
},
|
||||
{
|
||||
id: 'rozhdestvenskaya',
|
||||
@@ -111,6 +114,7 @@ export const NIZHNY_NOVGOROD: City = {
|
||||
background: '/assets/background/nn-bg-rozhdestvenskaya.png',
|
||||
audio: '/assets/audio/rozhdestvenskaya.mp3',
|
||||
achievement: '/assets/achivments/rozhdestvenskaya.png',
|
||||
model: '/assets/models/rozhdestvenskaya.glb',
|
||||
},
|
||||
{
|
||||
id: 'river-station',
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<p>Приезжайте на место, снимайте — объект попадёт в вашу коллекцию.</p>
|
||||
</div>
|
||||
|
||||
<div class="cities">
|
||||
<a class="city-card" routerLink="/city" [attr.aria-label]="city.name">
|
||||
<div class="city-card__top">
|
||||
<div>
|
||||
@@ -41,4 +42,12 @@
|
||||
}
|
||||
</div>
|
||||
</a>
|
||||
|
||||
@for (name of upcomingCities; track name) {
|
||||
<article class="city-card city-card--soon">
|
||||
<h2>{{ name }}</h2>
|
||||
<p>Скоро появится</p>
|
||||
</article>
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -76,6 +76,12 @@
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.cities {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.city-card {
|
||||
display: block;
|
||||
padding: 16px;
|
||||
@@ -85,6 +91,14 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.city-card--soon {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.city-card--soon h2 {
|
||||
color: var(--color-text-soft);
|
||||
}
|
||||
|
||||
.city-card__top {
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
|
||||
@@ -18,6 +18,7 @@ export class CitiesPage {
|
||||
private readonly store = inject(Store);
|
||||
|
||||
protected readonly city = this.catalog.city;
|
||||
protected readonly upcomingCities = ['Москва', 'Санкт-Петербург'];
|
||||
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
|
||||
protected readonly openedCount = this.store.selectSignal(selectOpenedCount);
|
||||
protected readonly totalCount = this.city.objects.length;
|
||||
|
||||
@@ -51,10 +51,6 @@
|
||||
</div>
|
||||
<div class="picked__body">
|
||||
<h3>{{ landmark.title }}</h3>
|
||||
<span>
|
||||
<app-icon name="check" [size]="15" />
|
||||
Получен
|
||||
</span>
|
||||
</div>
|
||||
<span class="picked__bar" aria-hidden="true"></span>
|
||||
</a>
|
||||
|
||||
@@ -145,20 +145,11 @@
|
||||
|
||||
.picked__body h3 {
|
||||
margin: 0;
|
||||
min-height: 38px;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.picked__body span {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
color: var(--color-accent-soft);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.picked__bar {
|
||||
height: 4px;
|
||||
background: var(--color-accent);
|
||||
|
||||
@@ -278,7 +278,11 @@
|
||||
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 {
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
--color-on-accent: #1a1508;
|
||||
--color-danger: #ea333d;
|
||||
--color-success: #67c3b0;
|
||||
--color-primary: #d4143f;
|
||||
--color-label: #ffffff;
|
||||
--nav-height: 72px;
|
||||
--page-max-width: 560px;
|
||||
--radius-card: 24px;
|
||||
|
||||
Reference in New Issue
Block a user