import React, { useState } from "react"; import { API_URL } from "./constants"; import { getUrl } from "./redux/selectors"; import * as Actions from "./redux/actionCreators"; import { useActionCreator } from "./hooks"; import { useCallback } from "react"; import { useSelector } from "react-redux"; export default function Feedback() { const close = useActionCreator(Actions.closeFeedbackForm); const [message, setMessage] = useState(""); const [email, setEmail] = useState(""); const [sending, setSending] = useState(false); const [sent, setSent] = useState(false); 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", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body), }); setSent(true); }, [message, email, url]); if (sent) { return (
Thanks for your feedback. I appreciate you taking the time to share your thoughts.
Let me know what you think about the Winamp Skin Museum. Bug reports, feature suggestions, personal anecdotes, or criticism are all welcome.