import { clear, readText } from '@tauri-apps/plugin-clipboard-manager'; import * as m from 'motion/react-m'; import { useEffect, useState } from 'react'; import { fireAndForget } from '../lib/fireAndForget'; import { useImportCurl } from '../hooks/useImportCurl'; import { useWindowFocus } from '../hooks/useWindowFocus'; import { Button } from './core/Button'; import { Icon } from './core/Icon'; export function ImportCurlButton() { const focused = useWindowFocus(); const [clipboardText, setClipboardText] = useState(''); const importCurl = useImportCurl(); const [isLoading, setIsLoading] = useState(false); // oxlint-disable-next-line react-hooks/exhaustive-deps useEffect(() => { fireAndForget(readText().then(setClipboardText)); }, [focused]); if (!clipboardText?.trim().startsWith('curl ')) { return null; } return ( ); }