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.

💄 style(imessage): wrap BlueBubbles bridge config into a connection card (#15342)

Arvin Xuc27b62e10c89
diff --git a/locales/en-US/agent.json b/locales/en-US/agent.json
index 7be31a4e1c8..550b8c6c963 100644
--- a/locales/en-US/agent.json
+++ b/locales/en-US/agent.json
@@ -106,6 +106,7 @@
"channel.imessage.blueBubblesPasswordHint": "Stored locally in LobeHub Desktop and used only to call the local BlueBubbles server.",
"channel.imessage.blueBubblesServerUrl": "BlueBubbles Server URL",
"channel.imessage.blueBubblesServerUrlHint": "The local BlueBubbles server URL reachable from this Desktop app.",
+ "channel.imessage.blueBubblesServerUrlTip": "If BlueBubbles and LobeHub Desktop run on the same Mac, use 127.0.0.1; if they run on different devices, enter the LAN IP.",
"channel.imessage.bridgeEnabled": "Enable Bridge",
"channel.imessage.bridgeEnabledHint": "When enabled, LobeHub Desktop receives local BlueBubbles webhooks and forwards them to LobeHub.",
"channel.imessage.bridgeMissingApplicationId": "Enter the Application ID first.",
@@ -116,11 +117,22 @@
"channel.imessage.bridgeRefresh": "Refresh",
"channel.imessage.bridgeRefreshFailed": "Failed to refresh iMessage Desktop bridge",
"channel.imessage.bridgeRunning": "Running",
+ "channel.imessage.bridgeRunningDesc": "This local relay forwards iMessage messages to LobeHub. You can now test the BlueBubbles connection.",
+ "channel.imessage.bridgeRunningDescListening": "Listening on {url}, relaying iMessage messages to LobeHub. You can now test the BlueBubbles connection.",
+ "channel.imessage.bridgeRunningTitle": "Bridge service running",
"channel.imessage.bridgeSave": "Save Bridge",
"channel.imessage.bridgeSaveFailed": "Failed to save iMessage Desktop bridge",
"channel.imessage.bridgeSaved": "iMessage Desktop bridge saved",
+ "channel.imessage.bridgeSectionDesc": "Confirm the Server URL and password first, then enable the bridge and test the connection.",
+ "channel.imessage.bridgeSectionTitle": "BlueBubbles Connection",
+ "channel.imessage.bridgeStatusConnected": "Connected",
+ "channel.imessage.bridgeStatusFailed": "Connection Failed",
+ "channel.imessage.bridgeStatusPending": "Pending Test",
"channel.imessage.bridgeStopped": "Stopped",
+ "channel.imessage.bridgeStoppedDesc": "Enable the bridge to relay iMessage messages to LobeHub, then test the connection.",
+ "channel.imessage.bridgeStoppedTitle": "Bridge service stopped",
"channel.imessage.bridgeTest": "Test BlueBubbles",
+ "channel.imessage.bridgeTestDisabledHint": "Enable the bridge service first.",
"channel.imessage.bridgeTestFailed": "BlueBubbles test failed",
"channel.imessage.bridgeTestSuccess": "BlueBubbles connection passed",
"channel.imessage.description": "Connect this assistant to iMessage through the local LobeHub Desktop BlueBubbles bridge.",
diff --git a/locales/zh-CN/agent.json b/locales/zh-CN/agent.json
index 044e730e639..d22c4139cd5 100644
--- a/locales/zh-CN/agent.json
+++ b/locales/zh-CN/agent.json
@@ -106,6 +106,7 @@
"channel.imessage.blueBubblesPasswordHint": "仅保存在 LobeHub Desktop 本地,用于访问本机 BlueBubbles Server。",
"channel.imessage.blueBubblesServerUrl": "BlueBubbles Server URL",
"channel.imessage.blueBubblesServerUrlHint": "当前桌面端可以访问到的本机 BlueBubbles Server 地址。",
+ "channel.imessage.blueBubblesServerUrlTip": "如果 BlueBubbles 与 LobeHub Desktop 运行在同一台 Mac 上,建议使用 127.0.0.1;如果在其他设备上,请填写局域网 IP。",
"channel.imessage.bridgeEnabled": "启用桥接",
"channel.imessage.bridgeEnabledHint": "启用后,LobeHub Desktop 会接收本机 BlueBubbles webhook 并转发给 LobeHub。",
"channel.imessage.bridgeMissingApplicationId": "请先填写 Application ID。",
@@ -116,11 +117,22 @@
"channel.imessage.bridgeRefresh": "刷新",
"channel.imessage.bridgeRefreshFailed": "刷新 iMessage Desktop 桥接失败",
"channel.imessage.bridgeRunning": "运行中",
+ "channel.imessage.bridgeRunningDesc": "本地中继正在把 iMessage 消息转发到 LobeHub,可进行 BlueBubbles 连接测试。",
+ "channel.imessage.bridgeRunningDescListening": "正在监听 {url},把 iMessage 消息中继到 LobeHub,可进行 BlueBubbles 连接测试。",
+ "channel.imessage.bridgeRunningTitle": "桥接服务运行中",
"channel.imessage.bridgeSave": "保存桥接",
"channel.imessage.bridgeSaveFailed": "保存 iMessage Desktop 桥接失败",
"channel.imessage.bridgeSaved": "iMessage Desktop 桥接已保存",
+ "channel.imessage.bridgeSectionDesc": "先确认 Server URL 和密码,再开启桥接并测试连接。",
+ "channel.imessage.bridgeSectionTitle": "BlueBubbles 连接配置",
+ "channel.imessage.bridgeStatusConnected": "已连接",
+ "channel.imessage.bridgeStatusFailed": "连接失败",
+ "channel.imessage.bridgeStatusPending": "待测试",
"channel.imessage.bridgeStopped": "已停止",
+ "channel.imessage.bridgeStoppedDesc": "开启桥接后,LobeHub Desktop 会把 iMessage 消息中继到 LobeHub,并可测试连接。",
+ "channel.imessage.bridgeStoppedTitle": "桥接服务已停止",
"channel.imessage.bridgeTest": "测试 BlueBubbles",
+ "channel.imessage.bridgeTestDisabledHint": "请先启用桥接服务",
"channel.imessage.bridgeTestFailed": "BlueBubbles 测试失败",
"channel.imessage.bridgeTestSuccess": "BlueBubbles 连接测试通过",
"channel.imessage.description": "通过 LobeHub Desktop 本地 BlueBubbles 桥接将助手连接到 iMessage。",
diff --git a/packages/builtin-tool-claude-code/src/client/Inspector/WebFetch.tsx b/packages/builtin-tool-claude-code/src/client/Inspector/WebFetch.tsx
index 7029ea0d48c..2b2315550c8 100644
--- a/packages/builtin-tool-claude-code/src/client/Inspector/WebFetch.tsx
+++ b/packages/builtin-tool-claude-code/src/client/Inspector/WebFetch.tsx
@@ -3,6 +3,7 @@
import { inspectorTextStyles, shinyTextStyles } from '@lobechat/shared-tool-ui/styles';
import type { BuiltinInspectorProps } from '@lobechat/types';
import { createStaticStyles, cx } from 'antd-style';
+import { Globe } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -13,22 +14,31 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
overflow: hidden;
display: inline-flex;
flex-shrink: 1;
+ gap: 6px;
align-items: center;
min-width: 0;
- max-width: 60%;
margin-inline-start: 6px;
- padding-block: 1px;
- padding-inline: 8px;
+ padding-block: 2px;
+ padding-inline: 10px;
border-radius: 999px;
+ background: ${cssVar.colorFillTertiary};
+ `,
+ icon: css`
+ flex-shrink: 0;
+ color: ${cssVar.colorTextDescription};
+ `,
+ url: css`
+ overflow: hidden;
+
+ min-width: 0;
+
font-family: ${cssVar.fontFamilyCode};
font-size: 12px;
color: ${cssVar.colorText};
text-overflow: ellipsis;
white-space: nowrap;
-
- background: ${cssVar.colorFillTertiary};
`,
}));
@@ -53,7 +63,12 @@ export const WebFetchInspector = memo<BuiltinInspectorProps<WebFetchArgs>>(
return (
<div className={cx(inspectorTextStyles.root, isShiny && shinyTextStyles.shinyText)}>
<span>{url ? `${label}:` : label}</span>
- {url && <span className={styles.chip}>{stripProtocol(url)}</span>}
+ {url && (
+ <span className={styles.chip}>
+ <Globe className={styles.icon} size={14} />
+ <span className={styles.url}>{stripProtocol(url)}</span>
+ </span>
+ )}
</div>
);
},
diff --git a/src/locales/default/agent.ts b/src/locales/default/agent.ts
index eb668fd468d..5e8901f3bf2 100644
--- a/src/locales/default/agent.ts
+++ b/src/locales/default/agent.ts
@@ -68,9 +68,26 @@ export default {
'channel.imessage.blueBubblesServerUrl': 'BlueBubbles Server URL',
'channel.imessage.blueBubblesServerUrlHint':
'The local BlueBubbles server URL reachable from this Desktop app.',
+ 'channel.imessage.blueBubblesServerUrlTip':
+ 'If BlueBubbles and LobeHub Desktop run on the same Mac, use 127.0.0.1; if they run on different devices, enter the LAN IP.',
'channel.imessage.bridgeEnabled': 'Enable Bridge',
'channel.imessage.bridgeEnabledHint':
'When enabled, LobeHub Desktop receives local BlueBubbles webhooks and forwards them to LobeHub.',
+ 'channel.imessage.bridgeRunningDesc':
+ 'This local relay forwards iMessage messages to LobeHub. You can now test the BlueBubbles connection.',
+ 'channel.imessage.bridgeRunningDescListening':
+ 'Listening on {url}, relaying iMessage messages to LobeHub. You can now test the BlueBubbles connection.',
+ 'channel.imessage.bridgeRunningTitle': 'Bridge service running',
+ 'channel.imessage.bridgeSectionDesc':
+ 'Confirm the Server URL and password first, then enable the bridge and test the connection.',
+ 'channel.imessage.bridgeSectionTitle': 'BlueBubbles Connection',
+ 'channel.imessage.bridgeStatusConnected': 'Connected',
+ 'channel.imessage.bridgeStatusFailed': 'Connection Failed',
+ 'channel.imessage.bridgeStatusPending': 'Pending Test',
+ 'channel.imessage.bridgeStoppedDesc':
+ 'Enable the bridge to relay iMessage messages to LobeHub, then test the connection.',
+ 'channel.imessage.bridgeStoppedTitle': 'Bridge service stopped',
+ 'channel.imessage.bridgeTestDisabledHint': 'Enable the bridge service first.',
'channel.imessage.bridgeMissingApplicationId': 'Enter the Application ID first.',
'channel.imessage.bridgeMissingPassword': 'Enter the BlueBubbles password first.',
'channel.imessage.bridgeMissingServerUrl': 'Enter the BlueBubbles Server URL first.',
diff --git a/src/routes/(main)/agent/channel/platform/imessage/CredentialExtras.tsx b/src/routes/(main)/agent/channel/platform/imessage/CredentialExtras.tsx
index 383970b320b..a520c7c35ab 100644
--- a/src/routes/(main)/agent/channel/platform/imessage/CredentialExtras.tsx
+++ b/src/routes/(main)/agent/channel/platform/imessage/CredentialExtras.tsx
@@ -1,33 +1,71 @@
'use client';
import { isDesktop } from '@lobechat/const';
-import type {
- ImessageBridgeConfig,
- ImessageBridgePublicConfig,
-} from '@lobechat/electron-client-ipc';
+import type { ImessageBridgeConfig, ImessageBridgeStatus } from '@lobechat/electron-client-ipc';
import { Flexbox, FormItem, Tag, Text } from '@lobehub/ui';
import { App, Button, Form as AntdForm, Switch } from 'antd';
-import { RefreshCw, TestTube2 } from 'lucide-react';
+import { createStaticStyles } from 'antd-style';
+import { Info, Wrench } from 'lucide-react';
import { memo, use, useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { FormInput, FormPassword } from '@/components/FormInput';
+import { useClientDataSWR } from '@/libs/swr';
import { gatewayConnectionService } from '@/services/electron/gatewayConnection';
import { imessageBridgeService } from '@/services/electron/imessageBridge';
import { ChannelPostSaveContext } from '../../detail/postSaveContext';
-interface BridgeFormState {
- blueBubblesPassword: string;
- blueBubblesServerUrl: string;
- enabled: boolean;
-}
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ card: css`
+ margin-block: 8px;
+ padding: 20px;
+ border: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: ${cssVar.borderRadiusLG};
-const DEFAULT_BRIDGE_FORM: BridgeFormState = {
- blueBubblesPassword: '',
- blueBubblesServerUrl: '',
- enabled: true,
-};
+ background: ${cssVar.colorBgContainer};
+ `,
+ headerIcon: css`
+ overflow: hidden;
+ flex: none;
+
+ width: 44px;
+ height: 44px;
+ border: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: ${cssVar.borderRadiusLG};
+
+ img {
+ width: 100%;
+ height: 100%;
+ object-fit: contain;
+ }
+ `,
+ infoBox: css`
+ padding-block: 8px;
+ padding-inline: 12px;
+ border-radius: ${cssVar.borderRadius};
+
+ line-height: 1.6;
+ color: ${cssVar.colorTextSecondary};
+
+ background: ${cssVar.colorFillQuaternary};
+ `,
+ statusCard: css`
+ padding: 12px;
+ border-radius: ${cssVar.borderRadiusLG};
+ background: ${cssVar.colorFillQuaternary};
+ `,
+ title: css`
+ font-size: 15px;
+ font-weight: 600;
+ `,
+}));
+
+type TestStatus = 'idle' | 'success' | 'failed';
+
+const BLUEBUBBLES_ICON_URL = 'https://bluebubbles.app/web/splash/img/light-2x.png';
+
+const BRIDGE_STATUS_KEY = 'imessage-bridge-status';
const getErrorMessage = (error: unknown) =>
error instanceof Error ? error.message : String(error);
@@ -38,14 +76,42 @@ const CredentialExtras = memo(() => {
const { message } = App.useApp();
const form = AntdForm.useFormInstance();
const applicationId = AntdForm.useWatch('applicationId', form) as string | undefined;
+ const appId = applicationId?.trim();
const postSave = use(ChannelPostSaveContext);
- const [bridgeForm, setBridgeForm] = useState<BridgeFormState>(DEFAULT_BRIDGE_FORM);
- const [loading, setLoading] = useState(false);
- const [passwordSet, setPasswordSet] = useState(false);
- const [running, setRunning] = useState(false);
- const [serverUrl, setServerUrl] = useState<string>();
+ // Source of truth: the bridge status lives in the Electron main process. Read
+ // it through SWR (revalidates on focus + after each mutation) instead of
+ // caching a copy that can drift — so there's no manual Refresh to keep in sync.
+ const { data: status, mutate } = useClientDataSWR<ImessageBridgeStatus | undefined>(
+ isDesktop ? BRIDGE_STATUS_KEY : null,
+ () => imessageBridgeService.getStatus(),
+ );
+
+ const savedConfig = status?.configs.find((config) => config.applicationId === appId);
+ const enabled = savedConfig?.enabled ?? false;
+ const passwordSet = savedConfig?.blueBubblesPasswordSet ?? false;
+ const running = status?.running ?? false;
+ const serverUrl = status?.serverUrl;
+ // The loopback server is shared across bot configs; scope the displayed state
+ // to this bot by folding in its (SoT) enable flag.
+ const bridgeActive = running && enabled;
+
+ // Draft credentials the operator types — kept local until a save action (the
+ // unified "Save Configuration" click, or flipping Enable on) persists them.
+ const [serverUrlInput, setServerUrlInput] = useState('');
+ const [serverUrlDirty, setServerUrlDirty] = useState(false);
+ const [passwordInput, setPasswordInput] = useState('');
+ const [testStatus, setTestStatus] = useState<TestStatus>('idle');
const [testing, setTesting] = useState(false);
+ const [toggling, setToggling] = useState(false);
+ const [optimisticEnabled, setOptimisticEnabled] = useState<boolean | null>(null);
+
+ // Seed the Server URL input from the saved config once it loads, unless the
+ // operator has already started editing it.
+ const savedServerUrl = savedConfig?.blueBubblesServerUrl;
+ useEffect(() => {
+ if (!serverUrlDirty && savedServerUrl) setServerUrlInput(savedServerUrl);
+ }, [savedServerUrl, serverUrlDirty]);
const fillDesktopDeviceId = useCallback(async () => {
const deviceInfo = await gatewayConnectionService.getDeviceInfo();
@@ -66,77 +132,57 @@ const CredentialExtras = memo(() => {
return generated;
}, [form]);
- const refreshStatus = useCallback(async () => {
- if (!isDesktop) return;
+ // Build + validate the bridge config from the current draft. Throws (rather
+ // than warning + returning) so each caller can surface the error.
+ const buildBridgeConfig = useCallback(
+ (enabledValue: boolean): ImessageBridgeConfig => {
+ const blueBubblesServerUrl = serverUrlInput.trim();
+ const blueBubblesPassword = passwordInput.trim();
- setLoading(true);
- try {
+ if (!appId) throw new Error(t('channel.imessage.bridgeMissingApplicationId'));
+ if (!blueBubblesServerUrl) throw new Error(t('channel.imessage.bridgeMissingServerUrl'));
+ if (!blueBubblesPassword && !passwordSet) {
+ throw new Error(t('channel.imessage.bridgeMissingPassword'));
+ }
+
+ return {
+ applicationId: appId,
+ blueBubblesPassword: blueBubblesPassword || undefined,
+ blueBubblesServerUrl,
+ enabled: enabledValue,
+ webhookSecret: ensureWebhookSecret(),
+ };
+ },
+ [appId, serverUrlInput, passwordInput, passwordSet, ensureWebhookSecret, t],
+ );
+
+ // Persist the draft to the main process and revalidate the SoT. Enabling also
+ // starts the loopback server + registers the BlueBubbles webhook (which needs
+ // a valid Server URL + password), so the toggle reuses this same path.
+ const persistConfig = useCallback(
+ async (enabledValue: boolean) => {
+ const config = buildBridgeConfig(enabledValue);
await fillDesktopDeviceId();
- const status = await imessageBridgeService.getStatus();
- const savedConfig = status.configs.find(
- (config: ImessageBridgePublicConfig) => config.applicationId === applicationId?.trim(),
- );
-
- setBridgeForm(
- savedConfig
- ? {
- blueBubblesPassword: '',
- blueBubblesServerUrl: savedConfig.blueBubblesServerUrl,
- enabled: savedConfig.enabled,
- }
- : DEFAULT_BRIDGE_FORM,
- );
- setPasswordSet(Boolean(savedConfig?.blueBubblesPasswordSet));
- setRunning(status.running);
- setServerUrl(status.serverUrl);
- } catch (error) {
- message.error(`${t('channel.imessage.bridgeRefreshFailed')}: ${getErrorMessage(error)}`);
- } finally {
- setLoading(false);
- }
- }, [applicationId, fillDesktopDeviceId, message, t]);
-
- // Build + validate the bridge config. Throws (rather than warning + returning)
- // so the unified save flow and the Test button can each surface the error.
- const buildBridgeConfig = useCallback((): ImessageBridgeConfig => {
- const appId = applicationId?.trim();
- const blueBubblesServerUrl = bridgeForm.blueBubblesServerUrl.trim();
- const blueBubblesPassword = bridgeForm.blueBubblesPassword.trim();
-
- if (!appId) throw new Error(t('channel.imessage.bridgeMissingApplicationId'));
- if (!blueBubblesServerUrl) throw new Error(t('channel.imessage.bridgeMissingServerUrl'));
- if (!blueBubblesPassword && !passwordSet) {
- throw new Error(t('channel.imessage.bridgeMissingPassword'));
- }
+ await imessageBridgeService.upsertConfig(config);
+ setPasswordInput('');
+ setTestStatus('idle');
+ await mutate();
+ },
+ [buildBridgeConfig, fillDesktopDeviceId, mutate],
+ );
- return {
- applicationId: appId,
- blueBubblesPassword: blueBubblesPassword || undefined,
- blueBubblesServerUrl,
- enabled: bridgeForm.enabled,
- webhookSecret: ensureWebhookSecret(),
- };
- }, [applicationId, bridgeForm, passwordSet, ensureWebhookSecret, t]);
-
- // Persist the Desktop-only bridge config. Registered as a post-save effect so
- // it runs as part of the single "Save Configuration" click.
+ // Persist as part of the single "Save Configuration" click. Skip when there's
+ // nothing to save so an untouched bridge never blocks the channel save.
const saveBridge = useCallback(async () => {
- const config = buildBridgeConfig();
- await fillDesktopDeviceId();
- await imessageBridgeService.upsertConfig(config);
- await refreshStatus();
- }, [buildBridgeConfig, fillDesktopDeviceId, refreshStatus]);
+ if (!serverUrlInput.trim() && !savedConfig) return;
+ await persistConfig(enabled);
+ }, [persistConfig, serverUrlInput, savedConfig, enabled]);
- useEffect(() => {
- void refreshStatus();
- }, [refreshStatus]);
-
- // Seed a webhook secret as soon as the form is ready so the saved cloud
- // provider always carries one.
useEffect(() => {
if (!isDesktop) return;
+ void fillDesktopDeviceId();
ensureWebhookSecret();
- }, [applicationId, ensureWebhookSecret]);
+ }, [applicationId, fillDesktopDeviceId, ensureWebhookSecret]);
// Hook the bridge save into the main "Save Configuration" flow.
useEffect(() => {
@@ -147,89 +193,157 @@ const CredentialExtras = memo(() => {
if (!isDesktop) return null;
+ // Enabling is a write-through mutation: it auto-saves the current draft and
+ // starts/stops the bridge immediately, so the toggle reflects the real state.
+ const handleToggleEnabled = async (next: boolean) => {
+ setToggling(true);
+ setOptimisticEnabled(next);
+ try {
+ await persistConfig(next);
+ } catch (error) {
+ message.error(getErrorMessage(error));
+ } finally {
+ setOptimisticEnabled(null);
+ setToggling(false);
+ }
+ };
+
+ // Testing pings BlueBubbles directly — independent of whether the bridge is
+ // enabled/running. It only needs a reachable Server URL + password.
+ const canTest = Boolean(appId && serverUrlInput.trim() && (passwordInput.trim() || passwordSet));
+
const handleTest = async () => {
setTesting(true);
try {
- const config = buildBridgeConfig();
+ const config = buildBridgeConfig(enabled);
await imessageBridgeService.testConfig(config);
+ setTestStatus('success');
message.success(t('channel.imessage.bridgeTestSuccess'));
} catch (error) {
+ setTestStatus('failed');
message.error(`${t('channel.imessage.bridgeTestFailed')}: ${getErrorMessage(error)}`);
} finally {
setTesting(false);
}
};
+ const statusBadge = {
+ failed: { color: 'red', text: t('channel.imessage.bridgeStatusFailed') },
+ idle: { color: 'gold', text: t('channel.imessage.bridgeStatusPending') },
+ success: { color: 'green', text: t('channel.imessage.bridgeStatusConnected') },
+ }[testStatus];
+
+ // `{url}` is a single-brace placeholder (react-i18next only parses `{{ }}`),
+ // so it never registers as a namespace interpolation variable — keeping the
+ // typed `t`/`Trans` inference for the whole `agent` namespace untouched.
+ const bridgeDesc = bridgeActive
+ ? serverUrl
+ ? t('channel.imessage.bridgeRunningDescListening').replace('{url}', serverUrl)
+ : t('channel.imessage.bridgeRunningDesc')
+ : t('channel.imessage.bridgeStoppedDesc');
+
return (
- <>
+ <Flexbox className={styles.card}>
+ {/* Top: logo spanning both lines, then title + status and the subtitle.
+ Reserve breathing room below so the header doesn't crowd the form. */}
+ <Flexbox horizontal align="center" gap={12} style={{ marginBlockEnd: 24 }}>
+ <Flexbox align="center" className={styles.headerIcon} justify="center">
+ <img alt="BlueBubbles" src={BLUEBUBBLES_ICON_URL} />
+ </Flexbox>
+ <Flexbox gap={4}>
+ <Flexbox horizontal align="center" gap={8}>
+ <Text className={styles.title}>{t('channel.imessage.bridgeSectionTitle')}</Text>
+ <Tag color={statusBadge.color}>{statusBadge.text}</Tag>
+ </Flexbox>
+ <Text type="secondary">{t('channel.imessage.bridgeSectionDesc')}</Text>
+ </Flexbox>
+ </Flexbox>
+
+ {/* Middle: the credential fields the operator fills in. */}
<FormItem
- divider
desc={t('channel.imessage.blueBubblesServerUrlHint')}
label={t('channel.imessage.blueBubblesServerUrl')}
- minWidth={'max(50%, 400px)'}
+ minWidth={'max(50%, 360px)'}
variant="borderless"
>
- <FormInput
- placeholder="http://127.0.0.1:1234"
- value={bridgeForm.blueBubblesServerUrl}
- onChange={(value) =>
- setBridgeForm((previous) => ({ ...previous, blueBubblesServerUrl: value }))
- }
- />
+ <Flexbox gap={8}>
+ <FormInput
+ placeholder="http://127.0.0.1:1234"
+ value={serverUrlInput}
+ onChange={(value) => {
+ setServerUrlInput(value);
+ setServerUrlDirty(true);
+ setTestStatus('idle');
+ }}
+ />
+ <Flexbox horizontal align="flex-start" className={styles.infoBox} gap={8}>
+ <Info size={14} style={{ flex: 'none', marginBlockStart: 3 }} />
+ <Text fontSize={12} type="secondary">
+ {t('channel.imessage.blueBubblesServerUrlTip')}
+ </Text>
+ </Flexbox>
+ </Flexbox>
</FormItem>
<FormItem
divider
desc={t('channel.imessage.blueBubblesPasswordHint')}
label={t('channel.imessage.blueBubblesPassword')}
- minWidth={'max(50%, 400px)'}
+ minWidth={'max(50%, 360px)'}
variant="borderless"
>
<FormPassword
autoComplete="new-password"
placeholder={passwordSet ? t('channel.imessage.bridgePasswordSavedPlaceholder') : ''}
- value={bridgeForm.blueBubblesPassword}
- onChange={(value) =>
- setBridgeForm((previous) => ({ ...previous, blueBubblesPassword: value }))
- }
+ value={passwordInput}
+ onChange={(value) => {
+ setPasswordInput(value);
+ setTestStatus('idle');
+ }}
/>
</FormItem>
- <FormItem
- divider
- desc={t('channel.imessage.bridgeEnabledHint')}
- label={t('channel.imessage.bridgeEnabled')}
- minWidth={'max(50%, 400px)'}
- variant="borderless"
- >
- <Switch
- checked={bridgeForm.enabled}
- onChange={(enabled) => setBridgeForm((previous) => ({ ...previous, enabled }))}
- />
- </FormItem>
- <Flexbox horizontal align="center" gap={8} style={{ marginBlockStart: 8 }}>
- <Tag color={running ? 'green' : 'default'}>
- {running ? t('channel.imessage.bridgeRunning') : t('channel.imessage.bridgeStopped')}
- </Tag>
- {serverUrl && (
- <Text fontSize={12} type="secondary">
- {serverUrl}
- </Text>
- )}
- <Button
- icon={<RefreshCw size={14} />}
- loading={loading}
- size="small"
- type="text"
- onClick={refreshStatus}
- >
- {t('channel.imessage.bridgeRefresh')}
- </Button>
- </Flexbox>
- <Flexbox horizontal gap={8} style={{ marginBlockStart: 12 }}>
- <Button icon={<TestTube2 size={14} />} loading={testing} onClick={handleTest}>
- {t('channel.imessage.bridgeTest')}
- </Button>
+
+ {/* Bottom: row 1 — service status + the Enable toggle (write-through);
+ row 2 — the connection test. */}
+ <Flexbox className={styles.statusCard} gap={12} style={{ marginBlockStart: 16 }}>
+ <Flexbox horizontal align="center" gap={16} justify="space-between">
+ <Flexbox gap={2}>
+ <Flexbox horizontal align="center" gap={8}>
+ <Text style={{ fontWeight: 500 }}>
+ {bridgeActive
+ ? t('channel.imessage.bridgeRunningTitle')
+ : t('channel.imessage.bridgeStoppedTitle')}
+ </Text>
+ <Tag color={bridgeActive ? 'green' : 'default'}>
+ {bridgeActive
+ ? t('channel.imessage.bridgeRunning')
+ : t('channel.imessage.bridgeStopped')}
+ </Tag>
+ </Flexbox>
+ <Text fontSize={12} type="secondary">
+ {bridgeDesc}
+ </Text>
+ </Flexbox>
+ <Flexbox horizontal align="center" gap={8} style={{ flex: 'none' }}>
+ <Text style={{ fontWeight: 500 }}>{t('channel.imessage.bridgeEnabled')}</Text>
+ <Switch
+ checked={optimisticEnabled ?? enabled}
+ loading={toggling}
+ onChange={handleToggleEnabled}
+ />
+ </Flexbox>
+ </Flexbox>
+ <Flexbox horizontal align="center" gap={12} justify="flex-end">
+ <Button
+ disabled={!canTest}
+ icon={<Wrench size={14} />}
+ loading={testing}
+ onClick={handleTest}
+ >
+ {t('channel.imessage.bridgeTest')}
+ </Button>
+ </Flexbox>
</Flexbox>
- </>
+ </Flexbox>
);
});