element-call/src/room/RageshakeRequestModal.jsx

67 lines
1.9 KiB
React
Raw Normal View History

2022-05-04 17:09:48 +01:00
/*
Copyright 2022 Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
2022-02-04 16:55:57 -08:00
import React, { useEffect } from "react";
import { Modal, ModalContent } from "../Modal";
import { Button } from "../button";
import { FieldRow, ErrorMessage } from "../input/Input";
2022-04-07 14:22:36 -07:00
import { useSubmitRageshake } from "../settings/submit-rageshake";
2022-02-04 16:55:57 -08:00
import { Body } from "../typography/Typography";
export function RageshakeRequestModal({
rageshakeRequestId,
roomIdOrAlias,
...rest
}) {
2022-02-04 16:55:57 -08:00
const { submitRageshake, sending, sent, error } = useSubmitRageshake();
useEffect(() => {
if (sent) {
rest.onClose();
2022-02-04 16:55:57 -08:00
}
}, [sent, rest.onClose]);
2022-02-04 16:55:57 -08:00
return (
<Modal title="Debug Log Request" isDismissable {...rest}>
2022-02-04 16:55:57 -08:00
<ModalContent>
<Body>
Another user on this call is having an issue. In order to better
diagnose these issues we'd like to collect a debug log.
</Body>
<FieldRow>
<Button
onPress={() =>
submitRageshake({
sendLogs: true,
rageshakeRequestId,
roomIdOrAlias, // Possibly not a room ID, but oh well
})
}
2022-02-04 16:55:57 -08:00
disabled={sending}
>
{sending ? "Sending debug log..." : "Send debug log"}
</Button>
</FieldRow>
{error && (
<FieldRow>
<ErrorMessage>{error.message}</ErrorMessage>
</FieldRow>
)}
</ModalContent>
</Modal>
);
}