­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ import React, { useState, useEffect } from 'react' import { __ } from '@wordpress/i18n' import { FileUploadForm } from './FromFileUpload/FileUploadForm' import { ImportForm } from './FromOtherPlugins/ImportForm' import { ImportSection } from './shared' type TabType = 'upload' | 'plugins' export const ImportApp: React.FC = () => { const [activeTab, setActiveTab] = useState('upload') useEffect(() => { const urlParams = new URLSearchParams(window.location.search) const tabParam = urlParams.get('tab') as TabType if (tabParam === 'plugins' || tabParam === 'upload') { setActiveTab(tabParam) } }, []) const handleTabChange = (tab: TabType) => { setActiveTab(tab) const url = new URL(window.location.href) url.searchParams.set('tab', tab) window.history.replaceState({}, '', url) } return (

{ e.preventDefault() handleTabChange('upload') }} > {__('Import Snippets', 'code-snippets')} { e.preventDefault() handleTabChange('plugins') }} > {__('Import from other plugins', 'code-snippets')}

) }