diff --git a/docusaurus.config.js b/docusaurus.config.js
index 29f2b9e5..0c3e419a 100644
--- a/docusaurus.config.js
+++ b/docusaurus.config.js
@@ -283,6 +283,14 @@ var _hmt = _hmt || [];
src: "/js/clarity.js",
async: true,
},
+ {
+ src: "https://tcdn.casibase.org/casibase.js",
+ async: true,
+ },
+ {
+ src: "/js/casibase.js",
+ async: true,
+ },
],
presets: [
[
diff --git a/src/ChatWidget/ChatButton.jsx b/src/ChatWidget/ChatButton.jsx
deleted file mode 100644
index c2574da8..00000000
--- a/src/ChatWidget/ChatButton.jsx
+++ /dev/null
@@ -1,84 +0,0 @@
-import React, {useEffect, useState} from "react";
-import {
- chatButton,
- chatButtonHover,
- chatButtonOpen,
- chatIframe,
- chatIframeContainer,
- chatIframeContainerOpen,
- closeIcon
-} from "./chatStyles";
-
-function ChatButton() {
- const [isChatOpen, setIsChatOpen] = useState(false);
- const [isHovered, setIsHovered] = useState(false);
- const [containerStyle, setContainerStyle] = useState(chatIframeContainer);
- const [iconRotation, setIconRotation] = useState(0);
-
- useEffect(() => {
- if (isChatOpen) {
- setTimeout(() => {
- setContainerStyle({...chatIframeContainer, ...chatIframeContainerOpen});
- }, 50);
- setIconRotation(-90);
- } else {
- setContainerStyle(chatIframeContainer);
- setIconRotation(0);
- }
- }, [isChatOpen]);
-
- const handleClick = () => {
- setIsChatOpen(!isChatOpen);
- };
-
- return (
-
-
-
-
-
-
- );
-}
-
-export default ChatButton;
diff --git a/src/ChatWidget/chatStyles.js b/src/ChatWidget/chatStyles.js
deleted file mode 100644
index 32db8ec0..00000000
--- a/src/ChatWidget/chatStyles.js
+++ /dev/null
@@ -1,64 +0,0 @@
-export const chatButton = {
- position: "fixed",
- bottom: "20px",
- right: "20px",
- backgroundColor: "#403B79",
- color: "white",
- border: "none",
- borderRadius: "50px",
- padding: "10px 20px",
- cursor: "pointer",
- zIndex: 1000,
- display: "flex",
- alignItems: "center",
- fontWeight: "bold",
- fontSize: "16px",
- transition: "all 0.3s ease",
-};
-
-export const chatButtonHover = {
- backgroundColor: "#2E2A57",
- boxShadow: "0 6px 100px rgba(0, 0, 0, 0.5)",
-};
-
-export const chatButtonOpen = {
- borderRadius: "50%",
- width: "50px",
- height: "50px",
- padding: 0,
- justifyContent: "center",
-};
-
-export const closeIcon = {
- fontSize: "50px",
- fontWeight: "100",
- lineHeight: 1,
- transition: "transform 0.3s ease",
-};
-
-export const chatIframeContainer = {
- position: "fixed",
- bottom: "80px",
- right: "20px",
- width: "min(550px, calc(100vw - 40px))",
- height: "min(600px, calc(100vh - 100px))",
- borderRadius: "10px",
- zIndex: 1001,
- flexDirection: "column",
- overflow: "hidden",
- transition: "all 0.3s ease",
- transform: "translateY(30px)",
- opacity: 1,
- boxShadow: "-8px 0 8px -8px rgba(0, 0, 0, 0.2), 0 -8px 8px -8px rgba(0, 0, 0, 0.2), 0 8px 8px -8px rgba(0, 0, 0, 0.2)",
-};
-
-export const chatIframeContainerOpen = {
- transform: "translateY(0)",
- opacity: 1,
-};
-
-export const chatIframe = {
- width: "100%",
- height: "100%",
- marginLeft: "-2px",
-};
diff --git a/src/ChatWidget/chatWidget.js b/src/ChatWidget/chatWidget.js
deleted file mode 100644
index 8b2f7fe0..00000000
--- a/src/ChatWidget/chatWidget.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import React from "react";
-import ReactDOM from "react-dom";
-import ChatButton from "./ChatButton";
-
-export function initChatWidget(targetElement) {
- if (typeof window !== "undefined" && targetElement) {
- const chatContainer = document.createElement("div");
- targetElement.appendChild(chatContainer);
- ReactDOM.render(, chatContainer);
- }
-}
-
-export {ChatButton};
diff --git a/src/components/HomepageFeatures/index.js b/src/components/HomepageFeatures/index.js
index 3d3eaa65..4196e98f 100644
--- a/src/components/HomepageFeatures/index.js
+++ b/src/components/HomepageFeatures/index.js
@@ -1,9 +1,8 @@
-import React, {useEffect} from "react";
+import React from "react";
import clsx from "clsx";
import styles from "./styles.module.css";
import Translate from "@docusaurus/Translate";
import {useColorMode} from "@docusaurus/theme-common";
-import {initChatWidget} from "../../ChatWidget/chatWidget";
const FeatureList = [
{
@@ -70,11 +69,6 @@ function Feature({title, path, description}) {
}
export default function HomepageFeatures() {
-
- useEffect(() => {
- initChatWidget(document.body);
- }, []);
-
return (
diff --git a/static/js/casibase.js b/static/js/casibase.js
new file mode 100644
index 00000000..e0de4aed
--- /dev/null
+++ b/static/js/casibase.js
@@ -0,0 +1,5 @@
+/* eslint-disable no-undef */
+initCasibaseChat({
+ endpoint: "https://ai.casbin.com",
+ themeColor: "rgb(64,59,121)",
+});