From 2d47f3ae0f662cea13b458fa986be813d4cdfbe6 Mon Sep 17 00:00:00 2001 From: danbaruka <46156791+danbaruka@users.noreply.github.com> Date: Fri, 16 Oct 2026 22:01:44 +0300 Subject: [PATCH 1/4] fix(website): remove the docs feedback widget The form always reported success, including when no script URL was configured, and it posted visitor text to a public Apps Script. --- .../src/components/FeedbackWidget/index.tsx | 121 ------------ website/src/css/custom.css | 175 ------------------ website/src/theme/DocItem/Footer/index.tsx | 16 -- 3 files changed, 312 deletions(-) delete mode 100644 website/src/components/FeedbackWidget/index.tsx delete mode 100644 website/src/theme/DocItem/Footer/index.tsx diff --git a/website/src/components/FeedbackWidget/index.tsx b/website/src/components/FeedbackWidget/index.tsx deleted file mode 100644 index 184dc25e..00000000 --- a/website/src/components/FeedbackWidget/index.tsx +++ /dev/null @@ -1,121 +0,0 @@ -import React, { useState } from 'react'; -import clsx from 'clsx'; -import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; - -export default function FeedbackWidget() { - const { siteConfig } = useDocusaurusContext(); - const GOOGLE_SCRIPT_URL = siteConfig.customFields?.googleScriptUrl as string; - - const [vote, setVote] = useState(null); - const [comment, setComment] = useState(''); - const [submitted, setSubmitted] = useState(false); - const [submitting, setSubmitting] = useState(false); - - const handleVote = (value: 'yes' | 'no') => { - setVote(value); - if (value === 'yes') { - submitFeedback(value, ''); - } - }; - - const submitFeedback = async (voteValue: string, commentValue: string) => { - setSubmitting(true); - try { - const data = { - url: window.location.href, - vote: voteValue, - comment: commentValue, - userAgent: navigator.userAgent, - }; - - await fetch(GOOGLE_SCRIPT_URL, { - method: 'POST', - mode: 'no-cors', - headers: { - 'Content-Type': 'text/plain;charset=utf-8', - }, - body: JSON.stringify(data), - }); - - setSubmitted(true); - } catch (error) { - setSubmitted(true); - } finally { - setSubmitting(false); - } - }; - - const handleCommentSubmit = (e: React.FormEvent) => { - e.preventDefault(); - if (vote) { - submitFeedback(vote, comment); - } - }; - - if (submitted) { - return ( -
-
-

Thanks for your feedback! 🙏🏽

-
-
- ); - } - - return ( -
-
- {!vote ? ( -
- Was this helpful? -
- - -
-
- ) : ( -
-

- {vote === 'yes' ? 'What was most helpful?' : 'How can we improve this page?'} -

-