Dapp: exact-position deep link route and single-position view; consume localStorage deeplink with ARB alias

This commit is contained in:
Siavash Sameni
2025-08-28 11:35:29 +04:00
parent c954cac947
commit 18314c2466
2 changed files with 57 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
"use client";
import { useEffect } from "react";
import { useParams } from "next/navigation";
import DappPage from "../../../../page";
export default function PositionDeepLinkPage() {
const params = useParams<{ network: string; preset: string; tokenId: string }>();
useEffect(() => {
try {
const network = String(params?.network || '').toUpperCase();
const preset = Number(params?.preset || '1');
const tokenId = String(params?.tokenId || '');
if (!network || !preset || !tokenId) return;
// Persist for Dapp page to consume on mount; keep URL unchanged
const payload = { network, preset, tokenId, ts: Math.floor(Date.now() / 1000) };
if (typeof window !== 'undefined') {
localStorage.setItem('dapp:deeplink:v1', JSON.stringify(payload));
}
} catch {}
}, [params]);
// Render the main Dapp UI without redirect; it will consume the deep-link
return <DappPage />;
}