import { Icon, useBreakpoint, useEditor, useValue } from '@tldraw/tldraw' import { ChangeEvent, useCallback, useState } from 'react' export function APIKeyInput() { const breakpoint = useBreakpoint() const [cool, setCool] = useState(false) const editor = useEditor() const isFocusMode = useValue('is focus mode', () => editor.getInstanceState().isFocusMode, [ editor, ]) // Store the API key locally, but ONLY in development mode const handleChange = useCallback((e: ChangeEvent) => { if (process.env.NODE_ENV === 'development') { localStorage.setItem('makeitreal_key', e.target.value) } }, []) const handleKeyDown = useCallback((e: React.KeyboardEvent) => { if (e.key === 'Enter') { e.preventDefault() e.stopPropagation() e.currentTarget.blur() setCool(true) // its cool setTimeout(() => setCool(false), 1200) } }, []) if (isFocusMode) return null return (
) }