A comprehensive Token Portfolio management application built with React, TypeScript, and modern web technologies. This application allows users to track cryptocurrency holdings, manage watchlists, connect wallets, and view real-time market data with interactive charts and responsive design.
- Portfolio Total Display: Real-time total value with currency formatting
- Interactive Donut Chart: Visual portfolio distribution with color-coded legend
- Last Updated Timestamp: Shows when data was last refreshed
- Value Calculations: Automatic calculation of
holdings Γ current_price
- Comprehensive Token Table: Displays token info, prices, 24h changes, sparklines
- Editable Holdings: Inline editing of token holdings with real-time value updates
- Pagination: Navigate through large watchlists efficiently
- Token Actions: Add, remove, and manage tokens with context menus
- Search Functionality: Search tokens by name or symbol with debounced input
- Trending Tokens: Discover popular tokens automatically
- Multi-Selection: Select multiple tokens to add simultaneously
- Real-time Search: Live search results from CoinGecko API
- Multiple Wallet Support: MetaMask, WalletConnect, Coinbase Wallet
- Auto-Connect: Remembers previously connected wallets
- ENS Resolution: Human-readable wallet addresses
- Connection Status: Visual indicators for wallet connection state
- Data Persistence: Portfolio data persists regardless of wallet connection
- Live Price Updates: Automatic refresh every 60 seconds
- Manual Refresh: Manual price updates via refresh button
- Market Data: Current prices, 24h changes, and 7-day sparklines
- Error Handling: Graceful handling of API failures
- Redux Toolkit: Complete state management with TypeScript
- localStorage: Persistent data across browser sessions
- Auto-Save: Automatic saving of all user data
- Data Restoration: Seamless data recovery on app restart
- React 19 - Latest React with concurrent features
- TypeScript - Type-safe development
- Vite - Fast build tool and development server
- Redux Toolkit - Modern Redux with simplified API
- React Redux - React bindings for Redux
- TailwindCSS - Utility-first CSS framework
- Custom Styles - Inline styles for precise design matching
- TanStack React Query - Data fetching and caching
- Axios - HTTP client for API requests
- CoinGecko API - Cryptocurrency market data
- Recharts - React charting library
- Custom Sparklines - 7-day price trend charts
- Wagmi - React hooks for Ethereum
- Viem - TypeScript interface for Ethereum
- Multiple Connectors - MetaMask, WalletConnect, Coinbase
- Lucide React - Beautiful, customizable icons
- Custom Assets - Project-specific icons and images
react-assignment/
βββ src/
β βββ components/ # React components
β β βββ AddTokenModal.tsx # Token addition modal
β β βββ Header.tsx # Application header
β β βββ Pagination.tsx # Pagination component
β β βββ PortfolioChart.tsx # Donut chart component
β β βββ PortfolioTotal.tsx # Portfolio total display
β β βββ Sparkline.tsx # Price trend charts
β β βββ WalletButton.tsx # Wallet connection UI
β β βββ WalletStatus.tsx # Wallet status display
β β βββ WatchlistActions.tsx # Watchlist action buttons
β β βββ WatchlistTable.tsx # Main token table
β βββ config/
β β βββ wagmi.ts # Wallet configuration
β βββ hooks/ # Custom React hooks
β β βββ redux.ts # Redux hooks
β β βββ usePriceUpdates.ts # Price update logic
β β βββ useWallet.ts # Wallet management
β β βββ useWalletPersistence.ts # Data persistence
β βββ pages/
β β βββ Portfolio.tsx # Main portfolio page
β βββ services/
β β βββ coinGeckoApi.ts # API service layer
β βββ store/ # Redux store
β β βββ index.ts # Store configuration
β β βββ slices/
β β βββ portfolioSlice.ts # Portfolio state management
β βββ utils/
β β βββ localStorage.ts # Data persistence utilities
β βββ App.tsx # Main app component
β βββ main.tsx # Application entry point
βββ public/ # Static assets
β βββ homepageImages/ # Project images
βββ package.json # Dependencies and scripts
βββ README.md # This file
- Node.js 18+
- npm or yarn
- Modern web browser
- MetaMask or other Web3 wallet (optional)
-
Clone the repository
git clone [repository-url] cd react-assignment -
Install dependencies
npm install
-
Start development server
npm run dev
-
Open in browser
http://localhost:5173
# Build the application
npm run build
# Preview production build
npm run preview
# Lint code
npm run lintThe application integrates with CoinGecko API for real-time cryptocurrency data:
- Market Data:
/coins/markets- Current prices and market information - Token Search:
/search- Search tokens by name or symbol - Trending Tokens:
/search/trending- Popular tokens - Price History:
/coins/{id}/market_chart- Historical data for sparklines - Token Details:
/coins/{id}- Detailed token information
- Automatic rate limiting (1 second between requests)
- Error handling with fallback options
- Graceful degradation on API failures
token-portfolio-watchlist- User's token watchlisttoken-portfolio-holdings- Token holdings datatoken-portfolio-last-updated- Last update timestamptoken-portfolio-total- Portfolio total valuelastConnectedWallet- Previously connected wallet
- Automatic Saving: Data saved on every state change
- Cross-Session: Data persists across browser sessions
- Wallet Independent: Portfolio data persists regardless of wallet connection
- Error Recovery: Graceful handling of storage failures
- MetaMask - Most popular Ethereum wallet
- WalletConnect - Multi-wallet QR code connection
- Coinbase Wallet - Coinbase's Web3 wallet
- Injected Wallets - Generic wallet support
- Auto-Connect: Remembers last connected wallet
- ENS Resolution: Human-readable addresses
- Network Support: Mainnet and Sepolia testnet
- Error Handling: User-friendly error messages
- Connection Status: Visual connection indicators
- Primary:
#A9E851(Green for actions and highlights) - Background:
#212124(Dark background) - Surface:
#27272A(Card backgrounds) - Text:
#F4F4F5(Primary text) - Secondary Text:
#A1A1AA(Secondary text)
- Font Family: Inter (Sans-serif)
- Font Weights: 400 (Regular), 500 (Medium), 600 (Semi-bold)
- Responsive: Scales appropriately across devices
- Consistent Spacing: 8px base unit system
- Border Radius: 6px for cards, 12px for modals
- Shadows: Subtle shadows for depth
- Transitions: Smooth 0.2s transitions
- Desktop: 1440px max-width with centered layout
- Tablet: Responsive scaling for medium screens
- Mobile: Optimized layout for small screens
- Touch-Friendly: Large touch targets
- Swipe Gestures: Intuitive navigation
- Optimized Tables: Horizontal scrolling for data tables
- Modal Overlays: Full-screen modals on mobile
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLint- TypeScript: Full type safety
- ESLint: Code linting and formatting
- Prettier: Code formatting
- Strict Mode: React strict mode enabled
- Code Splitting: Automatic code splitting with Vite
- Lazy Loading: Components loaded on demand
- Memoization: Optimized re-rendering
- Bundle Optimization: Tree shaking and minification
- Follow TypeScript best practices
- Use functional components with hooks
- Maintain consistent naming conventions
- Add proper error handling
- Include loading states
- CoinGecko - Cryptocurrency data API
- Wagmi - Ethereum React hooks
- Recharts - Charting library
- TailwindCSS - CSS framework
- Vite - Build tool