Ir al contenido

NotFoundPage

Una página o un registro que no está, dicho con claridad, con salidas: buscar, los lugares que la gente suele buscar y volver. Dentro de la consola, un registro que falta dice cuál y por qué pudo irse.

import { NotFound, LinkCard } from '@sypnia/ui/react'

En esta página
  1. En un computador
  2. En un celular
  3. Un registro dentro de la consola
  4. Cuándo usarlo
  5. Para todos
  6. Props

En un computador

Fuera de la consola: buscar, tres lugares que la gente busca y un camino a casa.

Esta página no existe

Puede que el enlace sea viejo o que la dirección tenga un error. Busca lo que querías, o empieza desde uno de estos.

Código
import { useState } from 'react';
import { AuthLayout, Button, Field, LinkCard, NotFound, Page, PageHeader, SearchInput, Stack, Text, useSypnia } from '@sypnia/ui/react';

// A page that does not exist, said plainly, with ways out: search, the places people usually look for, and back.
// Inside the console a missing record keeps the frame and says which record and why it may be gone.
const en = {
  title: 'This page does not exist', body: 'The link may be old, or the address has a typo. Search for what you were looking for, or start from one of these.',
  search: 'Search Sypnia', searchHint: 'Projects, tables, settings', places: 'Places people look for',
  projects: 'Your projects', projectsText: 'Every project in your organization', docs: 'Documentation', docsText: 'Guides and the API reference',
  status: 'Status', statusText: 'Whether every service is working', home: 'Go to my projects', results: (q: string) => `Searching for «${q}»…`,
  what: 'The table orders_2024', recordBody: 'It was deleted or renamed, or it belongs to a project you cannot see. Tables deleted in the last 7 days can be restored.',
  back: 'Back to tables', restore: 'See deleted tables', page: 'Tables',
};
const es: typeof en = {
  title: 'Esta página no existe', body: 'Puede que el enlace sea viejo o que la dirección tenga un error. Busca lo que querías, o empieza desde uno de estos.',
  search: 'Buscar en Sypnia', searchHint: 'Proyectos, tablas, ajustes', places: 'Lugares que la gente busca',
  projects: 'Tus proyectos', projectsText: 'Todos los proyectos de tu organización', docs: 'Documentación', docsText: 'Guías y la referencia de la API',
  status: 'Estado', statusText: 'Si todos los servicios funcionan', home: 'Ir a mis proyectos', results: (q: string) => `Buscando «${q}»…`,
  what: 'La tabla orders_2024', recordBody: 'Se borró o se le cambió el nombre, o es de un proyecto que no puedes ver. Las tablas borradas en los últimos 7 días se pueden recuperar.',
  back: 'Volver a tablas', restore: 'Ver tablas borradas', page: 'Tablas',
};

export default function NotFoundPage({ variant = 'page' }: { variant?: 'page' | 'record' }) {
  const { locale } = useSypnia();
  const c = locale.startsWith('es') ? es : en;
  const [query, setQuery] = useState('');
  const [searched, setSearched] = useState('');
  if (variant === 'record') {
    return (
      <Page>
        <PageHeader title={c.page} />
        <NotFound what={c.what} backHref="#tables" backLabel={c.back}>
          <Stack gap={3}><span>{c.recordBody}</span><div><Button variant="quiet" icon="history" href="#trash">{c.restore}</Button></div></Stack>
        </NotFound>
      </Page>
    );
  }
  return (
    <AuthLayout plain title={c.title} lead={c.body} brandHref="#">
      <Stack gap={6}>
        <form role="search" onSubmit={(e) => { e.preventDefault(); setSearched(query.trim()); }}>
          <Field label={c.search} hint={c.searchHint}><SearchInput name="q" value={query} onChange={(e) => setQuery(e.target.value)} /></Field>
        </form>
        {searched && <Text size="sm" tone="muted" as="p">{c.results(searched)}</Text>}
        <nav aria-label={c.places}>
          <Stack gap={2}>
            <LinkCard href="#projects" icon="home" title={c.projects}>{c.projectsText}</LinkCard>
            <LinkCard href="#docs" icon="book" title={c.docs}>{c.docsText}</LinkCard>
            <LinkCard href="#status" icon="uptime" title={c.status}>{c.statusText}</LinkCard>
          </Stack>
        </nav>
        <div><Button variant="primary" icon="arrow-left" href="#projects">{c.home}</Button></div>
      </Stack>
    </AuthLayout>
  );
}

En un celular

A 390 px los lugares quedan en una columna de tarjetas.

Un registro dentro de la consola

El marco se queda; el mensaje nombra el registro y dice cómo se puede recuperar.

Tablas

La tabla orders_2024 no existe

Se borró o se le cambió el nombre, o es de un proyecto que no puedes ver. Las tablas borradas en los últimos 7 días se pueden recuperar.

Cuándo usarlo

Úsalo cuando

  • Una dirección que no lleva a ninguna parte: un enlace viejo, un error al escribir.
  • Un registro que se borró, cambió de nombre o es de un proyecto que la persona no puede ver. Di las tres cosas, porque la app no sabe cuál fue.

No lo uses cuando

  • Un chiste en vez de una salida.
  • Decirle a alguien que existe un registro privado: el mensaje es el mismo si se borró o si no es suyo.

Para todos

  • El título es el único h1 de la página; la búsqueda es una región de búsqueda y los lugares una navegación con nombre.
  • Cada salida es un enlace real, al que se llega con Tab en el orden de lectura.

Props

NotFoundTipoPor defecto
whatobligatorio

What was looked for, as the start of a sentence: «The table orders».

