From 70992310e641cf9c948b82cee51b729b7ec29e09 Mon Sep 17 00:00:00 2001
From: sadiq1971
Date: Wed, 3 Jun 2026 16:19:20 +0600
Subject: [PATCH 1/2] fix(dapp): pre-select the clicked token on the Transfer
page
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
A balances row's "Send →" opened Transfer but always defaulted to the
first token in the list rather than the one clicked. Thread the chosen
token address from the balances row through App into TransferPage, which
now pre-selects the matching token (falling back to the first token when
opened via plain sidebar navigation).
Closes #66
---
.claude/scheduled_tasks.lock | 1 +
packages/dapp/src/App.tsx | 35 +++++++++++++++++--
.../dapp/src/pages/DashboardBalancesPage.tsx | 8 ++++-
packages/dapp/src/pages/TransferPage.tsx | 20 +++++++++--
4 files changed, 57 insertions(+), 7 deletions(-)
create mode 100644 .claude/scheduled_tasks.lock
diff --git a/.claude/scheduled_tasks.lock b/.claude/scheduled_tasks.lock
new file mode 100644
index 0000000..1236ac7
--- /dev/null
+++ b/.claude/scheduled_tasks.lock
@@ -0,0 +1 @@
+{"sessionId":"b8586f35-35cb-4ee2-a80e-3ac683758a43","pid":63405,"procStart":"Tue Jun 2 07:04:56 2026","acquiredAt":1780481630395}
\ No newline at end of file
diff --git a/packages/dapp/src/App.tsx b/packages/dapp/src/App.tsx
index 3c33c5f..61999b9 100644
--- a/packages/dapp/src/App.tsx
+++ b/packages/dapp/src/App.tsx
@@ -44,6 +44,9 @@ export default function App() {
const [connectError, setConnectError] = useState(null);
const [reconnecting, setReconnecting] = useState(false);
const [dashboardTab, setDashboardTab] = useState(readTabFromHash);
+ // Token address to pre-select when opening the Transfer tab from a balances
+ // row's "Send →". Null on plain nav so Transfer falls back to the first token.
+ const [transferToken, setTransferToken] = useState(null);
// Mirror dashboardTab into the URL hash so a refresh on /#balances stays on
// Balances instead of snapping back to Profile. Only mutate the hash while
@@ -120,10 +123,24 @@ export default function App() {
mm.disconnect();
setProfile(null);
clearAllSessions();
+ setTransferToken(null);
setDashboardTab("profile");
setPage("landing");
}
+ // Plain tab navigation (sidebar). Clears any pending pre-selection so the
+ // Transfer tab only honours a token when reached via a "Send →" row action.
+ const handleTabChange = useCallback((tab: DashboardTab) => {
+ setTransferToken(null);
+ setDashboardTab(tab);
+ }, []);
+
+ // "Send →" on a balances row: pre-select that token, then open Transfer.
+ const handleSendToken = useCallback((tokenAddress: string) => {
+ setTransferToken(tokenAddress);
+ setDashboardTab("transfer");
+ }, []);
+
const handleCustodial = useCallback(() => {
setMode("custodial");
setPage("custodial-pending");
@@ -330,16 +347,28 @@ export default function App() {
const sharedProps = {
address,
activeTab: dashboardTab,
- onTabChange: setDashboardTab,
+ onTabChange: handleTabChange,
onDisconnect: handleDisconnect,
};
if (dashboardTab === "balances") {
- return ;
+ return (
+
+ );
}
if (dashboardTab === "transfer") {
- return ;
+ return (
+
+ );
}
if (dashboardTab === "activity") {
diff --git a/packages/dapp/src/pages/DashboardBalancesPage.tsx b/packages/dapp/src/pages/DashboardBalancesPage.tsx
index 4da0d54..b3ef2d6 100644
--- a/packages/dapp/src/pages/DashboardBalancesPage.tsx
+++ b/packages/dapp/src/pages/DashboardBalancesPage.tsx
@@ -35,6 +35,8 @@ interface Props {
onTabChange: (tab: DashboardTab) => void;
onDisconnect: () => void;
keyMode: "custodial" | "external";
+ /** Open the Transfer tab with this token pre-selected. */
+ onSendToken: (tokenAddress: string) => void;
}
type OfferRowState = "idle" | "preparing" | "signing" | "executing";
@@ -170,6 +172,7 @@ export function DashboardBalancesPage({
onTabChange,
onDisconnect,
keyMode,
+ onSendToken,
}: Props) {
const [fetchState, setFetchState] = useState(null);
const [offers, setOffers] = useState(null);
@@ -444,7 +447,10 @@ export function DashboardBalancesPage({
{token.symbol}
-