feat:tawkto

This commit is contained in:
Rama Priyanto 2025-06-16 11:19:51 +07:00
parent 47a252e2d1
commit 984513321c
2 changed files with 24 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import { Metadata } from "next";
import { Providers } from "./providers";
import LoadScript from "@/utils/global";
import { type ReactNode } from "react";
import LoadTawk from "@/components/ui/tawkto/load-tawk";
const inter = Inter({ subsets: ["latin"] });
export const metadata: Metadata = {
@ -56,6 +57,7 @@ export default function RootLayout({ children }: { children: ReactNode }) {
<Providers themeProps={{ attribute: "class", defaultTheme: "light" }}>
<main className="">{children}</main>
</Providers>
<LoadTawk />
</body>
</html>
);

View File

@ -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;