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:
@@ -30,8 +30,23 @@ function authHeaders(token: string): HeadersInit {
|
||||
return { Authorization: `Bearer ${token}` };
|
||||
}
|
||||
|
||||
/** HTTP error that preserves the status code so callers can react to 401s. */
|
||||
export class FavoriteHttpError extends Error {
|
||||
readonly status: number;
|
||||
constructor(status: number, message: string) {
|
||||
super(message || `Request failed (${status})`);
|
||||
this.name = "FavoriteHttpError";
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
|
||||
/** True when an error means the wallet session is no longer authorized. */
|
||||
export function isFavoritesAuthError(error: unknown): boolean {
|
||||
return error instanceof FavoriteHttpError && error.status === 401;
|
||||
}
|
||||
|
||||
async function parseJSON<T>(res: Response): Promise<T> {
|
||||
if (!res.ok) throw new Error(await res.text());
|
||||
if (!res.ok) throw new FavoriteHttpError(res.status, await res.text());
|
||||
return res.json() as Promise<T>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user