From 4e862c15fbeef3a25cd1092b4ac9ba19c10d9c58 Mon Sep 17 00:00:00 2001 From: arsam Date: Fri, 18 Sep 2026 23:25:44 +0330 Subject: [PATCH] Import source: app/src/pages/TagPage Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality. --- app/src/pages/TagPage.jsx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 app/src/pages/TagPage.jsx diff --git a/app/src/pages/TagPage.jsx b/app/src/pages/TagPage.jsx new file mode 100644 index 0000000..ef76993 --- /dev/null +++ b/app/src/pages/TagPage.jsx @@ -0,0 +1,28 @@ +import { useState, useEffect } from 'react'; +import { EmptyState } from '../../teknav-ui.jsx'; +import { ArticleRow } from '../../teknav-articles.jsx'; +import { contentApi } from '../../src/lib/content-api.js'; + +export function TagPage({ tag }) { + const decoded = decodeURIComponent(tag); + const [articles, setArticles] = useState(() => contentApi.fallbackArticles().filter((item) => item.tags?.includes(decoded))); + useEffect(() => { + let cancelled = false; + setArticles(contentApi.fallbackArticles().filter((item) => item.tags?.includes(decoded))); + contentApi.listArticles({ tag: decoded, limit: 100 }) + .then((res) => { if (!cancelled) setArticles(res.items ?? []); }) + .catch(() => {}); + return () => { cancelled = true; }; + }, [decoded]); + return ( +
+
+

برچسب {decoded}

+

همه مقاله‌هایی که با این برچسب منتشر شده‌اند.

+ {articles.length === 0 ? : articles.map((article, index) => ( + + ))} +
+
+ ); +}