import { useState, useEffect } from 'react'; import { marked } from 'marked'; import { api } from '../utils/api.js'; // Configure marked for safe rendering marked.setOptions({ breaks: true, gfm: true }); export default function HelpModal({ onClose, dismissed: initialDismissed }) { const [content, setContent] = useState(''); const [loading, setLoading] = useState(true); const [dismissed, setDismissed] = useState(!!initialDismissed); useEffect(() => { api.getHelp() .then(({ content }) => setContent(content)) .catch(() => setContent('# Getting Started\n\nHelp content could not be loaded.')) .finally(() => setLoading(false)); }, []); const handleDismissToggle = async (e) => { const val = e.target.checked; setDismissed(val); try { await api.dismissHelp(val); } catch (_) {} }; return (
e.target === e.currentTarget && onClose()}>
{/* Header */}

Getting Started

{/* Scrollable markdown content */}
{loading ? (
Loading…
) : (
)}
{/* Footer */}
); }