This React app was created for Relai Assignment in PlanB tech school. It provides a comprehensive interface for displaying and filtering Bitcoin transactions. It supports infinite scrolling, multiple filter options, and displays both Bitcoin and fiat values for transactions.
- 📊 Transaction Display: Tabulated view of all transactions with sorting capabilities
- 🔍 Filters: Date range and transaction type filtering with real-time updates
- 💱 BTC to Fiat Conversion: Real-time price updates using CoinGecko API
- ♾️ Infinite Scrolling: Load data seamlessly with optimized performance
- 🖥️ Responsive Design: Optimized for all devices
- 🚀 Error Handling: User-friendly error messages and loading states
- Node.js 16.x or higher
- npm, yarn, or pnpm package manager
- CoinGecko API key
- Clone the repository
git clone [repository-url]
cd [project-directory]
- Install dependencies
npm install
# or
yarn install
# or
pnpm install
- Create a
.env
file in the root directory:
VITE_COINGECKO_API_KEY=your_api_key_here
-
Update the
EXAMPLE_USER
mockup data inconstants/index.ts
to match your requirements. -
Start the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
├── components/ # Reusable React components
│ ├── bitcoin-transactions/ # Bitcoin transaction management
│ │ ├── index.tsx # Main transaction component
│ │ ├── filterBar.tsx # Transaction filter bar
│ │ ├── hooks/ # Custom hooks for transactions
│ │ │ ├── useBtcPrice.ts # Fetch and manage BTC price
│ │ │ └── useTransactions.ts # Fetch and manage transaction data
│ │ └── transaction-table/ # Transaction table components
│ │ ├── body.tsx # Table body layout
│ │ ├── header.tsx # Table header layout
│ │ └── row.tsx # Individual row layout
│ └── ui/ # Pre-styled UI components from shadcn
Main component that renders the full transaction interface.
interface BitcoinTransactionsProps {
defaultFilter?: TransactionFilter;
onTransactionClick?: (transaction: Transaction) => void;
className?: string;
}
Manages BTC price fetching and updates.
const {
data: btcPrice,
error,
status
} = useBtcPrice()
Handles transaction fetching, filtering, and infinite scroll logic.
const {
filteredTransactions,
needsMoreData,
fetchNextPage,
hasNextPage,
isFetchingNextPage,
error,
status
} = useTransactions(filter, weekAgo, monthAgo)
- User interactions trigger filter updates
useTransactions
hook manages data fetching based on filters- React Query handles caching and background updates
- Infinite scroll triggers new data fetching when needed
- BTC price updates happen independently via
useBtcPrice
hook
- react-query: For data fetching and caching
- react-intersection-observer: For infinite scroll detection
- lucide-react: For icons
- shadcn/ui: For UI components
- axios: For data fetching
Tested and supported in:
- Chrome (last 2 versions)
- Firefox (last 2 versions)
- Safari (last 2 versions)
- Edge (last 2 versions)
- Add transaction amount aggregation with customizable time periods
- Implement date range picker for custom ranges
- Add CSV/PDF export functionality
- Add full-text transaction search with advanced filters
- Implement detailed transaction view modal
- Add unit and integration tests
- Implement transaction grouping by day/week/month
- Add more customization options for the table display
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This project is licensed under the MIT License - see the LICENSE file for details