chore: removing the kapa ai for toast doc page (#4833)

This commit is contained in:
Maharshi Alpesh 2025-02-14 19:41:56 +05:30 committed by GitHub
parent d78885d99e
commit 52f926a9fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,15 +1,32 @@
"use client";
import * as React from "react";
import Script from "next/script";
import { usePathname } from "next/navigation";
export function ScriptProviders({ isKapaEnabled = true }: { isKapaEnabled?: boolean }) {
const pathname = usePathname();
const [isMounted, setIsMounted] = React.useState(false);
export function ScriptProviders({isKapaEnabled = true}: {isKapaEnabled?: boolean}) {
if (!isKapaEnabled) return null;
React.useEffect(() => {
setIsMounted(true);
}, []);
React.useEffect(() => {
const kapaElements = document.querySelectorAll('[id^="kapa-"]');
const display = pathname.includes("toast") ? "none" : "block";
kapaElements.forEach(element => (element as HTMLElement).style.display = display);
}, [pathname]);
if (!isKapaEnabled || !isMounted) {
return null;
}
return (
<>
<Script
defer
data-button-position-left="20px"
data-modal-disclaimer="This is a custom LLM for HeroUI with access to all developer docs (heroui.com/docs) and GitHub Issues and PRs (github.com/heroui-inc/heroui)."
data-modal-example-questions="How do I install for Next.js?,How do I customize primary color?"
data-project-color="#000000"