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
Phone layout like an iPhone app: tab bar, large titles, segmented views, 44px controls, swipe rows (PR 2014)
Tim Gutberlet4e7c12975ec5
diff --git a/apps/web/src/Workspace.tsx b/apps/web/src/Workspace.tsxindex 43c6c626..e3ee43ae 100644--- a/apps/web/src/Workspace.tsx+++ b/apps/web/src/Workspace.tsx@@ -19,6 +19,7 @@ import { preloadLiveKit } from './call/livekit.ts'import { togglePlayback } from './call/playback.ts'import { assignGroups, assigneeViewGroups } from './inbox/assign.ts'import { Inbox } from './inbox/Inbox.tsx'+import { TabBar } from './shell/TabBar.tsx'import type { ReminderOption } from './inbox/remind.ts'import { useSelection } from './inbox/selection.ts'import { useCallActions } from './inbox/useCallActions.ts'@@ -30,6 +31,7 @@ import {callTitle,dial,type InboxTab,+ splits,tabOf,visibleSplits,} from './inbox-model.ts'@@ -667,6 +669,7 @@ export function Workspace({ me, onSignedOut, onSessionStale, notice = null, onRe'app',navDocked ? 'nav-docked' : navOpen && 'nav-open',navDocked && navCollapsed && 'nav-collapsed',+ !openCall && 'has-tabbar',)}><Nav@@ -856,6 +859,18 @@ export function Workspace({ me, onSignedOut, onSessionStale, notice = null, onRe</div>)}<SyncBar />+ {!openCall && (+ <TabBar+ route={nav.route}+ onInbox={nav.route === 'calls' && (splits as readonly InboxTab[]).includes(tab)}+ unreadCount={view.unreadNeedsYou}+ onInboxTab={() => {+ if (nav.route === 'calls' && tab === 'you')+ document.querySelector('.ib-list')?.scrollTo({ top: 0, behavior: 'smooth' })+ else view.setTab('you')+ }}+ />+ )}{asksNameIn(me) && <AskName impersonating={!!me.impersonation} />}</main><Overlaysdiff --git a/apps/web/src/call/CallView.tsx b/apps/web/src/call/CallView.tsxindex 00def865..564af2b9 100644--- a/apps/web/src/call/CallView.tsx+++ b/apps/web/src/call/CallView.tsx@@ -77,10 +77,16 @@ function Bar({ call, index, count, menu, ...on }: BarProps) {return (<div className="cv-bar" role="toolbar" aria-label={t('call.bar.label')}>{menu}+ {/* Phones: the call is a page pushed over the inbox, so the way back is "‹ Inbox" at the top left (mobile.css). */}+ <button type="button" className="cv-back-phone" aria-label={t('call.bar.back')} onClick={on.onBack}>+ <Icon name="left" size={22} />+ <span>{t('shell.nav.inbox')}</span>+ </button><Buttonsize="sm"variant="ghost"icon="left"+ className="cv-back"title={t('common.withKey', { label: t('call.bar.back'), key: 'esc' })}aria-label={t('call.bar.back')}onClick={on.onBack}@@ -89,6 +95,7 @@ function Bar({ call, index, count, menu, ...on }: BarProps) {size="sm"variant="ghost"icon="up"+ className="cv-step"title={t('common.withKey', { label: t('call.bar.previous'), key: 'K' })}aria-label={t('call.bar.previous')}disabled={index <= 0}@@ -98,6 +105,7 @@ function Bar({ call, index, count, menu, ...on }: BarProps) {size="sm"variant="ghost"icon="down"+ className="cv-step"title={t('common.withKey', { label: t('call.bar.next'), key: 'J' })}aria-label={t('call.bar.next')}disabled={index >= count - 1}diff --git a/apps/web/src/inbox/InboxHead.tsx b/apps/web/src/inbox/InboxHead.tsxindex 52e17694..4a16cf02 100644--- a/apps/web/src/inbox/InboxHead.tsx+++ b/apps/web/src/inbox/InboxHead.tsx@@ -270,7 +270,13 @@ export function InboxHead({onSwitch={assigneeTabs.includes(p.tab) ? p.onAssigneeViews : undefined}/>) : (- <Tabs tab={p.tab} setTab={p.setTab} counts={p.counts} />+ <>+ {/* Phones: the large title above the views, as in iPhone apps (mobile.css); the page's h1 is for screen readers. */}+ <div className="ib-big" aria-hidden="true">+ {t('shell.nav.inbox')}+ </div>+ <Tabs tab={p.tab} setTab={p.setTab} counts={p.counts} />+ </>)}{p.search === null && p.trialEndsAt && <TrialStatus endsAt={p.trialEndsAt} />}{p.search === null && (diff --git a/apps/web/src/inbox/Row.tsx b/apps/web/src/inbox/Row.tsxindex 5b44eaa9..14be6294 100644--- a/apps/web/src/inbox/Row.tsx+++ b/apps/web/src/inbox/Row.tsx@@ -16,6 +16,7 @@ import { callHash } from '../shell/useRoute.ts'import { useT } from '@linedesk/i18n/react'import { i18n } from '../i18n/index.tsx'import { MissingInfoFlags, missingInfoOf, missingInfoText } from '../call/MissingInfo.tsx'+import { useSwipe } from './useSwipe.ts'/** The inbox passes them all; a call list elsewhere (a contact's calls) only those it offers. */export type RowHandlers = {@@ -286,6 +287,12 @@ export const Row = memo(function Row({const live = call.status === 'live'const done = call.inbox_state === 'done'const reminded = tabOf(call) === 'reminders'+ const swipe = useSwipe(!!on.onToggleDone && !live)+ const swiped = (run: () => void) => (e: MouseEvent) => {+ e.stopPropagation()+ swipe.close()+ run()+ }return (<divref={measure}@@ -305,8 +312,13 @@ export const Row = memo(function Row({selected && 'is-selected',(unread || live) && 'unread',done && search !== null && 'is-done',+ swipe.className,)}- onClick={() => on.onOpen?.(call)}+ style={swipe.style}+ {...swipe.handlers}+ onClick={() => {+ if (!swipe.takeClick()) on.onOpen?.(call)+ }}onMouseMove={() => {if (!isCursor) on.onHover?.(call)}}@@ -423,6 +435,27 @@ export const Row = memo(function Row({/>)}</span>+ {swipe.shown && (+ <span className="r-swipe">+ {reminded+ ? on.onClearReminder && (+ <button type="button" className="r-swipe-remind" onClick={swiped(() => on.onClearReminder!(call))}>+ <Icon name="restart" size={20} />+ {t('inbox.goLive.clearReminder')}+ </button>+ )+ : on.onRemind && (+ <button type="button" className="r-swipe-remind" onClick={swiped(() => on.onRemind!(call))}>+ <Icon name="clock" size={20} />+ {t('inbox.action.remind')}+ </button>+ )}+ <button type="button" className="r-swipe-done" onClick={swiped(() => on.onToggleDone!(call))}>+ <Icon name={done ? 'restart' : 'check'} size={20} />+ {done ? t('inbox.action.notDone') : t('inbox.action.done')}+ </button>+ </span>+ )}</div>)})diff --git a/apps/web/src/inbox/useSwipe.ts b/apps/web/src/inbox/useSwipe.tsnew file mode 100644index 00000000..896ed86e--- /dev/null+++ b/apps/web/src/inbox/useSwipe.ts@@ -0,0 +1,85 @@+// Swipe a row to the left on a phone (LIN-874): its two actions (Remind, Done) come out from behind it, as in Mail.+// A short swipe snaps back; past half the actions' width it stays open until a tap. Only one row is open at a time.+// Below 720px only; elsewhere the row's own buttons are there.+import { type CSSProperties, type TouchEvent, useCallback, useRef, useState } from 'react'++/** The width of the actions behind the row (two buttons of 76px, mobile.css `.r-swipe`). */+export const SWIPE_WIDTH = 152++const PHONE_QUERY = '(max-width: 719px)'+let closeOpenRow: (() => void) | null = null++type Gesture = { x: number; y: number; base: number; axis: 'x' | 'y' | null }++export function useSwipe(enabled: boolean) {+ const [offset, setOffset] = useState(0)+ const [dragging, setDragging] = useState(false)+ const gesture = useRef<Gesture | null>(null)+ // A swipe ends with a click on the row: that click must not open the call.+ const swallowClick = useRef(false)+ const close = useCallback(() => {+ setOffset(0)+ if (closeOpenRow === close) closeOpenRow = null+ }, [])++ const onTouchStart = (e: TouchEvent) => {+ if (!enabled || e.touches.length !== 1 || !window.matchMedia(PHONE_QUERY).matches) return+ const touch = e.touches[0]!+ gesture.current = { x: touch.clientX, y: touch.clientY, base: offset, axis: null }+ }+ const onTouchMove = (e: TouchEvent) => {+ const g = gesture.current+ if (!g) return+ const touch = e.touches[0]!+ const dx = touch.clientX - g.x+ const dy = touch.clientY - g.y+ if (!g.axis) {+ if (Math.abs(dx) < 8 && Math.abs(dy) < 8) return+ g.axis = Math.abs(dx) > Math.abs(dy) ? 'x' : 'y'+ if (g.axis === 'x') {+ if (closeOpenRow && closeOpenRow !== close) closeOpenRow()+ setDragging(true)+ }+ }+ if (g.axis !== 'x') return+ setOffset(Math.min(0, Math.max(-SWIPE_WIDTH * 1.25, g.base + dx)))+ }+ const onTouchEnd = () => {+ const g = gesture.current+ gesture.current = null+ if (!g || g.axis !== 'x') return+ swallowClick.current = true+ setDragging(false)+ setOffset(current => {+ const open = current < -SWIPE_WIDTH / 2+ closeOpenRow = open ? close : closeOpenRow === close ? null : closeOpenRow+ return open ? -SWIPE_WIDTH : 0+ })+ }++ /** For the row's click: true when the click belongs to a swipe, or only closes the open row. */+ const takeClick = () => {+ if (swallowClick.current) {+ swallowClick.current = false+ return true+ }+ if (offset !== 0) {+ close()+ return true+ }+ if (closeOpenRow) {+ closeOpenRow()+ return true+ }+ return false+ }++ return {+ shown: dragging || offset !== 0,+ className: dragging ? 'is-swiping' : offset !== 0 ? 'is-swiped' : undefined,+ style: (offset !== 0 ? { '--swipe': `${offset}px` } : undefined) as CSSProperties | undefined,+ handlers: { onTouchStart, onTouchMove, onTouchEnd, onTouchCancel: onTouchEnd },+ takeClick,+ close,+ }+}diff --git a/apps/web/src/main.tsx b/apps/web/src/main.tsxindex e345def7..7fd0acfd 100644--- a/apps/web/src/main.tsx+++ b/apps/web/src/main.tsx@@ -13,6 +13,7 @@ import '@fontsource/geist-mono/400.css'import '@fontsource/geist-mono/500.css'import './styles.css'import './app.css'+import './mobile.css'import { captureOpenRouterReturn } from './admin/openrouterAuth.ts'import { fetchAuthMethods } from './auth.ts'import { activate, initialLocale, languageFromAddress, LocaleRoot } from './i18n/index.tsx'diff --git a/apps/web/src/mobile.css b/apps/web/src/mobile.cssnew file mode 100644index 00000000..2bf0c8df--- /dev/null+++ b/apps/web/src/mobile.css@@ -0,0 +1,486 @@+/*+ * Phones (below 720px, in the Linedesk app and in a phone's browser): an iPhone-style app, not the desktop made small+ * (LIN-874). A tab bar at the bottom (shell/TabBar.tsx), large titles, a segmented control for the inbox's views,+ * controls of at least 44px, rows to tap with the thumb, and a call that opens as a page pushed over the inbox with+ * "‹ Inbox" at the top left. Loaded after app.css, so these rules win at the same specificity.+ */++/* Phone-only parts are hidden on wider windows. */+.tabbar,+.ib-big,+.cv-back-phone {+ display: none;+}++@media (max-width: 719px) {+ :root {+ /* Apple's minimum touch target is 44pt: every button and field on a phone is at least that (sm buttons 40). */+ --control-h-sm: 40px;+ --control-h: 44px;+ --control-h-lg: 50px;+ --gutter: 16px;+ --phone-bar: 49px;+ --phone-fill: #efede8;+ }+ body {+ font-size: 16px;+ line-height: 22px;+ }+ /* Fields at 16px: iOS zooms into anything smaller when it gets the focus. */+ input,+ textarea,+ select,+ .k-input input {+ font-size: 16px !important;+ }+ .k-btn {+ font-size: 15px;+ }+ .k-btn-sm {+ font-size: 14px;+ padding: 0 12px;+ }+ .k-btn-icon svg,+ .k-btn-sm.k-btn-icon svg {+ width: 20px;+ height: 20px;+ }+ /* Keyboard hints mean nothing on a phone. */+ .k-btn .k-kbds {+ display: none;+ }++ /* The page reaches under the status bar in the app (viewport-fit=cover): the content starts below it. */+ .main {+ padding-top: env(safe-area-inset-top, 0px);+ box-sizing: border-box;+ }+ .nav {+ padding-top: max(12px, env(safe-area-inset-top, 0px));+ }++ /* ---- Menu (☰): bigger, the way into the places the tab bar does not have ---- */+ .menu-btn.k-btn {+ width: 44px;+ height: 44px;+ }+ .menu-btn.k-btn svg {+ width: 24px;+ height: 24px;+ }+ .nav .nav-item {+ min-height: 44px;+ font-size: 16px;+ }++ /* ---- Tab bar ---- */+ .tabbar {+ display: flex;+ flex: none;+ order: 99;+ padding-bottom: env(safe-area-inset-bottom, 0px);+ border-top: 0.5px solid var(--line-soft);+ background: color-mix(in srgb, var(--surface) 88%, transparent);+ -webkit-backdrop-filter: saturate(180%) blur(20px);+ backdrop-filter: saturate(180%) blur(20px);+ }+ .tabbar-tab {+ flex: 1 1 0;+ min-width: 0;+ height: var(--phone-bar);+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ gap: 2px;+ color: #8f8882;+ text-decoration: none;+ -webkit-tap-highlight-color: transparent;+ }+ .tabbar-tab.is-current {+ color: var(--ink);+ }+ .tabbar-icon {+ position: relative;+ display: grid;+ }+ .tabbar-label {+ font-size: 10.5px;+ line-height: 12px;+ font-weight: 500;+ }+ .tabbar-badge {+ position: absolute;+ top: -5px;+ left: 15px;+ min-width: 18px;+ height: 18px;+ box-sizing: border-box;+ padding: 0 5px;+ border: 2px solid var(--surface);+ border-radius: var(--radius-full);+ background: #16a34a;+ color: #fff;+ font-size: 11px;+ font-weight: 600;+ line-height: 14px;+ text-align: center;+ }+ .app.has-tabbar .toast {+ bottom: calc(var(--phone-bar) + 12px + env(safe-area-inset-bottom, 0px));+ }++ /* ---- Headers: a slim top line (menu, actions), then the large title ---- */+ .cv > .ib-head {+ flex-wrap: wrap;+ align-items: center;+ gap: 0 4px;+ min-height: 0;+ padding: 2px 8px 10px;+ border-bottom: 0;+ }+ .cv > .ib-head > .menu-btn,+ .cv > .ib-head > .menu-btn-wrap {+ order: 0;+ }+ .cv > .ib-head .ib-right {+ order: 1;+ margin-left: auto;+ gap: 0;+ }+ .ib-big,+ .cv > .ib-head .ib-title {+ order: 2;+ flex: 1 0 100%;+ display: block;+ margin: 2px 0 8px;+ padding: 0 8px;+ font-size: 32px;+ line-height: 38px;+ font-weight: 700;+ letter-spacing: -0.02em;+ color: var(--ink);+ }+ .cv > .ib-head .ib-title {+ display: flex;+ align-items: baseline;+ gap: 8px;+ }+ .cv > .ib-head .ib-title b {+ font-weight: 700;+ }+ .cv > .ib-head .ib-title .n {+ font-size: 15px;+ font-weight: 500;+ letter-spacing: 0;+ color: var(--ink-muted);+ }+ /* The header's quiet buttons are icons only on a phone (search, import): their names are in the tooltip. */+ .cv > .ib-head .ib-right .k-btn-ghost {+ width: 44px;+ padding: 0;+ justify-content: center;+ }+ .cv > .ib-head .ib-right .k-btn-ghost > span {+ display: none;+ }+ .cv > .ib-head .ib-right .k-btn-ghost svg {+ width: 22px;+ height: 22px;+ }+ .cv > .ib-head .ib-right .k-btn-primary.k-btn-sm {+ width: 40px;+ padding: 0;+ justify-content: center;+ border-radius: var(--radius-full);+ }+ .cv > .ib-head .ib-right .k-btn-primary.k-btn-sm > span {+ display: none;+ }+ .ib-maya:not(.is-live) .ib-maya-t {+ display: none;+ }+ .cv > .ib-head .ib-trial {+ order: 4;+ }+ .cv > .ib-head .k-input {+ order: 2;+ flex: 1 1 100%;+ margin: 4px 8px 0;+ border: 0;+ border-radius: var(--radius-md);+ background: var(--phone-fill);+ box-shadow: none;+ }++ /* ---- The inbox's views: a segmented control ---- */+ .cv > .ib-head .ib-tabs {+ order: 3;+ flex: 1 1 100%;+ display: flex;+ gap: 0;+ margin: 0 8px;+ padding: 2px;+ border-radius: 9px;+ background: var(--phone-fill);+ overflow: visible;+ }+ .cv > .ib-head .ib-tab {+ flex: 1 1 0;+ min-width: 0;+ justify-content: center;+ height: 32px;+ padding: 0 6px;+ border-radius: 7px;+ font-size: 14px;+ font-weight: 500;+ color: var(--ink);+ background: transparent;+ }+ .cv > .ib-head .ib-tab[aria-selected="true"] {+ background: var(--surface);+ color: var(--ink);+ font-weight: 600;+ box-shadow:+ 0 3px 8px rgb(0 0 0 / 0.08),+ 0 0 0 0.5px rgb(0 0 0 / 0.04);+ }+ .cv > .ib-head .ib-tab .n {+ font-size: 12px;+ color: var(--ink-muted);+ }++ /* ---- Lists: rows to tap, like Mail ---- */+ .ib-list {+ padding-bottom: 24px;+ }+ .ib-list .ib-day {+ padding: 14px 16px 6px 32px;+ font-size: 13px;+ font-weight: 600;+ text-transform: none;+ letter-spacing: 0;+ color: var(--ink-muted);+ background: var(--bg);+ }+ .ib-list {+ overflow-x: hidden;+ }+ .ib-list .row {+ touch-action: pan-y;+ -webkit-tap-highlight-color: transparent;+ box-shadow: none;+ }+ /* The hairline between rows starts at the text, as in iPhone lists. */+ .ib-list .row::after {+ content: "";+ position: absolute;+ left: 32px;+ right: 0;+ bottom: 0;+ height: 0.5px;+ background: var(--line-soft);+ pointer-events: none;+ }+ .ib-list .row.is-cursor {+ box-shadow: none;+ }+ .cust-row .c-mono,+ .ib-list .row .r-time,+ .ct-row .c-last,+ .ct-row .c-count {+ font-family: var(--font-sans);+ font-size: 13px;+ }+ .ib-list .row:not(.cust-row) {+ padding: 11px 16px 12px 32px;+ row-gap: 2px;+ min-height: 76px;+ font-size: 15px;+ line-height: 20px;+ }+ .ib-list .row:not(.cust-row) .r-dot {+ left: 10px;+ top: 15px;+ width: 14px;+ }+ .ib-list .row:not(.cust-row) .r-dot i {+ width: 10px;+ height: 10px;+ }+ .ib-list .row:not(.cust-row) .r-time {+ font-family: var(--font-sans);+ }+ .ib-list .row:not(.cust-row) .r-status .r-next {+ color: var(--ink-muted);+ }+ .ib-list .row.cust-row {+ min-height: 64px;+ padding: 10px 16px 10px 32px;+ font-size: 15px;+ line-height: 20px;+ }+ .ib-list .row.cust-row b,+ .ib-list .row.cust-row .r-name {+ font-size: 16px;+ }+ .ib-list .row:not(.cust-row) .r-name {+ font-size: 16px;+ line-height: 21px;+ }+ .ib-list .row:not(.cust-row) .r-time {+ font-size: 14px;+ color: var(--ink-muted);+ }+ .ib-list .row:not(.cust-row) .r-sum {+ font-size: 15px;+ line-height: 20px;+ }+ .ib-list .row:not(.cust-row) .r-status {+ font-size: 14px;+ }+ .ib-list .row.is-cursor:not(:active) {+ background-color: transparent;+ }+ .ib-list .row:active {+ background-color: var(--surface-hover);+ }+ .ib-list .row.is-swiping,+ .ib-list .row.is-swiped {+ background-color: var(--bg);+ }+ /* The row's ⋯: swipe instead (Done, Remind), or open the call. */+ .ib-list .row:not(.cust-row) .r-acts {+ display: none;+ }++ /* Swipe a row to the left: Remind and Done appear behind it (Row.tsx useSwipe). */+ .row.is-swiping,+ .row.is-swiped {+ transform: translateX(var(--swipe, 0px));+ }+ .row.is-swiped {+ transition: transform 0.2s ease-out;+ }+ .r-swipe {+ position: absolute;+ top: 0;+ bottom: 0;+ left: 100%;+ display: flex;+ }+ .r-swipe button {+ width: 76px;+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ gap: 4px;+ border: 0;+ font: inherit;+ font-size: 13px;+ font-weight: 500;+ color: #fff;+ }+ .r-swipe .r-swipe-remind {+ background: #6b645e;+ }+ .r-swipe .r-swipe-done {+ background: var(--ink);+ }++ /* ---- Pages with the plain title bar: the large title under a slim line ---- */+ .pagebar {+ flex-wrap: wrap;+ min-height: 0;+ padding: 2px 8px 6px;+ border-bottom: 0;+ gap: 0;+ }+ .pagebar > b {+ flex: 1 0 100%;+ padding: 2px 8px 4px;+ font-size: 32px;+ line-height: 38px;+ font-weight: 700;+ letter-spacing: -0.02em;+ }+ /* Settings › Assistant: "‹ Settings" back at the top left, the page's own title large below. */+ .pagebar .pagebar-up {+ display: inline-flex;+ align-items: center;+ height: 44px;+ padding: 0 8px;+ font-size: 17px;+ color: var(--ink);+ text-decoration: none;+ }+ .pagebar .pagebar-up::before {+ content: "";+ width: 11px;+ height: 11px;+ margin-right: 6px;+ border-left: 2.5px solid currentColor;+ border-bottom: 2.5px solid currentColor;+ transform: rotate(45deg);+ }+ .pagebar .pagebar-sep {+ display: none;+ }+ .pagebar:has(.pagebar-up) > .menu-btn,+ .pagebar:has(.pagebar-up) > .menu-btn-wrap {+ display: none;+ }++ /* ---- A call: a page pushed over the inbox ---- */+ .cv-bar {+ min-height: 52px;+ padding: 0 8px 0 4px;+ gap: 4px;+ border-bottom: 0.5px solid var(--line);+ }+ .cv-bar > .menu-btn,+ .cv-bar > .menu-btn-wrap,+ .cv-bar .cv-back,+ .cv-bar .cv-step,+ .cv-bar .cv-pos {+ display: none;+ }+ .cv-back-phone {+ display: inline-flex;+ align-items: center;+ gap: 0;+ height: 44px;+ padding: 0 8px 0 0;+ border: 0;+ background: none;+ color: var(--ink);+ font: inherit;+ font-size: 17px;+ cursor: pointer;+ -webkit-tap-highlight-color: transparent;+ }+ .cv-bar .cv-acts {+ gap: 0;+ }+ .cv-bar .cv-acts .k-btn-ghost.k-btn-icon {+ width: 44px;+ }+ .cv-foot {+ gap: 10px;+ padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));+ border-top: 0.5px solid var(--line);+ }+ .cv-foot .k-btn {+ height: 50px;+ border-radius: var(--radius-lg);+ font-size: 16px;+ font-weight: 600;+ }+ .cv-foot .cv-foot-done {+ min-width: 108px;+ }+ .app:has(.cv-foot) .toast {+ bottom: calc(80px + env(safe-area-inset-bottom, 0px));+ }+}diff --git a/apps/web/src/native/init.ts b/apps/web/src/native/init.tsindex 425fe6b1..4ac01a9e 100644--- a/apps/web/src/native/init.ts+++ b/apps/web/src/native/init.ts@@ -23,7 +23,7 @@ const pageToOpen = (url: string) => {* Escape), then goes back in the app's history, and at the start puts the app in the background like other apps.*/function onBack(canGoBack: boolean) {- const open = document.querySelector('[role="dialog"], [role="menu"], [role="listbox"], .nav-drawer.is-open')+ const open = document.querySelector('[role="dialog"], [role="menu"], [role="listbox"], .app.nav-open')if (open) {document.activeElement?.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }))returndiff --git a/apps/web/src/shell/TabBar.tsx b/apps/web/src/shell/TabBar.tsxnew file mode 100644index 00000000..311e590f--- /dev/null+++ b/apps/web/src/shell/TabBar.tsx@@ -0,0 +1,63 @@+// 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 rest (Reminders,+// Done, Integrations, Server admin, the account) stays in the menu (☰).+import { useFormat, useT } from '@linedesk/i18n/react'+import type { IconName } from '../ui/icons.ts'+import { cx, Icon } from '../ui/kit.tsx'+import { isSettingsRoute, 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,+}: {+ 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+}) {+ 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' },+ { id: 'settings', href: '#settings', label: pages.settings.title, icon: 'gear', current: isSettingsRoute(route) },+ ]+ 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>+ ))}+ </nav>+ )+}diff --git a/packages/i18n/locales/en/shell.json b/packages/i18n/locales/en/shell.jsonindex d6282d35..94aa8bf8 100644--- a/packages/i18n/locales/en/shell.json+++ b/packages/i18n/locales/en/shell.json@@ -315,6 +315,7 @@"tabNotice.switchTo": "Switch to {workspace}","tabNotice.switched.text": "Another account signed in on this browser in another tab. Changes made here were not sent as them.","tabNotice.switched.title": "Someone else signed in",+ "tabbar.label": "Main sections","termsUpdate.accept": "Accept","termsUpdate.changed": "The terms changed again while this was open. Read them again, then accept.","termsUpdate.later": "Later",