diff --git a/apps/landing/src/components/docs/blocks/InteractiveAPIWidget.tsx b/apps/landing/src/components/docs/blocks/InteractiveAPIWidget.tsx index 8b91a4d..195b913 100644 --- a/apps/landing/src/components/docs/blocks/InteractiveAPIWidget.tsx +++ b/apps/landing/src/components/docs/blocks/InteractiveAPIWidget.tsx @@ -1,5 +1,6 @@ 'use client'; +import { useApiKey } from '@/components/shared/ApiKeyWidget/apikey-context'; /** * Interactive API Widget - Production Version * @@ -60,6 +61,8 @@ export const InteractiveAPIWidget = ({ const [isExpanded, setIsExpanded] = useState(false); const [paramValues, setParamValues] = useState>({}); + const {apiKeyValidated, focus} = useApiKey() + // Load API key from localStorage and listen for changes useEffect(() => { const loadApiKey = () => { @@ -266,7 +269,7 @@ func main() { // Expand API key input in navigation const expandApiKey = () => { - window.dispatchEvent(new CustomEvent('expandApiKeyInput')); + focus(); }; const isSuccess = response && response.success === true; @@ -336,7 +339,7 @@ func main() { onClick={expandApiKey} className="text-sm text-gray-400 hover:text-white underline-offset-4 hover:underline transition-colors" > - {apiKey ? 'API Key Set' : 'Enter API Key'} + {apiKeyValidated ? 'API Key Set' : 'Enter API Key'}