deckhearth/src/pages/Dashboard.tsx
Randall Stillwell 6b81ed38b0 🚀 TCG Vault - Complete All-Vercel Setup
 Features:
- Camera OCR card scanning with Tesseract.js
- Beautiful glowing card effects and animations
- Intelligent card matching and recognition
- Mobile-responsive design with Tailwind CSS

🏗️ Architecture:
- Frontend: React TypeScript application
- Backend: Vercel Functions (replacing FastAPI)
- Database: JSON file with exported card data
- Deployment: Single Vercel project

📁 Structure:
- api/ - Vercel Functions backend endpoints
- src/ - React frontend components and logic
- src/data/cards.json - Card database (12 cards)
- vercel.json - Optimized Vercel configuration

💰 Cost: /bin/zsh additional (uses existing Vercel Pro)
🚀 Ready for immediate Vercel deployment
2025-07-21 13:53:06 -05:00

154 lines
No EOL
5.3 KiB
TypeScript

import React from 'react';
import { useAuth } from '../contexts/AuthContext';
import { Link } from 'react-router-dom';
const Dashboard: React.FC = () => {
const { isAuthenticated, user } = useAuth();
if (!isAuthenticated) {
return (
<div className="text-center py-12">
<div className="max-w-md mx-auto">
<h1 className="text-3xl font-bold text-gray-900 mb-4">
Welcome to TCG Vault
</h1>
<p className="text-gray-600 mb-8">
Your complete trading card database with OCR scanning, AI-powered deck building, and real-time pricing.
</p>
<Link
to="/login"
className="bg-primary-600 hover:bg-primary-700 text-white px-6 py-3 rounded-md text-lg font-medium transition-colors"
>
Get Started
</Link>
</div>
</div>
);
}
return (
<div>
<div className="mb-8">
<h1 className="text-3xl font-bold text-gray-900 mb-2">
Welcome back, {user?.username}!
</h1>
<p className="text-gray-600">
Here's an overview of your trading card collection.
</p>
</div>
{/* Quick Stats */}
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
<div className="bg-white rounded-lg shadow p-6 border border-gray-200">
<div className="flex items-center">
<div className="flex-shrink-0">
<span className="text-2xl">📚</span>
</div>
<div className="ml-4">
<p className="text-sm font-medium text-gray-600">Collections</p>
<p className="text-2xl font-bold text-gray-900">0</p>
</div>
</div>
</div>
<div className="bg-white rounded-lg shadow p-6 border border-gray-200">
<div className="flex items-center">
<div className="flex-shrink-0">
<span className="text-2xl">🎴</span>
</div>
<div className="ml-4">
<p className="text-sm font-medium text-gray-600">Decks</p>
<p className="text-2xl font-bold text-gray-900">0</p>
</div>
</div>
</div>
<div className="bg-white rounded-lg shadow p-6 border border-gray-200">
<div className="flex items-center">
<div className="flex-shrink-0">
<span className="text-2xl">🃏</span>
</div>
<div className="ml-4">
<p className="text-sm font-medium text-gray-600">Total Cards</p>
<p className="text-2xl font-bold text-gray-900">0</p>
</div>
</div>
</div>
<div className="bg-white rounded-lg shadow p-6 border border-gray-200">
<div className="flex items-center">
<div className="flex-shrink-0">
<span className="text-2xl">💰</span>
</div>
<div className="ml-4">
<p className="text-sm font-medium text-gray-600">Total Value</p>
<p className="text-2xl font-bold text-gray-900">$0</p>
</div>
</div>
</div>
</div>
{/* Quick Actions */}
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<Link
to="/scanner"
className="bg-white rounded-lg shadow p-6 border border-gray-200 hover:shadow-md transition-shadow"
>
<div className="text-center">
<span className="text-4xl mb-4 block">📸</span>
<h3 className="text-lg font-semibold text-gray-900 mb-2">
Scan Cards
</h3>
<p className="text-gray-600">
Use OCR to quickly add cards to your collection
</p>
</div>
</Link>
<Link
to="/collections"
className="bg-white rounded-lg shadow p-6 border border-gray-200 hover:shadow-md transition-shadow"
>
<div className="text-center">
<span className="text-4xl mb-4 block">📚</span>
<h3 className="text-lg font-semibold text-gray-900 mb-2">
Manage Collections
</h3>
<p className="text-gray-600">
Organize and track your card collections
</p>
</div>
</Link>
<Link
to="/decks"
className="bg-white rounded-lg shadow p-6 border border-gray-200 hover:shadow-md transition-shadow"
>
<div className="text-center">
<span className="text-4xl mb-4 block">🎴</span>
<h3 className="text-lg font-semibold text-gray-900 mb-2">
Build Decks
</h3>
<p className="text-gray-600">
Create and optimize decks with AI assistance
</p>
</div>
</Link>
</div>
{/* Recent Activity (placeholder) */}
<div className="mt-8">
<h2 className="text-xl font-semibold text-gray-900 mb-4">
Recent Activity
</h2>
<div className="bg-white rounded-lg shadow border border-gray-200 p-6">
<p className="text-gray-500 text-center py-8">
No recent activity. Start by scanning some cards or creating a collection!
</p>
</div>
</div>
</div>
);
};
export default Dashboard;