feat: settings and deploy docs

This commit is contained in:
opencode committed 2026-10-18 10:36:43 +02:00
1 parent 8b33242db1
commit 39f782057c
10 files changed
+194

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
"use client";
import { useState } from "react";
export function TestButtons() {
const [mail, setMail] = useState("test@example.de");
const [chatId, setChatId] = useState("");
const [result, setResult] = useState("");
async function testMail() {
setResult("…");
const res = await fetch("/api/settings/test-mail", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ to: mail }),
});
const data = await res.json().catch(() => ({}));
setResult(res.ok ? "Test-Mail versendet." : `Fehler: ${data.error ?? res.status}`);
}
async function testTelegram() {
setResult("…");
const res = await fetch("/api/settings/test-telegram", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ chatId }),
});
const data = await res.json().catch(() => ({}));
setResult(res.ok ? "Test-Telegram versendet." : `Fehler: ${data.error ?? res.status}`);
}
return (
<section className="space-y-3 rounded border p-4">
<h2 className="font-medium">Versand testen</h2>
<div>
<label htmlFor="mail" className="block text-sm font-medium">E-Mail-Empfänger</label>
<input id="mail" value={mail} onChange={(e) => setMail(e.target.value)} className="mt-1 w-full rounded border px-3 py-2" />
</div>
<button type="button" onClick={testMail} className="rounded bg-black px-4 py-2 text-white">Test-Mail senden</button>
<div>
<label htmlFor="chatId" className="block text-sm font-medium">Telegram-Chat-ID</label>
<input id="chatId" value={chatId} onChange={(e) => setChatId(e.target.value)} className="mt-1 w-full rounded border px-3 py-2" />
</div>
<button type="button" onClick={testTelegram} className="rounded bg-black px-4 py-2 text-white">Test-Telegram senden</button>
{result && <p role="status" className="text-sm">{result}</p>}
</section>
);
}