[demo] better? demo mode

This commit is contained in:
nymkappa
2024-10-24 16:52:47 +09:00
parent 908b8b4352
commit 99cc47cf00
4 changed files with 34 additions and 23 deletions

View File

@@ -3,8 +3,8 @@ import { Subscription } from 'rxjs';
import { MarkBlockState, StateService } from '@app/services/state.service';
import { specialBlocks } from '@app/app.constants';
import { BlockExtended } from '@interfaces/node-api.interface';
import { Router } from '@angular/router';
import { sleep$ } from '@app/shared/common.utils';
import { Router, ActivatedRoute } from '@angular/router';
import { handleDemoRedirect } from '../../shared/common.utils';
@Component({
selector: 'app-start',
@@ -63,7 +63,8 @@ export class StartComponent implements OnInit, AfterViewChecked, OnDestroy {
constructor(
public stateService: StateService,
private cd: ChangeDetectorRef,
private router: Router
private router: Router,
private route: ActivatedRoute
) {
this.isiOS = ['iPhone','iPod','iPad'].includes((navigator as any)?.userAgentData?.platform || navigator.platform);
if (this.stateService.network === '') {
@@ -71,26 +72,8 @@ export class StartComponent implements OnInit, AfterViewChecked, OnDestroy {
}
}
async demoMode() {
// @ts-ignore
if (!window.demoMode) {
// @ts-ignore
window.demoMode = true;
const paths = ['', 'acceleration', 'mining', 'lightning'];
let i = 0;
while ('Bitcoin is still alive') {
i = (i + 1) % paths.length;
this.router.navigateByUrl(paths[i]);
await sleep$(30000);
}
}
}
ngOnInit() {
// @ts-ignore
if (window.location.search === '?demo=1') {
this.demoMode();
}
handleDemoRedirect(this.route, this.router);
this.firstPageWidth = 40 + (this.blockWidth * this.dynamicBlocksAmount);
this.blockCounterSubscription = this.stateService.blocks$.subscribe((blocks) => {