diff --git a/app/src/pages/ComparisonPage.jsx b/app/src/pages/ComparisonPage.jsx new file mode 100644 index 0000000..7c53be7 --- /dev/null +++ b/app/src/pages/ComparisonPage.jsx @@ -0,0 +1,202 @@ +import { useState } from 'react'; +import { TeknavData } from '../../teknav-data.js'; +import { useNav, EmptyState } from '../../teknav-ui.jsx'; +import linkIcon from '../../src/assets/icons/link.svg'; + +function ComparisonVoteBar({ slug, item1, item2 }) { + const key = `cmp_vote_${slug}`; + const [vote, setVote] = useState(() => { + try { return localStorage.getItem(key) || null; } catch { return null; } + }); + const [shared, setShared] = useState(false); + + const cast = (choice) => { + try { localStorage.setItem(key, choice); } catch {} + setVote(choice); + }; + + const shareComparison = () => { + const url = `https://www.teknav.ir/compare/${slug}`; + if (navigator.share) { + navigator.share({ title: `مقایسه ${item1.name} در برابر ${item2.name} — تکناو`, url }).catch(() => {}); + } else { + navigator.clipboard?.writeText(url).then(() => { setShared(true); setTimeout(() => setShared(false), 2000); }).catch(() => {}); + } + }; + + return ( +
شما کدام را ترجیح میدهید؟
++ انتخاب شما ثبت شد. برای تغییر دوباره کلیک کنید. +
+ )} +{comparison.metaDescription}
+ )} + {comparison.factCheckedAt && ( ++ آخرین بروزرسانی: {comparison.factCheckedAt} +
+ )} + +{item.summary}
+{verdict}
+