From 1c73c999ac78d2e6d3a8c68b4e17058046326f55 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 12 Jul 2025 14:55:19 +0900 Subject: feat(frontend): create pages and components --- frontend/src/pages/UnreadArticles.tsx | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 frontend/src/pages/UnreadArticles.tsx (limited to 'frontend/src/pages/UnreadArticles.tsx') diff --git a/frontend/src/pages/UnreadArticles.tsx b/frontend/src/pages/UnreadArticles.tsx new file mode 100644 index 0000000..38bf077 --- /dev/null +++ b/frontend/src/pages/UnreadArticles.tsx @@ -0,0 +1,34 @@ +import { useQuery } from "urql"; +import { ArticleList } from "../components"; +import { GetUnreadArticlesDocument } from "../graphql/generated/graphql"; + +export function UnreadArticles() { + const [{ data, fetching, error }] = useQuery({ + query: GetUnreadArticlesDocument, + }); + + if (fetching) { + return
Loading unread articles...
; + } + + if (error) { + return
Error: {error.message}
; + } + + return ( +
+
+

Unread Articles

+ {data?.unreadArticles && ( +

+ {data.unreadArticles.length} article + {data.unreadArticles.length !== 1 ? "s" : ""} +

+ )} +
+ {data?.unreadArticles && ( + + )} +
+ ); +} -- cgit v1.2.3-70-g09d2