From 94834afbb26b576218a3d84b2187e38708301ba0 Mon Sep 17 00:00:00 2001
From: Adam Mathes <adam@adammathes.com>
Date: Sun, 15 Feb 2026 14:09:45 -0800
Subject: Frontend: Implement multi-select feeds in sidebar (NK-p0nfoi)

---
 frontend/src/components/FeedList.tsx | 54 ++++++++++++++++++++++++++++--------
 1 file changed, 43 insertions(+), 11 deletions(-)

(limited to 'frontend/src/components/FeedList.tsx')

diff --git a/frontend/src/components/FeedList.tsx b/frontend/src/components/FeedList.tsx
index 4e6738e..556ce6e 100644
--- a/frontend/src/components/FeedList.tsx
+++ b/frontend/src/components/FeedList.tsx
@@ -194,17 +194,49 @@ export default function FeedList({
             <p>No feeds found.</p>
           ) : (
             <ul className="feed-list-items">
-              {feeds.map((feed) => (
-                <li key={feed._id} className="sidebar-feed-item">
-                  <Link
-                    to={getNavPath(`/feed/${feed._id}`)}
-                    className={`feed-title ${feedId === String(feed._id) ? 'active' : ''}`}
-                    onClick={handleLinkClick}
-                  >
-                    {feed.title || feed.url}
-                  </Link>
-                </li>
-              ))}
+              {feeds.map((feed) => {
+                const isSelected = feedId?.split(',').includes(String(feed._id));
+
+                const toggleFeed = (e: React.MouseEvent) => {
+                  e.preventDefault();
+                  e.stopPropagation();
+
+                  const selectedIds = feedId ? feedId.split(',') : [];
+                  let newIds;
+                  if (isSelected) {
+                    newIds = selectedIds.filter(id => id !== String(feed._id));
+                  } else {
+                    newIds = [...selectedIds, String(feed._id)];
+                  }
+
+                  if (newIds.length === 0) {
+                    navigate(getNavPath('/'));
+                  } else {
+                    navigate(getNavPath(`/feed/${newIds.join(',')}`));
+                  }
+                };
+
+                return (
+                  <li key={feed._id} className="sidebar-feed-item">
+                    <div className="feed-item-row">
+                      <input
+                        type="checkbox"
+                        checked={!!isSelected}
+                        onChange={() => { }} // Controlled by div click for better hit area
+                        onClick={toggleFeed}
+                        className="feed-checkbox"
+                      />
+                      <Link
+                        to={getNavPath(`/feed/${feed._id}`)}
+                        className={`feed-title ${isSelected ? 'active' : ''}`}
+                        onClick={handleLinkClick}
+                      >
+                        {feed.title || feed.url}
+                      </Link>
+                    </div>
+                  </li>
+                );
+              })}
             </ul>
           ))}
       </div>
-- 
cgit v1.2.3

