From e0f643207fbc87efed12ed62b39bfc90c3d656ed Mon Sep 17 00:00:00 2001 From: Milad Raeisi Date: Fri, 13 Dec 2024 15:24:41 +0400 Subject: [PATCH] Refactor ExploreComponent to use IndexerService and update countdown timer logic; remove CountdownTimerComponent --- src/app/components/explore/explore.component.html | 4 ++-- src/app/components/explore/explore.component.ts | 6 +++++- .../common}/countdown-timer/countdown-timer.component.ts | 0 3 files changed, 7 insertions(+), 3 deletions(-) rename src/app/{components => layout/common}/countdown-timer/countdown-timer.component.ts (100%) diff --git a/src/app/components/explore/explore.component.html b/src/app/components/explore/explore.component.html index e2c2727..089f058 100644 --- a/src/app/components/explore/explore.component.html +++ b/src/app/components/explore/explore.component.html @@ -153,7 +153,7 @@
Target Amount - {{ project.targetAmount | number }} TBTC + {{ project.targetAmount | number }} {{ indexerService.getNetwork() === 'mainnet' ? 'BTC' : 'TBTC' }}
@@ -196,7 +196,7 @@
- diff --git a/src/app/components/explore/explore.component.ts b/src/app/components/explore/explore.component.ts index 6bc8f0b..f31bdad 100644 --- a/src/app/components/explore/explore.component.ts +++ b/src/app/components/explore/explore.component.ts @@ -32,7 +32,8 @@ import { catchError, Observable, of, Subject, takeUntil, tap } from 'rxjs'; import { BookmarkService } from 'app/services/bookmark.service'; import { Project, ProjectDetails, ProjectStatistics } from 'app/interface/project.interface'; import { ProjectsService } from 'app/services/projects.service'; -import { CountdownTimerComponent } from '../countdown-timer/countdown-timer.component'; +import { CountdownTimerComponent } from '../../layout/common/countdown-timer/countdown-timer.component'; +import { IndexerService } from 'app/services/indexer.service'; @Component({ selector: 'explore', @@ -63,6 +64,7 @@ export class ExploreComponent implements OnInit, OnDestroy { changeDetectorRef = inject(ChangeDetectorRef); router = inject(Router); bookmarkService = inject(BookmarkService); + indexerService = inject(IndexerService); projects: Project[] = []; projectDetails = signal([]); @@ -226,6 +228,8 @@ export class ExploreComponent implements OnInit, OnDestroy { } goToProjectDetails(project: ProjectDetails): void { + const network = this.indexerService.getNetwork(); + const baseUrl = network === 'mainnet' ? 'https://beta.angor.io/view/' : 'https://test.angor.io/view/'; this.projectService.fetchProjectStats(project.projectIdentifier).pipe( tap((stats: ProjectStatistics) => { this.storageService.saveProjectStats(project.projectIdentifier, stats); diff --git a/src/app/components/countdown-timer/countdown-timer.component.ts b/src/app/layout/common/countdown-timer/countdown-timer.component.ts similarity index 100% rename from src/app/components/countdown-timer/countdown-timer.component.ts rename to src/app/layout/common/countdown-timer/countdown-timer.component.ts