fix(nav): settings tab now correctly returns to /settings from any sub-page

SettingsShell always passed the literal string "/settings" as currentPage
to TabNavigation, regardless of the actual sub-route. TabNavigation's
isExactRoot check (currentPage === tab.href) was therefore always true for
the settings tab, so tapping it while on any settings sub-page (e.g.
/settings/wallet) always hit the "already here" branch and called
preventDefault() instead of navigating — the user had to tap a different
tab first (which uses a different pathname) before tapping Settings again
would actually work. Now passes the real pathname; tab highlighting is
unaffected since TabNavigation already does its own startsWith() check for
that.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
payacom
2026-09-17 16:22:56 +03:30
parent 0c080d22cd
commit 83c2102afe

View File

@@ -30,13 +30,13 @@ export default function SettingsShell({
transition={{ duration: 0.35, ease: [0.25, 0.46, 0.45, 0.94] }}
className="fixed bottom-0 left-0 right-0 z-50"
>
<TabNavigation
currentPage={
pathname?.startsWith("/settings/chats")
? "/settings/chats"
: "/settings"
}
/>
{/* pathname واقعی رو پاس می‌دیم، نه همیشه "/settings" ثابت — قبلاً برای هر
زیرصفحه‌ی تنظیمات (مثلاً /settings/wallet) هم "/settings" پاس داده می‌شد،
پس isExactRoot توی TabNavigation.tsx همیشه true می‌شد و کلیکِ روی آیکونِ
تنظیمات preventDefault می‌شد (به‌جای navigate واقعی)، چون فکر می‌کرد از
قبل دقیقاً روی روتِ /settings هستیم. isActive/هایلایتِ تب همچنان درست
کار می‌کنه چون TabNavigation خودش startsWith("/settings") رو چک می‌کنه */}
<TabNavigation currentPage={pathname ?? "/settings"} />
</motion.div>
)}
</AnimatePresence>