aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/src/pages/UnreadArticles.tsx
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-07-12 14:55:19 +0900
committernsfisis <nsfisis@gmail.com>2025-07-12 16:23:37 +0900
commit1c73c999ac78d2e6d3a8c68b4e17058046326f55 (patch)
tree41a01cc3827098dfc8d108e5b9cfac1fd5e7fb7f /frontend/src/pages/UnreadArticles.tsx
parent9da56e3023af305ba7c5fd49caab60ac8bb57100 (diff)
downloadfeedaka-1c73c999ac78d2e6d3a8c68b4e17058046326f55.tar.gz
feedaka-1c73c999ac78d2e6d3a8c68b4e17058046326f55.tar.zst
feedaka-1c73c999ac78d2e6d3a8c68b4e17058046326f55.zip
feat(frontend): create pages and components
Diffstat (limited to 'frontend/src/pages/UnreadArticles.tsx')
-rw-r--r--frontend/src/pages/UnreadArticles.tsx34
1 files changed, 34 insertions, 0 deletions
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 <div className="p-4">Loading unread articles...</div>;
+ }
+
+ if (error) {
+ return <div className="p-4 text-red-600">Error: {error.message}</div>;
+ }
+
+ return (
+ <div>
+ <div className="border-b border-gray-200 bg-white px-4 py-3">
+ <h1 className="text-xl font-semibold text-gray-900">Unread Articles</h1>
+ {data?.unreadArticles && (
+ <p className="text-sm text-gray-500">
+ {data.unreadArticles.length} article
+ {data.unreadArticles.length !== 1 ? "s" : ""}
+ </p>
+ )}
+ </div>
+ {data?.unreadArticles && (
+ <ArticleList articles={data.unreadArticles} showReadStatus={true} />
+ )}
+ </div>
+ );
+}