Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

♻️ refactor: replace antd Radio with lobe-ui RadioGroup (#17387)

Innei2bec6ee16972
diff --git a/package.json b/package.json
index 0bca49732ce..05d31cf5974 100644
--- a/package.json
+++ b/package.json
@@ -299,7 +299,7 @@
"@lobehub/icons": "^5.11.0",
"@lobehub/market-sdk": "0.39.2",
"@lobehub/tts": "^5.1.2",
- "@lobehub/ui": "^5.20.3",
+ "@lobehub/ui": "^5.23.0",
"@modelcontextprotocol/sdk": "^1.29.0",
"@napi-rs/canvas": "^0.1.100",
"@neondatabase/serverless": "^1.1.0",
diff --git a/src/features/PluginDevModal/MCPManifestForm/index.tsx b/src/features/PluginDevModal/MCPManifestForm/index.tsx
index d0715bb9473..8c8728fffda 100644
--- a/src/features/PluginDevModal/MCPManifestForm/index.tsx
+++ b/src/features/PluginDevModal/MCPManifestForm/index.tsx
@@ -1,7 +1,7 @@
import { Alert, Flexbox, FormItem, Input, InputPassword } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
+import { Button, RadioGroup } from '@lobehub/ui/base-ui';
import { type FormInstance } from 'antd';
-import { Divider, Form, Radio } from 'antd';
+import { Divider, Form } from 'antd';
import isEqual from 'fast-deep-equal';
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -253,7 +253,7 @@ const MCPManifestForm = ({
label={t('dev.mcp.auth.label')}
name={AUTH_TYPE}
>
- <Radio.Group
+ <RadioGroup
style={{ width: '100%' }}
options={[
{
diff --git a/src/routes/(main)/settings/proxy/features/ProxyForm.test.tsx b/src/routes/(main)/settings/proxy/features/ProxyForm.test.tsx
index b67d54e2afd..21188c9dda1 100644
--- a/src/routes/(main)/settings/proxy/features/ProxyForm.test.tsx
+++ b/src/routes/(main)/settings/proxy/features/ProxyForm.test.tsx
@@ -92,6 +92,35 @@ vi.mock('@lobehub/ui/base-ui', () => ({
{children}
</button>
),
+ RadioGroup: ({
+ disabled,
+ onChange,
+ options,
+ value,
+ }: {
+ disabled?: boolean;
+ onChange?: (value: string) => void;
+ options?: Array<string | { disabled?: boolean; label?: ReactNode; value: string }>;
+ value?: string;
+ }) => (
+ <div role="radiogroup">
+ {options?.map((option) => {
+ const item = typeof option === 'string' ? { label: option, value: option } : option;
+ return (
+ <label key={item.value}>
+ <input
+ checked={value === item.value}
+ disabled={disabled || item.disabled}
+ type="radio"
+ value={item.value}
+ onChange={() => onChange?.(item.value)}
+ />
+ {item.label}
+ </label>
+ );
+ })}
+ </div>
+ ),
Switch: ({
checked,
disabled,
diff --git a/src/routes/(main)/settings/proxy/features/ProxyForm.tsx b/src/routes/(main)/settings/proxy/features/ProxyForm.tsx
index 24926409751..b1f71226dec 100644
--- a/src/routes/(main)/settings/proxy/features/ProxyForm.tsx
+++ b/src/routes/(main)/settings/proxy/features/ProxyForm.tsx
@@ -3,8 +3,8 @@
import { type NetworkProxySettings } from '@lobechat/electron-client-ipc';
import { type FormGroupItemType } from '@lobehub/ui';
import { Flexbox, Form, Skeleton, toast } from '@lobehub/ui';
-import { Button, Switch } from '@lobehub/ui/base-ui';
-import { Form as AntdForm, Input, Radio } from 'antd';
+import { Button, RadioGroup, Switch } from '@lobehub/ui/base-ui';
+import { Form as AntdForm, Input } from 'antd';
import { useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -227,11 +227,10 @@ const ProxyForm = () => {
children: [
{
children: (
- <Radio.Group disabled={!isEnableProxy}>
- <Radio value="http">HTTP</Radio>
- <Radio value="https">HTTPS</Radio>
- <Radio value="socks5">SOCKS5</Radio>
- </Radio.Group>
+ <RadioGroup
+ disabled={!isEnableProxy}
+ options={PROXY_TYPES.map((type) => ({ label: type.toUpperCase(), value: type }))}
+ />
),
label: t('proxy.type'),
minWidth: undefined,