Commit Graph

60 Commits

Author SHA1 Message Date
pezkuwichain 591e63e99e feat: Add citizenship NFT workflow and wallet enhancements
- Add BeCitizen page with citizenship application workflow
- Add NftList component to display Tiki role NFTs
- Implement citizenship crypto and workflow utilities
- Add wallet score tracking and calculation
- Update WalletDashboard to display NFTs and scores
- Update AccountBalance and AppLayout for better UX
- Enhance PolkadotContext with Tiki pallet integration
- Clean up temporary debugging scripts

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 19:39:02 +03:00
pezkuwichain 3212af89b2 feat: Implement live blockchain staking with score tracking and PEZ rewards
- Add comprehensive staking library (src/lib/staking.ts) with blockchain queries
- Rewrite StakingDashboard to use validator nomination staking
- Implement real-time staking score from pallet_staking_score
- Add PEZ rewards display from pallet_pez_rewards
- Fix bonded amount display with stash/controller account handling
- Add 5-card dashboard: Total Bonded, Unlocking, Redeemable, Staking Score, PEZ Rewards
- Implement bond, nominate, unbond, and withdraw functionality
- Add auto-refresh every 30 seconds for real-time data

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 07:36:18 +03:00
pezkuwichain 617b61030a fix: Enable dynamic liquidity pools and improve USDT display consistency
- Make AddLiquidityModal dynamic to support all pool combinations (HEZ-PEZ, HEZ-USDT, PEZ-USDT)
- Pass asset0 and asset1 props from PoolDashboard to AddLiquidityModal
- Rename balance key from wUSDT to USDT in WalletContext for user-facing consistency
- Display USDT instead of wUSDT in PriceChart for better UX
- Backend still uses wUSDT (Asset ID 2), but frontend shows USDT to users

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 19:55:57 +03:00
pezkuwichain 5686386ef6 chore: Add utility scripts for DEX pool management
- check-asset-state.mjs: Asset state verification
- check-balances.mjs: Balance checking utilities
- check-founder-balances.mjs: Founder account balance checks
- check-hez-balance.mjs: HEZ token balance verification
- check-pool-balances-detailed.mjs: Detailed pool balance analysis
- create-all-pools.mjs: Automated pool creation
- create-pez-wusdt-pool.mjs: PEZ/wUSDT pool setup
- mint-and-create-pools.mjs: Mint tokens and create pools
- mint-whez.mjs: wHEZ minting utility
- verify-pool-state.mjs: Pool state verification
- wrap-hez-and-create-all-pools.mjs: HEZ wrapping and pool setup

These scripts support DEX pool management and testing for beta testnet.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 12:55:15 +03:00
pezkuwichain 4825ac3839 feat: Add USDT support, dynamic pricing, and balance validation
Major improvements to wallet dashboard and DEX functionality:

## USDT Integration
- Add wUSDT (Asset ID 2) support with 6 decimal precision
- Display USDT balances in wallet dashboard
- Integrate USDT into swap and pool interfaces

## Dynamic Token Pricing
- Fetch real-time HEZ and PEZ prices from liquidity pools
- Calculate USD values using pool reserve ratios
- Display live USD equivalent for token balances

## User Experience Improvements
- Hide wrapped tokens (wHEZ, wUSDT) from user interface
- Show only HEZ, PEZ, USDT as user-facing tokens
- Handle wrapping/unwrapping transparently in backend
- Add balance validation before swap transactions
- Prevent insufficient balance swaps with clear warnings

## Pool Dashboard Enhancements
- Support multiple pool pairs (HEZ/PEZ, HEZ/USDT, PEZ/USDT)
- Dynamic pool selection interface
- User-friendly token names throughout pool interface

