style: update proxy settings form to match proxy-settings-dialog

This commit is contained in:
zhom
2025-06-11 02:40:03 +04:00
parent d17545bd05
commit ab563f81fa
+34 -3
View File
@@ -72,6 +72,8 @@ export function CreateProfileDialog({
const [proxyType, setProxyType] = useState("http"); const [proxyType, setProxyType] = useState("http");
const [proxyHost, setProxyHost] = useState(""); const [proxyHost, setProxyHost] = useState("");
const [proxyPort, setProxyPort] = useState(8080); const [proxyPort, setProxyPort] = useState(8080);
const [proxyUsername, setProxyUsername] = useState("");
const [proxyPassword, setProxyPassword] = useState("");
const { const {
availableVersions, availableVersions,
@@ -194,6 +196,8 @@ export function CreateProfileDialog({
proxy_type: proxyType, proxy_type: proxyType,
host: proxyHost, host: proxyHost,
port: proxyPort, port: proxyPort,
username: proxyUsername || undefined,
password: proxyPassword || undefined,
} }
: undefined; : undefined;
@@ -210,6 +214,8 @@ export function CreateProfileDialog({
setProxyEnabled(false); setProxyEnabled(false);
setProxyHost(""); setProxyHost("");
setProxyPort(8080); setProxyPort(8080);
setProxyUsername("");
setProxyPassword("");
onClose(); onClose();
} catch (error) { } catch (error) {
console.error("Failed to create profile:", error); console.error("Failed to create profile:", error);
@@ -231,12 +237,12 @@ export function CreateProfileDialog({
return ( return (
<Dialog open={isOpen} onOpenChange={onClose}> <Dialog open={isOpen} onOpenChange={onClose}>
<DialogContent className="max-w-md"> <DialogContent className="max-w-md max-h-[80vh] my-8 flex flex-col">
<DialogHeader> <DialogHeader className="flex-shrink-0">
<DialogTitle>Create New Profile</DialogTitle> <DialogTitle>Create New Profile</DialogTitle>
</DialogHeader> </DialogHeader>
<div className="grid gap-4 py-4"> <div className="grid overflow-y-scroll flex-1 gap-6 py-4 min-h-0">
{/* Profile Name */} {/* Profile Name */}
<div className="grid gap-2"> <div className="grid gap-2">
<Label htmlFor="profile-name">Profile Name</Label> <Label htmlFor="profile-name">Profile Name</Label>
@@ -414,6 +420,31 @@ export function CreateProfileDialog({
max="65535" max="65535"
/> />
</div> </div>
<div className="grid gap-2">
<Label htmlFor="proxy-username">Username (optional)</Label>
<Input
id="proxy-username"
value={proxyUsername}
onChange={(e) => {
setProxyUsername(e.target.value);
}}
placeholder="Proxy username"
/>
</div>
<div className="grid gap-2">
<Label htmlFor="proxy-password">Password (optional)</Label>
<Input
id="proxy-password"
type="password"
value={proxyPassword}
onChange={(e) => {
setProxyPassword(e.target.value);
}}
placeholder="Proxy password"
/>
</div>
</> </>
)} )}
</div> </div>