diff --git a/src/components/CollectionsFeed/CollectionsFeed.css b/src/components/CollectionsFeed/CollectionsFeed.css index 09809d5..c0e3a31 100644 --- a/src/components/CollectionsFeed/CollectionsFeed.css +++ b/src/components/CollectionsFeed/CollectionsFeed.css @@ -105,29 +105,55 @@ } .collections-filter { - display: flex; - flex-wrap: wrap; - gap: 10px; - max-height: 200px; + max-height: 300px; overflow-y: auto; padding: 10px 0; + background-color: var(--background); + border-radius: 8px; + border: 1px solid var(--card-border); + margin-top: 10px; } - .collection-checkbox { + .collection-item { + padding: 8px 12px; + border-bottom: 1px solid var(--card-border); + cursor: pointer; display: flex; align-items: center; - margin-right: 15px; - margin-bottom: 5px; + transition: background-color 0.2s; } - .collection-checkbox input[type="checkbox"] { - margin-right: 5px; + .collection-item:last-child { + border-bottom: none; } - .collection-checkbox label { - font-size: 0.9rem; + .collection-item:hover { + background-color: rgba(0, 0, 0, 0.05); + } + + .collection-item.selected { + background-color: rgba(var(--button-bg-rgb), 0.1); + } + + .collection-item-name { + font-size: 0.95rem; color: var(--text); - cursor: pointer; + flex-grow: 1; + } + + .collection-item-checkbox { + margin-right: 10px; + width: 16px; + height: 16px; + accent-color: var(--button-bg); + } + + .dark-mode .collection-item:hover { + background-color: rgba(255, 255, 255, 0.05); + } + + .dark-mode .collection-item.selected { + background-color: rgba(var(--button-bg-rgb), 0.2); } .refresh-button { diff --git a/src/components/CollectionsFeed/CollectionsFeed.js b/src/components/CollectionsFeed/CollectionsFeed.js index 9cb7228..9c20b6a 100644 --- a/src/components/CollectionsFeed/CollectionsFeed.js +++ b/src/components/CollectionsFeed/CollectionsFeed.js @@ -106,7 +106,8 @@ const CollectionsFeed = () => { // Fetch records for each collection in parallel const fetchPromises = collectionsList.map(async (collection) => { - let url = `${endpoint}/xrpc/com.atproto.repo.listRecords?repo=${encodeURIComponent(userDid)}&collection=${encodeURIComponent(collection)}&limit=10`; + // Limit to 5 records per collection initially (for 20 records total across ~4 collections) + let url = `${endpoint}/xrpc/com.atproto.repo.listRecords?repo=${encodeURIComponent(userDid)}&collection=${encodeURIComponent(collection)}&limit=5`; // Add cursor if loading more and we have a cursor for this collection if (isLoadMore && newCursors[collection]) { @@ -155,6 +156,11 @@ const CollectionsFeed = () => { return new Date(b.timestamp) - new Date(a.timestamp); }); + // If not loading more, limit to 20 most recent records + if (!isLoadMore) { + allRecords = allRecords.slice(0, 20); + } + setRecords(allRecords); setCollectionCursors(newCursors); setFetchingMore(false); @@ -165,14 +171,12 @@ const CollectionsFeed = () => { } }; - // Handle filter change - const handleFilterChange = (e) => { - const { value, checked } = e.target; - - if (checked) { - setSelectedCollections(prev => [...prev, value]); + // Toggle collection selection + const toggleCollection = (collection) => { + if (selectedCollections.includes(collection)) { + setSelectedCollections(prev => prev.filter(item => item !== collection)); } else { - setSelectedCollections(prev => prev.filter(item => item !== value)); + setSelectedCollections(prev => [...prev, collection]); } }; @@ -294,17 +298,19 @@ const CollectionsFeed = () => {