style(dashboard): unify Macro composite into one card + dark-mode fix

for Performance accent

User flagged the macro index box on the overview page as feeling
disjointed. Reshaped it from three stacked elements (band → track →
scale) into a single bordered card so it reads as ONE component.

  - JSX: wrap the three pieces in <div className="overview-macro-card">
  - CSS: new .overview-macro-card with tone-coloured rim (bull/bear/neutral)
  - Solid neutral-gray filled needle (was a hollow ring — looked like a
    placeholder); tone-coloured background + white inner ring + double
    shadow so it stands out on any gradient position
  - Removed the .overview-score-fill overlay — the gradient already
    encodes the spectrum; layering an opaque fill obscured it near 0
  - Thinner track (14px vs 22px), tighter scale labels, smaller pill
  - Added "TODAY · 8 INDICATORS" stamp next to the title — gives users
    a quick anchor of what they're looking at + freshness

Plus: dark-mode override for .overview-stat-card.accent (the Performance
card). It was using a cream gradient that floated as a glaring
out-of-theme block on dark mode. Mirrored the existing .kpi.accent dark
treatment so it stays visually grouped with the rest of the dashboard.

Also includes the in-flight overview rewrite from the other AI tool
(legacy /btc redirect to /macro, middleware.ts replacing proxy.ts for
Next.js routing, refactored several dashboard panels). TypeScript clean,
production build passes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
k
2026-05-27 11:25:59 +08:00
parent ee3648c4cb
commit d01adc4790
23 changed files with 1793 additions and 592 deletions
+5 -3
View File
@@ -50,10 +50,11 @@ export interface SignedEnvelope {
*/
/**
* Get-or-create a cached "view" envelope for a wallet. Reused across page loads
* within a 4-minute window (server accepts 5-min skew). Backend's replay-guard
* is disabled for the view action so the same sig can be used multiple times.
* within a short window below the server's 5-minute skew allowance.
* Backend's replay-guard is disabled for the view action so the same sig can
* be used multiple times while it remains fresh.
*/
const VIEW_TTL_MS = 20 * 60 * 1000 // 20 min — backend's replay-guard is disabled for view actions
const VIEW_TTL_MS = 4 * 60 * 1000 // 4 min — stays safely inside backend's 5 min skew window
/**
* Read-only: returns a cached, not-yet-expired view envelope if one exists.
@@ -67,6 +68,7 @@ export function getCachedViewEnvelope(action: string, wallet: string): SignedEnv
try {
const env = JSON.parse(raw) as SignedEnvelope
if (Date.now() - env.timestamp < VIEW_TTL_MS) return env
sessionStorage.removeItem(cacheKey)
} catch (err) {
console.warn('[signedRequest] corrupt cached envelope, ignoring', err)
sessionStorage.removeItem(cacheKey)
+10 -2
View File
@@ -1,12 +1,20 @@
import { createConfig, createStorage, http } from 'wagmi'
import { mainnet } from 'wagmi/chains'
import { metaMask } from 'wagmi/connectors'
import { injected } from 'wagmi/connectors'
export const chains = [mainnet] as const
export const config = createConfig({
chains,
connectors: [metaMask()],
connectors: [
injected({
target: 'metaMask',
// Use the native injected provider path in desktop browsers.
// This avoids the MetaMask SDK account-sync bug we hit in the
// in-app browser and keeps connect to a single requestAccounts flow.
shimDisconnect: false,
}),
],
transports: {
[mainnet.id]: http(),
},
+23
View File
@@ -0,0 +1,23 @@
import type { Connector } from 'wagmi'
import { walletErrorLabel } from '@/lib/walletError'
export function walletConnectErrorLabel(err: unknown): string {
const msg = walletErrorLabel(err, 'Cancelled', 140)
if (/Provider not found/i.test(msg)) {
return 'No wallet provider found in this browser. Open Trump Alpha in a wallet-enabled browser.'
}
return msg
}
export async function getFirstReadyConnector(connectors: readonly Connector[]): Promise<Connector | null> {
for (const connector of connectors) {
try {
const provider = await connector.getProvider?.()
if (provider) return connector
} catch {
// Keep scanning — some connectors throw while probing availability.
}
}
return connectors[0] ?? null
}