4.1.3
This commit is contained in:
@@ -56,6 +56,20 @@ export default function TabNavigation({ currentPage }: TabNavigationProps) {
|
||||
<Link
|
||||
key={tab.href}
|
||||
href={tab.href}
|
||||
onClick={(e) => {
|
||||
// وقتی تبی که از قبل توش هستیم دوباره زده میشه، Next.js چون مسیر عوض
|
||||
// نمیشه هیچ اسکرول/رفرشی انجام نمیده — طبق درخواست کاربر، مثل اینستاگرام
|
||||
// باید صفحه بره بالا و (برای تبِ خانه) جدیدترین پستها هم لود بشن
|
||||
if (isActive) {
|
||||
e.preventDefault();
|
||||
window.dispatchEvent(
|
||||
new CustomEvent("app:tab-reselect", {
|
||||
detail: { href: tab.href },
|
||||
})
|
||||
);
|
||||
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||
}
|
||||
}}
|
||||
className="gentle-transition flex flex-col items-center gap-0.5 px-2 py-1 active:scale-95"
|
||||
>
|
||||
<BoldIcon
|
||||
|
||||
Reference in New Issue
Block a user