diff --git a/www/packages/docs-ui/src/components/CodeBlock/Actions/index.tsx b/www/packages/docs-ui/src/components/CodeBlock/Actions/index.tsx index 6a05c91a91..f615544e55 100644 --- a/www/packages/docs-ui/src/components/CodeBlock/Actions/index.tsx +++ b/www/packages/docs-ui/src/components/CodeBlock/Actions/index.tsx @@ -66,9 +66,9 @@ export const CodeBlockActions = ({ )}
+const feedbackOptions = { + positive: [ + "Easy to understand", + "Accurate code and text", + "Exactly what I was looking for", + "Ease of use", + "Other", + ], + negative: [ + "Difficult to understand", + "Inaccurate code or text", + "Didn't find what I was looking for", + "Trouble using the documentation", + "Other", + ], +} + export const Feedback = ({ event, pathName, @@ -44,15 +60,14 @@ export const Feedback = ({ question = "Was this page helpful?", positiveBtn = "It was helpful", negativeBtn = "It wasn't helpful", - positiveQuestion = "What was most helpful?", - negativeQuestion = "What can we improve?", + positiveQuestion = "What did you like?", + negativeQuestion = "What was the problem?", submitBtn = "Submit", submitMessage = "Thank you for helping improve our documentation!", showPossibleSolutions = true, className = "", extraData = {}, vertical = false, - showLongForm = false, showDottedSeparator = true, }: FeedbackProps) => { const { @@ -69,10 +84,7 @@ export const Feedback = ({ const inlineMessageRef = useRef(null) const [positiveFeedback, setPositiveFeedback] = useState(false) const [message, setMessage] = useState("") - const [steps, setSteps] = useState("") - const [medusaVersion, setMedusaVersion] = useState("") - const [errorFix, setErrorFix] = useState("") - const [contactInfo, setContactInfo] = useState("") + const [feedbackOption, setFeedbackOption] = useState("") const nodeRef = submittedFeedback ? inlineMessageRef : showForm @@ -80,20 +92,16 @@ export const Feedback = ({ : inlineFeedbackRef const { loaded, track } = useAnalytics() - function handleFeedback(e: React.MouseEvent) { + function handleFeedback(feedback: boolean) { if (!loaded) { return } - const feedback = (e.target as Element).classList.contains("positive") setPositiveFeedback(feedback) setShowForm(true) - submitFeedback(e, feedback) + submitFeedback(feedback) } - function submitFeedback( - e: React.MouseEvent, - feedback = false - ) { + function submitFeedback(feedback = false) { if (showForm) { setLoading(true) } @@ -109,10 +117,7 @@ export const Feedback = ({ : "no", message: message?.length ? message : null, os: window.navigator.userAgent, - steps, - medusaVersion, - errorFix, - contactInfo, + feedbackOption, ...extraData, }, function () { @@ -129,6 +134,10 @@ export const Feedback = ({ setSubmittedFeedback(true) } + useEffect(() => { + setFeedbackOption("Other") + }, [positiveFeedback]) + return (
{showDottedSeparator && ( @@ -173,7 +182,7 @@ export const Feedback = ({ )} >