Skip to content

Commit

Permalink
crisp chat widget
Browse files Browse the repository at this point in the history
closes #36
  • Loading branch information
mercuriev committed Dec 21, 2024
1 parent 832b041 commit 2d050af
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
VITE_ALCHEMY_KEY=JPv_vpU3puJFVcnr7ptvxnCLo3hFhxYY
VITE_GRAPH_ENDPOINT=https://subgraph.satsuma-prod.com/d34acdd89ceb/maxs-team--618638/priveer-CHAINID/version/v1/api
VITE_CRISP_ID=c2dc68e0-61f4-492d-b5c1-4fb28b70ca44
21 changes: 21 additions & 0 deletions src/components/ChatWidget.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React, {useEffect} from 'react';
import * as process from "node:process";

const ChatWidget: React.FC = () => {
useEffect(() => {
window.$crisp = [];
window.CRISP_WEBSITE_ID = import.meta.env.VITE_CRISP_ID;

(function () {
const d = document;
const s = d.createElement('script');
s.src = 'https://client.crisp.chat/l.js';
s.async = true;
d.getElementsByTagName('head')[0].appendChild(s);
})();
}, []);

return null;
};

export default ChatWidget;
2 changes: 2 additions & 0 deletions src/layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Topnav from "./Topnav";
import {Outlet} from "react-router-dom";
import {Footer} from "antd/es/layout/layout.js";
import {Announcement} from "components/Announcement";
import ChatWidget from "../components/ChatWidget";

const {Header, Content} = AntLayout;

Expand All @@ -22,6 +23,7 @@ export default function Layout()
</div>
</Content>
<Footer />
<ChatWidget />
</AntLayout>
);
}

0 comments on commit 2d050af

Please sign in to comment.