import React from 'react'; import { useLocation } from 'react-router-dom'; import { useContactsGestures } from '../hooks/useContactsGestures'; import { SymbolIcon } from './SymbolIcon'; import { IcSymbolCarrier, IcSymbolContactsCircle, IcSymbolPhone } from '../res/icons'; import { strings } from '../res/strings'; import { stringsEn } from '../res/strings.en'; import { useAppStrings } from '@/os/useAppStrings'; type TabKey = 'calls' | 'contacts' | 'business'; function getActiveTab(pathname: string): TabKey { if (pathname.startsWith('/contacts')) return 'contacts'; if (pathname.startsWith('/business')) return 'business'; if (pathname.startsWith('/settings')) return 'calls'; // keep dialer selected in settings return 'calls'; } export const BottomTabBar: React.FC = () => { const { bindTap } = useContactsGestures(); const location = useLocation(); const active = getActiveTab(location.pathname); const s = useAppStrings(strings, stringsEn); const items: Array<{ key: TabKey; label: string; icon: React.ReactNode; tapProps: React.HTMLAttributes; }> = [ { key: 'calls', label: s.dialerIconLabel, icon: , tapProps: bindTap('tab.calls'), }, { key: 'contacts', label: s.contactsAllLabel, icon: , tapProps: bindTap('tab.contacts'), }, { key: 'business', label: s.businessHallLabel, icon: , tapProps: bindTap('tab.business'), }, ]; return (
{items.map((it) => { const isActive = active === it.key; const color = isActive ? 'text-black' : 'text-gray-400'; return ( ); })}
{/* extra safe area to mimic gesture inset */}
); };