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 bccc12e..8d3243b 100644
--- a/packages/dapp/src/pages/DashboardBalancesPage.tsx
+++ b/packages/dapp/src/pages/DashboardBalancesPage.tsx
@@ -36,6 +36,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";
@@ -176,6 +178,7 @@ export function DashboardBalancesPage({
onTabChange,
onDisconnect,
keyMode,
+ onSendToken,
}: Props) {
const [fetchState, setFetchState] = useState(null);
const [offers, setOffers] = useState(null);
@@ -470,7 +473,10 @@ export function DashboardBalancesPage({
{token.symbol}
-