import { html, render, useEffect, useRef, useState } from './vendor/htm-preact.js'; import { t } from './i18n.js'; /** * Ask why a file is being reported, drawn by the page like `ask.js`. * * Resolves `{ reason, detail }`, or null when cancelled. The reasons are the * hub's own closed list (api/moderation.py `ReportRequest`), and the detail is * bounded to what the hub keeps (256 characters). */ const REASONS = ['illegal', 'spam', 'copyright', 'other']; function ReportDialog({ name, onDone }) { const [reason, setReason] = useState('illegal'); const [detail, setDetail] = useState(''); const firstRef = useRef(null); useEffect(() => { if (firstRef.current) firstRef.current.focus(); }, []); return html`
{ if (e.target.classList.contains('video-overlay')) onDone(null); }}>