Skip to content

Commit

Permalink
add chatbot
Browse files Browse the repository at this point in the history
  • Loading branch information
amanver45 committed Oct 29, 2024
1 parent 40bdf06 commit 7521e52
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 46 deletions.
89 changes: 45 additions & 44 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"mini-svg-data-uri": "^1.4.4",
"moment": "^2.30.1",
"mongoose": "^8.3.4",
"next": "^14.2.3",
"next": "^14.2.16",
"next-contentlayer": "^0.3.4",
"next-mdx-remote": "^0.5.1",
"next-themes": "^0.3.0",
Expand Down Expand Up @@ -91,5 +91,9 @@
"next-contentlayer": {
"next": "$next"
}
}
},
"description": "<p align=\"center\">\r <a href=\"https://reactplay.io\" target=\"_blank\" style=\"font-size:80px\"><img src=\"public/logo-white.png\" alt=\"react-play\" width=\"125\" /></a>\r </p>",
"main": "index.js",
"author": "",
"license": "ISC"
}
28 changes: 28 additions & 0 deletions src/app/(app)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'; // Mark this file as a Client Component
import { useEffect } from 'react';
import Banner from '@/components/banner';
import { Beam, Beam2 } from '@/components/beam';
import Features from '@/components/features';
Expand All @@ -18,6 +20,32 @@ import { Star } from 'lucide-react';
import Link from 'next/link';

const IndexPage = () => {
useEffect(() => {
// Create and append the configuration script
const configScript = document.createElement('script');
configScript.innerHTML = `
window.embeddedChatbotConfig = {
chatbotId: "CgIoEqUF_3FxcQasT8MFb",
domain: "www.chatbase.co"
}
`;
document.body.appendChild(configScript);

// Create and append the chatbot script
const chatbotScript = document.createElement('script');
chatbotScript.src = 'https://www.chatbase.co/embed.min.js';
chatbotScript.setAttribute('chatbotId', 'CgIoEqUF_3FxcQasT8MFb');
chatbotScript.setAttribute('domain', 'www.chatbase.co');
chatbotScript.setAttribute('defer', '');
document.body.appendChild(chatbotScript);

// Cleanup function to remove scripts on unmount
return () => {
document.body.removeChild(configScript);
document.body.removeChild(chatbotScript);
};
}, []);

return (
<>
<PageHeader className=" relative z-30 ">
Expand Down

0 comments on commit 7521e52

Please sign in to comment.