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

Added AI supported chatbot #254

Merged
merged 2 commits into from
Oct 26, 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
36 changes: 18 additions & 18 deletions client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { modeAtom } from "./atom/Atom";
import ForgotPassword from "./component/ForgotPassword";
import VerifyEmail from "./component/Verify";
import NotFound from "./component/NotFound";
import MiniChatbot from "./component/MiniChatbot";
// import MiniChatbot from "./component/MiniChatbot";
import ProgressBar from "./component/ProgressBar/ProgressBar";
import ProtectedRoute from '../../client/src/component/ProtectedRoute'

Expand All @@ -52,25 +52,25 @@ const Layout = ({ children, mode, setProgress, toggleMode, showAlert }) => {
<div className="h-full w-full">
{/* Conditionally render the Navbar */}
{/* {!hideNavbarRoutes.includes(location.pathname) && ( */}
<Navbar
title='BITBOX'
home='Home'
about='About Us'
community='Community'
BlogPage="Blogs"
discussion='Discussion'
showAlert={showAlert}
mode={mode}
toggleMode={toggleMode}
/>
<Navbar
title='BITBOX'
home='Home'
about='About Us'
community='Community'
BlogPage="Blogs"
discussion='Discussion'
showAlert={showAlert}
mode={mode}
toggleMode={toggleMode}
/>
{/* )} */}

{/* Main content */}
{children}

{/* Conditionally render the Footer */}
{/* {!hideFooterRoutes.includes(location.pathname) && ( */}
<Footer mode={mode} setProgress={setProgress} setAlert={showAlert} />
<Footer mode={mode} setProgress={setProgress} setAlert={showAlert} />
{/* )} */}
</div>
);
Expand All @@ -87,7 +87,7 @@ function App() {
};

const [progress, setProgress] = useState(0);
const [islogged,setloggedin]=useState(false)
const [islogged, setloggedin] = useState(false)
useEffect(() => {
const savedMode = localStorage.getItem("mode");
if (savedMode) {
Expand Down Expand Up @@ -140,7 +140,7 @@ function App() {
</div>
<ProgressBar mode={mode} />
<ScrollTop />
<MiniChatbot />
{/* <MiniChatbot /> */}

{/* Wrap everything inside the Layout component */}
<Layout
Expand All @@ -161,9 +161,9 @@ function App() {
/>
}
/>
<Route exact path="/discussion" element={<ProtectedRoute loggedin={islogged}><Discussion mode={mode} setProgress={setProgress} showAlert={showAlert} /></ProtectedRoute>} />
<Route exact path="/discussion" element={<ProtectedRoute loggedin={islogged}><Discussion mode={mode} setProgress={setProgress} showAlert={showAlert} /></ProtectedRoute>} />
<Route exact path="/community" element={<ProtectedRoute loggedin={islogged}><Community mode={mode} setProgress={setProgress} showAlert={showAlert} /></ProtectedRoute>} />
<Route exact path="/about" element={<ProtectedRoute loggedin={islogged}><About mode={mode} setProgress={setProgress} showAlert={showAlert} /></ProtectedRoute>} />
<Route exact path="/about" element={<ProtectedRoute loggedin={islogged}><About mode={mode} setProgress={setProgress} showAlert={showAlert} /></ProtectedRoute>} />
<Route
exact
path='/blog'
Expand Down Expand Up @@ -208,7 +208,7 @@ function App() {
/>
}
/>
<Route exact path="/login" element={<Login mode={mode} setProgress={setProgress} showAlert={showAlert} loggedin={islogged} setloggedin={setloggedin}/>} />
<Route exact path="/login" element={<Login mode={mode} setProgress={setProgress} showAlert={showAlert} loggedin={islogged} setloggedin={setloggedin} />} />
<Route
exact
path='/signup'
Expand Down
28 changes: 27 additions & 1 deletion client/src/component/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import { FaXTwitter } from "react-icons/fa6";
import { FaGithub, FaLinkedin, FaYoutube } from 'react-icons/fa';
import React, { useState } from "react";

import React, { useEffect, useState } from "react";
const Footer = (props) => {
const [email, setEmail] = useState("");
const [message, setMessage] = useState("");
Expand Down Expand Up @@ -54,6 +55,31 @@ const Footer = (props) => {
setEmail("");
}, 7000);
};
useEffect(() => {
// Configure the chatbot settings
window.embeddedChatbotConfig = {
chatbotId: "GzK_h2kRkJ8e-jLXJVgmy",
domain: "www.chatbase.co"
};

// Create the script element
const script = document.createElement('script');
script.src = "https://www.chatbase.co/embed.min.js";
script.defer = true;
script.setAttribute("chatbotId", "GzK_h2kRkJ8e-jLXJVgmy");
script.setAttribute("domain", "www.chatbase.co");

// Append the script to the body
document.body.appendChild(script);

// Cleanup function to remove the script on component unmount
return () => {
document.body.removeChild(script);
};
}, []);



return (
<>
{/* Divider line */}
Expand Down
2 changes: 1 addition & 1 deletion client/src/css/ScrollTop.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
display: none;
position: fixed;
bottom: 20px;
right: 30px;
right: 80px;
z-index: 999;
transition-duration: 0.3s;
}
Expand Down