SPB Git

Repository Public

dashboard.setup.tsx 1.7 KB 30 lines tsx

1// SP Mail Next — inscription du centre de commande dans la coquille : volet « /dashboard », entrée de la barre latérale et du bas, raccourci « g h », commande de palette.2import { lazy } from "react"3import { t } from "../../i18n"4import { resetDashboard } from "../../next/dashboard-data"5import type { Setup } from "../../next/features"6import { nextHref } from "../../next/nav"7import { registerMainPane, registerShortcut, registerSidebarEntry, setCommandCenterHref } from "../../state/registry"8import { navigate } from "../../state/session"9import { registerCommand } from "../commands"1011const Dashboard = lazy(() => import("./Dashboard"))1213export const setupDashboard: Setup = () => {14  const href = nextHref("dashboard")15  const go = () => navigate(href)16  const off = [17    registerMainPane({ id: "dashboard", when: (s) => s.route.name === "next" && s.route.page === "dashboard", component: Dashboard }),18    registerSidebarEntry({ id: "dashboard", slot: "primary", order: 10, icon: "bolt", label: () => t("nx.dashboard.title"), href, active: (s) => s.route.name === "next" && s.route.page === "dashboard" }),19    // « g d » ouvre déjà les brouillons : le centre de commande prend « g h » (« home »)20    registerShortcut({ id: "dashboard", keys: "g h", label: () => t("nx.dashboard.title"), run: go, order: 10 }),21    registerCommand(() => ({ id: "go.dashboard", section: "go", title: t("nx.dashboard.title"), icon: "bolt", keys: "g h", keywords: ["dashboard", "tableau de bord", "command center", "accueil", "home"], run: go })),22  ]23  setCommandCenterHref(href)24  return () => {25    off.forEach((f) => f())26    setCommandCenterHref(null)27    resetDashboard()28  }29}30
Files main
Menu

Theme