Production polish: i18n shelved, PWA icons, SEO/GEO cleanup, UX fixes

Big-picture changes since 01be8e7:

New routes — /trump /btc /kol /trades /analytics /archive plus four
SEO landing pages (/methodology /glossary /case-studies /contact),
all served under /[locale]. Each has dedicated metadata + JSON-LD.

KOL page (new) — DigestWidget + OnchainWidget + TalkVsTradesWidget,
filter by handle/ticker, click-through to per-post detail with the
original AI-extracted ticker/conviction/quote.

BTC page (new) — tabbed: macro-bottom (AHR999 + 200WMA + Pi Cycle)
and funding-rate reversal, with live sparkline + threshold bands.

Telegram card on Settings — wallet-link code generation, status,
disconnect. Preferences moved into the bot itself (/trump /btc etc.)
so the card stays minimal.

SignalMonitor (new) — ETH/LINK Bollinger breakout monitor in its own
component, shares the singleton WsProvider so no second WS opens.

WS singleton refactor (lib/wsContext) — shared WsProvider + useWsSubscribe
hook. Cleanup now actively closes the socket on unmount; previously the
local `ws` couldn't be reached from cleanup and leaked one connection
per StrictMode remount.

OpenPositions polling no longer pops MetaMask in the background —
splits into load('first') for user-initiated and load('poll') that
uses getCachedViewEnvelope without signing.

i18n shelved — proxy.ts (Next 16 middleware rename) wires next-intl
but only Navbar + layout footer have translations. Rest of UI used
isZh ternary scattered across 28 files. All `const isZh = locale === 'zh'`
flipped to `const isZh = false` so every site renders English; Chinese
branches kept as dead code so revival is one regex away.
LanguageSwitch hidden but file kept. zh-CN hreflang removed from
metadata + sitemap to avoid duplicate-content penalties.

Wallet error handling — lib/walletError.ts: isUserRejection walks EIP-1193
code 4001 + .cause chain; previous string-match for "reject"/"denied"
broke for users running MetaMask in non-English UIs. 12 call sites
migrated across 5 components.

PWA icons — app/icon.tsx + app/apple-icon.tsx render the brand "α" via
Next's ImageResponse so no static PNG asset is required. manifest.ts
references /icon and /apple-icon dynamic routes.

OG image + sitemap + robots — dynamic 1200×630 OG card; robots blocks
both /en/settings and /zh/settings; sitemap only emits /en routes;
JSON-LD covers SoftwareApplication + Organization + 10-Q FAQPage.

Landing page polish — Launch Dashboard button stripped of magnetic
hover + shimmer + lift + glow expansion (multiple users found it busy);
hero scramble alphabet swapped to alphanumeric (was block characters);
"15 KOL feeds" copy updated to 19 in 5 places.

PostCards source icons — new entries for btc_bottom_reversal,
funding_reversal, kol_divergence so they no longer fall through to
the generic "first letter" fallback.

Archive page filter — excludes funding_reversal + kol_divergence
(previously only excluded truth + btc_bottom_reversal so new live
signals leaked into the legacy archive).

Cache + skeleton loading — lib/cache.ts SWR module with per-key TTL,
applied across the major pages so navigation feels instant.

