import { useParams } from 'react-router';
import { DEFAULT_WALLET_SECTION, isWalletSection, type WalletSectionId } from './shared';

// The URL names the open section — not a panel channel. See docs/navigation-audit.md. WalletScreen
// redirects anything unrecognised, so the fallback here only covers the instant before that lands.

export function useWalletSection(): WalletSectionId {
  const { section } = useParams();
  return isWalletSection(section) ? section : DEFAULT_WALLET_SECTION;
}
