"use client"; import { useState } from "react"; import { api, errorText } from "@/lib/api"; import { REPORT_KINDS, type ReportKind } from "@/lib/forum"; /** What to do when someone may be in danger: shown right after a crisis report. */ export function CrisisHelp() { return (

Ha azonnali veszélyt látsz, hívd a 112-t. A lelki elsősegély-szolgálat ingyenes, éjjel-nappal hívható száma: 116-123.

); } /** * "Jelentés" on a post or a private message: what the problem is, an * optional note, and a thank-you (with the helpline for a crisis report). */ export function ReportButton({ path, className = "fp-tool" }: { path: string; className?: string }) { const [open, setOpen] = useState(false); const [kind, setKind] = useState(""); const [note, setNote] = useState(""); const [busy, setBusy] = useState(false); const [error, setError] = useState(null); const [done, setDone] = useState<{ crisis: boolean } | null>(null); async function submit(e: React.FormEvent) { e.preventDefault(); if (!kind) return; setBusy(true); setError(null); try { const res = await api<{ crisis: boolean }>(path, { body: { kind, note } }); setDone(res); } catch (err) { setError(errorText(err)); } finally { setBusy(false); } } if (done) { return (

Köszönjük, a moderátorok megnézik.

{done.crisis && }
); } if (!open) { return ( ); } return (
Mi a gond? {REPORT_KINDS.map((k) => ( ))}
{kind === "crisis" && }