import { useAtomValue } from "jotai"; import { Suspense } from "react"; import { useLocation, useSearch } from "wouter"; import { feedsAtom } from "../atoms"; import { ErrorBoundary } from "./ErrorBoundary"; 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 handleSelect = (feedId: string | null) => { if (feedId) { setLocation(`${basePath}?feed=${feedId}`); } else { setLocation(basePath); } }; return ( ); } function FeedListItems({ isReadView, selectedFeedId, onSelect, }: { isReadView: boolean; selectedFeedId: string | null; onSelect: (feedId: string | null) => void; }) { const { data: allFeeds } = useAtomValue(feedsAtom); const feeds = isReadView ? allFeeds : allFeeds.filter((feed) => feed.unreadCount > 0); return ( <> {feeds.map((feed) => (