Commit graph

156 commits

Author SHA1 Message Date
Randall Stillwell
3bb1c9357a Fixed authentication API endpoints and login functionality
- Updated login and register APIs to use proper Vercel Postgres imports
- Fixed database queries to use sql template literal syntax
- Replaced old auth-utils imports with direct bcrypt and jwt usage
- Consistent JWT token generation across login and register endpoints
- Removed debugging console.log statements
- Login API now returns 200 with proper user data and JWT token
- All authentication endpoints working correctly with Neon database
- Login flow redirects properly to dashboard/admin based on user role
2025-07-24 19:57:19 -05:00
Randall Stillwell
3478932c3c Fixed SSR and null user issues for production deployment
- Made admin pages client-side only using dynamic imports to prevent SSR issues
- Added proper null checks in Layout component to handle guest users
- Updated AdminProtected to support render prop pattern for user data
- Fixed card-editor and card-import pages to use proper authentication flow
- Eliminated hardcoded user data that was causing build failures
- All pages now build successfully and handle null user states gracefully
- Production deployment should now work without SSR errors
2025-07-24 17:04:06 -05:00
Randall Stillwell
53423509f0 Integrated real database authentication with JWT tokens
- Updated auth verification to use Neon database instead of mock data
- Implemented proper JWT token authentication with localStorage storage
- Created beautiful login page with admin quick-login for development
- Updated all admin auth hooks to use JWT tokens from localStorage
- Added automatic token cleanup on authentication failures
- Enhanced AdminProtected component with proper token validation
- Created logout functionality that clears tokens and redirects
- Maintained fallback admin access for development (no token = admin)
- Real admin credentials: admin@tcgvault.com / admin123
- Seamless integration with existing admin card editor workflow
2025-07-24 16:36:10 -05:00
Randall Stillwell
0d6c6f1957 Implemented admin authentication and seamless card editing
- Created admin authentication system with useIsAdmin hook
- Added AdminProtected component for route protection
- Added prominent 'Edit Card (Admin)' button on card detail pages
- Protected all admin routes (/admin/*) with authentication
- Added admin navigation item to main layout sidebar
- Updated auth verification API to return mock admin user
- Integrated admin edit button that redirects to card editor with card ID
- Added proper access denied page for non-admin users
- Admin-only features now show/hide based on user role
- Seamless workflow: spot incorrect card → click edit → fix immediately
2025-07-24 16:31:29 -05:00
Randall Stillwell
f27a7333db Created comprehensive admin card editor
- Built complete admin interface for editing all card properties
- Added card search functionality with live results
- Created comprehensive form with sections for:
  * Basic information (name, game, set, rarity, etc.)
  * Game mechanics (type, mana cost, power/toughness, colors)
  * Card text and oracle text
  * Image URLs (primary and stock images)
  * Pricing information (current and market prices)
- Added real-time card preview that updates as you edit
- Implemented PUT API endpoint for updating cards
- Added proper validation and error handling
- Added database schema updates (updated_at column)
- Integrated admin navigation between card editor and import tools
- Full responsive design with modern UI components
- Live search with card thumbnails and metadata
- Proper form state management and data persistence
2025-07-24 15:16:57 -05:00
Randall Stillwell
bb60b4f6b0 Enhanced card detail page with real data and functionality
- Updated card detail page to fetch real data from API
- Added ownership tracking with quantity management
- Added favorite system for cards
- Added collection and deck management functionality
- Created API endpoints for ownership, favorites, collections, and decks
- Added database columns for quantity and favorited status
- Shows current collections and decks the card belongs to
- Added proper error handling and loading states
- Integrated with real card data from database
- Added purchase links to TCGPlayer and eBay
2025-07-24 15:03:09 -05:00
Randall Stillwell
73a0c652b2 Fix card sizing consistency across all TCGs
- Added wrapper div with max-width constraint to ensure consistent card sizes
- Updated image rendering to use object-cover with proper positioning
- Removed maxWidth from Card3D component since it's now handled by wrapper
- Ensures all cards (MTG, Pokemon, Lorcana) have identical dimensions
- Fixed responsive grid layout to maintain consistent card sizes
2025-07-24 14:54:12 -05:00
Randall Stillwell
e046515a38 Add real Lorcana import using Lorcast API
- Replaced mock Lorcana import with real API integration
- Uses Lorcast API (https://api.lorcast.com/v0/cards/search) for comprehensive card data
- Added proper set code mapping (tfc->1, rotf->2, ink->3)
- Includes card images, prices, stats, and detailed metadata
- Created dedicated Lorcana import scripts for standalone use
- Maintains duplicate checking and proper error handling
- Supports all 3 Lorcana sets: The First Chapter, Rise of the Floodborn, Into the Inklands
2025-07-24 12:27:10 -05:00
Randall Stillwell
b6f76297bc Fix import issues: Add retry logic and better error handling
- Added retry logic with exponential backoff for Pokemon API calls
- Created Lorcana import endpoint with placeholder data
- Improved error handling for 504 timeouts and 404 not found errors
- Added longer delays for Pokemon imports to avoid rate limiting
- Enhanced logging for better debugging of import issues
- Fixed response parsing to handle different API response formats
2025-07-24 10:30:21 -05:00
Randall Stillwell
72c70c2248 Update .gitignore to exclude .next directory 2025-07-23 21:27:11 -05:00
Randall Stillwell
e75a4a6649 Major redesign: Enhanced card display with particle effects, improved filters, and search functionality
- Redesigned card display with 2.5:3.5 aspect ratio and image-only view
- Added infinite scroll to replace pagination
- Implemented authentic card back placeholders for MTG, Pokemon, and Lorcana
- Added rarity-based particle effects with tiered intensity (mythic/enchanted/rare/uncommon)
- Enhanced hover details panel with structured card information
- Fixed search functionality with debouncing and Enter key support
- Improved filter system with working TCG, rarity, set, and price filters
- Added favorite system for cards in both hover and detail views
- Updated card detail page with comprehensive metadata and actions
- Fixed API filtering with proper Vercel Postgres implementation
- Added particle animations and rarity glow effects
- Improved overall UX with better visual hierarchy and interactions
2025-07-23 21:26:54 -05:00
Randall Stillwell
c218dd53ac Add simple API test without dependencies 2025-07-23 09:42:30 -05:00
Randall Stillwell
dc419f681b Add database connection test API 2025-07-23 09:41:38 -05:00
Randall Stillwell
373f103810 Fix bcryptjs imports to use dynamic imports 2025-07-23 09:40:50 -05:00
Randall Stillwell
20c2439ff4 Add database setup API to create tables 2025-07-23 09:39:22 -05:00
Randall Stillwell
83776bc6be Add authentication system and admin API endpoints 2025-07-23 09:38:16 -05:00
Randall Stillwell
2f94044832 Remove broken migration script that references deleted files 2025-07-23 09:34:37 -05:00
Randall Stillwell
f7e65bc21d Fix TypeScript moduleResolution for build compatibility 2025-07-23 09:33:36 -05:00
Randall Stillwell
7be41b4490 Clean slate: Remove React traces and create pure Next.js setup 2025-07-23 09:32:31 -05:00
Randall Stillwell
2d4c4963b8 Simplify Vercel config to resolve API routing issues 2025-07-23 09:22:14 -05:00
Randall Stillwell
b4e011e8fa Add minimal health check API 2025-07-23 09:21:29 -05:00
Randall Stillwell
b5e547df7b Force fresh deployment to resolve configuration mismatch 2025-07-23 09:19:11 -05:00
Randall Stillwell
a528676f37 Add require() postgres test and update Vercel config 2025-07-23 08:53:08 -05:00
Randall Stillwell
dda057c1d6 Add basic test API without external dependencies 2025-07-23 08:51:59 -05:00
Randall Stillwell
07f8e49924 Add dynamic postgres import test and clean npm install 2025-07-23 08:50:51 -05:00
Randall Stillwell
339fb6f910 Update @vercel/postgres to latest version and add test APIs 2025-07-23 08:49:05 -05:00
Randall Stillwell
41a7eeef12 Fix API import paths and convert to Next.js Pages API format 2025-07-23 08:40:30 -05:00
Randall Stillwell
df48fd784d Add simple Next.js API route 2025-07-23 08:32:03 -05:00
Randall Stillwell
9a86a5a834 Remove conflicting React app files to ensure Next.js deployment 2025-07-23 08:31:15 -05:00
Randall Stillwell
26dd9bea50 Add explicit Next.js framework configuration to vercel.json 2025-07-23 08:30:44 -05:00
Randall Stillwell
4f9575dc49 Force rebuild by removing .next directory 2025-07-23 08:30:03 -05:00
Randall Stillwell
3c9388a56e Update Vercel config for Next.js app 2025-07-23 08:29:39 -05:00
Randall Stillwell
5737c6e1f0 Add simple test API 2025-07-23 08:29:09 -05:00
Randall Stillwell
e49ada09ba Convert admin API to Next.js Pages API format 2025-07-23 08:28:42 -05:00
Randall Stillwell
2cc332e0a0 Move API routes to pages/api/ for proper Next.js structure 2025-07-23 08:27:14 -05:00
Randall Stillwell
873f4592c2 Convert from React to Next.js for proper API route support 2025-07-23 08:25:58 -05:00
Randall Stillwell
09bb380da6 Add simple test API to isolate the issue 2025-07-23 08:22:39 -05:00
Randall Stillwell
16228f8fa0 Add test endpoint and better error handling for database issues 2025-07-23 08:22:16 -05:00
Randall Stillwell
df5b3bfc44 Temporarily bypass auth for testing admin API 2025-07-23 08:21:46 -05:00
Randall Stillwell
8d7eb67a97 Fix auth imports and add proper admin access control - create auth-utils.js with verifyToken function 2025-07-23 07:05:14 -05:00
Randall Stillwell
49cfa31253 Consolidate API functions to stay within Vercel Hobby plan limits - reduce from 12+ to 8 functions 2025-07-23 06:57:22 -05:00
Randall Stillwell
7057417a89 Implement database-based card loading system - add card loader API, database search, and admin interface 2025-07-23 06:50:44 -05:00
Randall Stillwell
ee67b05e28 Improve Lorcana card data parsing - add comprehensive field mapping and debugging 2025-07-23 06:40:02 -05:00
Randall Stillwell
dbb0353def Fix Lorcana API search syntax - use correct endpoints and search parameters 2025-07-23 06:34:21 -05:00
Randall Stillwell
0a09b333c4 Fix Lorcana API endpoints based on official documentation - update to correct API URLs 2025-07-23 06:28:22 -05:00
Randall Stillwell
5aa168bd24 Add CORS proxy for Lorcana APIs and improve error handling - fix CORS issues and 500 errors 2025-07-23 06:13:49 -05:00
Randall Stillwell
d27a04e460 Fix Lorcana API integration and user-cards 500 error - add dual API support and database table checks 2025-07-22 21:54:42 -05:00
Randall Stillwell
29e935b680 Fix API connection and Lorcana API issues - update API base URL to Vercel deployment and improve Lorcana API resilience 2025-07-22 21:48:45 -05:00
Randall Stillwell
40928bbbda Add user cards API endpoints - fix Cards page error by implementing missing /api/user-cards endpoints 2025-07-22 21:43:53 -05:00
Randall Stillwell
d9ed0e911e Add card view and table view toggle to CardDatabaseBrowser - enhanced browsing experience with dual view modes 2025-07-22 20:58:49 -05:00