Commit Graph

15 Commits

Author SHA1 Message Date
pezkuwichain 82ff3fd283 chore: Remove debug logging from profile operations
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>
2025-10-29 05:26:43 +03:00
pezkuwichain 205e22e083 fix: Use SECURITY DEFINER function for profile upserts
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>
2025-10-29 05:10:53 +03:00
pezkuwichain 280c335977 fix: Use upsert for profile updates to handle missing rows
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>
2025-10-29 04:45:23 +03:00
pezkuwichain ca510ead86 debug: Add comprehensive logging to profile save/fetch operations
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>
2025-10-29 04:30:43 +03:00
pezkuwichain 9ca14ec300 fix: Sync field names between ProfileSettings and Dashboard
Root Cause:
- ProfileSettings was saving to: phone, (missing location, website)
- Dashboard was reading from: phone_number, location, website
- Field name mismatch caused "Not set" despite successful saves

Changes to ProfileSettings:
1. Renamed field: phone → phone_number (matches Dashboard & migration)
2. Added fields: location, website (now editable)
3. Updated state initialization, loadProfile, and updateProfile functions
4. Added UI inputs for Location and Website

Now ProfileSettings saves to:
- username, full_name, bio 
- phone_number, location, website  (was: phone )
- language, theme 

Dashboard reads from same fields:
- full_name, phone_number, location, website 

Result: Profile updates now persist correctly!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 04:25:18 +03:00
pezkuwichain f82c38fb05 fix: Remove email_verified update to profiles table (400 Bad Request)
Issue: Dashboard was throwing 400 Bad Request when updating profiles table

Root Cause:
- Dashboard tried to update profiles.email_verified column
- But this column doesn't exist in profiles table
- Migration only has: username, email, full_name, avatar_url, referral fields

Solution:
- Removed sync logic that updates profiles.email_verified
- Email verification is now ONLY read from Supabase Auth (user.email_confirmed_at)
- No need to duplicate verification status in profiles table

Benefits:
- No more 400 errors
- Single source of truth (Supabase Auth)
- Cleaner code, less database writes

UI still works correctly:
- Account Status card checks: user?.email_confirmed_at || profile?.email_verified
- Since user.email_confirmed_at exists, profile.email_verified is never needed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 04:08:01 +03:00
pezkuwichain d00b830e0a fix: Sync email verification status from Supabase Auth
Root Cause:
- Dashboard was checking profiles.email_verified column
- But Supabase Auth uses user.email_confirmed_at field
- This caused verified emails to show as "Unverified"

Changes:
1. Dashboard now checks BOTH sources:
   - Primary: user.email_confirmed_at (Supabase Auth)
   - Fallback: profile.email_verified (profiles table)

2. Auto-sync profiles table:
   - When loading profile, sync email_verified from Auth
   - Updates profiles table if verification status differs

3. UI Improvements:
   - Show verification date in Account Status card
   - Display "Verified" badge next to email instead of button
   - Hide warning message if email is verified
   - Only show "Verify Email" button if truly unverified

This ensures consistent verification status across:
- Account Status card (top)
- Profile tab (email field)
- Security tab (warning message)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 03:59:06 +03:00
pezkuwichain e05fd0234a fix: Improve email verification with better error handling
- Added fallback verification method using password reset email
- Added detailed error messages for rate limits and user not found
- Added console logging for debugging email send issues
- Improved user feedback with "check spam folder" message

Debug steps:
1. Check browser console for detailed error logs
2. Verify Supabase dashboard settings (Auth > Email)
3. Check email templates are configured
4. Confirm "Confirm email" is enabled in Auth settings

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 03:45:45 +03:00
pezkuwichain 4dce9a9298 feat: Integrate real-time blockchain roles with Pallet-Tiki
Implemented comprehensive tiki (role) system integration with Dashboard:

