From e216c3bc97994b4172d15d52b46d5f6b75f35ea4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 13 Feb 2026 22:01:12 +0900 Subject: feat: add feed sidebar and cursor-based pagination Add a feed sidebar to /unread and /read pages for filtering articles by feed, and replace the fixed 100-article limit with cursor-based pagination using a "Load more" button. Backend: - Add PageInfo, ArticleConnection types and pagination args to GraphQL - Replace GetUnreadArticles/GetReadArticles with parameterized queries - Add GetFeedUnreadCounts query and composite index - Add shared pagination helper in resolver Frontend: - Add FeedSidebar component with unread count badges - Add usePaginatedArticles hook for cursor-based fetching - Update ArticleList with Load more button and single-feed mode - Use ?feed= query parameter for feed filtering Co-Authored-By: Claude Opus 4.6 --- graphql/schema.graphql | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) (limited to 'graphql') diff --git a/graphql/schema.graphql b/graphql/schema.graphql index e37d729..3f9eddb 100644 --- a/graphql/schema.graphql +++ b/graphql/schema.graphql @@ -29,6 +29,11 @@ type Feed { """ isSubscribed: Boolean! + """ + Number of unread articles in this feed + """ + unreadCount: Int! + """ Articles belonging to this feed """ @@ -90,6 +95,36 @@ type User { username: String! } +""" +Pagination information for cursor-based pagination +""" +type PageInfo { + """ + Whether there are more items after the last item in this page + """ + hasNextPage: Boolean! + + """ + Cursor of the last item in this page + """ + endCursor: ID +} + +""" +A paginated list of articles +""" +type ArticleConnection { + """ + The list of articles + """ + articles: [Article!]! + + """ + Pagination information + """ + pageInfo: PageInfo! +} + """ Authentication payload returned from login mutation """ @@ -110,14 +145,14 @@ type Query { feeds: [Feed!]! """ - Get all unread articles across all feeds + Get unread articles with optional feed filter and cursor-based pagination """ - unreadArticles: [Article!]! + unreadArticles(feedId: ID, after: ID, first: Int): ArticleConnection! """ - Get all read articles across all feeds + Get read articles with optional feed filter and cursor-based pagination """ - readArticles: [Article!]! + readArticles(feedId: ID, after: ID, first: Int): ArticleConnection! """ Get a specific feed by ID -- cgit v1.3-1-g0d28