SignConfirmSheet — 4 hardcoded Chinese strings translated to English
(English users were seeing zh-only "需要钱包签名" etc).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
k
2026-05-25 00:53:27 +08:00
parent 01be8e790b
commit d72323b1c6
67 changed files with 11735 additions and 2530 deletions
+182
View File
@@ -0,0 +1,182 @@
'use client'
/**
* SignConfirmSheet — elegant pre-signing confirmation UI.
*
* Usage (imperative, no context needed):
*
* import { confirmSign } from '@/components/wallet/SignConfirmSheet'
*
* const ok = await confirmSign({
* label: 'Enable Auto-Trade',
* description: 'Bot will open live trades on Hyperliquid when signals fire.',
* danger: true,
* })
* if (!ok) return // user cancelled
* const env = await signRequest(...) // only NOW triggers MetaMask
*/
import { createRoot } from 'react-dom/client'
export interface SignConfirmOptions {
/** Short action title, e.g. "Enable Auto-Trade" */
label: string
/** One-sentence explanation shown to the user */
description: string
/** If true, renders a red/warning accent — for irreversible / live-money actions */
danger?: boolean
}
/** Renders a confirmation sheet and resolves true (confirm) or false (cancel). */
export function confirmSign(opts: SignConfirmOptions): Promise<boolean> {
return new Promise((resolve) => {
const container = document.createElement('div')
document.body.appendChild(container)
const root = createRoot(container)
function cleanup(result: boolean) {
root.unmount()
container.remove()
resolve(result)
}
root.render(<Sheet {...opts} onConfirm={() => cleanup(true)} onCancel={() => cleanup(false)} />)
})
}
/* ─── Internal sheet component ─────────────────────────────────────────────── */
function Sheet({
label, description, danger,
onConfirm, onCancel,
}: SignConfirmOptions & { onConfirm: () => void; onCancel: () => void }) {
const accent = danger ? '#ef4444' : '#f5a524'
const accentSoft = danger ? 'rgba(239,68,68,0.1)' : 'rgba(245,165,36,0.1)'
// Dismiss on backdrop click
function handleBackdrop(e: React.MouseEvent<HTMLDivElement>) {
if (e.target === e.currentTarget) onCancel()
}
// Dismiss on Escape
function handleKey(e: React.KeyboardEvent) {
if (e.key === 'Escape') onCancel()
}
return (
<div
onClick={handleBackdrop}
onKeyDown={handleKey}
role="dialog"
aria-modal="true"
aria-label={label}
style={{
position: 'fixed', inset: 0,
background: 'rgba(0,0,0,0.70)',
backdropFilter: 'blur(3px)',
WebkitBackdropFilter: 'blur(3px)',
zIndex: 99999,
display: 'flex', alignItems: 'flex-end', justifyContent: 'center',
padding: '0 0 env(safe-area-inset-bottom, 0)',
}}
>
<div
style={{
width: '100%', maxWidth: 480,
background: '#111',
borderRadius: '16px 16px 0 0',
border: '1px solid #2a2a2a',
borderBottom: 'none',
padding: '28px 24px 32px',
boxShadow: '0 -12px 48px rgba(0,0,0,0.5)',
animation: 'signSheetIn 0.22s cubic-bezier(0.32,0.72,0,1)',
}}
>
{/* 拖拽条 */}
<div style={{
width: 36, height: 4, borderRadius: 2,
background: '#333', margin: '0 auto 24px',
}} />
{/* 图标 + 标题 */}
<div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 12 }}>
<div style={{
width: 40, height: 40, borderRadius: 10,
background: accentSoft,
display: 'flex', alignItems: 'center', justifyContent: 'center',
fontSize: 20, flexShrink: 0,
}}>
🔏
</div>
<div>
<div style={{ fontSize: 11, color: '#666', letterSpacing: '0.07em',
textTransform: 'uppercase', marginBottom: 2 }}>
Wallet signature required
</div>
<div style={{ fontSize: 17, fontWeight: 700, color: '#fff', lineHeight: 1.2 }}>
{label}
</div>
</div>
</div>
{/* 说明文字 */}
<div style={{
fontSize: 14, color: '#999', lineHeight: 1.6,
margin: '16px 0 24px',
paddingLeft: 52, // 与标题对齐
}}>
{description}
</div>
{/* 说明条 */}
<div style={{
padding: '10px 12px', borderRadius: 8,
background: 'rgba(255,255,255,0.04)',
border: '1px solid #2a2a2a',
fontSize: 12, color: '#666', lineHeight: 1.5,
marginBottom: 20,
}}>
Signing is used only to verify your identity. It will NOT authorize
any on-chain transfer and will NOT cost any gas. The MetaMask popup
will appear after you click Confirm.
</div>
{/* 按钮组 */}
<div style={{ display: 'flex', gap: 10 }}>
<button
onClick={onCancel}
style={{
flex: 1, padding: '12px 0',
borderRadius: 10, border: '1px solid #2a2a2a',
background: 'transparent', color: '#888',
fontSize: 14, fontWeight: 600, cursor: 'pointer',
}}
>
Cancel
</button>
<button
onClick={onConfirm}
autoFocus
style={{
flex: 2, padding: '12px 0',
borderRadius: 10, border: 'none',
background: accent, color: danger ? '#fff' : '#000',
fontSize: 14, fontWeight: 700, cursor: 'pointer',
display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 6,
}}
>
<span>Open MetaMask</span>
<span style={{ opacity: 0.7, fontSize: 16 }}></span>
</button>
</div>
</div>
<style>{`
@keyframes signSheetIn {
from { transform: translateY(100%); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
`}</style>
</div>
)
}