## Technical Improvements
- Correct decimal handling (6 for USDT, 12 for others)
- Proper pool account ID derivation using blake2 hash
- Balance subscriptions for real-time updates
- Custom token support with Add Token modal

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 10:56:44 +03:00
pezkuwichain 262a0da939 feat: Update pool dashboard to display PEZ/wUSDT pool
- Switch pool display from wHEZ/PEZ to PEZ/wUSDT
- Fix wUSDT decimal conversion (1e6 instead of 1e12)
- Update TokenSwap to support beta testnet endpoint
- Add wallet reconnection on network change
- Update API endpoint to wss://beta.pezkuwichain.com

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 12:50:06 +03:00
pezkuwichain 6c30c06660 config: Adrêsên multisig yên rastîn zêde kir
Multisig Members (3/5):
• Serok: 5D74yW53pg3gCaLMzGvZUNxiqTZMwFXA85bB2QYfcYh5Tdc4
• SerokiMeclise: 5GTRuK96TkmjUSuQnkjBJBCEmHSDSdW22ptWosxCBWACfsZp
• Xezinedar: 5DRTYPChot1UPDHEeJVTtuE8dLDgCVvAcWbdnc8zwwpYYjeR
• Noter: 5DFwqK698vL4gXHEcanaewnAqhxJ2rjhAogpSTHw3iwGDwd3
• Berdevk: 5F4V6dzpe72dE2C7YN3y7VGznMTWPFeSKL3ANhp4XasXjfvj

Guhertin:
 ReservesDashboardPage.tsx - SPECIFIC_ADDRESSES bi adrêsên rastîn
 USDT_MULTISIG_SETUP.md - Tabloya adrêsên tije
 MULTISIG_CONFIG.md (nû) - Referansa bilez û complete config

Ewlekarî:
🔒 Tenê public addresses hate paylaşkirin
🔒 Seed phrases/private keys NEHATINE dîtin
🔒 On-chain verification ji bo unique roles amade ye

