feat:tawkto
This commit is contained in:
parent
47a252e2d1
commit
984513321c
|
|
@ -9,6 +9,7 @@ import { Metadata } from "next";
|
||||||
import { Providers } from "./providers";
|
import { Providers } from "./providers";
|
||||||
import LoadScript from "@/utils/global";
|
import LoadScript from "@/utils/global";
|
||||||
import { type ReactNode } from "react";
|
import { type ReactNode } from "react";
|
||||||
|
import LoadTawk from "@/components/ui/tawkto/load-tawk";
|
||||||
const inter = Inter({ subsets: ["latin"] });
|
const inter = Inter({ subsets: ["latin"] });
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
|
|
@ -56,6 +57,7 @@ export default function RootLayout({ children }: { children: ReactNode }) {
|
||||||
<Providers themeProps={{ attribute: "class", defaultTheme: "light" }}>
|
<Providers themeProps={{ attribute: "class", defaultTheme: "light" }}>
|
||||||
<main className="">{children}</main>
|
<main className="">{children}</main>
|
||||||
</Providers>
|
</Providers>
|
||||||
|
<LoadTawk />
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
"use client";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
|
||||||
|
const LoadTawk = () => {
|
||||||
|
useEffect(() => {
|
||||||
|
const script = document.createElement("script");
|
||||||
|
script.src = "https://embed.tawk.to/5d43069be5ae967ef80df561/default"; // GANTI
|
||||||
|
script.async = true;
|
||||||
|
script.charset = "UTF-8";
|
||||||
|
script.setAttribute("crossorigin", "*");
|
||||||
|
|
||||||
|
document.body.appendChild(script);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
document.body.removeChild(script);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default LoadTawk;
|
||||||
Loading…
Reference in New Issue