[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

@@ -1,6 +1,7 @@
import { MempoolBlockDelta, MempoolBlockDeltaCompressed, MempoolDeltaChange, TransactionCompressed } from "../interfaces/websocket.interface";
import { TransactionStripped } from "@interfaces/node-api.interface";
import { AmountShortenerPipe } from "@app/shared/pipes/amount-shortener.pipe";
import { Router, ActivatedRoute } from '@angular/router';
const amountShortenerPipe = new AmountShortenerPipe();
export function isMobile(): boolean {
@@ -234,6 +235,21 @@ export function sleep$(ms: number): Promise<void> {
});
}
export function handleDemoRedirect(route: ActivatedRoute, router: Router) {
route.queryParams
.subscribe(params => {
if (params.next) {
const path = ['/', '/acceleration', '/mining', '/lightning', '/graphs'];
const index = path.indexOf(params.next);
if (index >= 0) {
const nextPath = path[(index + 1) % path.length];
setTimeout(() => { window.location.replace(`${params.next}?next=${nextPath}`) }, 3000);
}
}
}
);
}
// https://stackoverflow.com/a/60467595
export function md5(inputString): string {
var hc="0123456789abcdef";