docs: gh feedback link (#21606)

Co-authored-by: bracesproul <braceasproul@gmail.com>
pull/21649/head
Bagatur 4 weeks ago committed by GitHub
parent 506df439eb
commit 752b1e85f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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 (
<div style={{ display: "flex", flexDirection: "column" }}>
<hr />
@ -199,7 +205,7 @@ export default function Feedback() {
<h4>Thanks for your feedback!</h4>
) : (
<>
<h4>Help us out by providing feedback on this documentation page:</h4>
<h4>Was this page helpful?</h4>
<div style={{ display: "flex", gap: "5px" }}>
<div
{...defaultFields}
@ -240,6 +246,14 @@ export default function Feedback() {
</div>
</>
)}
<br />
<h4>
You can leave detailed feedback{" "}
<a target="_blank" href={newGithubIssueURL}>
on GitHub
</a>
.
</h4>
</div>
);
}

Loading…
Cancel
Save