import { useAtomValue } from "jotai"; import { useLocation, useSearch } from "wouter"; import { feedsAtom } from "../atoms"; interface Props { basePath: string; isReadView?: boolean; } export function FeedSidebar({ basePath, isReadView = false }: Props) { const search = useSearch(); const [, setLocation] = useLocation(); const params = new URLSearchParams(search); const selectedFeedId = params.get("feed"); const { data: allFeeds } = useAtomValue(feedsAtom); const feeds = isReadView ? allFeeds : allFeeds.filter((feed) => feed.unreadCount > 0); const handleSelect = (feedId: string | null) => { if (feedId) { setLocation(`${basePath}?feed=${feedId}`); } else { setLocation(basePath); } }; return ( ); }