New Features:
- Created src/lib/tiki.ts utility library based on real pallet-tiki implementation
- Added fetchUserTikis() to query user roles from blockchain
- Implemented role scoring, categorization, and display helpers
- Added "Roles & Tikis" tab to Dashboard showing:
  * Primary role from highest-scoring tiki
  * Total tiki score (sum of all role scores)
  * All assigned roles with emoji indicators
  * Role categories (Government, Judiciary, Education, etc.)
  * Connected wallet address

Role System Details:
- 49 different tiki types from pallet-tiki (Serok, Wezir, Dadger, etc.)
- Role assignment types: Automatic, Appointed, Elected, Earned
- Score-based hierarchy (10-250 points per role)
- Dynamic role display based on blockchain state
- Fallback to "Member" when no wallet connected or no tikis assigned

Dashboard Improvements:
- Fixed email verification using Supabase auth.resend()
- Fixed Edit Profile button to navigate to /profile/settings
- Added Tiki Score card showing total score and role count
- Expanded stats grid to 4 columns (Status, Join Date, Role, Tiki Score)
- Real-time role updates when wallet connects/disconnects

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 03:40:48 +03:00
pezkuwichain 1caad3ad79 feat: Major UI improvements and DEX integration
 Features:
- Improved navbar with proper flex layout and spacing
- Added Governance and Trading dropdown menus
- Integrated TokenSwap with AssetConversion pallet support
- Added DEX availability check with fallback UI

🎨 UI Improvements:
- Fixed navbar logo positioning (left-aligned)
- Menu items flow naturally from left to right
- Responsive design improvements
- Updated social media links in footer

🔧 Technical:
- Real-time balance queries from Assets pallet
- Exchange rate calculation from liquidity pools
- Slippage protection
- Transaction event monitoring

📝 Modified files:
- AppLayout.tsx: Navbar restructure
- TokenSwap.tsx: DEX integration
- WalletModal.tsx: Wallet improvements
- Login.tsx: Auth updates
2025-10-29 02:02:11 +03:00
pezkuwichain f9b059d4f7 fix: Improve text readability on light backgrounds
Fixed white/light text on white/light backgrounds across multiple pages by adding text-gray-900 classes to ensure proper contrast and readability. This addresses the issue where text was unreadable until hover/click on delegation, proposal, swap, and other pages.

Changes:
- DelegationManager: Added dark text to green-50 TabsList
- DelegateProfile: Fixed text color in blue-50 and green-50 Alert components
- ProposalWizard: Added dark text to green-50 success Alert
- Dashboard: Fixed text color in yellow-50 verification warning
- TokenSwap: Added dark text to all gray-50 and blue-50 containers (6 instances)
- DiscussionThread: Fixed markdown help card with gray-50 background
- FundingProposal: Added dark text to yellow-50 milestone warning

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 23:12:51 +03:00
pezkuwichain b600b2951f feat: Add back to home button to all sub pages
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>
2025-10-28 22:47:22 +03:00
pezkuwichain 9bf1c79e44 feat: Complete wallet features - Multi-token support, Receive modal, Transaction history 2025-10-28 08:04:14 +03:00
pezkuwichain 2d1a2cf3ba feat: Add wallet dashboard with balance and transfer functionality
New Components:
- AccountBalance: Real-time balance display with free/reserved breakdown
- TransferModal: Token transfer interface with transaction signing
- WalletDashboard: Complete wallet management page

Features:
- Live balance fetching from blockchain
- Balance subscription for real-time updates
- Transfer modal with recipient and amount input
- Transaction signing via Polkadot.js extension
- Transaction status tracking (signing, pending, success, error)
- Account switching support
- Responsive dashboard layout
- Quick action buttons (Send, Receive, History)

Technical:
- Integration with PolkadotContext
- web3FromAddress for transaction signing
- signAndSend for blockchain transactions
- Balance conversion (plancks to tokens)
- Error handling and user feedback
- Toast notifications for transaction status

Navigation:
- Added /wallet route with ProtectedRoute
- Added Wallet link to navigation menu
2025-10-28 00:28:20 +03:00
pezkuwichain 9aab34c101 Initial commit - PezkuwiChain Web Governance App 2025-10-22 18:21:46 -07:00