import { useMemo } from 'react'; import { formatKeyLabel } from '../controls/keymapUtils.js'; import { getHelpContent } from '../help/content.js'; function KeyPill({ actionId, keymap }) { const value = keymap?.[actionId]?.[0] ?? ''; return ( {formatKeyLabel(value)} ); } function renderSegments(segments, keymap) { return segments.map((segment, idx) => { if (typeof segment === 'string') { return {segment}; } if (segment?.action) { return ; } if (segment?.text) { return {segment.text}; } return null; }); } function renderLine(line, keymap, idx) { if (typeof line === 'string') return line; if (Array.isArray(line?.segments)) return renderSegments(line.segments, keymap); if (line && typeof line === 'object') { // Fallback: render any stray object as text if possible if (typeof line.text === 'string') return line.text; if (Array.isArray(line)) return renderSegments(line, keymap); } return String(line ?? ''); } function Hero({ hero, keymap }) { if (!hero) return null; return (

{hero.title}

{hero.subtitle &&

{hero.subtitle}

}
{hero.chips && (
{hero.chips.map((chip) => ( {chip} ))}
)}
{hero.bullets && ( )}
); } function ListBlock({ block, keymap }) { return (

{block.title}

); } function CalloutBlock({ block }) { const toneClass = block.tone === 'info' ? 'border-cyan-500/40' : 'border-slate-700'; return (

{block.title}

{block.body && ( )}
); } function KeyboardGroup({ group, keymap }) { return (

{group.title}

{group.items.map((item) => (
{item.label}
))}
); } function KeyboardBlock({ block, keymap }) { if (!block) return null; return (
{block.title} {block.footnote && {block.footnote}}
{block.groups?.map((group) => ( ))}
); } function GamepadBlock({ block }) { if (!block) return null; return (

{block.title}

); } function BlockRenderer({ block, keymap }) { if (!block) return null; switch (block.type) { case 'list': return ; case 'callout': return ; case 'keyboard': return ; case 'gamepad': return ; default: return null; } } export function HelpContentView({ layout, keymap }) { const content = useMemo(() => getHelpContent(layout), [layout]); const bindings = keymap || {}; const mainBlocks = content.main || []; const asideBlocks = content.aside || []; return (
{mainBlocks.map((block, idx) => ( ))}
{asideBlocks.map((block, idx) => ( ))}
); } export default HelpContentView;