Refactor ExploreComponent to use IndexerService and update countdown timer logic; remove CountdownTimerComponent

This commit is contained in:
Milad Raeisi
2024-12-13 15:24:41 +04:00
parent 7e67b8c0d6
commit e0f643207f
3 changed files with 7 additions and 3 deletions

View File

@@ -153,7 +153,7 @@
<mat-icon class="text-primary text-3xl" [svgIcon]="'heroicons_outline:currency-dollar'"></mat-icon>
<div class="flex flex-col">
<span class="text-sm text-gray-500">Target Amount</span>
<span class="font-semibold">{{ project.targetAmount | number }} TBTC</span>
<span class="font-semibold">{{ project.targetAmount | number }} {{ indexerService.getNetwork() === 'mainnet' ? 'BTC' : 'TBTC' }}</span>
</div>
</div>
<div class="flex items-center space-x-2 p-4 bg-white shadow-md rounded-lg">
@@ -196,7 +196,7 @@
<!-- Investment Buttons -->
<div class="mt-6 grid grid-cols-1 sm:grid-cols-2 gap-4">
<!-- Invest Button -->
<a [href]="'https://test.angor.io/view/' + project.projectIdentifier"
<a [href]="(indexerService.getNetwork() === 'mainnet' ? 'https://beta.angor.io/view/' : 'https://test.angor.io/view/') + project.projectIdentifier"
target="_blank"
class="group relative inline-flex items-center justify-center overflow-hidden rounded-lg bg-primary p-0.5 text-sm font-medium hover:bg-primary-700 focus:outline-none focus:ring-4 focus:ring-primary-300 dark:bg-primary dark:hover:bg-primary-600 dark:focus:ring-primary-800 w-full">
<span class="relative flex items-center justify-center gap-2 rounded-md bg-card w-full px-4 py-2.5 transition-all duration-75 ease-in group-hover:bg-opacity-0">

View File

@@ -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<ProjectDetails[]>([]);
@@ -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);