SPB Git

Repository Public

BottomNav.tsx 2.5 KB 52 lines tsx

1// Barre de navigation du bas (téléphone) : boîte de réception, recherche, écrire, commandes (ou « Command Center »), plus.2import { t } from "../i18n"3import { S, routeHref } from "../state/app"4import { composeNew } from "../state/composer"5import { R } from "../state/registry"6import { linkProps } from "../state/session"7import { useStore } from "../state/store"8import { focusSearch } from "./commands"9import { Icon } from "./kit"1011export function BottomNav() {12  // hors du courrier (écrans « Next ») : la boîte courante reste celle où l'on revient, pas la première13  const mbIndex = useStore(S, (s) => (s.route.name === "mail" && !s.route.all ? s.route.mbIndex : Math.max(0, s.me?.mailboxes.findIndex((m) => m.id === s.mb) ?? 0)))14  const inInbox = useStore(S, (s) => s.route.name === "mail" && !s.route.all && s.view === "inbox")15  const searching = useStore(S, (s) => s.route.name === "mail" && s.view === "search")16  const navOpen = useStore(S, (s) => s.navOpen)17  const commandCenter = useStore(R, (r) => r.commandCenterHref)18  return (19    // tiroir ouvert : la barre passe dessous et ne reçoit plus ni focus ni clic20    <nav className="bottom-nav" aria-label={t("nav.bottom")} inert={navOpen}>21      <a {...linkProps(routeHref({ name: "mail", mbIndex, view: "inbox", threadId: null, q: "" }))} aria-current={inInbox ? "page" : undefined} className="bottom-item">22        <Icon name="inbox" />23        <span>{t("nav.bottom.inbox")}</span>24      </a>25      <button type="button" className="bottom-item" aria-pressed={searching} onClick={focusSearch}>26        <Icon name="search" />27        <span>{t("search.placeholder")}</span>28      </button>29      <button type="button" className="bottom-item bottom-compose" aria-label={t("nav.bottom.compose")} onClick={() => composeNew()}>30        <span className="bottom-fab">31          <Icon name="edit" />32        </span>33      </button>34      {commandCenter ? (35        <a {...linkProps(commandCenter)} className="bottom-item">36          <Icon name="bolt" />37          <span>{t("nav.bottom.center")}</span>38        </a>39      ) : (40        <button type="button" className="bottom-item" onClick={() => S.set({ paletteOpen: true })}>41          <Icon name="command" />42          <span>{t("nav.bottom.commands")}</span>43        </button>44      )}45      <button type="button" className="bottom-item" aria-expanded={navOpen} aria-controls="sidebar" onClick={() => S.set({ navOpen: true })}>46        <Icon name="menu" />47        <span>{t("nav.bottom.more")}</span>48      </button>49    </nav>50  )51}52
Files main
Menu

Theme