-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from bcnmy/feedback
Add feedback tool in docs
- Loading branch information
Showing
3 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Feedback | ||
description: Help us improve the Biconomy documentation site by leaving your feedback | ||
title: "[Feedback]" | ||
labels: ["documentation", "feedback", "community"] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
Thanks for taking the time to leave your feedback! | ||
- type: textarea | ||
id: improvements | ||
attributes: | ||
label: How could we improve the Biconomy documentation site? | ||
placeholder: Send us your ideas! | ||
- type: markdown | ||
attributes: | ||
value: | | ||
We welcome documentation contributions! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// src/components/Feedback.js | ||
|
||
import React, { useState } from 'react'; | ||
import {useLocation} from '@docusaurus/router'; | ||
|
||
const Feedback = () => { | ||
const location = useLocation(); | ||
const [showYesCommentDiv, setShowYesCommentDiv] = useState(false); | ||
const [showNoCommentDiv, setShowNoCommentDiv] = useState(false); | ||
const handleFeedback = (isHelpful: boolean) => { | ||
// Implement logic to handle user feedback (e.g., send to analytics or API) | ||
console.log(`User feedback: ${isHelpful ? 'Helpful' : 'Not helpful'}`); | ||
if(isHelpful) { | ||
setShowYesCommentDiv(true); | ||
setShowNoCommentDiv(false); | ||
} else { | ||
setShowYesCommentDiv(false); | ||
setShowNoCommentDiv(true); | ||
} | ||
// You can customize this logic based on your needs | ||
}; | ||
|
||
return ( | ||
<div> | ||
<p style={{marginBottom: 6 }}>Was this page helpful?</p> | ||
<label> | ||
<input | ||
type="radio" | ||
name="feedback" | ||
value="yes" | ||
checked={showYesCommentDiv === true} | ||
onChange={() => handleFeedback(true)} | ||
/> | ||
Yes | ||
</label> | ||
<div className="gap-2"></div> | ||
<label> | ||
<input | ||
type="radio" | ||
name="feedback" | ||
value="no" | ||
checked={showNoCommentDiv === true} | ||
onChange={() => handleFeedback(false)} | ||
/> | ||
No | ||
</label> | ||
{ | ||
showYesCommentDiv && ( | ||
<div> | ||
<p>Thanks!</p> | ||
</div> | ||
) | ||
} | ||
{ | ||
|
||
showNoCommentDiv && ( | ||
<div> | ||
<p>Thanks! Help us improve by leaving a comment:{' '} | ||
<a | ||
href={`https://github.com/bcnmy/docs/issues/new?assignees=&labels=documentation%2Cfeedback%2Ccommunity&template=feedback.yml&title=%5BFeedback%5D%20Page:%20${location.pathname}`} | ||
target="_blank" | ||
rel="noreferrer noopener" | ||
>Leave a comment | ||
</a> | ||
</p> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Feedback; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import TOCItems from '@theme-original/TOCItems'; | ||
import Feedback from '../../components/Feedback'; | ||
|
||
export default function TOCItemsWrapper(props) { | ||
return ( | ||
<> | ||
<TOCItems {...props} /> | ||
<div className="table-of-contents"> | ||
<Feedback /> | ||
</div> | ||
|
||
</> | ||
); | ||
} |