/* eslint-disable @next/next/no-img-element -- Binder/card images use external URLs; next/image migration is out of scope. */ import Link from 'next/link'; import UploadImageModal from './UploadImageModal'; import ShareModal from './ShareModal'; import CollaboratorFacepile from './CollaboratorFacepile'; import CardItem from './CardItem'; import LoginCTA from './LoginCTA'; import { ManaCost, ColorFilterSymbol } from './ManaSymbols'; import ManaSymbolSettings from './ManaSymbolSettings'; import { VOCAB, collectionDisplayName } from '../lib/collection-vocabulary.js'; import CollectionEditModal from './CollectionEditModal'; import CollectionDeleteModal from './CollectionDeleteModal'; export default function CollectionPageView(props) { const { cards, collection, copySuccess, editForm, favoritedCards, gameStats, groupBy, groupedCards, handleAddCard, handleAddToCollection, handleAddToDeck, handleDeleteCollection, handleDownloadCSV, handleEditCollection, handleImageUpload, handleSearchCards, handleToggleFavorite, handleToggleSelect, identifier, isFavorited, loading, router, searchCards, searchQuery, searchResults, selectedCards, selectedRarity, selectedTCG, selectedType, setCards, setCollection, setCopySuccess, setEditForm, setFavoritedCards, setGroupBy, setIsFavorited, setLoading, setSearchCards, setSearchQuery, setSearchResults, setSelectedCards, setSelectedRarity, setSelectedTCG, setSelectedType, setShowDeleteModal, setShowEditModal, setShowSearchResults, setShowShareModal, setShowUploadModal, setSortBy, setViewMode, showDeleteModal, showEditModal, showInitialLoading, showSearchResults, showShareModal, showUploadModal, sortBy, user, viewMode } = props; return ( <>
{/* Header */}
{/* Back button */}
{/* Action buttons */}
{/* Edit and Delete buttons - only show for owner and non-system collections */} {collection.userRole === 'owner' && !collection.isSystemCollection && ( <> )}
{/* Collection Info */}

{collectionDisplayName(collection)}

{/* System collection indicator */} {collection.isSystemCollection && (
🔒 SYSTEM
{VOCAB.SYSTEM_COLLECTION_SYNC_HINT}
)}

{collection.description}

{/* TCG Tags */}
{Object.entries(gameStats).map(([game, count]) => count > 0 ? ( {game} ) : null )}
{/* Creator and Stats */}
{collection.creator ? ( ) : ( Crafted by Unknown User )}
Cards: {cards.length}
Cost: ${collection.value || '0'}
Created {new Date(collection.createdAt).toLocaleDateString()} Last updated {new Date(collection.lastViewed).toLocaleDateString()}
{/* Action Bar */}
Activity 123
{/* Content */}
{/* Search and Filters */}
{ setSearchCards(e.target.value); handleSearchCards(e.target.value); }} className="w-64 px-4 py-2 border rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent" style={{ borderColor: 'var(--border)', backgroundColor: 'var(--bg-secondary)' }} />
{/* Game Sections */} {Object.entries(groupedCards).map(([game, gameCards]) => (

{game === 'MTG' ? 'Magic The Gathering' : game} {gameCards.length}

{gameCards.map((card, index) => ( c.id === card.id)} onToggleSelect={handleToggleSelect} onAddToCollection={handleAddToCollection} onAddToDeck={handleAddToDeck} onToggleFavorite={handleToggleFavorite} isFavorited={favoritedCards.has(card.id)} /> ))}
))} {cards.length === 0 && (
🃏

Start Building Your List

Add cards to get started with your collection

)}
{/* Search Results Dropdown */} {showSearchResults && searchResults.length > 0 && (
{searchResults.map(card => (
handleAddCard(card)} className="flex items-center p-3 hover:bg-gray-50 cursor-pointer" > {card.name} { e.target.src = 'https://via.placeholder.com/48x64/6366f1/ffffff?text=No+Image'; }} />
{card.name}
{card.set_name} • ${card.market_price}
))}
)} setShowEditModal(false)} onSave={handleEditCollection} /> setShowDeleteModal(false)} onConfirm={handleDeleteCollection} /> {/* Upload Image Modal */} setShowUploadModal(false)} onUpload={handleImageUpload} currentImage={collection.image} /> {/* Share Modal */} setShowShareModal(false)} collectionId={identifier} isPublic={collection.isPublic} onTogglePublic={togglePublic} onInviteUser={(email) => console.log('Invited:', email)} />
{/* Show login CTA for non-authenticated users */} {!user && collection?.isPublic && ( )} ); }