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

@@ -1,5 +1,8 @@
import { Heart } from "lucide-react";
import { useEffect, useRef, useState } from "react";
import { Link } from "react-router-dom";
import { useI18n } from "../i18n";
import { useLocalizedPath } from "../useLocalizedPath";
import { shortenAddress, useWallet } from "./WalletProvider";
export function WalletButton({
@@ -10,6 +13,7 @@ export function WalletButton({
onOpenLogin?: () => void;
}) {
const { t } = useI18n();
const lp = useLocalizedPath();
const wallet = useWallet();
const [open, setOpen] = useState(false);
const rootRef = useRef<HTMLDivElement>(null);
@@ -53,6 +57,14 @@ export function WalletButton({
<div className="truncate px-3 py-2 text-xs text-neutral-400">
{wallet.address}
</div>
<Link
to={lp("/favorites")}
onClick={() => setOpen(false)}
className="flex w-full items-center gap-2 rounded-xl px-3 py-2 text-left text-sm font-medium text-neutral-100 transition hover:bg-ark-gold/10 hover:text-ark-gold"
>
<Heart size={16} strokeWidth={2} />
{t("favorites")}
</Link>
<button
type="button"
onClick={() => {