Root cause: Token symbol mismatch between TokenSwap component and WalletContext
- WalletContext stored balance with key 'USDT'
- TokenSwap used symbol 'wUSDT' for lookups
- This caused balances['wUSDT'] to return undefined
- Triggered false "insufficient balance" errors
Changes:
- Updated TokenSwap.tsx to use 'USDT' symbol consistently
- Fixed token symbol in AVAILABLE_TOKENS array
- Updated asset ID mapping in swap transaction logic
- Fixed swap history token display
Also includes:
- Added new DEX components (SwapInterface, PoolBrowser, etc.)
- Added TypeScript type definitions for DEX
- Added DEX utility functions
- Removed obsolete test scripts
- Updated WalletContext with USDT balance support
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Cleaned up console.log statements added during debugging:
- Removed verbose logging from ProfileSettings loadProfile
- Removed verbose logging from ProfileSettings updateProfile
- Removed verbose logging from Dashboard fetchProfile
Kept only essential error logging for production.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Changes:
1. Created migration 004_create_upsert_function.sql:
- Creates upsert_user_profile() function with SECURITY DEFINER
- Bypasses RLS to allow profile creation/updates
- Only accessible to authenticated users via auth.uid()
2. Updated ProfileSettings.tsx:
- Changed from direct upsert to RPC function call
- Updated updateProfile() to use supabase.rpc()
- Updated updateNotificationSettings() to use same function
This solves the RLS policy violation by using a secure
server-side function that properly handles authentication.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Changes:
1. Created migration 003_fix_profile_creation.sql:
- Added INSERT policy for profiles table
- Made username nullable with default value
- Created upsert_profile function for safe upserts
2. Updated ProfileSettings.tsx:
- Changed from .update() to .upsert()
- Added id field to upsert data
- Added loadProfile() call after save to refresh state
This fixes the issue where users couldn't update their profile
because no profile row existed in the database.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Added detailed console logging to track data flow:
- ProfileSettings: Log data being saved and save responses
- ProfileSettings: Log data being loaded when page opens
- Dashboard: Log profile data being fetched and set to state
This will help identify where profile data is being lost between
save in ProfileSettings and display in Dashboard.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Added ArrowLeft navigation button to return to home page on:
- AdminPanel.tsx - Admin panel page
- ProfileSettings.tsx - Profile settings page
- PasswordReset.tsx - Password reset page
- EmailVerification.tsx - Email verification page
- WalletDashboard.tsx - Wallet dashboard page
- Dashboard.tsx - User dashboard page
Each page now includes:
- Import of ArrowLeft icon from lucide-react
- Import of useNavigate from react-router-dom (if not already present)
- Positioned button in top-left (absolute positioning)
- Consistent styling: gray-400 with hover effect
- Navigate to '/' on click
This improves UX by providing consistent navigation across all sub pages.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>