import React, { useState } from 'react'; import { styled } from '@mui/system'; import { TextField, Button, RadioGroup, FormControlLabel, Radio, Box, Typography } from '@mui/material'; import { sendProxyConfig } from '../../api/proxy'; import { useGlobalInfoStore } from '../../context/globalInfo'; const FormContainer = styled(Box)({ display: 'flex', flexDirection: 'column', gap: '16px', padding: '20px', borderRadius: '8px', }); const FormControl = styled(Box)({ marginBottom: '16px', }); const ProxyForm: React.FC = () => { const [proxyConfig, setProxyConfig] = useState({ type: 'http', server: '', username: '', password: '', apiKey: '', }); const { notify } = useGlobalInfoStore(); const handleChange = (e: React.ChangeEvent) => { const { name, value } = e.target; setProxyConfig({ ...proxyConfig, [name]: value }); }; const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); await sendProxyConfig(proxyConfig).then((response) => { if (response) { notify('success', 'Proxy configuration submitted successfully'); } else { notify('error', 'Failed to submit proxy configuration. Try again.'); } }); }; return (
Select Proxy Type } label="HTTP" /> } label="HTTPS" /> } label="SOCKS5" /> Proxy Configuration
); }; export default ProxyForm;