import { Button } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { useEffect, useState } from '@wordpress/element'; import { linkOff } from '@wordpress/icons'; import ConnectionStatus from './ConnectionStatus'; import LianaAPIFields from './LianaAPIFields'; type LianaMailerSettingsProps = { connected: boolean; loading: boolean; onReset: () => void; onSave: ( event: React.FormEvent< HTMLFormElement > ) => void; restEndpoint: string; settings: LianaAPISettings; }; export default function LianaMailerSettings( props: LianaMailerSettingsProps ) { const { connected, loading, onReset, onSave, restEndpoint, settings } = props; const [ stateSettings, setStateSettings ] = useState( settings ); const handleInputChange = ( name: string, value: string ) => { setStateSettings( ( prevSettings ) => ( { ...prevSettings, [ name ]: value, } ) ); }; useEffect( () => { if ( ! settings ) { setStateSettings( {} ); } else { setStateSettings( settings ); } }, [ settings ] ); const submitButtonText = loading ? __( 'Saving…', 'liana-with-growthstack' ) : __( 'Save Settings', 'liana-with-growthstack' ); return (

{ __( 'LianaMailer API Settings', 'liana-with-growthstack' ) }

onSave( event ) } >
); }