'use client';

import { GoogleOAuthProvider } from '@react-oauth/google';

const googleClientId = process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID || '';

// Always render the provider so GoogleLogin can be mounted anywhere.
// When clientId is empty the button is hidden in the sign-in page, so no
// actual auth calls are made.
export function GoogleOAuthWrapper({ children }: { children: React.ReactNode }) {
  return (
    <GoogleOAuthProvider clientId={googleClientId || 'not-configured'}>
      {children}
    </GoogleOAuthProvider>
  );
}
