diff --git a/.gitignore b/.gitignore index 0915329..9302638 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,6 @@ core # Ejecuciones escritas por RunLog. El jsonl es la fuente de verdad en la maquina # que lo produce, no algo que se versione: son datos, no codigo. -runs/ +# Anclado a la raiz: sin la barra inicial ignoraba CUALQUIER carpeta llamada `runs`, y se +# tragaba en silencio las rutas del front (frontend/app/runs/[id]) y sus clientes. +/runs/ diff --git a/frontend/app/not-found.tsx b/frontend/app/not-found.tsx new file mode 100644 index 0000000..6cc6d09 --- /dev/null +++ b/frontend/app/not-found.tsx @@ -0,0 +1,12 @@ +import Link from "next/link"; +import { Notice } from "@/components/molecules"; +import { routes } from "@/lib/routes"; + +/** Cualquier URL que no existe, con la interfaz de la app en vez de la página por defecto. */ +export default function NotFound() { + return ( + + Revisa la dirección, o vuelve a Ejecuciones. + + ); +} diff --git a/frontend/app/runs/[id]/[seed]/page.tsx b/frontend/app/runs/[id]/[seed]/page.tsx new file mode 100644 index 0000000..3e4f373 --- /dev/null +++ b/frontend/app/runs/[id]/[seed]/page.tsx @@ -0,0 +1,12 @@ +import { notFound } from "next/navigation"; +import { RunDetailScreen } from "@/components/screens/RunDetailScreen"; +import { isUuid } from "@/lib/routes"; + +/** Detalle de una ejecución, en el episodio de una semilla. */ +export default async function Page({ params }: PageProps<"/runs/[id]/[seed]">) { + const { id, seed } = await params; + const n = Number(seed); + // Un id es un UUID y una semilla, un entero: si no, es una URL que no existe. + if (!isUuid(id) || !Number.isInteger(n)) notFound(); + return ; +} diff --git a/frontend/app/runs/[id]/page.tsx b/frontend/app/runs/[id]/page.tsx new file mode 100644 index 0000000..3d2e15e --- /dev/null +++ b/frontend/app/runs/[id]/page.tsx @@ -0,0 +1,10 @@ +import { notFound } from "next/navigation"; +import { RunDetailScreen } from "@/components/screens/RunDetailScreen"; +import { isUuid } from "@/lib/routes"; + +/** Detalle de una ejecución, en su último episodio. */ +export default async function Page({ params }: PageProps<"/runs/[id]">) { + const { id } = await params; + if (!isUuid(id)) notFound(); + return ; +} diff --git a/frontend/components/atoms/Icon/Icon.tsx b/frontend/components/atoms/Icon/Icon.tsx index e7b48d4..444d4cd 100644 --- a/frontend/components/atoms/Icon/Icon.tsx +++ b/frontend/components/atoms/Icon/Icon.tsx @@ -1,6 +1,6 @@ import type { ReactNode } from "react"; -export type IconName = "check" | "arrowDown" | "crosshair" | "circleDot" | "wave" | "x" | "flag" | "chevronsUpDown" | "sun" | "moon"; +export type IconName = "check" | "arrowDown" | "crosshair" | "circleDot" | "wave" | "x" | "flag" | "chevronsUpDown" | "sun" | "moon" | "chevronLeft" | "chevronRight" | "arrowLeft"; /* Trazos de 16×16. Iconos de línea, sin relleno: ninguno lleva color propio, heredan `currentColor` del que los use. */ @@ -15,6 +15,9 @@ const PATHS: Record = { chevronsUpDown: , sun: (<>), moon: , + chevronLeft: , + chevronRight: , + arrowLeft: , }; /** Decorativo: el significado lo lleva el texto de al lado, no el icono. */ diff --git a/frontend/components/molecules/ThemeToggle/ThemeToggle.module.css b/frontend/components/atoms/IconButton/IconButton.module.css similarity index 58% rename from frontend/components/molecules/ThemeToggle/ThemeToggle.module.css rename to frontend/components/atoms/IconButton/IconButton.module.css index 1deb729..1989e9e 100644 --- a/frontend/components/molecules/ThemeToggle/ThemeToggle.module.css +++ b/frontend/components/atoms/IconButton/IconButton.module.css @@ -1,6 +1,7 @@ -.toggle { +.button { width: 40px; height: 40px; + flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; @@ -9,4 +10,5 @@ border: 1px solid var(--border); background: var(--surface); } -.toggle:hover { background: var(--row-hover); color: var(--text); } +.button:hover:not(:disabled) { background: var(--row-hover); color: var(--text); } +.button:disabled { cursor: not-allowed; opacity: 0.4; } diff --git a/frontend/components/atoms/IconButton/IconButton.tsx b/frontend/components/atoms/IconButton/IconButton.tsx new file mode 100644 index 0000000..9b12dd5 --- /dev/null +++ b/frontend/components/atoms/IconButton/IconButton.tsx @@ -0,0 +1,21 @@ +import { Icon, type IconName } from "../Icon"; +import styles from "./IconButton.module.css"; + +type Props = { + icon: IconName; + /** Lo que hace: es el nombre accesible y el aviso al pasar el ratón. Un botón sin texto + * visible no puede quedarse sin él. */ + label: string; + onClick?: () => void; + disabled?: boolean; +}; + +/** Botón redondo con solo un icono. */ +export function IconButton({ icon, label, onClick, disabled }: Props) { + return ( + + ); +} diff --git a/frontend/components/atoms/IconButton/index.ts b/frontend/components/atoms/IconButton/index.ts new file mode 100644 index 0000000..c62ce98 --- /dev/null +++ b/frontend/components/atoms/IconButton/index.ts @@ -0,0 +1 @@ +export { IconButton } from "./IconButton"; diff --git a/frontend/components/atoms/index.ts b/frontend/components/atoms/index.ts index 07a6eab..9f1d842 100644 --- a/frontend/components/atoms/index.ts +++ b/frontend/components/atoms/index.ts @@ -21,3 +21,4 @@ export { Swatch } from "./Swatch"; export { Table, Th, Td, Tr } from "./Table"; export { Sparkline } from "./Sparkline"; export { Logo } from "./Logo"; +export { IconButton } from "./IconButton"; diff --git a/frontend/components/molecules/EpisodePicker/EpisodePicker.module.css b/frontend/components/molecules/EpisodePicker/EpisodePicker.module.css new file mode 100644 index 0000000..ae651bb --- /dev/null +++ b/frontend/components/molecules/EpisodePicker/EpisodePicker.module.css @@ -0,0 +1 @@ +.picker { display: inline-flex; align-items: center; gap: 8px; } diff --git a/frontend/components/molecules/EpisodePicker/EpisodePicker.tsx b/frontend/components/molecules/EpisodePicker/EpisodePicker.tsx new file mode 100644 index 0000000..0495372 --- /dev/null +++ b/frontend/components/molecules/EpisodePicker/EpisodePicker.tsx @@ -0,0 +1,29 @@ +import { IconButton, Select, Text, type SelectOption } from "../../atoms"; +import styles from "./EpisodePicker.module.css"; + +type Props = { + options: SelectOption[]; + value: string; + onChange: (value: string) => void; + /** Sin manejador, el botón queda bloqueado (primer o último episodio). */ + onPrev?: () => void; + onNext?: () => void; + /** «3 / 25»: dónde está el elegido dentro de la ejecución. */ + counter?: string; +}; + +/** Elige el episodio (la semilla) que se mira dentro de una ejecución: anterior, lista y + * siguiente. */ +export function EpisodePicker({ options, value, onChange, onPrev, onNext, counter }: Props) { + return ( +
+ Episodio + +