🤖 Bi [Claude Code](https://claude.com/claude-code) re hate çêkirin

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 02:49:12 +03:00
pezkuwichain d860d8beb3 feat: Pergala USDT multisig a tevahî li ser chain
Taybetmendiyên Nû:
• pallet-multisig bi kar anîna - 3/5 threshold
• wUSDT asset (ID: 2) - 1:1 backing bi USDT
• Multisig members: Serok, SerokiMeclise, Xezinedar, Noter, Berdevk
• Otomatîk query ji pallet-tiki (unique roles)

Lib/Utilities:
 src/lib/multisig.ts - Multisig utilities (members, tx, queries)
 src/lib/usdt.ts - wUSDT bridge helpers (mint, burn, reserves)
 src/lib/wallet.ts - WUSDT asset ID zêde kir

Components:
 MultisigMembers.tsx - Multisig members display
 USDTBridge.tsx - Deposit/withdrawal UI
 ReservesDashboard.tsx - Reserve monitoring dashboard

Pages & Routes:
 ReservesDashboardPage.tsx - /reserves route
 App.tsx - Route integration

Taybetmendî:
• Full on-chain multisig (no Ethereum dependency)
• Automatic tiki holder lookup
• Reserve health monitoring
• Tiered withdrawal limits (instant, standard, large)
• Event subscriptions (mint/burn tracking)
• 1:1 USDT backing verification

Documentation:
 USDT_MULTISIG_SETUP.md - Complete setup guide

🤖 Bi [Claude Code](https://claude.com/claude-code) re hate çêkirin

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 00:40:12 +03:00
pezkuwichain ee6224e707 docs: Pelên pêşkeftinê û amûrên testing DEX zêde bike
- README_DEX_IMPROVEMENTS.md: Belgekirin û rave kirinên DEX
- check-pool.mjs: Amûra kontrolkirina rewşa pool
- create-beta-pool.mjs: Script ji bo çêkirina pool li beta testnet
- create-beta-pool.js: Versiyona JavaScript ya scripta çêkirina pool

Ev pel ji bo pêşkeftin û testing in.

🤖 Bi [Claude Code](https://claude.com/claude-code) re hate çêkirin

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 23:49:58 +03:00
pezkuwichain 4839765aee serrastkirin: Hesabkirina pool account bi blake2 hash
- poolAccountIds fonksiyona API tune ne, ji ber vê hataye derket
- Niha pool account bi AccountIdConverter û blake2 hash tê hesabkirin
- PalletId "py/ascon" bi (u32, u32) poolId re tê hash kirin
- Ev guhertin hem ji bo AddLiquidityModal û hem jî PoolDashboard

Taybetmendî:
 Add liquidity niha bi rast dixebite
 Pool metrics rast têne xuyakirin
 Reserve balances rast têne hesabkirin
 LP position tracking çêbû

🤖 Bi [Claude Code](https://claude.com/claude-code) re hate çêkirin

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 23:48:44 +03:00
pezkuwichain 8af6127e7e feat: Add comprehensive liquidity pool management system
- Add AddLiquidityModal with automatic HEZ to wHEZ wrapping and 10% slippage tolerance
- Add RemoveLiquidityModal with automatic wHEZ to HEZ unwrapping
- Add PoolDashboard component with metrics, APR calculation, and impermanent loss calculator
- Add /pool route and integrate Pool button in WalletDashboard
- Display real-time pool reserves, TVL, and user positions
- Support batched transactions for optimal UX

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 23:32:40 +03:00
pezkuwichain 6c1fa9f1bf chore: Switch to beta testnet endpoint
- Changed default endpoint from ws://127.0.0.1:9944 to wss://beta.pezkuwichain.io
- Preparing for multi-validator beta testnet deployment

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 16:24:07 +03:00
pezkuwichain c9b6dea419 chore: Remove debug logs from swap history parsing
Clean up console.log statements used for debugging the path parsing issue.
Keep only essential error logging.
2025-11-01 15:46:53 +03:00
pezkuwichain b6679aa3cd fix: Correct path array parsing for swap token symbols
The path is an array of tuples [[assetId, amount], [assetId, amount]],
not an array of objects. Fixed to access asset ID at index 0 of each tuple.

Previous code was trying to access object properties (nativeOrAsset.asset)
which don't exist on arrays, causing all swaps to default to HEZ→HEZ.
2025-11-01 15:43:52 +03:00
pezkuwichain 243f3df4bd fix: Correct SwapExecuted event destructuring - add missing send_to field
The SwapExecuted event has 5 fields (who, send_to, amountIn, amountOut, path),
not 4. The old code was missing send_to, which caused the path (asset array)
to be assigned the recipient address instead, resulting in all swaps showing
as HEZ→HEZ regardless of actual token pairs.

This fixes the swap history display to show correct token symbols.
2025-11-01 15:40:34 +03:00
pezkuwichain 41bfce3ba4 fix: Correct token symbol parsing in swap history
- Fixed path array parsing for SwapExecuted events
- Handle different Polkadot.js enum formats (nativeOrAsset vs NativeOrAsset)
- Added toJSON() conversion for proper array parsing
- Now correctly shows HEZ↔PEZ swaps instead of HEZ→HEZ
- Applied fix to both initial history load and post-swap refresh

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 15:27:57 +03:00
pezkuwichain 5eb1cea6f2 feat: Add advanced trading features - Price Charts, Limit Orders & Escrow
🎨 Price Chart Component (TradingView style):
- Real-time price chart with Area Chart visualization
- Multiple timeframes (1H, 24H, 7D, 30D)
- Price change indicator with trending icons
- Color-coded (green for bullish, red for bearish)
- Historical data generation with random walk algorithm
- Responsive Recharts integration

📊 Limit Orders System:
- Full limit order management UI
- Create buy/sell limit orders at target prices
- Order status tracking (pending, filled, cancelled, expired)
- Price distance calculation from current market
- Order expiration (24h default)
- Order cancellation feature
- Real-time order list with filtering
- Step-by-step order creation wizard

🔒 P2P Escrow System (Binance P2P style):
- 3-step escrow flow (Funding → Payment → Release)
- Visual progress indicator with step icons
- Secure escrow protection explanation
- Trade details summary card
- Payment instructions & time limits
- Status-based UI (blue, yellow, green alerts)
- Cancel trade functionality
- Complete trade summary

All features are UI-ready and prepared for blockchain integration.
World-class trading experience matching Uniswap, Binance P2P & TradingView!

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 15:20:44 +03:00
pezkuwichain ea1fe462b4 feat: Enhance trading/P2P with world-class features
TokenSwap Improvements (Uniswap/PancakeSwap inspired):
-  Price impact indicator with color-coded warnings (<1% green, 1-5% yellow, >5% red)
-  Real-time transaction history from blockchain (SwapExecuted events)
-  LP fee breakdown display
-  Minimum received calculation with slippage
-  High price impact warnings (>5%)
-  Auto-refresh history after successful swaps

P2P Market Improvements (Binance P2P/LocalBitcoins inspired):
-  Advanced filtering system (payment method, price range)
-  Smart sorting (by price, rating, completed trades)
-  Create Order modal with full form
-  Collapsible advanced filters panel
-  Clear all filters button
-  Better UX with filter toggles

These features bring DKSweb trading experience to world-class standards,
matching the best DEX and P2P platforms in the crypto ecosystem.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 14:50:41 +03:00
pezkuwichain 56170bbd57 perf: Further optimize DKstate background image
- Reduced file size from 243KB to 149KB (39% additional reduction)
- Total optimization: 719KB -> 149KB (79% reduction)
- Enhanced page load performance significantly

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 14:38:06 +03:00
pezkuwichain 580552db0b perf: Optimize DKstate background image
- Reduced file size from 719KB to 243KB (66% reduction)
- Updated DKstate.png with optimized version
- Improved page load performance

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 13:24:26 +03:00
pezkuwichain dc35e19099 feat: Replace hero section background with DKstate image
- Added DKstate.png to public folder (719KB PNG)
- Replaced Kurdish Flag CDN image with local DKstate background
- Updated alt text to "DKstate Background"
- Maintained gradient overlay styling

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 12:39:12 +03:00
pezkuwichain 861e8c710a feat: Replace reward distribution image with PezkuwiChain logo
- Added PezkuwiChain logo to public folder (179KB PNG)
- Replaced CDN image with local logo in RewardDistribution component
- Updated alt text to "PezkuwiChain Logo"

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 11:47:02 +03:00
pezkuwichain 63027314f6 feat: Add real-time trust score display in Wallet Dashboard
- Fetch trust score from blockchain via api.query.trust.trustScores
- Display trust score in AccountBalance component (Account Info card)
- Show between Address and Source fields with Award icon
- Use purple-cyan gradient styling for visual consistency

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 11:30:58 +03:00
pezkuwichain 675a21d214 debug: Add detailed logging for trust score fetch
Added comprehensive console logs to debug trust score fetching:
- API readiness check
- Account availability check
- Query execution log
- Detailed error logging with stack trace

This will help identify the exact point of failure.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 10:56:33 +03:00
pezkuwichain 6ee49de3a0 fix: Correct trust score storage query name
Changed from `trustScoreOf` to `trustScores` to match the actual
storage item name in pallet_trust. Polkadot.js API uses storage names,
not getter function names.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 10:53:00 +03:00
pezkuwichain 96d6277a0f feat: Add real-time trust score to wallet dashboard
- Fetch trust score from pallet_trust via API
- Display score in WalletModal with Award icon
- Shows user's current trust score from blockchain
- Gradient styling (purple to cyan) for visual appeal
- Fallback to '-' when API not ready or score unavailable

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 10:44:17 +03:00
pezkuwichain e9809ebc99 feat: Align Trust Score Calculator with pallet_staking_score
- Replace free slider with HEZ amount input (0-1000)
- Implement discrete amount scores (20, 30, 40, 50) matching blockchain
- Add automatic score calculation based on staked amount
- Show both amount and calculated score in UI
- Duration multipliers unchanged (x1.0 to x2.0)

This ensures the calculator accurately simulates blockchain behavior.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 10:41:38 +03:00
pezkuwichain a1f19e4487 feat: Add total voters and tokens staked from blockchain
- Fetch total staked tokens from pallet_staking.erasTotalStake()
- Count unique voters from pallet_conviction_voting.votingFor.keys()
- Display real-time data instead of hardcoded values
- Shows '-' when data is unavailable (e.g. no current era)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 10:33:04 +03:00
pezkuwichain ad25287721 feat: Connect homepage stats to blockchain data
Updated HeroSection to fetch real governance data:
- Active Proposals from pallet_referenda (was hardcoded to 127)
- Replaced all hardcoded stats with dynamic blockchain queries
- Shows "-" for unavailable data (totalVoters, tokensStaked, trustScore)
- Real-time updates using PolkadotContext API

Now homepage shows actual on-chain referendum count instead of mock data.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 10:25:27 +03:00
pezkuwichain 50cb6d98cc feat: Integrate real blockchain data for governance stats
Connected governance overview to actual blockchain data:
- Active proposals from pallet_referenda
- Treasury balance from treasury account
- Parliament (Council) members from pallet_collective
- Real-time data fetching using PolkadotContext API
- Replaced mock data with live blockchain queries

Todo: Add total voters and participation rate calculation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 10:20:42 +03:00
pezkuwichain 5097b769a1 feat: Add whitepaper PDF download to Docs links
Added Pezkuwi whitepaper PDF to repository and updated navigation:
- Added public/Whitepaper.pdf (738KB)
- Updated Docs links to download whitepaper from GitHub
- Both header and footer navigation now link to GitHub raw PDF
- Users can download whitepaper by clicking Docs

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 10:16:20 +03:00
pezkuwichain 0622e3278f feat: Complete DEX frontend integration with Pezkuwi SDK
🎉 Full DEX UI with token swap functionality
 Wallet connection with Polkadot.js extension
🔄 Real-time balance updates and transaction status

## Features / Taybetmendî:
-  Token swap interface (wHEZ ↔ PEZ) / Rûkarê swap tokenan
-  Wallet integration / Pêvekirina wallet
-  Balance display / Nîşandana balance
-  Transaction processing / Pêvajoya transaction
-  Real-time updates / Nûvekirinên real-time

## Components:
- App.tsx - Main swap interface
- wallet.ts - Polkadot.js integration
- Responsive UI with loading states

Connected to Pezkuwi SDK testnet / Girêdayî testnet Pezkuwi SDK

Bi kêfxweş ji bo Kurdistan 🌟
2025-11-01 08:59:19 +03:00
pezkuwichain 06fe4783f2 feat: Add Kurdistan sun animation for swap processing
Added animated Kurdistan-themed loading indicator that displays during swap transactions:
- KurdistanSun component with 21 rays (Kurdistan flag symbolism)
- White center sun with glow effects
- Rotating colored halos: green (outer), red (middle), yellow (inner)
- Full-screen overlay with backdrop blur during processing
- Fixed timing: dialog closes before animation shows

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 08:44:56 +03:00
pezkuwichain e92baa75c7 fix: DEX swap calculation and wallet refresh issues
- Fix AMM formula to use correct 3% LP fee (was 0.3%)
  - Runtime uses LPFee=30 (3% = 30/1000)
  - Changed to Uniswap V2 formula: amountOut = (amountIn * 970 * reserveOut) / (reserveIn * 1000 + amountIn * 970)
  - Fixes ProvidedMinimumNotSufficientForSwap error

- Fix wallet disconnection after successful swap
  - Added refreshBalances() to WalletContext
  - Replaced window.location.reload() with refreshBalances()
  - Wallet connection now persists after swap

Changes:
- src/components/TokenSwap.tsx: Correct AMM formula, async callback for refresh
- src/contexts/WalletContext.tsx: Add refreshBalances() export
2025-11-01 08:18:24 +03:00
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 ceec6a5569 fix: Simplify profile RLS policies to allow insert
Updated migration 003 to properly handle RLS:
- Make username nullable with default
- Drop all existing policies and recreate them
- Add proper INSERT policy with WITH CHECK clause
- Add UPDATE policy with both USING and WITH CHECK

This fixes RLS error blocking profile creation.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 05:07:18 +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 994bec74af feat: Add missing columns to profiles table
Added comprehensive user profile columns to fix 400 Bad Request errors:

Profile Information:
- bio, phone, location, website
- phone_number, recovery_email, recovery_email_verified

User Preferences:
- language (default: 'en')
- theme (default: 'dark')

Notification Settings:
- notifications_email (default: true)
- notifications_push (default: false)
- notifications_sms (default: false)

Security:
- two_factor_enabled (default: false)
- email_verified (for compatibility)

Metadata:
- joined_at (synced from created_at)
- role (default: 'Member')

Indexes:
- Created indexes on phone, language, location for faster queries

This resolves 400 errors when updating profile settings.

Migration Status:  Successfully executed on Supabase

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 04:13:58 +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 9cc05b3d72 fix: Correct profile settings route from /profile-settings to /profile/settings
Issue: Edit Profile button returned 404 error

Root Cause:
- App.tsx route: /profile-settings (with dash)
- Dashboard navigate: /profile/settings (with slash)
- Route mismatch caused 404

Changes:
- Updated App.tsx route: /profile-settings → /profile/settings
- Updated AppLayout.tsx Settings button navigation

All profile settings links now use consistent /profile/settings route

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 04:04:50 +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 46eb6f3256 fix: Complete English translation keys in en.ts
Problem: Translation keys were showing on screen instead of actual text
- "hero.exploreGovernance" instead of "Explore Governance"
- "nav.proposals" instead of "Proposals"
- "common.backToHome" instead of "Back to Home"

Root Cause: en.ts had only 59 lines while en.json had 244 lines
- config.ts imports en.ts (not en.json)
- Missing keys caused i18n to display the key itself

Solution: Converted all keys from en.json to en.ts flat format
- Added all 280+ translation keys
- Includes: nav, hero, governance, identity, proposals, delegation,
  profile, common, notifications, websocket, auth, wallet, login
- Now matches the complete en.json structure

Result: All translation keys now display proper English text

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 22:57:45 +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