diff --git a/app/src/pages/AuthorProfilePage.jsx b/app/src/pages/AuthorProfilePage.jsx new file mode 100644 index 0000000..81b2451 --- /dev/null +++ b/app/src/pages/AuthorProfilePage.jsx @@ -0,0 +1,50 @@ +import { useState, useEffect } from 'react'; +import { TeknavData } from '../../teknav-data.js'; +import { useNav, AuthorAvatar, EmptyState } from '../../teknav-ui.jsx'; +import { ArticleRow } from '../../teknav-articles.jsx'; + +export function AuthorProfilePage({ slug }) { + const { navigate } = useNav(); + const [author, setAuthor] = useState(null); + const [articles, setArticles] = useState([]); + const [loading, setLoading] = useState(true); + + useEffect(() => { + const staticAuthor = TeknavData.authors.find(a => a.slug === slug); + const username = staticAuthor?.username || slug; + navigate(`/profile/@${username}`); + }, [slug]); + + if (loading) return
در حال بارگذاری…
; + if (!author) return ; + + return ( +
+
+
+ +
+

+ {author.name} + {author.verifiedExpert && متخصص تاییدشده} +

+ {author.verifiedExpert && author.verificationNote &&
{author.verificationNote}
} +
{author.specialty}
+

{author.bio}

+
+
{author.articleCount}مقاله
+
{articles.reduce((s, a) => s + (a.views || 0), 0).toLocaleString('fa')}بازدید
+
+
+
+
+ +
+

مقاله‌های {author.name}

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