mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-10 01:03:36 -05:00
Refresh the feedback menu.
This commit is contained in:
parent
973d8adbed
commit
7e1698cc79
2 changed files with 38 additions and 88 deletions
2
external/lang
vendored
2
external/lang
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 09955e9d30c19c1a180fd3aacdb85961641da2bc
|
Subproject commit e3b83ab17a6021de7957a3030d5ead6d9eeb38d3
|
|
@ -1,50 +1,15 @@
|
||||||
import { Github } from "@styled-icons/boxicons-logos";
|
import { Github } from "@styled-icons/boxicons-logos";
|
||||||
import { ListOl } from "@styled-icons/boxicons-regular";
|
import { BugAlt, Group, ListOl } from "@styled-icons/boxicons-regular";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
import styles from "./Panes.module.scss";
|
import styles from "./Panes.module.scss";
|
||||||
import { Localizer, Text } from "preact-i18n";
|
import { Text } from "preact-i18n";
|
||||||
import { useState } from "preact/hooks";
|
|
||||||
|
|
||||||
import { useClient } from "../../../context/revoltjs/RevoltClient";
|
|
||||||
|
|
||||||
import Button from "../../../components/ui/Button";
|
|
||||||
import InputBox from "../../../components/ui/InputBox";
|
|
||||||
import Radio from "../../../components/ui/Radio";
|
|
||||||
import TextArea from "../../../components/ui/TextArea";
|
|
||||||
import CategoryButton from "../../../components/ui/fluent/CategoryButton";
|
import CategoryButton from "../../../components/ui/fluent/CategoryButton";
|
||||||
|
|
||||||
export function Feedback() {
|
export function Feedback() {
|
||||||
const client = useClient();
|
|
||||||
const [other, setOther] = useState("");
|
|
||||||
const [description, setDescription] = useState("");
|
|
||||||
const [state, setState] = useState<"ready" | "sending" | "sent">("ready");
|
|
||||||
const [checked, setChecked] = useState<
|
|
||||||
"Bug" | "Feature Request" | "__other_option__"
|
|
||||||
>("Bug");
|
|
||||||
|
|
||||||
async function onSubmit(ev: JSX.TargetedEvent<HTMLFormElement, Event>) {
|
|
||||||
ev.preventDefault();
|
|
||||||
setState("sending");
|
|
||||||
|
|
||||||
await fetch(`https://workers.revolt.chat/feedback`, {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify({
|
|
||||||
checked,
|
|
||||||
other,
|
|
||||||
description,
|
|
||||||
name: client.user!.username,
|
|
||||||
}),
|
|
||||||
mode: "no-cors",
|
|
||||||
});
|
|
||||||
|
|
||||||
setState("sent");
|
|
||||||
setChecked("Bug");
|
|
||||||
setDescription("");
|
|
||||||
setOther("");
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form className={styles.feedback} onSubmit={onSubmit}>
|
<div className={styles.feedback}>
|
||||||
<a
|
<a
|
||||||
href="https://github.com/revoltchat/revolt/discussions"
|
href="https://github.com/revoltchat/revolt/discussions"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
@ -53,8 +18,10 @@ export function Feedback() {
|
||||||
hover
|
hover
|
||||||
action="external"
|
action="external"
|
||||||
icon={<Github size={24} />}
|
icon={<Github size={24} />}
|
||||||
description="Suggest new Revolt features on GitHub discussions.">
|
description={
|
||||||
Submit feature suggestion
|
<Text id="app.settings.pages.feedback.suggest_desc" />
|
||||||
|
}>
|
||||||
|
<Text id="app.settings.pages.feedback.suggest" />
|
||||||
</CategoryButton>
|
</CategoryButton>
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
|
@ -65,54 +32,37 @@ export function Feedback() {
|
||||||
hover
|
hover
|
||||||
action="external"
|
action="external"
|
||||||
icon={<ListOl size={24} />}
|
icon={<ListOl size={24} />}
|
||||||
description="To help us more easily triage issues, you can create an issue on GitHub.">
|
description={
|
||||||
Create a new GitHub issue
|
<Text id="app.settings.pages.feedback.issue_desc" />
|
||||||
|
}>
|
||||||
|
<Text id="app.settings.pages.feedback.issue" />
|
||||||
</CategoryButton>
|
</CategoryButton>
|
||||||
</a>
|
</a>
|
||||||
<h3>
|
<a
|
||||||
<Text id="app.settings.pages.feedback.report" />
|
href="https://github.com/orgs/revoltchat/projects/1"
|
||||||
</h3>
|
target="_blank"
|
||||||
<div className={styles.options}>
|
rel="noreferrer">
|
||||||
<Radio
|
<CategoryButton
|
||||||
checked={checked === "Bug"}
|
hover
|
||||||
disabled={state === "sending"}
|
action="external"
|
||||||
onSelect={() => setChecked("Bug")}>
|
icon={<BugAlt size={24} />}
|
||||||
|
description={
|
||||||
|
<Text id="app.settings.pages.feedback.bug_desc" />
|
||||||
|
}>
|
||||||
<Text id="app.settings.pages.feedback.bug" />
|
<Text id="app.settings.pages.feedback.bug" />
|
||||||
</Radio>
|
</CategoryButton>
|
||||||
<Radio
|
</a>
|
||||||
disabled={state === "sending"}
|
<Link to="/invite/Testers">
|
||||||
checked={checked === "__other_option__"}
|
<a target="_blank" rel="noreferrer">
|
||||||
onSelect={() => setChecked("__other_option__")}>
|
<CategoryButton
|
||||||
<Localizer>
|
hover
|
||||||
<InputBox
|
action="chevron"
|
||||||
value={other}
|
icon={<Group size={24} />}
|
||||||
disabled={state === "sending"}
|
description="You can report issues and discuss improvements with us directly here.">
|
||||||
name="entry.1151440373.other_option_response"
|
Join Testers server.
|
||||||
onChange={(e) => setOther(e.currentTarget.value)}
|
</CategoryButton>
|
||||||
placeholder={
|
</a>
|
||||||
(
|
</Link>
|
||||||
<Text id="app.settings.pages.feedback.other" />
|
</div>
|
||||||
) as unknown as string
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</Localizer>
|
|
||||||
</Radio>
|
|
||||||
</div>
|
|
||||||
<h3>
|
|
||||||
<Text id="app.settings.pages.feedback.describe" />
|
|
||||||
</h3>
|
|
||||||
<TextArea
|
|
||||||
// maxRows={10}
|
|
||||||
value={description}
|
|
||||||
id="entry.685672624"
|
|
||||||
disabled={state === "sending"}
|
|
||||||
onChange={(ev) => setDescription(ev.currentTarget.value)}
|
|
||||||
/>
|
|
||||||
<p>
|
|
||||||
<Button type="submit" contrast>
|
|
||||||
<Text id="app.settings.pages.feedback.send" />
|
|
||||||
</Button>
|
|
||||||
</p>
|
|
||||||
</form>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue