From a81d0327d206dc967edc8bba7ef37d0b4db4b589 Mon Sep 17 00:00:00 2001 From: yyh Date: Tue, 13 Jan 2026 11:04:11 +0800 Subject: [PATCH] feat(sandbox-provider): update UI to match Figma design - Update settings icon to RiEqualizer2Line - Add 4px rounded container for provider icons in config modal - Update section titles to uppercase style - Change switch modal confirm button to warning variant - Add i18n keys for setAsActive, readDocLink, securityTip --- .../sandbox-provider-page/config-modal.tsx | 131 ++++++++++++------ .../sandbox-provider-page/index.tsx | 4 +- .../sandbox-provider-page/provider-card.tsx | 74 ++++++---- .../sandbox-provider-page/switch-modal.tsx | 2 +- web/i18n/en-US/common.json | 14 +- web/i18n/zh-Hans/common.json | 10 +- 6 files changed, 151 insertions(+), 84 deletions(-) diff --git a/web/app/components/header/account-setting/sandbox-provider-page/config-modal.tsx b/web/app/components/header/account-setting/sandbox-provider-page/config-modal.tsx index 0a35261bb9..6a71097772 100644 --- a/web/app/components/header/account-setting/sandbox-provider-page/config-modal.tsx +++ b/web/app/components/header/account-setting/sandbox-provider-page/config-modal.tsx @@ -2,7 +2,7 @@ import type { FormRefObject, FormSchema } from '@/app/components/base/form/types' import type { SandboxProvider } from '@/service/use-sandbox-provider' -import { RiExternalLinkLine } from '@remixicon/react' +import { RiExternalLinkLine, RiLock2Fill } from '@remixicon/react' import { memo, useCallback, useMemo, useRef } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/app/components/base/button' @@ -22,6 +22,27 @@ type ConfigModalProps = { onClose: () => void } +const PROVIDER_ICONS: Record = { + e2b: '/sandbox-providers/e2b.svg', + daytona: '/sandbox-providers/daytona.svg', + docker: '/sandbox-providers/docker.svg', + local: '/sandbox-providers/local.svg', +} + +const ProviderIcon = ({ providerType }: { providerType: string }) => { + const iconSrc = PROVIDER_ICONS[providerType] || PROVIDER_ICONS.e2b + + return ( +
+ {`${providerType} +
+ ) +} + const ConfigModal = ({ provider, onClose, @@ -91,54 +112,78 @@ const ConfigModal = ({ -
- + {/* Provider subtitle */} +
+ + {provider.label} +
- {/* Footer Actions */} -
- -
- {isConfigured && ( - - )} - -
+ {t('sandboxProvider.configModal.readDocLink', { ns: 'common', provider: provider.label })} + + + )}
+
+ {isConfigured && ( + + )} + + +
+
+ + {/* Security tip */} +
+ +

+ {t('sandboxProvider.configModal.securityTip', { ns: 'common' })} + {' '} + PKCS1_OAEP + {' '} + {t('sandboxProvider.configModal.securityTipTechnology', { ns: 'common' })} +

) diff --git a/web/app/components/header/account-setting/sandbox-provider-page/index.tsx b/web/app/components/header/account-setting/sandbox-provider-page/index.tsx index f677fbc793..87c7481af3 100644 --- a/web/app/components/header/account-setting/sandbox-provider-page/index.tsx +++ b/web/app/components/header/account-setting/sandbox-provider-page/index.tsx @@ -41,7 +41,7 @@ const SandboxProviderPage = () => { {/* Current Provider Section */} {currentProvider && (
-
+
{t('sandboxProvider.currentProvider', { ns: 'common' })}
{ {/* Other Providers Section */} {otherProviders.length > 0 && (
-
+
{t('sandboxProvider.otherProvider', { ns: 'common' })}
diff --git a/web/app/components/header/account-setting/sandbox-provider-page/provider-card.tsx b/web/app/components/header/account-setting/sandbox-provider-page/provider-card.tsx index c84dc8ede3..e4c3cfc92d 100644 --- a/web/app/components/header/account-setting/sandbox-provider-page/provider-card.tsx +++ b/web/app/components/header/account-setting/sandbox-provider-page/provider-card.tsx @@ -1,6 +1,7 @@ 'use client' import type { SandboxProvider } from '@/service/use-sandbox-provider' +import { RiEqualizer2Line } from '@remixicon/react' import { memo } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/app/components/base/button' @@ -17,6 +18,7 @@ type ProviderCardProps = { const PROVIDER_ICONS: Record = { e2b: '/sandbox-providers/e2b.svg', + daytona: '/sandbox-providers/daytona.svg', docker: '/sandbox-providers/docker.svg', local: '/sandbox-providers/local.svg', } @@ -28,7 +30,7 @@ const ProviderIcon = ({ providerType }: { providerType: string }) => { {`${providerType} ) } @@ -47,50 +49,62 @@ const ProviderCard = ({ return (
-
- {/* Icon */} -
- -
+ {/* Icon - 40x40 with 10px rounded */} +
+ +
- {/* Content */} -
-
- - {provider.label} + {/* Content */} +
+
+ + {provider.label} + + {provider.is_system_configured && ( + + {t('sandboxProvider.managedBySaas', { ns: 'common' })} - {provider.is_system_configured && ( - - {t('sandboxProvider.managedBySaas', { ns: 'common' })} - - )} -
-
- {provider.description} -
+ )} +
+
+ {provider.description}
- {/* Right side: Connected Badge + Actions */} + {/* Right side: Connected Badge + Divider + Settings Icon + Enable Button */}
+ {/* Connected Status */} {isConfigured && ( - + - {t('sandboxProvider.connected', { ns: 'common' })} + + {t('sandboxProvider.connected', { ns: 'common' })} + )} - + + + + {/* Set as Active Button */} {showEnableButton && ( )}
diff --git a/web/app/components/header/account-setting/sandbox-provider-page/switch-modal.tsx b/web/app/components/header/account-setting/sandbox-provider-page/switch-modal.tsx index a0d38e1b37..bb343b8dc5 100644 --- a/web/app/components/header/account-setting/sandbox-provider-page/switch-modal.tsx +++ b/web/app/components/header/account-setting/sandbox-provider-page/switch-modal.tsx @@ -79,7 +79,7 @@ const SwitchModal = ({ {t('sandboxProvider.switchModal.cancel', { ns: 'common' })}