Skip to content

Commit

Permalink
feat: add casibase widget JS via CDN (#260)
Browse files Browse the repository at this point in the history
* feat: add casibase tracker script and integrate in Layout component

* chore: update script source and add new casibase.js file

* chore: remove unused Layout component
  • Loading branch information
HashCookie authored Aug 7, 2024
1 parent b8b74d6 commit caf2120
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 168 deletions.
8 changes: 8 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
[
Expand Down
84 changes: 0 additions & 84 deletions src/ChatWidget/ChatButton.jsx

This file was deleted.

64 changes: 0 additions & 64 deletions src/ChatWidget/chatStyles.js

This file was deleted.

13 changes: 0 additions & 13 deletions src/ChatWidget/chatWidget.js

This file was deleted.

8 changes: 1 addition & 7 deletions src/components/HomepageFeatures/index.js
Original file line number Diff line number Diff line change
@@ -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 = [
{
Expand Down Expand Up @@ -70,11 +69,6 @@ function Feature({title, path, description}) {
}

export default function HomepageFeatures() {

useEffect(() => {
initChatWidget(document.body);
}, []);

return (
<section className={styles.features}>
<div className="container">
Expand Down
5 changes: 5 additions & 0 deletions static/js/casibase.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* eslint-disable no-undef */
initCasibaseChat({
endpoint: "https://ai.casbin.com",
themeColor: "rgb(64,59,121)",
});

0 comments on commit caf2120

Please sign in to comment.