update route
This commit is contained in:
@@ -13,8 +13,8 @@ export const routes: Routes = [
|
||||
{ path: 'collections', component: CollectionsPage },
|
||||
{ path: 'city', component: CityPage },
|
||||
{ path: 'collection', pathMatch: 'full', redirectTo: '/city' },
|
||||
{ path: 'items/:id/icon', component: IconPreviewPage },
|
||||
{ path: 'items/:id', component: MapItemPage },
|
||||
{ path: 'objects/:id', redirectTo: 'items/:id' },
|
||||
{ path: 'city/:id/icon', component: IconPreviewPage },
|
||||
{ path: 'city/:id', component: MapItemPage },
|
||||
{ path: 'objects/:id', redirectTo: 'city/:id' },
|
||||
{ path: '**', redirectTo: '' },
|
||||
];
|
||||
|
||||
+1
-3
@@ -24,7 +24,5 @@ export class App {
|
||||
{ initialValue: this.router.url },
|
||||
);
|
||||
|
||||
protected readonly hideNav = computed(
|
||||
() => this.url().startsWith('/items') || this.url().startsWith('/objects'),
|
||||
);
|
||||
protected readonly hideNav = computed(() => this.url().startsWith('/city/'));
|
||||
}
|
||||
|
||||
@@ -28,9 +28,7 @@ export class CityPage {
|
||||
protected readonly collectedIds = this.store.selectSignal(selectCollectedIdSet);
|
||||
protected readonly openedCount = this.store.selectSignal(selectOpenedCount);
|
||||
protected readonly progress = this.store.selectSignal(selectProgress);
|
||||
protected readonly closedCount = computed(
|
||||
() => this.city.objects.length - this.openedCount(),
|
||||
);
|
||||
protected readonly closedCount = computed(() => this.city.objects.length - this.openedCount());
|
||||
protected readonly landmarks = computed(() => {
|
||||
const items = this.city.objects;
|
||||
const ids = this.collectedIds();
|
||||
@@ -70,6 +68,6 @@ export class CityPage {
|
||||
}
|
||||
|
||||
protected objectRoute(id: string): string[] {
|
||||
return this.collectedIds().has(id) ? ['/items', id, 'icon'] : ['/items', id];
|
||||
return this.collectedIds().has(id) ? ['/city', id, 'icon'] : ['/city', id];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
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';
|
||||
|
||||
@@ -6,7 +12,12 @@ 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 { selectCollectedIdSet, selectOpenedCount, selectProfile, selectProgress } from '../../state';
|
||||
import {
|
||||
selectCollectedIdSet,
|
||||
selectOpenedCount,
|
||||
selectProfile,
|
||||
selectProgress,
|
||||
} from '../../state';
|
||||
|
||||
@Component({
|
||||
selector: 'app-collections-page',
|
||||
@@ -45,7 +56,7 @@ export class CollectionsPage {
|
||||
);
|
||||
|
||||
protected objectRoute(id: string): string[] {
|
||||
return this.collectedIds().has(id) ? ['/items', id, 'icon'] : ['/items', id];
|
||||
return this.collectedIds().has(id) ? ['/city', id, 'icon'] : ['/city', id];
|
||||
}
|
||||
|
||||
protected logout(): void {
|
||||
|
||||
@@ -35,7 +35,7 @@ export class IconPreviewPage {
|
||||
return;
|
||||
}
|
||||
|
||||
void this.router.navigate(['/items', item.id], { replaceUrl: true });
|
||||
void this.router.navigate(['/city', item.id], { replaceUrl: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user