mirror of
https://github.com/vector-im/element-call.git
synced 2026-09-28 22:45:49 +00:00
```
move () {
FROM=$1 TO=$2 find public/locales -type f -exec sh -c 'jq ".$TO = .\"$FROM\" | del(.\"$FROM\") | del(..|nulls) | select(length > 0)" {} | sponge {}' \;
}
move "Avatar" "common.avatar"
move "Camera" "common.camera"
move "Close" "action.close"
move "Copied!" "common.copied"
move "Copy" "action.copy"
move "Copy link" "action.copy_link"
move "Encrypted" "common.encrypted"
move "Go" "action.go"
move "Home" "common.home"
move "Invite" "action.invite"
move "Loading…" "common.loading"
move "Microphone" "common.microphone"
move "No" "action.no"
move "Not encrypted" "common.unencrypted"
move "Password" "common.password"
move "Profile" "common.profile"
move "Username" "common.username"
move "Video" "common.video"
move "Register" "action.register"
move "Remove" "action.remove"
move "Settings" "common.settings"
move "Sign in" "action.sign_in"
move "Sign out" "action.sign_out"
move "Submit" "action.submit"
move "User menu" "a11y.user_menu"
move "Audio" "common.audio"
move "Display name" "common.display_name"
```
108 lines
3.3 KiB
TypeScript
108 lines
3.3 KiB
TypeScript
/*
|
|
Copyright 2022 - 2023 New Vector Ltd
|
|
|
|
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.
|
|
*/
|
|
|
|
import { FC, useCallback } from "react";
|
|
import { randomString } from "matrix-js-sdk/src/randomstring";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import { Button } from "../button";
|
|
import { FieldRow, InputField, ErrorMessage } from "../input/Input";
|
|
import { useSubmitRageshake, useRageshakeRequest } from "./submit-rageshake";
|
|
import { Body } from "../typography/Typography";
|
|
import styles from "../input/SelectInput.module.css";
|
|
import feedbackStyles from "../input/FeedbackInput.module.css";
|
|
|
|
interface Props {
|
|
roomId?: string;
|
|
}
|
|
|
|
export const FeedbackSettingsTab: FC<Props> = ({ roomId }) => {
|
|
const { t } = useTranslation();
|
|
const { submitRageshake, sending, sent, error } = useSubmitRageshake();
|
|
const sendRageshakeRequest = useRageshakeRequest();
|
|
|
|
const onSubmitFeedback = useCallback(
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
// @ts-ignore
|
|
(e) => {
|
|
e.preventDefault();
|
|
const data = new FormData(e.target);
|
|
const descriptionData = data.get("description");
|
|
const description =
|
|
typeof descriptionData === "string" ? descriptionData : "";
|
|
const sendLogs = Boolean(data.get("sendLogs"));
|
|
const rageshakeRequestId = randomString(16);
|
|
|
|
submitRageshake({
|
|
description,
|
|
sendLogs,
|
|
rageshakeRequestId,
|
|
roomId,
|
|
});
|
|
|
|
if (roomId && sendLogs) {
|
|
sendRageshakeRequest(roomId, rageshakeRequestId);
|
|
}
|
|
},
|
|
[submitRageshake, roomId, sendRageshakeRequest],
|
|
);
|
|
|
|
return (
|
|
<div>
|
|
<h4 className={styles.label}>{t("Submit feedback")}</h4>
|
|
<Body>
|
|
{t(
|
|
"If you are experiencing issues or simply would like to provide some feedback, please send us a short description below.",
|
|
)}
|
|
</Body>
|
|
<form onSubmit={onSubmitFeedback}>
|
|
<FieldRow>
|
|
<InputField
|
|
className={feedbackStyles.feedback}
|
|
id="description"
|
|
name="description"
|
|
label={t("Your feedback")}
|
|
placeholder={t("Your feedback")}
|
|
type="textarea"
|
|
disabled={sending || sent}
|
|
/>
|
|
</FieldRow>
|
|
{sent ? (
|
|
<Body> {t("Thanks, we received your feedback!")}</Body>
|
|
) : (
|
|
<FieldRow>
|
|
<InputField
|
|
id="sendLogs"
|
|
name="sendLogs"
|
|
label={t("Include debug logs")}
|
|
type="checkbox"
|
|
defaultChecked
|
|
/>
|
|
{error && (
|
|
<FieldRow>
|
|
<ErrorMessage error={error} />
|
|
</FieldRow>
|
|
)}
|
|
<Button type="submit" disabled={sending}>
|
|
{sending ? t("Submitting…") : ("action.submit")}
|
|
</Button>
|
|
</FieldRow>
|
|
)}
|
|
</form>
|
|
</div>
|
|
);
|
|
};
|