SPB Git

Repository Public

App.tsx 1.5 KB 48 lines tsx

1import { lazy, Suspense } from 'react';2import { Loading, NotFound, Shell, useLocation } from '@spweb/shared-ui';3import { useT } from '@spweb/shared-ui/i18n/bot';4import { Landing } from './Landing';5import { Mark } from './Logo';6import { Removal } from './Removal';7import { Status } from './Status';89// The operator console is a separate chunk: public visitors never download it.10const Admin = lazy(() => import('./Admin'));1112function route(pathname: string) {13  const p = pathname.replace(/\/+$/, '') || '/';14  if (p === '/admin' || p.startsWith('/admin/')) {15    return <Suspense fallback={<div className="wrap page"><Loading /></div>}><Admin /></Suspense>;16  }17  switch (p) {18    case '/':19    case '/bot': return <Landing />; // /bot is the address announced in the User-Agent2021    case '/status': return <Status />;22    case '/removal': return <Removal />;23    default: return <NotFound />;24  }25}2627export function App() {28  const { t } = useT();29  const { pathname } = useLocation();30  return (31    <Shell32      site="bot"33      mark={(size) => <Mark size={size} />}34      brandLabel={t('brand.label')}35      tag={t('tag')}36      nav={[37        { href: pathname.replace(/\/+$/, '') === '/bot' ? '/bot' : '/', label: t('nav.home') },38        { href: '/status', label: t('nav.status') },39        { href: '/removal', label: t('nav.removal') },40        { href: '/admin', label: t('nav.admin') },41      ]}42      footer={<p>SPBoucherBot/1.0 — robots.txt, RFC 9309.</p>}43    >44      {route(pathname)}45    </Shell>46  );47}48
Files main
Menu

Theme