Repository navigation
fix navigation between tabs - #162
Conversation
WalkthroughSynchronizes tab UI by restoring DOM classes for three active tabs in src/App.tsx. In the tab-syncing useEffect, when Wallet, Apps, or Settings becomes active, the code removes the 'tab-hidden' class from the corresponding tab element. No exported APIs or broader control flow changed. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying wallet-signet with
|
| Latest commit: |
84c0ea9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8fe13196.wallet-23u.pages.dev |
| Branch Preview URL: | https://fix-tab-navigation-2.wallet-23u.pages.dev |
Deploying wallet-mutinynet with
|
| Latest commit: |
84c0ea9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ce1b0923.arkade-wallet.pages.dev |
| Branch Preview URL: | https://fix-tab-navigation-2.arkade-wallet.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/App.tsx (1)
80-103: LGTM! Fix correctly ensures active tab visibility.The additions of
classList.remove('tab-hidden')for each active tab properly synchronize the DOM state with the tab navigation. This ensures the active tab is always visible after switching, fixing the navigation issue.The implementation is correct, though the pattern repeats three times. If you'd like to reduce duplication, consider this optional refactor:
useEffect(() => { + const tabs = { + [Tabs.Wallet]: walletRef, + [Tabs.Apps]: appsRef, + [Tabs.Settings]: settingsRef, + } + + const activeTab = tabs[tab] + if (activeTab?.current) { + activeTab.current.setActive() + activeTab.current.classList.remove('tab-hidden') + + Object.entries(tabs).forEach(([key, ref]) => { + if (key !== tab && ref.current) { + ref.current.classList.add('tab-hidden') + } + }) + } - switch (tab) { - case Tabs.Wallet: - walletRef.current?.setActive() - walletRef.current?.classList.remove('tab-hidden') - appsRef.current?.classList.add('tab-hidden') - settingsRef.current?.classList.add('tab-hidden') - break - case Tabs.Apps: - appsRef.current?.setActive() - appsRef.current?.classList.remove('tab-hidden') - walletRef.current?.classList.add('tab-hidden') - settingsRef.current?.classList.add('tab-hidden') - break - case Tabs.Settings: - settingsRef.current?.setActive() - settingsRef.current?.classList.remove('tab-hidden') - walletRef.current?.classList.add('tab-hidden') - appsRef.current?.classList.add('tab-hidden') - break - default: - break - } }, [tab])
Deploying wallet-bitcoin-v8 with
|
| Latest commit: |
84c0ea9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://bd4b174f.wallet-v8.pages.dev |
| Branch Preview URL: | https://fix-tab-navigation-2.wallet-v8.pages.dev |
Summary by CodeRabbit