fix and add documents view

This commit is contained in:
2026-10-08 14:39:17 +03:00
parent 548ba43dc2
commit a65d4185f3
29 changed files with 553 additions and 267 deletions
+3 -35
View File
@@ -13,12 +13,7 @@ import { MatButton } from '@angular/material/button';
import { Router } from '@angular/router';
import { Store } from '@ngrx/store';
import {
areaOpenedCount,
areaTotalCount,
isObtained,
type AreaDetails,
} from '../../areas/area.models';
import { areaOpenedCount, areaTotalCount, type AreaDetails } from '../../areas/area.models';
import { ClaimFlow } from '../../claim/claim-flow/claim-flow';
import { AudioGuide } from '../../shared/audio-guide/audio-guide';
import { Icon } from '../../shared/icon/icon';
@@ -32,7 +27,6 @@ import {
selectAuthenticated,
selectClaim,
selectCollectedAt,
selectCollectedIdSet,
selectPhotos,
} from '../../state';
@@ -63,28 +57,19 @@ export class MapItemPage {
(): AreaDetails | null => this.details()[this.areaId()] ?? null,
);
protected readonly landmark = computed(() => this.attractions()[this.id()] ?? null);
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 openedCount = computed(() => {
const area = this.area();
return area ? areaOpenedCount(area, this.collectedIds()) : 0;
return area ? areaOpenedCount(area) : 0;
});
protected readonly totalCount = computed(() => {
const area = this.area();
return area ? areaTotalCount(area) : 0;
});
protected readonly collected = computed(() => {
const item = this.landmark();
return item ? isObtained(item, this.collectedIds()) : false;
});
protected readonly userPhoto = computed(() => {
const item = this.landmark();
return item ? (this.photos()[item.id] ?? null) : null;
});
protected readonly collected = computed(() => this.landmark()?.visited ?? false);
protected readonly collectedLabel = computed(() => {
if (!this.collected()) {
@@ -111,8 +96,6 @@ export class MapItemPage {
return claim.landmarkId === this.id() && claim.stage !== 'idle';
});
protected readonly photoOpen = signal(false);
constructor() {
effect(() => {
const areaId = this.areaId();
@@ -147,19 +130,4 @@ export class MapItemPage {
this.store.dispatch(GorodarActions.authSheetOpened({ intent: 'claim', 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();
}
}