diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-15 17:50:41 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-15 17:50:41 +0900 |
| commit | 7ff02cd24054ba6a629478cb20f565c7c6c76fbd (patch) | |
| tree | dd9de81711be20d682f94bed2dda8872d8d2bca4 | |
| parent | 6ec39d10d3f0f9f6df549208e4dcd6f30808e21b (diff) | |
| download | feedaka-7ff02cd24054ba6a629478cb20f565c7c6c76fbd.tar.gz feedaka-7ff02cd24054ba6a629478cb20f565c7c6c76fbd.tar.zst feedaka-7ff02cd24054ba6a629478cb20f565c7c6c76fbd.zip | |
feat(frontend): filter feed sidebar by read/unread viewv0.7.2
Unread sidebar now only shows feeds with unread articles.
Read sidebar shows all feeds but hides the unread count badge.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| -rw-r--r-- | frontend/src/components/FeedSidebar.tsx | 11 | ||||
| -rw-r--r-- | frontend/src/pages/ReadArticles.tsx | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/frontend/src/components/FeedSidebar.tsx b/frontend/src/components/FeedSidebar.tsx index 4d6502d..e196127 100644 --- a/frontend/src/components/FeedSidebar.tsx +++ b/frontend/src/components/FeedSidebar.tsx @@ -4,15 +4,20 @@ import { feedsAtom } from "../atoms"; interface Props { basePath: string; + isReadView?: boolean; } -export function FeedSidebar({ basePath }: Props) { +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: feeds } = useAtomValue(feedsAtom); + const { data: allFeeds } = useAtomValue(feedsAtom); + + const feeds = isReadView + ? allFeeds + : allFeeds.filter((feed) => feed.unreadCount > 0); const handleSelect = (feedId: string | null) => { if (feedId) { @@ -53,7 +58,7 @@ export function FeedSidebar({ basePath }: Props) { }`} > <span className="min-w-0 truncate">{feed.title}</span> - {feed.unreadCount > 0 && ( + {!isReadView && feed.unreadCount > 0 && ( <span className="ml-2 shrink-0 rounded-full bg-sky-100 px-1.5 py-0.5 text-xs font-medium text-sky-700"> {feed.unreadCount} </span> diff --git a/frontend/src/pages/ReadArticles.tsx b/frontend/src/pages/ReadArticles.tsx index e231906..57fbc9a 100644 --- a/frontend/src/pages/ReadArticles.tsx +++ b/frontend/src/pages/ReadArticles.tsx @@ -28,7 +28,7 @@ export function ReadArticles() { <div className="flex gap-8"> <ErrorBoundary> <Suspense fallback={<LoadingSpinner />}> - <FeedSidebar basePath="/read" /> + <FeedSidebar basePath="/read" isReadView /> </Suspense> </ErrorBoundary> <div className="min-w-0 flex-1"> |
