import { useEffect, useState } from "react"; import { api, asUiError } from "@/lib/api"; import { checkClient } from "@/lib/clientUpdate"; import { useI18n } from "@/i18n"; export function ClientGraphics({ serverId }: { serverId: string }) { const { t } = useI18n(); const [state, setState] = useState<{ dxvk_disabled: boolean; enhancements_disabled: boolean } | null>(null); const [busy, setBusy] = useState(false); const [error, setError] = useState(null); useEffect(() => { void api.clientGraphics(serverId).then(setState).catch(e => setError(asUiError(e).technical)); }, [serverId]); async function change(name: string, disabled: boolean) { setBusy(true); setError(null); try { setState(await api.clientSetGraphics(serverId, name, disabled)); await checkClient(serverId); } catch (e) { setError(asUiError(e).technical); } finally { setBusy(false); } } return

{t("client.graphics.hint")}

{error &&

{error}

}
; }