Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chatbot has been added. #352

Merged
merged 3 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,24 @@
/>
</head>
<body>

<div id="root"></div>

<script>
window.embeddedChatbotConfig = {
chatbotId: "rL36bLvnKl-LBrT-vmYpR",
domain: "www.chatbase.co"
}
</script>
trahulprabhu38 marked this conversation as resolved.
Show resolved Hide resolved

<script
src="https://www.chatbase.co/embed.min.js"
chatbotId="rL36bLvnKl-LBrT-vmYpR"
domain="www.chatbase.co"
defer>

</script>

<script type="module" src="/src/main.jsx"></script>
</body>
</html>
30 changes: 30 additions & 0 deletions frontend/src/chatbot.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import{ useEffect } from 'react';

const Chatbot = () => {
useEffect(() => {
// Set the chatbot config
window.embeddedChatbotConfig = {
chatbotId: "rL36bLvnKl-LBrT-vmYpR",
domain: "www.chatbase.co",
};

// Create the script element to load the chatbot
const script = document.createElement('script');
script.src = "https://www.chatbase.co/embed.min.js";
script.setAttribute("chatbotId", "rL36bLvnKl-LBrT-vmYpR");
script.setAttribute("domain", "www.chatbase.co");
script.defer = true;

// Append the script to the document body
document.body.appendChild(script);
trahulprabhu38 marked this conversation as resolved.
Show resolved Hide resolved

// Cleanup the script when the component unmounts
return () => {
document.body.removeChild(script);
};
}, []);
trahulprabhu38 marked this conversation as resolved.
Show resolved Hide resolved

return <div id="chatbot" />;
};

export default Chatbot;
trahulprabhu38 marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion frontend/src/components/Shared/BackToTopButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const BackToTopButton = () => {
{shouldRender && (
<button
onClick={scrollToTop}
className={`z-50 fixed bottom-12 right-8 bg-green-700 hover:bg-green-600 text-white font-bold px-5 py-3 rounded-md shadow-lg hover:shadow-xl transition-all duration-300 transform hover:scale-110 ${
className={`z-50 fixed bottom-20 right-5 bg-green-700 hover:bg-green-600 text-white font-bold px-5 py-3 rounded-md shadow-lg hover:shadow-xl transition-all duration-300 transform hover:scale-110 ${
isVisible ? 'animate-fadeInBounce' : 'animate-fadeOutBounce'
}`}
style={{ boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)' }}
Expand Down
Loading