🎯 Moved collaboration display from bottom section to hero header: - Created CollaboratorFacepile component with hover tooltips - Shows creator + active collaborators in compact format - Color-coded avatars by role (owner=purple, editor=blue, viewer=green) - Displays up to 4 faces, then '+N more' for additional collaborators - Rich hover tooltips showing email and role information - Responsive text: 'Crafted by X & N others' 🔧 Technical improvements: - Fixed favorites system database migration (separated SQL commands) - Fixed favorites API SQL syntax errors - Integrated facepile into collection metadata section - Removed redundant CollaborationManager from bottom - Clean component architecture with proper loading states 🎨 UX enhancements: - Smooth hover animations with scale effects - Professional tooltips with arrows - Proper z-index layering for overlapping elements - Loading skeleton while fetching collaborators - Accessible color contrast and typography Perfect for showing collaboration at a glance! 👥✨
43 lines
No EOL
1.7 KiB
JavaScript
43 lines
No EOL
1.7 KiB
JavaScript
#!/usr/bin/env node
|
|
import { config } from 'dotenv';
|
|
import { sql } from '@vercel/postgres';
|
|
config({ path: '.env.local' });
|
|
|
|
async function addFavoritesSystem() {
|
|
try {
|
|
console.log('⭐ Adding favorites system to database...');
|
|
|
|
// Create user_favorites table for all types of favorites
|
|
await sql`
|
|
CREATE TABLE IF NOT EXISTS user_favorites (
|
|
id SERIAL PRIMARY KEY,
|
|
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
|
|
item_type VARCHAR(50) NOT NULL, -- 'card', 'collection', 'deck'
|
|
item_id INTEGER NOT NULL,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
UNIQUE(user_id, item_type, item_id)
|
|
)
|
|
`;
|
|
console.log('✅ Created user_favorites table');
|
|
|
|
// Create indexes for performance
|
|
await sql`CREATE INDEX IF NOT EXISTS idx_user_favorites_user_id ON user_favorites(user_id)`;
|
|
await sql`CREATE INDEX IF NOT EXISTS idx_user_favorites_item_type ON user_favorites(item_type)`;
|
|
await sql`CREATE INDEX IF NOT EXISTS idx_user_favorites_item_id ON user_favorites(item_id)`;
|
|
await sql`CREATE INDEX IF NOT EXISTS idx_user_favorites_user_type ON user_favorites(user_id, item_type)`;
|
|
console.log('⚡ Created indexes for user_favorites');
|
|
|
|
console.log('\n🎉 Favorites system added successfully!\n');
|
|
console.log('📋 New Features:');
|
|
console.log(' • Users can favorite cards, collections, and decks');
|
|
console.log(' • Unified favorites table with item_type and item_id');
|
|
console.log(' • Optimized with indexes for fast queries');
|
|
console.log(' • Unique constraint prevents duplicate favorites');
|
|
|
|
} catch (error) {
|
|
console.error('❌ Failed to add favorites system:', error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
addFavoritesSystem();
|