This commit is contained in:
2026-10-07 12:10:12 +03:00
parent e384bc4872
commit e676717ffb
28 changed files with 722 additions and 236 deletions
@@ -1,18 +1,13 @@
import {
afterNextRender,
ChangeDetectionStrategy,
Component,
computed,
inject,
} from '@angular/core';
import { afterNextRender, ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';
import { RouterLink } from '@angular/router';
import { Store } from '@ngrx/store';
import { AuthPromptService } from '../../auth/auth-prompt.service';
import { AuthService } from '../../auth/auth.service';
import { CityCatalogService } from '../../root/services/city-catalog.service';
import { Icon } from '../../shared/icon/icon';
import {
GorodarActions,
selectAuthEmail,
selectAuthenticated,
selectCollectedIdSet,
selectOpenedCount,
selectProfile,
@@ -29,8 +24,6 @@ import {
export class CollectionsPage {
private readonly catalog = inject(CityCatalogService);
private readonly store = inject(Store);
private readonly auth = inject(AuthService);
private readonly authPrompt = inject(AuthPromptService);
protected readonly city = this.catalog.city;
protected readonly profile = this.store.selectSignal(selectProfile);
@@ -38,8 +31,10 @@ export class CollectionsPage {
protected readonly openedCount = this.store.selectSignal(selectOpenedCount);
protected readonly totalCount = this.city.objects.length;
protected readonly progress = this.store.selectSignal(selectProgress);
private readonly authenticated = this.store.selectSignal(selectAuthenticated);
private readonly authEmail = this.store.selectSignal(selectAuthEmail);
protected readonly accountEmail = computed(() =>
this.auth.authenticated() ? this.auth.email() : this.profile().email,
this.authenticated() ? this.authEmail() : this.profile().email,
);
protected readonly collectedLandmarks = computed(() =>
this.city.objects.filter((item) => this.collectedIds().has(item.id)),
@@ -47,7 +42,7 @@ export class CollectionsPage {
constructor() {
afterNextRender(() => {
void this.authPrompt.prompt('collection');
this.store.dispatch(GorodarActions.authSheetOpened({ intent: 'collection' }));
});
}
@@ -60,7 +55,7 @@ export class CollectionsPage {
}
protected logout(): void {
this.auth.logout();
this.store.dispatch(GorodarActions.logout());
}
private plural(count: number, forms: [string, string, string]): string {
+9 -8
View File
@@ -12,13 +12,13 @@ import { MatButton } from '@angular/material/button';
import { Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { AuthPromptService } from '../../auth/auth-prompt.service';
import { ClaimFlow } from '../../claim/claim-flow/claim-flow';
import { CityCatalogService } from '../../root/services/city-catalog.service';
import { AudioGuide } from '../../shared/audio-guide/audio-guide';
import { Icon } from '../../shared/icon/icon';
import {
GorodarActions,
selectAuthenticated,
selectClaim,
selectCollectedAt,
selectCollectedIdSet,
@@ -37,7 +37,7 @@ export class MapItemPage {
private readonly store = inject(Store);
private readonly location = inject(Location);
private readonly router = inject(Router);
private readonly authPrompt = inject(AuthPromptService);
private readonly authenticated = this.store.selectSignal(selectAuthenticated);
readonly id = input.required<string>();
@@ -95,13 +95,14 @@ export class MapItemPage {
}
protected claimItem(): void {
void this.authPrompt.prompt('claim').then((result) => {
if (result !== 'authenticated') {
return;
}
if (this.authenticated()) {
this.store.dispatch(GorodarActions.takePhoto({ landmarkId: this.id() }));
});
return;
}
this.store.dispatch(
GorodarActions.authSheetOpened({ intent: 'claim', landmarkId: this.id() }),
);
}
protected openPhoto(): void {