MCPcopy Create free account
hub / github.com/codename-co/stack / Debug

Function Debug

packages/website/src/components/Debug.tsx:5–72  ·  view source on GitHub ↗
({
  children,
  lang,
})

Source from the content-addressed store, hash-verified

3import { useTranslations, type Lang } from "~/i18n";
4
5export const Debug: React.FC<{ children?: any; lang: Lang }> = ({
6 children,
7 lang,
8}) => {
9 const [connected, setConnected] = useState(false);
10
11 const t = useTranslations(lang);
12
13 const check = async () => {
14 const connected = await isApiAccessible();
15 console.log("API is accessible:", connected);
16 setConnected(connected);
17
18 globalThis.document.body.setAttribute(
19 "data-connected",
20 connected.toString(),
21 );
22 };
23
24 useEffect(() => {
25 check();
26 setInterval(check, 2000);
27 }, []);
28
29 const debugStyle: CSSProperties = {
30 transform: `translateY(${connected ? "0" : "-100%"})`,
31 transition: "all 0.3s ease-in-out",
32 background:
33 "repeating-linear-gradient(45deg, #333, #333 10px, #555 10px, #555 20px)",
34 backgroundSize: "160% 100%",
35 animation: "gradientShift 20s linear infinite",
36 };
37
38 return (
39 <>
40 <style>
41 {`
42 @keyframes gradientShift {
43 0% { background-position: 0% 50%; }
44 100% { background-position: 100% 50%; }
45 }
46 `}
47 </style>
48 {children}
49 <div
50 id="debug"
51 style={debugStyle}
52 className="fixed top-0 left-0 right-0 w-full z-50 user-select-none text-white max-w-96 mx-auto my-0 px-6 py-1 text-sm font-semibold rounded-bl-lg rounded-br-lg"
53 >
54 <span>
55 ▶{" "}
56 <span
57 dangerouslySetInnerHTML={{ __html: t("Service is running…") }}
58 />
59 </span>
60 <nav className="float-end">
61 <a
62 className="!text-white"

Callers

nothing calls this directly

Calls 3

useTranslationsFunction · 0.90
checkFunction · 0.85
tFunction · 0.50

Tested by

no test coverage detected