diff --git a/app/src/pages/GlossaryPage.jsx b/app/src/pages/GlossaryPage.jsx new file mode 100644 index 0000000..38fd3c4 --- /dev/null +++ b/app/src/pages/GlossaryPage.jsx @@ -0,0 +1,68 @@ +import { useState } from 'react'; +import { TeknavData } from '../../teknav-data.js'; +import { useNav, EmptyState, pillBtn } from '../../teknav-ui.jsx'; +import { ArticleRow } from '../../teknav-articles.jsx'; +import { contentApi } from '../../src/lib/content-api.js'; + +export function GlossaryPage({ slug }) { + const { navigate } = useNav(); + const term = TeknavData.glossary?.find((item) => item.slug === slug); + const articles = contentApi.fallbackArticles().filter((article) => ( + article.tags?.some((tag) => tag.toLowerCase() === term?.term?.toLowerCase() || tag.toLowerCase() === term?.english?.toLowerCase()) + || article.summary?.toLowerCase().includes(term?.english?.toLowerCase() || '') + || article.title?.toLowerCase().includes(term?.english?.toLowerCase() || '') + )).slice(0, 6); + + if (!term) return ; + + const related = (term.related ?? []).map((item) => TeknavData.glossary?.find((g) => g.slug === item)).filter(Boolean); + const topic = TeknavData.topicHubs?.find((item) => item.slug === term.topic); + + return ( + + + + navigate('/articles')} style={{ ...pillBtn, background: '#F4EFE6', color: '#0F6B73', border: '1px solid #E4DDD2', marginBottom: 18 }}>بازگشت به مقالهها + فرهنگ واژگان تکنّاو + {term.term} + {term.english} + {term.summary} + + + + + + پرسشهای رایج + {(term.faqs ?? []).map(([q, a]) => ( + + {q} + {a} + + ))} + + + مقالههای مرتبط + {articles.length === 0 ? : articles.map((article, index) => )} + + + + + + + ); +}
{term.summary}
{a}