string
backHref string
backLabel string
LinkCardTipoPor defecto
hrefobligatorio string
titleobligatorio ReactNode
external boolean
icon "function" | "error" | "replay" | "performance" | "uptime" | "traces" | "rage-click" | "dead-click" | "alert" | "summary" | "watch" | "sleep" | "light" | "suggestion" | "prompt" | "mcp" | "pull-request" | "git-branch" | "fix" | "check" | "open-source" | "self-host" | "sdk" | "engine" | "signals-in" | "web" | "mobile" | "backend" | "cloud" | "data" | "user" | "clock" | "shield" | "lock" | "mail" | "star" | "copy" | "arrow-right" | "arrow-up-right" | "chevron-down" | "plus" | "close" | "play" | "pause" | "search" | "info" | "warning" | "trash" | "menu" | "download" | "upload" | "filter" | "home" | "table" | "key" | "users" | "sun" | "moon" | "globe" | "sign-out" | "link" | "edit" | "calendar" | "chevron-left" | "chevron-right" | "chevron-up" | "minus" | "more" | "sort" | "arrow-left" | "arrow-up" | "arrow-down" | "arrow-down-right" | "arrow-down-left" | "arrow-up-left" | "swap" | "swap-vertical" | "chevrons-up-down" | "chevrons-left" | "chevrons-right" | "chevrons-down" | "chevrons-up" | "enter" | "undo" | "redo" | "refresh" | "expand" | "collapse" | "fullscreen" | "fullscreen-exit" | "move" | "grip" | "more-vertical" | "trend-up" | "trend-down" | "log-in" | "external" | "slash" | "equal" | "check-small" | "close-small" | "success" | "failure" | "help" | "plus-circle" | "minus-circle" | "ban" | "pending" | "dot" | "dot-off" | "bolt" | "flag" | "pin" | "bookmark" | "heart" | "thumbs-up" | "thumbs-down" | "sparkle" | "target" | "idea" | "award" | "crown" | "bell" | "bell-off" | "bug" | "fire" | "leaf" | "file" | "file-text" | "file-code" | "file-plus" | "file-check" | "file-table" | "file-lock" | "files" | "folder" | "folder-open" | "folder-plus" | "archive" | "clipboard" | "clipboard-check" | "paperclip" | "image" | "save" | "cloud-upload" | "cloud-download" | "cloud-off" | "import" | "export" | "share" | "inbox" | "send" | "box" | "layers" | "tag" | "hash" | "at" | "qr-code" | "book" | "book-open" | "notebook" | "rows" | "columns" | "grid" | "list" | "list-ordered" | "list-checks" | "kanban" | "chart-line" | "chart-bar" | "chart-area" | "chart-parts" | "chart-scatter" | "gauge" | "funnel" | "heatmap" | "sparkline" | "percent" | "sum" | "variable" | "braces" | "brackets" | "null" | "primary-key" | "relation" | "index" | "query" | "backup" | "migrate" | "seed" | "csv" | "json" | "bold" | "italic" | "underline" | "strikethrough" | "heading" | "text" | "paragraph" | "quote" | "code" | "align-left" | "align-center" | "align-right" | "indent" | "outdent" | "unlink" | "scissors" | "eraser" | "highlight" | "duplicate" | "paste" | "wand" | "palette" | "brush" | "ruler" | "crop" | "user-plus" | "user-minus" | "user-check" | "user-x" | "user-circle" | "team" | "organization" | "id-card" | "contact" | "role" | "chat" | "chats" | "comment" | "phone" | "video" | "mic" | "mic-off" | "megaphone" | "rss" | "mail-open" | "handshake" | "wave" | "desktop" | "laptop" | "tablet" | "terminal" | "window" | "browser" | "server" | "cpu" | "memory" | "disk" | "network" | "wifi" | "wifi-off" | "plug" | "power" | "container" | "queue" | "cron" | "webhook" | "api" | "route" | "load-balancer" | "dns" | "domain" | "certificate" | "firewall" | "rocket" | "deploy" | "rollback" | "logs" | "test" | "pipeline" | "commit" | "merge" | "fork" | "release" | "environment" | "region" | "robot" | "agent" | "puzzle" | "credit-card" | "wallet" | "receipt" | "invoice" | "cart" | "bag" | "coins" | "dollar" | "gift" | "plan" | "upgrade" | "usage" | "bank" | "history" | "timer" | "hourglass" | "calendar-check" | "calendar-plus" | "map" | "compass" | "translate" | "accessibility" | "keyboard" | "pointer" | "hand" | "print" | "support" | "stop" | "record" | "skip-forward" | "skip-back" | "fast-forward" | "rewind" | "volume" | "mute" | "camera" | "zoom-in" | "zoom-out" | "eye-off" | "sliders" | "settings" | "toggle" | "sidebar-left" | "sidebar-right" | "panel-bottom" | "split" | "layout" | "dashboard" | "cards" | "density" | "dark-mode" | "theme" | "mouse" | "cursor" | "select" | "picture-in-picture" | "scan" | "unlock" | "shield-off" | "shield-alert" | "shield-user" | "password" | "fingerprint" | "two-factor" | "policy" | "incognito" | "verified" | "audit" | "secret" | "p-telemetry" | "p-cases" | "p-agent" | "p-git" | "p-data" | "p-files" | "p-run" | "p-ai" | "p-mail" | "p-domains" | "p-design" | "p-learn" | "p-skills" | "p-app" | "p-ui"
  1. En un computador
  2. En un celular
  3. Un registro dentro de la consola
  4. Cuándo usarlo
  5. Para todos
  6. Props

    Busca páginas, secciones y términos