/* eslint-disable @next/next/no-img-element -- External or generated image URLs; next/image migration is out of scope. */
import Link from 'next/link';
import PermissionIndicator from './PermissionIndicator';
import { VOCAB, collectionDisplayName } from '../lib/collection-vocabulary.js';
import CollectionsCreateModal from './CollectionsCreateModal';
import CollectionsEditModal from './CollectionsEditModal';
import CollectionsSuccessModal from './CollectionsSuccessModal';
import CollectionsThumbnail from './CollectionsThumbnail';
import { Button, SearchBar } from './ui';
export default function CollectionsPageView(props) {
const {
collections,
createdCollection,
editTagInput,
editingCollection,
filteredCollections,
formatCurrency,
formatDate,
handleCreateCollection,
handleDeleteCollection,
handleUpdateCollection,
loading,
newCollection,
router,
searchQuery,
setCollections,
setCreatedCollection,
setEditTagInput,
setEditingCollection,
setLoading,
setNewCollection,
setSearchQuery,
setShowCreateModal,
setShowSuccessModal,
setSortBy,
setTagInput,
showCreateModal,
showSuccessModal,
sortBy,
sortCollections,
sortOptions,
sortedCollections,
tagInput,
user
} = props;
return (
<>
{/* Header */}
{VOCAB.LISTS}
Lists you own, collaborate on, or have been shared with you
setSearchQuery(e.target.value)}
onClear={() => setSearchQuery('')}
placeholder="Search listsโฆ"
/>
{/* Collections Grid */}
{sortedCollections.length === 0 ? (
๐ฆ
{searchQuery ? 'No lists found' : 'No lists yet'}
{searchQuery
? 'Try adjusting your search terms'
: 'Create your first list to get started'
}
{!searchQuery && (
)}
) : (
{sortedCollections.map(collection => (
router.push(`/collection/${collection.slug || collection.id}`)}
>
{/* Thumbnail Section */}
{/* Collection Info */}
{/* Header with name and description - more space */}
{collectionDisplayName(collection)}
{/* System collection indicator */}
{collection.isSystemCollection && (
๐ SYSTEM
{VOCAB.SYSTEM_COLLECTION_SYNC_HINT}
)}
{/* Edit/Delete buttons - hidden for system collections */}
{!collection.isSystemCollection && (
)}
{collection.description && (
{collection.description}
)}
{/* Compact Stats */}
{collection.cardCount} cards
{formatCurrency(collection.value)}
{formatDate(collection.createdAt)}
{/* Tags */}
{collection.tags && collection.tags.length > 0 && (
{collection.tags.slice(0, 2).map(tag => (
{tag}
))}
{collection.tags.length > 2 && (
+{collection.tags.length - 2}
)}
)}
{/* Creator/Facepile and View Button Row */}
{/* Creator info or facepile */}
{collection.creator ? collection.creator.charAt(0).toUpperCase() : 'A'}
{collection.creator ? collection.creator.split('@')[0] : 'alice'}
{/* Additional collaborators could go here as overlapping avatars */}
))}
)}
{
setShowCreateModal(false);
setTagInput('');
}}
onCreate={handleCreateCollection}
/>
{
setShowSuccessModal(false);
router.push(`/collection/${createdCollection.slug || createdCollection.id}`);
}}
onStay={() => setShowSuccessModal(false)}
/>
{
setEditingCollection(null);
setEditTagInput('');
}}
onUpdate={handleUpdateCollection}
/>
>
);
}