import * as React from "react"; import { SLASH_COMMANDS } from "../slashCommands"; const { useEffect, useRef } = React; interface HelpOverlayProps { onDismiss: () => void; } /** * Dismissible overlay that lists all available slash commands. * Dismiss with Escape, Enter, or Space. */ export function HelpOverlay({ onDismiss }: HelpOverlayProps) { const dismissRef = useRef(onDismiss); dismissRef.current = onDismiss; useEffect(() => { const handler = (e: KeyboardEvent) => { if (e.key === "Escape" || e.key === "Enter" || e.key === " ") { e.preventDefault(); dismissRef.current(); } }; window.addEventListener("keydown", handler); return () => window.removeEventListener("keydown", handler); }, []); return ( // biome-ignore lint/a11y/noStaticElementInteractions: backdrop dismiss is supplementary; keyboard handled via window keydown // biome-ignore lint/a11y/useKeyWithClickEvents: keyboard dismiss handled via window keydown listener
{cmd.name}
{cmd.description}