From 1c13845302a83d69699d0ed97c35c133d917be16 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 24 Oct 2024 18:26:11 +0530 Subject: [PATCH] feat: standard proxy and automatic proxy rotation tabs --- src/components/organisms/ProxyForm.tsx | 138 ++++++++++++++----------- 1 file changed, 78 insertions(+), 60 deletions(-) diff --git a/src/components/organisms/ProxyForm.tsx b/src/components/organisms/ProxyForm.tsx index a799490d..ace84119 100644 --- a/src/components/organisms/ProxyForm.tsx +++ b/src/components/organisms/ProxyForm.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import { styled } from '@mui/system'; -import { TextField, Button, Switch, FormControlLabel, Box, Typography } from '@mui/material'; +import { TextField, Button, Switch, FormControlLabel, Box, Typography, Tabs, Tab } from '@mui/material'; import { sendProxyConfig } from '../../api/proxy'; import { useGlobalInfoStore } from '../../context/globalInfo'; @@ -27,6 +27,7 @@ const ProxyForm: React.FC = () => { username: '', password: '', }); + const [tabIndex, setTabIndex] = useState(0); const { notify } = useGlobalInfoStore(); @@ -82,71 +83,88 @@ const ProxyForm: React.FC = () => { }); }; + const handleTabChange = (event: React.SyntheticEvent, newValue: number) => { + setTabIndex(newValue); + }; + return ( Proxy Configuration - - - + + + + {tabIndex === 0 && ( + + + + + + } + label="Requires Authentication?" + /> + + {requiresAuth && ( + <> + + + + + + + + )} + - + disabled={!proxyConfig.server_url || (requiresAuth && (!proxyConfig.username || !proxyConfig.password))} + > + Add Proxy + + + )} + {tabIndex === 1 && ( + + + + )} ); };