| 
1 |  | -import { ChangeDetectionStrategy, Component, ElementRef, NgZone, OnInit, ViewChild } from '@angular/core';  | 
 | 1 | +import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, OnInit, ViewChild } from '@angular/core';  | 
2 | 2 | import { untilDestroyed } from '@ngneat/until-destroy';  | 
3 | 3 | import { StoreDispatcher } from '@shared/base-classes/store-dispatcher.class';  | 
4 | 4 | import { WebNodeService } from '@core/services/web-node.service';  | 
5 | 5 | import { GlobalErrorHandlerService } from '@openmina/shared';  | 
6 | 6 | import { NgClass, NgForOf, NgIf, NgOptimizedImage } from '@angular/common';  | 
7 | 7 | import { Router } from '@angular/router';  | 
8 | 8 | import { getFirstFeature } from '@shared/constants/config';  | 
9 |  | -import { trigger, state, style, transition, animate } from '@angular/animations';  | 
 | 9 | +import { animate, state, style, transition, trigger } from '@angular/animations';  | 
10 | 10 | import { filter, switchMap, timer } from 'rxjs';  | 
11 | 11 | import { LoadingSpinnerComponent } from '@shared/loading-spinner/loading-spinner.component';  | 
12 | 12 | import { FileProgressHelper } from '@core/helpers/file-progress.helper';  | 
@@ -53,7 +53,7 @@ export interface WebNodeLoadingStep {  | 
53 | 53 |     ]),  | 
54 | 54 |   ],  | 
55 | 55 | })  | 
56 |  | -export class WebNodeDemoDashboardComponent extends StoreDispatcher implements OnInit {  | 
 | 56 | +export class WebNodeDemoDashboardComponent extends StoreDispatcher implements OnInit, AfterViewInit {  | 
57 | 57 | 
 
  | 
58 | 58 |   protected readonly WebNodeStepStatus = WebNodeStepStatus;  | 
59 | 59 |   readonly loading: WebNodeLoadingStep[] = [  | 
@@ -87,6 +87,9 @@ export class WebNodeDemoDashboardComponent extends StoreDispatcher implements On  | 
87 | 87 |     this.listenToErrorIssuing();  | 
88 | 88 |     this.checkWebNodeProgress();  | 
89 | 89 |     this.fetchPeersInformation();  | 
 | 90 | +  }  | 
 | 91 | + | 
 | 92 | +  ngAfterViewInit(): void {  | 
90 | 93 |     this.buildProgressBar();  | 
91 | 94 |   }  | 
92 | 95 | 
 
  | 
@@ -196,10 +199,10 @@ export class WebNodeDemoDashboardComponent extends StoreDispatcher implements On  | 
196 | 199 |         downloaded: (progress.downloaded / 1e6).toFixed(1),  | 
197 | 200 |         total: (progress.totalSize / 1e6).toFixed(1),  | 
198 | 201 |       };  | 
199 |  | -      // this step is only 1 out of 3. But it counts as 80% of the 100% progress.  | 
200 |  | -      // So we need to calculate the total progress based on the current step.  | 
201 |  | -      const totalProgress = (progress.progress * this.stepsPercentages[0]) / 100;  | 
202 |  | -      this.updateProgressBar(totalProgress);  | 
 | 202 | +      if (this.svg) {  | 
 | 203 | +        const totalProgress = (progress.progress * this.stepsPercentages[0]) / 100;  | 
 | 204 | +        this.updateProgressBar(totalProgress);  | 
 | 205 | +      }  | 
203 | 206 |       this.detect();  | 
204 | 207 |     });  | 
205 | 208 |   }  | 
@@ -259,7 +262,8 @@ export class WebNodeDemoDashboardComponent extends StoreDispatcher implements On  | 
259 | 262 | 
 
  | 
260 | 263 |     this.progressBar.append('text')  | 
261 | 264 |       .attr('text-anchor', 'middle')  | 
262 |  | -      .attr('dominant-baseline', 'middle')  | 
 | 265 | +      .attr('alignment-baseline', 'central')  | 
 | 266 | +      .attr('dominant-baseline', 'central')  | 
263 | 267 |       .attr('font-size', '40px')  | 
264 | 268 |       .attr('fill', 'var(--base-primary)')  | 
265 | 269 |       .attr('opacity', 0.8)  | 
 | 
0 commit comments