From 752b1e85f8884a5df8f2a3f5313aa05f871753c8 Mon Sep 17 00:00:00 2001 From: Bagatur <22008038+baskaryan@users.noreply.github.com> Date: Mon, 13 May 2024 20:11:37 -0400 Subject: [PATCH] docs: gh feedback link (#21606) Co-authored-by: bracesproul --- docs/src/theme/Feedback.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/src/theme/Feedback.js b/docs/src/theme/Feedback.js index 6b56037999f..26896baedc0 100644 --- a/docs/src/theme/Feedback.js +++ b/docs/src/theme/Feedback.js @@ -112,6 +112,7 @@ export default function Feedback() { const { setCookie, checkCookie } = useCookie(); const [feedbackSent, setFeedbackSent] = useState(false); const { siteConfig } = useDocusaurusContext(); + const [pathname, setPathname] = useState(""); /** @param {"good" | "bad"} feedback */ const handleFeedback = async (feedback) => { @@ -167,6 +168,7 @@ export default function Feedback() { // (cookies exp in 24hrs) const cookieName = `${FEEDBACK_COOKIE_PREFIX}_${window.location.pathname}`; setFeedbackSent(checkCookie(cookieName)); + setPathname(window.location.pathname); } }, []); @@ -192,6 +194,10 @@ export default function Feedback() { onMouseUp: (e) => (e.currentTarget.style.backgroundColor = "#f0f0f0"), }; + const newGithubIssueURL = pathname + ? `https://github.com/langchain-ai/langchain/issues/new?assignees=&labels=03+-+Documentation&projects=&template=documentation.yml&title=DOC%3A+%3CIssue+related+to+${pathname}%3E` + : "https://github.com/langchain-ai/langchain/issues/new?assignees=&labels=03+-+Documentation&projects=&template=documentation.yml&title=DOC%3A+%3CPlease+write+a+comprehensive+title+after+the+%27DOC%3A+%27+prefix%3E"; + return (

@@ -199,7 +205,7 @@ export default function Feedback() {

Thanks for your feedback!

) : ( <> -

Help us out by providing feedback on this documentation page:

+

Was this page helpful?

)} +
+

+ You can leave detailed feedback{" "} + + on GitHub + + . +

); }