import { X, Bug } from 'lucide-react'; import { useState, useEffect } from 'react'; const ErrorModal = ({ showErrorModal, closeErrorModal, customApiKey, setCustomApiKey, handleApiKeySubmit, // Add debug toggle prop with default value debugMode = false, setDebugMode = () => {} }) => { const [localApiKey, setLocalApiKey] = useState(customApiKey); // Update local API key when prop changes useEffect(() => { setLocalApiKey(customApiKey); }, [customApiKey]); const handleSubmit = (e) => { e.preventDefault(); handleApiKeySubmit(localApiKey); }; return ( <> {showErrorModal && (
{ if (e.target.classList.contains('modalBackdrop')) { closeErrorModal(); } }} onKeyDown={(e) => { if (e.key === 'Escape') { closeErrorModal(); } }} >

This space is super popular

{/* Debug toggle button - only visible in development */} {process.env.NODE_ENV === 'development' && (
{/* Tooltip */}

Debug Mode: {debugMode ? "ON" : "OFF"}

When enabled, this modal will automatically appear on page load for development purposes.

)}

Our free API key is currently at capacity. To continue:

  1. Get your own API key at ai.dev/app/apikey
  2. Enter it below
setLocalApiKey(e.target.value)} className="w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent" />
)} ); }; export default ErrorModal;