import React, { useCallback, useEffect } from "react"; import { Modal, ModalContent } from "../Modal"; import { Button } from "../button"; import { FieldRow, InputField, ErrorMessage } from "../input/Input"; import { useSubmitRageshake, useRageshakeRequest } from "../settings/rageshake"; import { Body } from "../typography/Typography"; import { randomString } from "matrix-js-sdk/src/randomstring"; export function FeedbackModal({ inCall, roomId, ...rest }) { const { submitRageshake, sending, sent, error } = useSubmitRageshake(); const sendRageshakeRequest = useRageshakeRequest(); const onSubmitFeedback = useCallback( (e) => { e.preventDefault(); const data = new FormData(e.target); const description = data.get("description"); const sendLogs = data.get("sendLogs"); const rageshakeRequestId = randomString(16); submitRageshake({ description, sendLogs, rageshakeRequestId, }); if (inCall && sendLogs) { sendRageshakeRequest(roomId, rageshakeRequestId); } }, [inCall, submitRageshake, roomId, sendRageshakeRequest] ); useEffect(() => { if (sent) { rest.onClose(); } }, [sent, rest.onClose]); return ( Having trouble? Help us fix it.
{error && ( {error.message} )}
); }