mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-01 02:01:48 +02:00
Switch to hook for crisp chat (#418)
This commit is contained in:
parent
9deb45bd33
commit
8c16966907
2 changed files with 4 additions and 11 deletions
|
@ -28,7 +28,7 @@ export const ChatButton: React.VoidFunctionComponent<{ text?: string }> = ({
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const CrispChat: React.VoidFunctionComponent = () => {
|
export const useCrispChat = () => {
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (!crispWebsiteId) {
|
if (!crispWebsiteId) {
|
||||||
return;
|
return;
|
||||||
|
@ -44,8 +44,4 @@ const CrispChat: React.VoidFunctionComponent = () => {
|
||||||
window.$crisp.push(["safe", true]); // disable warning about other event listeners
|
window.$crisp.push(["safe", true]); // disable warning about other event listeners
|
||||||
})();
|
})();
|
||||||
});
|
});
|
||||||
|
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default CrispChat;
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import "~/style.css";
|
||||||
|
|
||||||
import { NextPage } from "next";
|
import { NextPage } from "next";
|
||||||
import { AppProps } from "next/app";
|
import { AppProps } from "next/app";
|
||||||
import dynamic from "next/dynamic";
|
|
||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import { appWithTranslation } from "next-i18next";
|
import { appWithTranslation } from "next-i18next";
|
||||||
import PlausibleProvider from "next-plausible";
|
import PlausibleProvider from "next-plausible";
|
||||||
|
@ -13,14 +12,13 @@ import { Toaster } from "react-hot-toast";
|
||||||
|
|
||||||
import Maintenance from "@/components/maintenance";
|
import Maintenance from "@/components/maintenance";
|
||||||
|
|
||||||
|
import { useCrispChat } from "../components/crisp-chat";
|
||||||
import { absoluteUrl } from "../utils/absolute-url";
|
import { absoluteUrl } from "../utils/absolute-url";
|
||||||
import { trpcNext } from "../utils/trpc";
|
import { trpcNext } from "../utils/trpc";
|
||||||
|
|
||||||
const CrispChat = dynamic(() => import("@/components/crisp-chat"), {
|
|
||||||
ssr: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const MyApp: NextPage<AppProps> = ({ Component, pageProps }) => {
|
const MyApp: NextPage<AppProps> = ({ Component, pageProps }) => {
|
||||||
|
useCrispChat();
|
||||||
|
|
||||||
if (process.env.NEXT_PUBLIC_MAINTENANCE_MODE === "1") {
|
if (process.env.NEXT_PUBLIC_MAINTENANCE_MODE === "1") {
|
||||||
return <Maintenance />;
|
return <Maintenance />;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +55,6 @@ const MyApp: NextPage<AppProps> = ({ Component, pageProps }) => {
|
||||||
content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"
|
content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"
|
||||||
/>
|
/>
|
||||||
</Head>
|
</Head>
|
||||||
<CrispChat />
|
|
||||||
<Toaster />
|
<Toaster />
|
||||||
<Component {...pageProps} />
|
<Component {...pageProps} />
|
||||||
</PlausibleProvider>
|
</PlausibleProvider>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue