fix(rwallet): yield page renders standalone without wallet detection

Force topTab=visualizer and skip hero/address/features/examples when
activeView is yield. Works for both authenticated and anonymous users.
Yield rates auto-load on page init without requiring a wallet address.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-15 12:33:40 -07:00
parent 374f4adccb
commit 6d40904fa7
1 changed files with 38 additions and 20 deletions

View File

@ -214,23 +214,29 @@ class FolkWalletViewer extends HTMLElement {
this.address = params.get("address") || "";
this.checkAuthState();
// If address in URL, show visualizer regardless of auth
if (this.address) {
// Yield view is standalone — always force visualizer tab
if (this.activeView === "yield") {
this.topTab = "visualizer";
}
// For visualizer tab: auto-load address or demo
if (this.topTab === "visualizer" && !this.address) {
if (this.passKeyEOA) {
this.address = this.passKeyEOA;
} else {
this.address = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
this.render();
this.loadYieldData();
} else {
// If address in URL, show visualizer regardless of auth
if (this.address) {
this.topTab = "visualizer";
}
}
this.render();
if (this.topTab === "visualizer" && this.address) this.detectChains();
if (this.activeView === "yield") this.loadYieldData();
// For visualizer tab: auto-load address or demo
if (this.topTab === "visualizer" && !this.address) {
if (this.passKeyEOA) {
this.address = this.passKeyEOA;
} else {
this.address = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
}
}
this.render();
if (this.topTab === "visualizer" && this.address) this.detectChains();
}
}
if (!localStorage.getItem("rwallet_tour_done")) {
setTimeout(() => this._tour.start(), 1200);
@ -1433,6 +1439,12 @@ class FolkWalletViewer extends HTMLElement {
.yield-header-desc {
font-size: 13px; color: var(--rs-text-secondary); margin: 0; line-height: 1.5; max-width: 560px;
}
.yield-back-link {
padding: 8px 16px; border-radius: 8px; border: 1px solid var(--rs-border);
color: var(--rs-text-secondary); text-decoration: none; font-size: 13px; font-weight: 500;
white-space: nowrap; transition: all 0.2s;
}
.yield-back-link:hover { border-color: var(--rs-accent); color: var(--rs-accent); }
/* ── Yield tab ── */
.yield-summary {
@ -1924,6 +1936,8 @@ class FolkWalletViewer extends HTMLElement {
}
private renderYieldStandaloneHeader(): string {
// Derive the wallets link from current URL
const basePath = window.location.pathname.replace(/\/yield\/?$/, "");
return `
<div class="yield-header">
<div class="yield-header-row">
@ -1931,7 +1945,7 @@ class FolkWalletViewer extends HTMLElement {
<h2 class="yield-header-title">Stablecoin Yield</h2>
<p class="yield-header-desc">Compare APY rates across Aave V3 and Morpho Blue vaults on Ethereum and Base. Deposit idle USDC, USDT, or DAI through your Safe multisig.</p>
</div>
<button class="view-tab" data-view="balances" style="white-space:nowrap">Back to Balances</button>
<a href="${basePath}/wallets" class="yield-back-link">Back to Wallets</a>
</div>
</div>`;
}
@ -2169,6 +2183,11 @@ class FolkWalletViewer extends HTMLElement {
}
private renderVisualizerTab(): string {
// Yield view is standalone — skip wallet UI entirely
if (this.activeView === "yield") {
return `${this.renderYieldStandaloneHeader()}${this.renderYieldTab()}`;
}
return `
${this.renderHero()}
@ -2191,15 +2210,14 @@ class FolkWalletViewer extends HTMLElement {
` : ""}
</div>
${this.activeView !== "yield" ? this.renderSupportedChains() : ""}
${this.renderSupportedChains()}
${this.error ? `<div class="error">${this.esc(this.error)}</div>` : ""}
${this.loading ? '<div class="loading"><span class="spinner"></span> Detecting wallet across chains...</div>' : ""}
${this.activeView === "yield"
? `${this.renderYieldStandaloneHeader()}${this.renderYieldTab()}`
: `${this.renderFeatures()}${this.renderExamples()}${this.renderDashboard()}`
}
${this.renderFeatures()}
${this.renderExamples()}
${this.renderDashboard()}
`;
}