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(connect-agent): open on this computer's agents, switch devices inline (#23691)

Arvin Xuc6e049700f7e
diff --git a/locales/ar/chat.json b/locales/ar/chat.json
index 9a5fc11f31d..e2418675496 100644
--- a/locales/ar/chat.json
+++ b/locales/ar/chat.json
@@ -270,8 +270,11 @@
"connectAgent.create.scanning": "جارٍ فحص الوكلاء على هذا الجهاز...",
"connectAgent.create.selectFirst": "اختر على الأقل وكيلًا واحدًا تم اكتشافه",
"connectAgent.create.stepAgents": "الخطوة 2 من 3 · {{device}}",
+ "connectAgent.create.stepAgentsInline": "Step 1 of 2 · {{device}}",
"connectAgent.create.stepConfirm": "الخطوة 3 من 3 · قم بتسمية الوكيل لقائمة الوكلاء الخاصة بك",
+ "connectAgent.create.stepConfirmInline": "Step 2 of 2 · Name it for your agent list",
"connectAgent.create.stepDevice": "الخطوة 1 من 3 · اختر الجهاز الذي يعمل عليه وكلاؤك — سيتم فحصه تلقائيًا.",
+ "connectAgent.create.switchDevice": "Run on",
"connectAgent.create.thisDevice": "هذا الجهاز",
"connectAgent.create.title": "اتصال الوكيل",
"connectAgent.providerDesc.amp": "وكيل البرمجة CLI من Sourcegraph",
diff --git a/locales/bg-BG/chat.json b/locales/bg-BG/chat.json
index a26c0248704..332788d794c 100644
--- a/locales/bg-BG/chat.json
+++ b/locales/bg-BG/chat.json
@@ -270,8 +270,11 @@
"connectAgent.create.scanning": "Сканиране на агенти на това устройство…",
"connectAgent.create.selectFirst": "Изберете поне един открит агент",
"connectAgent.create.stepAgents": "Стъпка 2 от 3 · {{device}}",
+ "connectAgent.create.stepAgentsInline": "Step 1 of 2 · {{device}}",
"connectAgent.create.stepConfirm": "Стъпка 3 от 3 · Дайте име за списъка с агенти",
+ "connectAgent.create.stepConfirmInline": "Step 2 of 2 · Name it for your agent list",
"connectAgent.create.stepDevice": "Стъпка 1 от 3 · Изберете машината, на която работят вашите агенти — тя ще бъде сканирана автоматично.",
+ "connectAgent.create.switchDevice": "Run on",
"connectAgent.create.thisDevice": "Това устройство",
"connectAgent.create.title": "Свържи агент",
"connectAgent.providerDesc.amp": "CLI агент за програмиране от Sourcegraph",
diff --git a/locales/de-DE/chat.json b/locales/de-DE/chat.json
index 82cbc5218c5..1e2f3929636 100644
--- a/locales/de-DE/chat.json
+++ b/locales/de-DE/chat.json
@@ -270,8 +270,11 @@
"connectAgent.create.scanning": "Agents auf diesem Gerät werden gescannt…",
"connectAgent.create.selectFirst": "Wählen Sie mindestens einen erkannten Agent aus",
"connectAgent.create.stepAgents": "Schritt 2 von 3 · {{device}}",
+ "connectAgent.create.stepAgentsInline": "Step 1 of 2 · {{device}}",
"connectAgent.create.stepConfirm": "Schritt 3 von 3 · Benennen Sie ihn für Ihre Agent-Liste",
+ "connectAgent.create.stepConfirmInline": "Step 2 of 2 · Name it for your agent list",
"connectAgent.create.stepDevice": "Schritt 1 von 3 · Wählen Sie das Gerät aus, auf dem Ihre Agents laufen — es wird automatisch gescannt.",
+ "connectAgent.create.switchDevice": "Run on",
"connectAgent.create.thisDevice": "Dieses Gerät",
"connectAgent.create.title": "Agent verbinden",
"connectAgent.providerDesc.amp": "Sourcegraph Coding Agent CLI",
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index 35c3cbd1134..46096e610ae 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -293,8 +293,11 @@
"connectAgent.create.scanning": "Scanning agents on this device…",
"connectAgent.create.selectFirst": "Select at least one detected agent",
"connectAgent.create.stepAgents": "Step 2 of 3 · {{device}}",
+ "connectAgent.create.stepAgentsInline": "Step 1 of 2 · {{device}}",
"connectAgent.create.stepConfirm": "Step 3 of 3 · Name it for your agent list",
+ "connectAgent.create.stepConfirmInline": "Step 2 of 2 · Name it for your agent list",
"connectAgent.create.stepDevice": "Step 1 of 3 · Pick the machine your agents run on — it will be scanned automatically.",
+ "connectAgent.create.switchDevice": "Run on",
"connectAgent.create.thisDevice": "This device",
"connectAgent.create.title": "Connect Agent",
"connectAgent.providerDesc.amp": "Sourcegraph coding agent CLI",
diff --git a/locales/es-ES/chat.json b/locales/es-ES/chat.json
index 408e6b7c0c0..69d8c209f62 100644
--- a/locales/es-ES/chat.json
+++ b/locales/es-ES/chat.json
@@ -270,8 +270,11 @@
"connectAgent.create.scanning": "Escaneando agentes en este dispositivo…",
"connectAgent.create.selectFirst": "Selecciona al menos un agente detectado",
"connectAgent.create.stepAgents": "Paso 2 de 3 · {{device}}",
+ "connectAgent.create.stepAgentsInline": "Step 1 of 2 · {{device}}",
"connectAgent.create.stepConfirm": "Paso 3 de 3 · Asígnale un nombre para tu lista de agentes",
+ "connectAgent.create.stepConfirmInline": "Step 2 of 2 · Name it for your agent list",
"connectAgent.create.stepDevice": "Paso 1 de 3 · Elige la máquina donde se ejecutan tus agentes — se escaneará automáticamente.",
+ "connectAgent.create.switchDevice": "Run on",
"connectAgent.create.thisDevice": "Este dispositivo",
"connectAgent.create.title": "Conectar agente",
"connectAgent.providerDesc.amp": "CLI del agente de codificación de Sourcegraph",
diff --git a/locales/fa-IR/chat.json b/locales/fa-IR/chat.json
index 0ff066caf41..c63ac0b9619 100644
--- a/locales/fa-IR/chat.json
+++ b/locales/fa-IR/chat.json
@@ -270,8 +270,11 @@
"connectAgent.create.scanning": "در حال اسکن عامل‌ها روی این دستگاه...",
"connectAgent.create.selectFirst": "حداقل یک عامل شناسایی شده را انتخاب کنید",
"connectAgent.create.stepAgents": "مرحله ۲ از ۳ · {{device}}",
+ "connectAgent.create.stepAgentsInline": "Step 1 of 2 · {{device}}",
"connectAgent.create.stepConfirm": "مرحله ۳ از ۳ · برای لیست عامل‌های خود نام‌گذاری کنید",
+ "connectAgent.create.stepConfirmInline": "Step 2 of 2 · Name it for your agent list",
"connectAgent.create.stepDevice": "مرحله ۱ از ۳ · دستگاهی که عامل‌های شما روی آن اجرا می‌شوند را انتخاب کنید — به طور خودکار اسکن خواهد شد.",
+ "connectAgent.create.switchDevice": "Run on",
"connectAgent.create.thisDevice": "این دستگاه",
"connectAgent.create.title": "اتصال عامل",
"connectAgent.providerDesc.amp": "CLI عامل کدنویسی Sourcegraph",
diff --git a/locales/fr-FR/chat.json b/locales/fr-FR/chat.json
index c0c0c12c03c..2cf9a1f669d 100644
--- a/locales/fr-FR/chat.json
+++ b/locales/fr-FR/chat.json
@@ -270,8 +270,11 @@
"connectAgent.create.scanning": "Analyse des agents sur cet appareil…",
"connectAgent.create.selectFirst": "Sélectionnez au moins un agent détecté",
"connectAgent.create.stepAgents": "Étape 2 sur 3 · {{device}}",
+ "connectAgent.create.stepAgentsInline": "Step 1 of 2 · {{device}}",
"connectAgent.create.stepConfirm": "Étape 3 sur 3 · Nommez-le pour votre liste d'agents",
+ "connectAgent.create.stepConfirmInline": "Step 2 of 2 · Name it for your agent list",
"connectAgent.create.stepDevice": "Étape 1 sur 3 · Choisissez la machine sur laquelle vos agents s'exécutent — elle sera analysée automatiquement.",
+ "connectAgent.create.switchDevice": "Run on",
"connectAgent.create.thisDevice": "Cet appareil",
"connectAgent.create.title": "Connecter un agent",
"connectAgent.providerDesc.amp": "CLI de l'agent de codage Sourcegraph",
diff --git a/locales/it-IT/chat.json b/locales/it-IT/chat.json
index d68877f5282..9fe0717baa6 100644
--- a/locales/it-IT/chat.json
+++ b/locales/it-IT/chat.json
@@ -270,8 +270,11 @@
"connectAgent.create.scanning": "Scansione degli agenti su questo dispositivo…",
"connectAgent.create.selectFirst": "Seleziona almeno un agente rilevato",
"connectAgent.create.stepAgents": "Passo 2 di 3 · {{device}}",
+ "connectAgent.create.stepAgentsInline": "Step 1 of 2 · {{device}}",
"connectAgent.create.stepConfirm": "Passo 3 di 3 · Assegna un nome per la tua lista di agenti",
+ "connectAgent.create.stepConfirmInline": "Step 2 of 2 · Name it for your agent list",
"connectAgent.create.stepDevice": "Passo 1 di 3 · Scegli la macchina su cui eseguire gli agenti — verrà scansionata automaticamente.",
+ "connectAgent.create.switchDevice": "Run on",
"connectAgent.create.thisDevice": "Questo dispositivo",
"connectAgent.create.title": "Connetti agente",
"connectAgent.providerDesc.amp": "CLI agente di codifica Sourcegraph",
diff --git a/locales/ja-JP/chat.json b/locales/ja-JP/chat.json
index 30d60e4f5ed..511d01fabb9 100644
--- a/locales/ja-JP/chat.json
+++ b/locales/ja-JP/chat.json
@@ -270,8 +270,11 @@
"connectAgent.create.scanning": "このデバイスでエージェントをスキャン中…",
"connectAgent.create.selectFirst": "検出されたエージェントを少なくとも1つ選択してください",
"connectAgent.create.stepAgents": "ステップ 2/3 · {{device}}",
+ "connectAgent.create.stepAgentsInline": "Step 1 of 2 · {{device}}",
"connectAgent.create.stepConfirm": "ステップ 3/3 · エージェントリスト用に名前を付けます",
+ "connectAgent.create.stepConfirmInline": "Step 2 of 2 · Name it for your agent list",
"connectAgent.create.stepDevice": "ステップ 1/3 · エージェントを実行するマシンを選択 — 自動的にスキャンされます。",
+ "connectAgent.create.switchDevice": "Run on",
"connectAgent.create.thisDevice": "このデバイス",
"connectAgent.create.title": "エージェントを接続",
"connectAgent.providerDesc.amp": "Sourcegraph コーディングエージェント CLI",
diff --git a/locales/ko-KR/chat.json b/locales/ko-KR/chat.json
index 7377853d436..9924739d45d 100644
--- a/locales/ko-KR/chat.json
+++ b/locales/ko-KR/chat.json
@@ -270,8 +270,11 @@
"connectAgent.create.scanning": "이 장치에서 에이전트를 스캔 중…",
"connectAgent.create.selectFirst": "감지된 에이전트를 최소 하나 선택하세요",
"connectAgent.create.stepAgents": "2단계 (총 3단계) · {{device}}",
+ "connectAgent.create.stepAgentsInline": "Step 1 of 2 · {{device}}",
"connectAgent.create.stepConfirm": "3단계 (총 3단계) · 에이전트 목록에 이름 지정",
+ "connectAgent.create.stepConfirmInline": "Step 2 of 2 · Name it for your agent list",
"connectAgent.create.stepDevice": "1단계 (총 3단계) · 에이전트가 실행되는 기기를 선택하세요 — 자동으로 스캔됩니다.",
+ "connectAgent.create.switchDevice": "Run on",
"connectAgent.create.thisDevice": "이 장치",
"connectAgent.create.title": "에이전트 연결",
"connectAgent.providerDesc.amp": "Sourcegraph 코딩 에이전트 CLI",
diff --git a/locales/nl-NL/chat.json b/locales/nl-NL/chat.json
index ef0619cd704..7c6e78bb0d4 100644
--- a/locales/nl-NL/chat.json
+++ b/locales/nl-NL/chat.json
@@ -270,8 +270,11 @@
"connectAgent.create.scanning": "Agents scannen op dit apparaat…",
"connectAgent.create.selectFirst": "Selecteer ten minste één gedetecteerde agent",
"connectAgent.create.stepAgents": "Stap 2 van 3 · {{device}}",
+ "connectAgent.create.stepAgentsInline": "Step 1 of 2 · {{device}}",
"connectAgent.create.stepConfirm": "Stap 3 van 3 · Geef het een naam voor je agentlijst",
+ "connectAgent.create.stepConfirmInline": "Step 2 of 2 · Name it for your agent list",
"connectAgent.create.stepDevice": "Stap 1 van 3 · Kies de machine waarop je agents draaien — deze wordt automatisch gescand.",
+ "connectAgent.create.switchDevice": "Run on",
"connectAgent.create.thisDevice": "Dit apparaat",
"connectAgent.create.title": "Agent verbinden",
"connectAgent.providerDesc.amp": "Sourcegraph coding agent CLI",
diff --git a/locales/pl-PL/chat.json b/locales/pl-PL/chat.json
index 04ba9876b41..6b30d202d09 100644
--- a/locales/pl-PL/chat.json
+++ b/locales/pl-PL/chat.json
@@ -270,8 +270,11 @@
"connectAgent.create.scanning": "Skanowanie agentów na tym urządzeniu…",
"connectAgent.create.selectFirst": "Wybierz co najmniej jednego wykrytego agenta",
"connectAgent.create.stepAgents": "Krok 2 z 3 · {{device}}",
+ "connectAgent.create.stepAgentsInline": "Step 1 of 2 · {{device}}",
"connectAgent.create.stepConfirm": "Krok 3 z 3 · Nazwij go dla swojej listy agentów",
+ "connectAgent.create.stepConfirmInline": "Step 2 of 2 · Name it for your agent list",
"connectAgent.create.stepDevice": "Krok 1 z 3 · Wybierz urządzenie, na którym działają Twoi agenci — zostanie ono automatycznie przeskanowane.",
+ "connectAgent.create.switchDevice": "Run on",
"connectAgent.create.thisDevice": "To urządzenie",
"connectAgent.create.title": "Połącz agenta",
"connectAgent.providerDesc.amp": "CLI agenta kodującego Sourcegraph",
diff --git a/locales/pt-BR/chat.json b/locales/pt-BR/chat.json
index 1b5ce1d0e5a..277baeab9e5 100644
--- a/locales/pt-BR/chat.json
+++ b/locales/pt-BR/chat.json
@@ -270,8 +270,11 @@
"connectAgent.create.scanning": "Escaneando agentes neste dispositivo…",
"connectAgent.create.selectFirst": "Selecione pelo menos um agente detectado",
"connectAgent.create.stepAgents": "Etapa 2 de 3 · {{device}}",
+ "connectAgent.create.stepAgentsInline": "Step 1 of 2 · {{device}}",
"connectAgent.create.stepConfirm": "Etapa 3 de 3 · Nomeie para sua lista de agentes",
+ "connectAgent.create.stepConfirmInline": "Step 2 of 2 · Name it for your agent list",
"connectAgent.create.stepDevice": "Etapa 1 de 3 · Escolha a máquina onde seus agentes serão executados — ela será escaneada automaticamente.",
+ "connectAgent.create.switchDevice": "Run on",
"connectAgent.create.thisDevice": "Este dispositivo",
"connectAgent.create.title": "Conectar Agente",
"connectAgent.providerDesc.amp": "CLI do agente de codificação Sourcegraph",
diff --git a/locales/ru-RU/chat.json b/locales/ru-RU/chat.json
index ff2e7612754..819ba83e07b 100644
--- a/locales/ru-RU/chat.json
+++ b/locales/ru-RU/chat.json
@@ -270,8 +270,11 @@
"connectAgent.create.scanning": "Сканирование агентов на этом устройстве…",
"connectAgent.create.selectFirst": "Выберите хотя бы одного обнаруженного агента",
"connectAgent.create.stepAgents": "Шаг 2 из 3 · {{device}}",
+ "connectAgent.create.stepAgentsInline": "Step 1 of 2 · {{device}}",
"connectAgent.create.stepConfirm": "Шаг 3 из 3 · Назовите его для списка агентов",
+ "connectAgent.create.stepConfirmInline": "Step 2 of 2 · Name it for your agent list",
"connectAgent.create.stepDevice": "Шаг 1 из 3 · Выберите устройство, на котором работают ваши агенты — оно будет автоматически отсканировано.",
+ "connectAgent.create.switchDevice": "Run on",
"connectAgent.create.thisDevice": "Это устройство",
"connectAgent.create.title": "Подключить агента",
"connectAgent.providerDesc.amp": "CLI агента программирования Sourcegraph",
diff --git a/locales/tr-TR/chat.json b/locales/tr-TR/chat.json
index 41db86d09db..a58cfeae4a6 100644
--- a/locales/tr-TR/chat.json
+++ b/locales/tr-TR/chat.json
@@ -270,8 +270,11 @@
"connectAgent.create.scanning": "Bu cihazdaki ajanlar taranıyor…",
"connectAgent.create.selectFirst": "Algılanan en az bir ajan seçin",
"connectAgent.create.stepAgents": "Adım 2/3 · {{device}}",
+ "connectAgent.create.stepAgentsInline": "Step 1 of 2 · {{device}}",
"connectAgent.create.stepConfirm": "Adım 3/3 · Ajan listeniz için bir ad verin",
+ "connectAgent.create.stepConfirmInline": "Step 2 of 2 · Name it for your agent list",
"connectAgent.create.stepDevice": "Adım 1/3 · Ajanlarınızın çalıştığı makineyi seçin — otomatik olarak taranacaktır.",
+ "connectAgent.create.switchDevice": "Run on",
"connectAgent.create.thisDevice": "Bu cihaz",
"connectAgent.create.title": "Ajan Bağla",
"connectAgent.providerDesc.amp": "Sourcegraph kodlama ajanı CLI",
diff --git a/locales/vi-VN/chat.json b/locales/vi-VN/chat.json
index bb61775cdca..baa0b651448 100644
--- a/locales/vi-VN/chat.json
+++ b/locales/vi-VN/chat.json
@@ -270,8 +270,11 @@
"connectAgent.create.scanning": "Đang quét các tác nhân trên thiết bị này…",
"connectAgent.create.selectFirst": "Chọn ít nhất một tác nhân đã phát hiện",
"connectAgent.create.stepAgents": "Bước 2 trong 3 · {{device}}",
+ "connectAgent.create.stepAgentsInline": "Step 1 of 2 · {{device}}",
"connectAgent.create.stepConfirm": "Bước 3 trong 3 · Đặt tên cho danh sách tác nhân của bạn",
+ "connectAgent.create.stepConfirmInline": "Step 2 of 2 · Name it for your agent list",
"connectAgent.create.stepDevice": "Bước 1 trong 3 · Chọn máy mà các tác nhân của bạn chạy trên đó — nó sẽ được quét tự động.",
+ "connectAgent.create.switchDevice": "Run on",
"connectAgent.create.thisDevice": "Thiết bị này",
"connectAgent.create.title": "Kết nối Tác nhân",
"connectAgent.providerDesc.amp": "CLI tác nhân mã hóa Sourcegraph",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index 2b3a398a3df..c39829ca0be 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -293,8 +293,11 @@
"connectAgent.create.scanning": "正在扫描设备上的助理…",
"connectAgent.create.selectFirst": "请先勾选至少一个已检测到的助理",
"connectAgent.create.stepAgents": "第 2 步,共 3 步 · {{device}}",
+ "connectAgent.create.stepAgentsInline": "第 1 步,共 2 步 · {{device}}",
"connectAgent.create.stepConfirm": "第 3 步,共 3 步 · 为助理命名",
+ "connectAgent.create.stepConfirmInline": "第 2 步,共 2 步 · 为助理命名",
"connectAgent.create.stepDevice": "第 1 步,共 3 步 · 选择运行助理的设备,将自动扫描其上安装的助理。",
+ "connectAgent.create.switchDevice": "运行于",
"connectAgent.create.thisDevice": "本机",
"connectAgent.create.title": "接入助理",
"connectAgent.providerDesc.amp": "Sourcegraph 编码助理 CLI",
diff --git a/locales/zh-TW/chat.json b/locales/zh-TW/chat.json
index 0d4b3cdab30..8154f056616 100644
--- a/locales/zh-TW/chat.json
+++ b/locales/zh-TW/chat.json
@@ -270,8 +270,11 @@
"connectAgent.create.scanning": "正在掃描此設備上的代理…",
"connectAgent.create.selectFirst": "至少選擇一個檢測到的代理",
"connectAgent.create.stepAgents": "第 2 步,共 3 步 · {{device}}",
+ "connectAgent.create.stepAgentsInline": "第 1 步,共 2 步 · {{device}}",
"connectAgent.create.stepConfirm": "第 3 步,共 3 步 · 為您的代理列表命名",
+ "connectAgent.create.stepConfirmInline": "第 2 步,共 2 步 · 為助理命名",
"connectAgent.create.stepDevice": "第 1 步,共 3 步 · 選擇運行代理的機器 — 它將自動掃描。",
+ "connectAgent.create.switchDevice": "執行於",
"connectAgent.create.thisDevice": "此設備",
"connectAgent.create.title": "連接代理",
"connectAgent.providerDesc.amp": "Sourcegraph 編碼代理 CLI",
diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.ts
index 196e64cceee..44e68e7649c 100644
--- a/packages/locales/src/default/chat.ts
+++ b/packages/locales/src/default/chat.ts
@@ -1684,6 +1684,9 @@ export default {
'connectAgent.create.stepDevice':
'Step 1 of 3 · Pick the machine your agents run on — it will be scanned automatically.',
'connectAgent.create.stepAgents': 'Step 2 of 3 · {{device}}',
+ 'connectAgent.create.stepAgentsInline': 'Step 1 of 2 · {{device}}',
+ 'connectAgent.create.stepConfirmInline': 'Step 2 of 2 · Name it for your agent list',
+ 'connectAgent.create.switchDevice': 'Run on',
'connectAgent.create.stepConfirm': 'Step 3 of 3 · Name it for your agent list',
'connectAgent.create.thisDevice': 'This device',
'connectAgent.create.connectedDevices': 'Connected devices',
diff --git a/src/features/ConnectAgent/index.tsx b/src/features/ConnectAgent/index.tsx
index dd457e99566..d923b555174 100644
--- a/src/features/ConnectAgent/index.tsx
+++ b/src/features/ConnectAgent/index.tsx
@@ -21,11 +21,13 @@ import {
Input,
type ModalInstance,
ScrollArea,
+ Select,
Text,
TextArea,
Tooltip,
useModalContext,
} from '@lobehub/ui';
+import { Surface } from '@lobehub/ui/dashboard';
import { t as i18nT } from 'i18next';
import {
ArrowLeft,
@@ -110,12 +112,6 @@ const styles = createStaticStyles(({ css }) => ({
background: ${cssVar.colorTextQuaternary};
`,
- emptyCard: css`
- overflow: hidden;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
- background: ${cssVar.colorBgContainer};
- `,
emptyHero: css`
padding-block: 24px;
padding-inline: 24px;
@@ -183,12 +179,6 @@ const styles = createStaticStyles(({ css }) => ({
background: ${cssVar.colorFillSecondary};
`,
- groupList: css`
- overflow: hidden;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
- background: ${cssVar.colorBgContainer};
- `,
iconBox: css`
display: flex;
flex: none;
@@ -279,6 +269,9 @@ interface CreatedAgent {
version?: string;
}
+/** The device switch's value for this computer; device ids are never empty. */
+const LOCAL_TARGET_VALUE = '';
+
const SectionLabel = memo<{ children: ReactNode }>(({ children }) => (
<Text fontSize={12} style={{ paddingInline: 4 }} type={'secondary'}>
{children}
@@ -302,16 +295,17 @@ const SkeletonRow = memo<{ squareIcon?: boolean; width: number }>(({ squareIcon,
));
const ScrollableAgentList = memo<{ children: ReactNode }>(({ children }) => (
- <ScrollArea
- disableContentFit
- scrollFade
- className={styles.groupList}
- scrollbarProps={{ className: styles.agentListScrollbar }}
- thumbProps={{ className: styles.agentListThumb }}
- viewportProps={{ className: styles.agentListViewport }}
- >
- {children}
- </ScrollArea>
+ <Surface padded={false}>
+ <ScrollArea
+ disableContentFit
+ scrollFade
+ scrollbarProps={{ className: styles.agentListScrollbar }}
+ thumbProps={{ className: styles.agentListThumb }}
+ viewportProps={{ className: styles.agentListViewport }}
+ >
+ {children}
+ </ScrollArea>
+ </Surface>
));
ScrollableAgentList.displayName = 'ScrollableAgentList';
@@ -425,9 +419,16 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(
initialDevice && isListableDevice(initialDevice, restrictToWorkspaceDevices)
? initialDevice
: undefined;
- const [step, setStep] = useState(preselected ? 1 : 0);
+ // On desktop the wizard opens straight on an agent list (this computer's,
+ // unless a device was preselected); other devices are a switch above it.
+ const deviceInline = isDesktop;
+ const [step, setStep] = useState(preselected || deviceInline ? 1 : 0);
const [target, setTarget] = useState<ScanTarget | null>(() =>
- preselected ? { device: preselected, kind: 'device' } : null,
+ preselected
+ ? { device: preselected, kind: 'device' }
+ : deviceInline
+ ? { kind: 'local' }
+ : null,
);
const [selectedTypes, setSelectedTypes] = useState<HeterogeneousAgentType[]>([]);
const [profiles, setProfiles] = useState<
@@ -454,9 +455,15 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(
mutate: refetchDevices,
} = useDeviceList();
+ // This computer is offered as "This computer" already, so its gateway row is left out.
const listedDevices = useMemo(
- () => (devices ?? []).filter((d) => isListableDevice(d, restrictToWorkspaceDevices)),
- [devices, restrictToWorkspaceDevices],
+ () =>
+ (devices ?? []).filter(
+ (d) =>
+ isListableDevice(d, restrictToWorkspaceDevices) &&
+ !(isDesktop && d.deviceId === currentDeviceId),
+ ),
+ [currentDeviceId, devices, restrictToWorkspaceDevices],
);
const onlineDevices = listedDevices.filter((d) => d.online);
// Rows painted from the persisted list until the server confirms presence:
@@ -661,7 +668,7 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(
return (
<Flexbox gap={8} paddingBlock={'16px 8px'}>
{showOpenChat && <SectionLabel>{t('connectAgent.create.doneHint')}</SectionLabel>}
- <div className={styles.groupList}>
+ <Surface padded={false}>
{done.map((agent) => (
<div className={`${styles.row} ${styles.rowStatic}`} key={agent.agentId}>
<agent.provider.brand.Avatar size={32} />
@@ -682,7 +689,7 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(
)}
</div>
))}
- </div>
+ </Surface>
<Flexbox horizontal justify={'flex-end'} style={{ paddingBlockStart: 8 }}>
<Button type={'primary'} onClick={close}>
{t('connectAgent.create.done')}
@@ -708,7 +715,7 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(
<Flexbox gap={16} paddingBlock={'16px 8px'}>
<SectionLabel>{t('connectAgent.create.stepDevice')}</SectionLabel>
{showEmpty ? (
- <div className={styles.emptyCard}>
+ <Surface padded={false}>
<Flexbox align={'center'} className={styles.emptyHero} gap={10}>
<span className={styles.heroIcon}>
<Icon icon={LaptopIcon} size={26} />
@@ -769,13 +776,13 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(
{t('connectAgent.create.refresh')}
</Button>
</Flexbox>
- </div>
+ </Surface>
) : (
<Flexbox gap={16}>
{isDesktop && (
<Flexbox gap={6}>
<SectionLabel>{t('connectAgent.create.thisDevice')}</SectionLabel>
- <div className={styles.groupList}>
+ <Surface padded={false}>
<DeviceRow
icon={<Icon icon={LaptopIcon} size={18} />}
statusText={t('connectAgent.create.online')}
@@ -783,7 +790,7 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(
title={t('connectAgent.create.localDevice')}
onClick={() => pickTarget({ kind: 'local' })}
/>
- </div>
+ </Surface>
</Flexbox>
)}
{deviceListState !== 'empty' && (
@@ -800,7 +807,7 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(
{t('connectAgent.create.refresh')}
</Button>
</Flexbox>
- <div className={styles.groupList}>
+ <Surface padded={false}>
{deviceListState === 'error' ? (
<AsyncError
error={deviceListError}
@@ -830,7 +837,7 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(
/>
))
)}
- </div>
+ </Surface>
</Flexbox>
)}
{isDesktop && deviceListState === 'empty' && (
@@ -855,7 +862,12 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(
its height — no jump when the scan settles */}
<Flexbox horizontal align={'center'} justify={'space-between'} style={{ minHeight: 28 }}>
<SectionLabel>
- {t('connectAgent.create.stepAgents', { device: targetLabel })}
+ {t(
+ deviceInline
+ ? 'connectAgent.create.stepAgentsInline'
+ : 'connectAgent.create.stepAgents',
+ { device: targetLabel },
+ )}
</SectionLabel>
{!(scanState.status === 'success' && detectedCount === 0) &&
scanState.status !== 'error' && (
@@ -871,6 +883,52 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(
)}
</Flexbox>
+ {deviceInline && listedDevices.length > 0 && (
+ <Flexbox horizontal align={'center'} gap={8} style={{ paddingInline: 4 }}>
+ <Text fontSize={12} style={{ flex: 'none' }} type={'secondary'}>
+ {t('connectAgent.create.switchDevice')}
+ </Text>
+ <Select
+ aria-label={t('connectAgent.create.switchDevice')}
+ popupMatchSelectWidth={false}
+ size={'small'}
+ style={{ minWidth: 180 }}
+ value={target.kind === 'device' ? target.device.deviceId : LOCAL_TARGET_VALUE}
+ options={[
+ {
+ label: (
+ <Flexbox horizontal align={'center'} gap={8}>
+ <Icon icon={LaptopIcon} size={14} />
+ {t('connectAgent.create.localDevice')}
+ </Flexbox>
+ ),
+ value: LOCAL_TARGET_VALUE,
+ },
+ ...listedDevices.map((device) => ({
+ disabled: !device.online,
+ label: (
+ <Flexbox horizontal align={'center'} gap={8}>
+ {getDeviceIcon(device.platform, 14)}
+ <span>{deviceLabel(device)}</span>
+ {!device.online && (
+ <Text fontSize={12} type={'secondary'}>
+ {t('connectAgent.create.offline')}
+ </Text>
+ )}
+ </Flexbox>
+ ),
+ value: device.deviceId,
+ })),
+ ]}
+ onChange={(value: string) => {
+ if (value === LOCAL_TARGET_VALUE) return pickTarget({ kind: 'local' });
+ const device = listedDevices.find((d) => d.deviceId === value);
+ if (device) pickTarget({ device, kind: 'device' });
+ }}
+ />
+ </Flexbox>
+ )}
+
{scanning && (
<Flexbox gap={6}>
<SectionLabel>{t('connectAgent.create.scanning')}</SectionLabel>
@@ -946,13 +1004,18 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(
)}
<Flexbox horizontal align={'center'} gap={8} justify={'space-between'}>
- <Button
- icon={<Icon icon={ArrowLeft} size={14} />}
- type={'text'}
- onClick={() => setStep(0)}
- >
- {t('connectAgent.create.back')}
- </Button>
+ {/* The device step is the switch above when inline: nothing to go back to. */}
+ {deviceInline ? (
+ <span />
+ ) : (
+ <Button
+ icon={<Icon icon={ArrowLeft} size={14} />}
+ type={'text'}
+ onClick={() => setStep(0)}
+ >
+ {t('connectAgent.create.back')}
+ </Button>
+ )}
<Flexbox horizontal align={'center'} gap={8}>
{single && (
<Button type={'text'} onClick={goConfirm}>
@@ -985,7 +1048,13 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(
if (step === 2 && single) {
return (
<Flexbox gap={16} paddingBlock={'16px 8px'}>
- <SectionLabel>{t('connectAgent.create.stepConfirm')}</SectionLabel>
+ <SectionLabel>
+ {t(
+ deviceInline
+ ? 'connectAgent.create.stepConfirmInline'
+ : 'connectAgent.create.stepConfirm',
+ )}
+ </SectionLabel>
<Flexbox horizontal align={'center'} gap={12}>
<single.brand.Avatar size={44} />
<Flexbox flex={1}>
@@ -1004,7 +1073,7 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(
value={description}
onChange={(e) => setDescription(e.target.value)}
/>
- <div className={styles.groupList}>
+ <Surface padded={false}>
<div className={`${styles.row} ${styles.rowStatic}`}>
<div className={styles.iconBox}>
{target?.kind === 'device' ? (
@@ -1025,7 +1094,7 @@ const ConnectAgentContent = memo<ConnectAgentContentProps>(
</Flexbox>
<Icon color={cssVar.colorSuccess} icon={CheckCircle2} size={16} />
</div>
- </div>
+ </Surface>
<CreateVisibilityField state={confirmVisibilityState} />
{createError && (
<Alert