SurfSense/surfsense_web/app/dashboard/api-key/client-wrapper.tsx

33 lines
835 B
TypeScript
Raw Normal View History

2025-07-27 10:05:37 -07:00
"use client";
2025-04-07 23:47:06 -07:00
2025-07-27 10:05:37 -07:00
import dynamic from "next/dynamic";
import { useEffect, useState } from "react";
2025-04-07 23:47:06 -07:00
// Loading component with animation
const LoadingComponent = () => (
2025-07-27 10:05:37 -07:00
<div className="flex flex-col justify-center items-center min-h-screen">
<div className="w-16 h-16 border-4 border-primary border-t-transparent rounded-full animate-spin mb-4"></div>
<p className="text-muted-foreground">Loading API Key Management...</p>
</div>
);
2025-04-07 23:47:06 -07:00
// Dynamically import the ApiKeyClient component
2025-07-27 10:05:37 -07:00
const ApiKeyClient = dynamic(() => import("./api-key-client"), {
ssr: false,
loading: () => <LoadingComponent />,
});
2025-04-07 23:47:06 -07:00
export default function ClientWrapper() {
2025-07-27 10:05:37 -07:00
const [isMounted, setIsMounted] = useState(false);
useEffect(() => {
setIsMounted(true);
}, []);
if (!isMounted) {
return <LoadingComponent />;
}
return <ApiKeyClient />;
}