feat: redesign wallet login and favorites, fix desktop/mobile bugs

- Remove forced BNB chain switch on injected login (signature is chain-agnostic)
- Refine isMobileDevice so touch Macs stay on desktop flow
- Wire RainbowKit/WalletConnect as a real MetaMask/imToken QR fallback,
  gated on a valid VITE_WALLETCONNECT_PROJECT_ID
- Rebuild login modal: single desktop primary action, collapsible other
  methods, mobile open-app fallback feedback, brand icons
- Add My Favorites entry points (header, mobile menu, wallet dropdown)
- Favorites page: error retry, mobile filter drawer
- Auto sign-out and re-login prompt on favorites 401
- Full native translations for all wallet strings across 7 locales

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
TerryM
2026-06-02 03:43:13 +08:00
parent f935f122f9
commit 7abe4a868c
17 changed files with 715 additions and 155 deletions

View File

@@ -0,0 +1,33 @@
import type { WalletKind } from "./injected";
type Brand = { bg: string; label: string };
const brands: Record<WalletKind, Brand> = {
tokenPocket: { bg: "#2980FE", label: "TP" },
metaMask: { bg: "#F6851B", label: "M" },
imToken: { bg: "#11C4D1", label: "im" },
};
/**
* Lightweight brand badge for wallet buttons — a rounded square tinted with the
* wallet's brand color and its monogram. Keeps bundle small while making each
* wallet visually distinguishable.
*/
export function WalletBrandIcon({
kind,
size = 28,
}: {
kind: WalletKind;
size?: number;
}) {
const brand = brands[kind];
return (
<span
aria-hidden="true"
style={{ width: size, height: size, backgroundColor: brand.bg }}
className="inline-flex shrink-0 items-center justify-center rounded-lg text-[11px] font-bold leading-none text-white"
>
{brand.label}
</span>
);
}