import { useEffect, useState } from "react"; import { Link } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { useSettings } from "../settings"; import { useAuth } from "../auth"; import { useToast } from "../toast"; import { api } from "../api"; import Icon from "../components/Icon"; import PolicyCard from "./settings/PolicyCard"; import RestoreCard from "./settings/RestoreCard"; export default function Settings() { const { t } = useTranslation(); const s = useSettings(); const { isAdmin } = useAuth(); const toast = useToast(); const [flagged, setFlagged] = useState([]); async function ladenFlagged() { try { setFlagged(await api.flaggedKeywords()); } catch { /* still ignorieren – nicht kritisch für die Einstellungen */ } } useEffect(() => { ladenFlagged(); }, []); async function keywordBehalten(id) { try { await api.confirmKeyword(id); setFlagged((f) => f.filter((x) => x.id !== id)); } catch (err) { toast(err.message, "error"); } } async function keywordEntfernen(id) { try { await api.deleteKeyword(id); setFlagged((f) => f.filter((x) => x.id !== id)); } catch (err) { toast(err.message, "error"); } } async function set(key, value) { try { await s.update(key, value); toast(t("settings.saved")); } catch (err) { toast(err.message, "error"); } } async function dl(fn) { try { await fn(); } catch (err) { toast(err.message, "error"); } } return (
{t("settings.keywordReviewHint")}
{flagged.map((f) => ({t("settings.baseCurrencyHint")}
{t("settings.budgetStartDayHint")}
{t("settings.securityHint")}
{t("settings.backupHint")}
{t("settings.exportHint")}
{t("settings.dbBackupHint")}