The open-source AI receptionist for businesses. Answers every call, books the appointment and hands over to a person when needed. You own the code and the data.
TypeScript ai-receptionistanswering-serviceappointment-bookinglivekitlocal-firstmcpopen-sourceself-hostedsiptelephonytypescriptvoice-agentvoice-ai
// The phone's tab bar (LIN-874): the four places used most, at the bottom where the thumb is, as in every iPhone app.
// Only below 720px (CSS `.tabbar` in mobile.css); wider windows keep the navigation on the left. The last tab, Menu,
// opens the menu with everything else (Reminders, Done, Integrations, Settings, Server admin, the account); the phone
// has no other menu button.
import { useFormat, useT } from '@linedesk/i18n/react'
import type { IconName } from '../ui/icons.ts'
import { cx, Icon } from '../ui/kit.tsx'
import { pages, type Route } from './pages.tsx'
type Tab = { id: string; href: string; label: string; icon: IconName; current: boolean; badge?: number }
export function TabBar({
route,
onInbox,
unreadCount,
onInboxTab,
menuOpen,
onMenu,
menuBadge,
}: {
route: Route
/** The inbox's own views (Needs you, Handled, Spam) are the Inbox tab; Done, Reminders and others are not. */
onInbox: boolean
unreadCount: number
/** Inbox again while on it: back to Needs you, at the top. */
onInboxTab: () => void
menuOpen: boolean
onMenu: () => void
/** Something waits in the menu (an invitation): a dot, as the old menu button had. */
menuBadge: boolean
}) {
const t = useT()
const format = useFormat()
const tabs: Tab[] = [
{ id: 'inbox', href: '#calls', label: t('shell.nav.inbox'), icon: 'phone', current: onInbox, badge: unreadCount },
{ id: 'contacts', href: '#contacts', label: pages.contacts.title, icon: 'contact', current: route === 'contacts' },
{ id: 'insights', href: '#insights', label: pages.insights.title, icon: 'chart', current: route === 'insights' },
]
// Menu is current on every page the other tabs do not show (Settings, Reminders, Done, Integrations, ...).
const menuCurrent = !tabs.some(tab => tab.current)
return (
<nav className="tabbar" aria-label={t('shell.tabbar.label')}>
{tabs.map(tab => (
<a
key={tab.id}
href={tab.href}
className={cx('tabbar-tab', tab.current && 'is-current')}
aria-current={tab.current ? 'page' : undefined}
onClick={
tab.id === 'inbox'
? e => {
e.preventDefault()
onInboxTab()
}
: undefined
}
>
<span className="tabbar-icon">
<Icon name={tab.icon} size={24} />
{tab.badge ? (
<span className="tabbar-badge">
{format.number(tab.badge)}
<span className="sr-only">{t('shell.nav.inboxUnreadTip', { count: tab.badge })}</span>
</span>
) : null}
</span>
<span className="tabbar-label">{tab.label}</span>
</a>
))}
<button
type="button"
className={cx('tabbar-tab', menuCurrent && 'is-current')}
aria-expanded={menuOpen}
aria-label={menuBadge ? t('shell.nav.openMenuInvitation') : undefined}
onClick={onMenu}
>
<span className="tabbar-icon">
<Icon name="menu" size={24} />
{menuBadge && <span className="tabbar-dot" aria-hidden="true" />}
</span>
<span className="tabbar-label">{t('shell.tabbar.menu')}</span>
</button>
</nav>
)
}