mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-23 10:07:35 +00:00
Fixes for feedback form
This commit is contained in:
parent
ee2ca7bef5
commit
f81cebe298
3 changed files with 11 additions and 2 deletions
|
|
@ -16,6 +16,10 @@ export default function Feedback() {
|
|||
const url = useSelector(getUrl);
|
||||
const send = useCallback(async () => {
|
||||
const body = { message, email, url: "https://skins/webamp.org" + url };
|
||||
if (message.trim().length === 0) {
|
||||
alert("Please add a message before sending.");
|
||||
return;
|
||||
}
|
||||
setSending(true);
|
||||
await fetch(`${API_URL}/feedback`, {
|
||||
method: "POST",
|
||||
|
|
|
|||
|
|
@ -27,9 +27,10 @@ function SearchLogo() {
|
|||
|
||||
function useFocusOnSlash() {
|
||||
const [input, setInput] = useState(null);
|
||||
const feedbackFormOpen = useSelector(Selectors.getFeedbackFormOpen);
|
||||
|
||||
useEffect(() => {
|
||||
if (input == null) {
|
||||
if (input == null || feedbackFormOpen) {
|
||||
return;
|
||||
}
|
||||
const handler = (e) => {
|
||||
|
|
@ -45,7 +46,7 @@ function useFocusOnSlash() {
|
|||
return () => {
|
||||
window.document.removeEventListener("keydown", handler);
|
||||
};
|
||||
}, [input]);
|
||||
}, [input, feedbackFormOpen]);
|
||||
|
||||
return setInput;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,3 +246,7 @@ export function getUploadedFiles(state) {
|
|||
});
|
||||
return files;
|
||||
}
|
||||
|
||||
export function getFeedbackFormOpen(state) {
|
||||
return state.showFeedbackForm;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue