From fb79e521fc8db7e75997b3f3a0c099c071c3d2b3 Mon Sep 17 00:00:00 2001 From: HF Date: Wed, 3 Aug 2022 20:32:51 +0200 Subject: [PATCH] add UI for IID Tools --- src/components/ModIIDtools.jsx | 96 ++++++++++++++++++++++++++++++++++ src/components/Modtools.jsx | 2 + 2 files changed, 98 insertions(+) create mode 100644 src/components/ModIIDtools.jsx diff --git a/src/components/ModIIDtools.jsx b/src/components/ModIIDtools.jsx new file mode 100644 index 0000000..835f969 --- /dev/null +++ b/src/components/ModIIDtools.jsx @@ -0,0 +1,96 @@ +/* + * Admintools + */ + +import React, { useState } from 'react'; +import { t } from 'ttag'; + +async function submitIIDAction( + action, + iid, + callback, +) { + const data = new FormData(); + data.append('iidaction', action); + data.append('iid', iid); + const resp = await fetch('./api/modtools', { + credentials: 'include', + method: 'POST', + body: data, + }); + callback(await resp.text()); +} + +function ModIIDtools() { + const [iIDAction, selectIIDAction] = useState('ban'); + const [iid, selectIid] = useState(''); + const [resp, setResp] = useState(null); + const [submitting, setSubmitting] = useState(false); + + return ( +
+

{t`IID Actions`}

+ +

+ {' IID: '} + { + const newIid = evt.target.value.trim(); + selectIid(newIid); + }} + /> +

+ +