Skip to content

feat(wework): add connection settings page - #1174

Merged
qdaxb merged 2 commits into
wecode-ai:mainfrom
FicoHu:codex/wework-connection-settings
May 27, 2026
Merged

qdaxb merged 2 commits into
wecode-ai:mainfrom
FicoHu:codex/wework-connection-settings

Conversation

@FicoHu

@FicoHu FicoHu commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

Release Notes

  • New Features

    • Added Connections settings page for managing authorized cloud devices and compute resources
    • Display devices with real-time status indicators, resource usage metrics (CPU, memory, disk), and device information
    • Quick-access device actions (terminal, IDE, desktop) and ability to add new devices from settings menu
  • Tests

    • Added test coverage for connections settings page navigation, layout, and device management UI
  • Localization

    • Added English and Chinese translations for new settings navigation and connections management interface

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 27, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR adds a connections settings page to the desktop workbench layout. Users can access it via a new settings button in the sidebar menu, which toggles a local UI state to display either the main workbench or the connections management interface. The new ConnectionsSettingsPage displays authorized devices with status, resource metrics, and per-device actions in a two-column layout. Localized UI strings and an integration test are included.

Changes

Connections Settings Page Feature

Layer / File(s) Summary
Settings Menu Navigation Callbacks
wework/src/components/layout/DesktopSettingsMenu.tsx, wework/src/components/layout/DesktopSidebar.tsx
DesktopSettingsMenu and DesktopSidebar accept a new onOpenSettings callback prop. The settings menu button click now invokes onOpenSettings instead of having no handler, and the sidebar conditionally renders the settings menu with a local handler that closes the menu and delegates to the parent callback.
Layout State and Conditional Rendering
wework/src/components/layout/DesktopWorkbenchLayout.tsx
DesktopWorkbenchLayout introduces settingsOpen state to toggle between DesktopWorkbenchMain and ConnectionsSettingsPage. The sidebar is hidden when settings are open, and the sidebar's onOpenSettings handler sets the state to show the settings page.
Connections Settings Page and Sub-Components
wework/src/components/settings/ConnectionsSettingsPage.tsx
New ConnectionsSettingsPage component with a two-column layout: left sidebar for navigation (connections/projects), main content area with authorized devices section, and device cards that display icons, names, version badges, localized online/offline status, CPU/memory/disk resource bars, and action buttons (terminal/IDE/desktop). Sub-components include StatusPill, DeviceCard, DeviceActionButton, ResourceMetric, and DeviceSection.
Localization Strings for Connections UI
wework/src/i18n/locales/en/common.json, wework/src/i18n/locales/zh-CN/common.json
English and Chinese i18n keys added for settings navigation items, connections page title and tabs, device field labels (name, version, status), resource labels (CPU/memory/disk), action text, and online/offline status strings.
Integration Test for Settings Navigation
wework/src/components/layout/DesktopWorkbenchLayout.test.tsx
New test case verifies navigation from sidebar settings menu to the connections settings page, asserting the presence of back button, page title, navigation items, device/resource labels, and conditional UI element rendering.

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • qdaxb

🐰 A settings page springs to life,
Device cards dance in organized strife,
Resource bars glow, online and free,
Navigation flows smooth as can be—
Connect, manage, and see what you've got! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(wework): add connection settings page' clearly summarizes the main change—adding a new connections settings page component to the wework feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
wework/src/components/layout/DesktopWorkbenchLayout.test.tsx (1)

100-164: ⚡ Quick win

Split this test into focused cases to keep it maintainable.

Line 100 introduces a single 65-line test with many unrelated assertions; please split it into smaller test cases (or extract assertion helpers) so failures are easier to localize.

♻️ Proposed refactor
-  test('opens the independent connection settings page from the settings menu', async () => {
+  async function openConnectionSettings() {
+    render(<DesktopWorkbenchLayout {...baseProps} />)
+    await userEvent.click(screen.getByTestId('settings-button'))
+    await userEvent.click(screen.getByTestId('settings-menu-button'))
+  }
+
+  test('navigates to connection settings page', async () => {
+    await openConnectionSettings()
+    expect(screen.getByTestId('wework-settings-page')).toBeInTheDocument()
+    expect(screen.getByRole('heading', { name: '连接' })).toBeInTheDocument()
+  })
+
+  test('renders cloud device actions and metrics', async () => {
+    await openConnectionSettings()
+    expect(screen.getByText('yunpeng7-executor-372706c30fcd')).toBeInTheDocument()
+    expect(screen.getByText('CPU')).toBeInTheDocument()
+    expect(screen.getByText('MEM')).toBeInTheDocument()
+    expect(screen.getByText('磁盘')).toBeInTheDocument()
+  })
+
+  test('does not render deprecated/incorrect labels', async () => {
+    await openConnectionSettings()
+    expect(screen.queryByText('Start Task')).not.toBeInTheDocument()
+    expect(screen.queryByText('Online')).not.toBeInTheDocument()
+  })
-    ...
-  })

As per coding guidelines, **/*.{py,ts,tsx}: Maximum 50 lines per function (preferred) in Python and TypeScript code.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/src/components/layout/DesktopWorkbenchLayout.test.tsx` around lines
100 - 164, The single large test "opens the independent connection settings page
from the settings menu" is doing too many unrelated assertions; split it into
focused tests (or extract helpers) to keep each test under ~50 lines. Create a
small helper like renderAndOpenSettings (called from multiple tests) that
renders <DesktopWorkbenchLayout {...baseProps} /> and clicks the
'settings-button' and 'settings-menu-button', then replace the giant test with
multiple tests such as: a navigation/assertions test (check
wework-settings-page, settings-back-button text,
settings-nav-connections/projects presence and absence of settings-nav-general),
a headings/content test (heading '连接', '连接设备', '项目', '可连接的设备', '云设备', '说明' and
absence of English labels), a device-list/test-icons test (assert
connection-device-icon-24a59054... classes, device name yunpeng7-executor...,
version v1.712, status 在线, absence of Personal Devices/Linux-Device...), an
actions/buttons test (presence of connection-terminal-button-24a59054...,
connection-code-server-button..., connection-vnc-button..., and labels
终端/IDE/桌面), and a metrics/test-percentages test (CPU/MEM/磁盘 and 42%/68%/57% and
connection-scale-wiki). Keep each test focused, reference the test ids used
above when moving assertions so failures are localized.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@wework/src/components/settings/ConnectionsSettingsPage.tsx`:
- Around line 159-163: In ConnectionsSettingsPage, several button elements
(e.g., the button using data-testid={testId} and other interactive elements in
the same component) use small height classes like h-8, h-9, h-10 and
min-h-[31px]; update each button's Tailwind classes to meet mobile accessibility
(at least 44×44) by replacing the height/size classes with h-11 and adding
min-w-[44px] (and remove or adjust conflicting min-h classes) for the buttons
referenced around the noted blocks (including the element with
data-testid={testId} and the buttons at the other ranges called out). Ensure
visual style (padding, gap) remains consistent after the change.
- Line 16: Buttons and nav items in ConnectionsSettingsPage (DeviceActionButton,
settings-back-button, settings-nav-*, connection-add-device-button and the
connections tab button) use heights like h-8/h-9/h-10 or min-h-[31px] which are
below the mobile touch target minimum (44×44); update their classes to ensure at
least h-11 and min-w-[44px] (or equivalent padding) so touch targets meet the
standard, and audit any custom components used by the page to propagate the size
change. Also fix the import: replace the incorrect import of useTranslation from
'react-i18next' with the project hook import '`@/hooks/useTranslation`' (or add a
wrapper hook at that path) so ConnectionsSettingsPage uses the local
useTranslation implementation used across the wework package. Ensure you update
all occurrences in this file that reference the old import and run style/type
checks.

---

Nitpick comments:
In `@wework/src/components/layout/DesktopWorkbenchLayout.test.tsx`:
- Around line 100-164: The single large test "opens the independent connection
settings page from the settings menu" is doing too many unrelated assertions;
split it into focused tests (or extract helpers) to keep each test under ~50
lines. Create a small helper like renderAndOpenSettings (called from multiple
tests) that renders <DesktopWorkbenchLayout {...baseProps} /> and clicks the
'settings-button' and 'settings-menu-button', then replace the giant test with
multiple tests such as: a navigation/assertions test (check
wework-settings-page, settings-back-button text,
settings-nav-connections/projects presence and absence of settings-nav-general),
a headings/content test (heading '连接', '连接设备', '项目', '可连接的设备', '云设备', '说明' and
absence of English labels), a device-list/test-icons test (assert
connection-device-icon-24a59054... classes, device name yunpeng7-executor...,
version v1.712, status 在线, absence of Personal Devices/Linux-Device...), an
actions/buttons test (presence of connection-terminal-button-24a59054...,
connection-code-server-button..., connection-vnc-button..., and labels
终端/IDE/桌面), and a metrics/test-percentages test (CPU/MEM/磁盘 and 42%/68%/57% and
connection-scale-wiki). Keep each test focused, reference the test ids used
above when moving assertions so failures are localized.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d057d52b-5b13-4bfa-92d0-b47f10e80338

📥 Commits

Reviewing files that changed from the base of the PR and between 469c359 and 5f5db6a.

📒 Files selected for processing (7)
  • wework/src/components/layout/DesktopSettingsMenu.tsx
  • wework/src/components/layout/DesktopSidebar.tsx
  • wework/src/components/layout/DesktopWorkbenchLayout.test.tsx
  • wework/src/components/layout/DesktopWorkbenchLayout.tsx
  • wework/src/components/settings/ConnectionsSettingsPage.tsx
  • wework/src/i18n/locales/en/common.json
  • wework/src/i18n/locales/zh-CN/common.json

Terminal,
} from 'lucide-react'
import type { ComponentType } from 'react'
import { useTranslation } from 'react-i18next'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify canonical translation hook usage patterns and current violation.

rg -n --type=ts --type=tsx "from '`@/hooks/useTranslation`'" wework/src
rg -n --type=ts --type=tsx "from 'react-i18next'" wework/src/components/settings/ConnectionsSettingsPage.tsx
fd -i "useTranslation*.ts" wework/src/hooks

Repository: wecode-ai/Wegent

Length of output: 116


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="wework/src/components/settings/ConnectionsSettingsPage.tsx"
test -f "$FILE" && echo "Found: $FILE" || { echo "Missing: $FILE"; exit 1; }

echo "---- useTranslation import check ----"
rg -n "from 'react-i18next'|from \"react-i18next\"|useTranslation" "$FILE" || true

echo "---- repo-wide guideline check (examples) ----"
rg -n "from 'react-i18next'" wework/src --glob='*.{ts,tsx,js,jsx}' || true
rg -n "from '`@/hooks/useTranslation`'" wework/src --glob='*.{ts,tsx,js,jsx}' || true

echo "---- quick scan for small button heights in this file ----"
# capture common Tailwind height classes used for buttons/interactive UI
rg -n "h-(8|9|10)\b|min-h-\[(3[0-9]|[12][0-9]|[0-9])|min-h-\[3[0-9]\]|min-h-\[2[0-9]\]" "$FILE" || true

echo "---- show relevant sections around earlier line numbers ----"
# Use sed to show around the previously mentioned areas without dumping whole file
sed -n '1,120p' "$FILE" | nl -ba | sed -n '1,120p' || true
sed -n '140,220p' "$FILE" | nl -ba | sed -n '1,120p' || true
sed -n '220,320p' "$FILE" | nl -ba | sed -n '1,120p' || true
sed -n '320,380p' "$FILE" | nl -ba | sed -n '1,80p' || true

Repository: wecode-ai/Wegent

Length of output: 3589


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="wework/src/components/settings/ConnectionsSettingsPage.tsx"

echo "---- file header (imports) ----"
sed -n '1,60p' "$FILE" | cat -n

echo "---- check translation hook usage pattern (local) ----"
rg -n "useTranslation\(" "$FILE"
rg -n "useUnifiedMessages|useUnifiedMessages\(" "$FILE" || true

echo "---- confirm whether '`@/hooks/useTranslation`' exists and is used repo-wide ----"
fd -i "useTranslation*.ts*" wework/src/hooks || true
rg -n "from '`@/hooks/useTranslation`'" wework/src --glob='*.{ts,tsx,js,jsx}' || true

echo "---- show relevant sections around earlier reported lines ----"
for start in 140 230 250 270 295 300; do
  end=$((start+35))
  echo "### lines $start-$end"
  sed -n "${start},${end}p" "$FILE" | cat -n
done

echo "---- enumerate interactive elements near those small heights ----"
# Print lines mentioning height/min-height plus nearby tags indicating interactivity.
rg -n "h-(8|9|10)\b|min-h-\[[0-9]+\]|min-h-\[(3[0-9]|[12][0-9]|[0-9])\]" "$FILE" || true

Repository: wecode-ai/Wegent

Length of output: 11014


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "---- locate '`@/hooks/useTranslation`' implementation ----"
rg -n "hooks/useTranslation" wework/src --glob='*.{ts,tsx,js,jsx}' || true
fd -i "useTranslation" wework/src/hooks || true

echo "---- confirm useUnifiedMessages usage in this file ----"
rg -n "useUnifiedMessages" wework/src/components/settings/ConnectionsSettingsPage.tsx || true

Repository: wecode-ai/Wegent

Length of output: 173


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "---- find any file that looks like a useTranslation hook ----"
fd -i "useTranslation" . || true
fd -i "*useTranslation*" . || true

echo "---- search for '`@/hooks/useTranslation`' usage across repo ----"
rg -n "from '`@/hooks/useTranslation`'" . --glob='*.{ts,tsx,js,jsx}' || true

echo "---- search for 'useUnifiedMessages' ----"
rg -n "useUnifiedMessages" . --glob='*.{ts,tsx,js,jsx}' || true

echo "---- search for 'hooks/useTranslation' path ----"
rg -n "hooks/useTranslation" . --glob='*.{ts,tsx,js,jsx}' || true

echo "---- check if any '`@/hooks/`' translation file exists ----"
fd -i "translation" wework/src/hooks . || true

Repository: wecode-ai/Wegent

Length of output: 50687


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n "from '`@/hooks/useTranslation`'" wework/src --glob='*.{ts,tsx,js,jsx}' || true
rg -n "from '`@/hooks/useTranslation`'" . --glob='wework/src/**/*.{ts,tsx,js,jsx}' || true
ls -la wework/src/hooks || true
fd -i "useTranslation*.ts" wework/src || true

Repository: wecode-ai/Wegent

Length of output: 300


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "---- repo top-level dirs ----"
ls -ლა

echo "---- find wework tsconfig(s) ----"
fd -i "tsconfig*.json" wework -a 2>/dev/null || true
fd -i "tsconfig*.json" . -a 2>/dev/null | rg "wework" || true

echo "---- show wework tsconfig paths for '@' alias ----"
for f in $(fd -i "tsconfig*.json" wework --maxdepth 4 2>/dev/null); do
  echo "### $f"
  rg -n "\"paths\"|\"baseUrl\"|\"`@/hooks/useTranslation`\"|\"@\"" "$f" || true
done

echo "---- find any usage of '`@/hooks/useTranslation`' inside wework ----"
rg -n "from '`@/hooks/useTranslation`'" wework --glob='*.{ts,tsx,js,jsx}' || true

echo "---- find any local translation hook file under wework ----"
fd -i "useTranslation*.ts*" wework --type f 2>/dev/null || true

Repository: wecode-ai/Wegent

Length of output: 172


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "---- repo top-level dirs ----"
ls -la

echo "---- find wework tsconfig(s) ----"
fd -i "tsconfig*.json" wework 2>/dev/null || true

echo "---- show wework tsconfig paths for '@' alias ----"
for f in $(fd -i "tsconfig*.json" wework 2>/dev/null); do
  echo "### $f"
  rg -n "\"paths\"|\"baseUrl\"|\"`@/hooks/useTranslation`\"|\"@\"" "$f" || true
done

echo "---- find any usage of '`@/hooks/useTranslation`' inside wework ----"
rg -n "from '`@/hooks/useTranslation`'" wework --glob='*.{ts,tsx,js,jsx}' || true

echo "---- find any local translation hook file under wework ----"
fd -i "useTranslation*.ts*" wework 2>/dev/null || true

echo "---- find any useTranslation implementation under wework ----"
rg -n "function useTranslation|useTranslation\\s*\\(" wework --glob='*.{ts,tsx,js,jsx}' || true

Repository: wecode-ai/Wegent

Length of output: 5468


🏁 Script executed:

#!/bin/bash
set -euo pipefail
cat -n wework/tsconfig.json | sed -n '1,120p'

Repository: wecode-ai/Wegent

Length of output: 364


Fix mobile touch targets for buttons (min 44×44).

wework/src/components/settings/ConnectionsSettingsPage.tsx has interactive buttons styled with h-8/h-9/h-10 and a nav item with min-h-[31px] (e.g., DeviceActionButton, settings-back-button, settings-nav-*, the connections tab button, and connection-add-device-button), which falls below the h-11 min-w-[44px] requirement.

Also, this file imports useTranslation from react-i18next; in the wework package, @/* maps to wework/src/* and there is no wework/src/hooks/useTranslation implementation (only useIsDesktop.ts / useIsMobile.ts), so switching to @/hooks/useTranslation requires adding/using that hook in wework.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/src/components/settings/ConnectionsSettingsPage.tsx` at line 16,
Buttons and nav items in ConnectionsSettingsPage (DeviceActionButton,
settings-back-button, settings-nav-*, connection-add-device-button and the
connections tab button) use heights like h-8/h-9/h-10 or min-h-[31px] which are
below the mobile touch target minimum (44×44); update their classes to ensure at
least h-11 and min-w-[44px] (or equivalent padding) so touch targets meet the
standard, and audit any custom components used by the page to propagate the size
change. Also fix the import: replace the incorrect import of useTranslation from
'react-i18next' with the project hook import '`@/hooks/useTranslation`' (or add a
wrapper hook at that path) so ConnectionsSettingsPage uses the local
useTranslation implementation used across the wework package. Ensure you update
all occurrences in this file that reference the old import and run style/type
checks.

Comment on lines +159 to +163
<button
type="button"
data-testid={testId}
className="inline-flex h-8 items-center gap-1.5 rounded-md border border-[#dedede] bg-white px-2.5 text-xs font-medium text-[#3c4043] hover:bg-[#f7f7f8]"
>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Increase button touch targets to 44×44 for mobile accessibility.

Several interactive buttons are below the required size (h-8, h-9, h-10, and min-h-[31px]). Update these to meet the minimum mobile target size.

Suggested class updates
- className="inline-flex h-8 items-center gap-1.5 rounded-md border border-[`#dedede`] bg-white px-2.5 text-xs font-medium text-[`#3c4043`] hover:bg-[`#f7f7f8`]"
+ className="inline-flex h-11 min-w-[44px] items-center gap-1.5 rounded-md border border-[`#dedede`] bg-white px-2.5 text-xs font-medium text-[`#3c4043`] hover:bg-[`#f7f7f8`]"

- className="mb-4 flex h-9 items-center gap-2 rounded-md px-2 text-sm text-[`#777`] hover:bg-black/5"
+ className="mb-4 flex h-11 min-w-[44px] items-center gap-2 rounded-md px-2 text-sm text-[`#777`] hover:bg-black/5"

- className="flex min-h-[31px] w-full items-center gap-2 rounded-lg px-2.5 text-left text-sm font-medium"
+ className="flex h-11 min-w-[44px] w-full items-center gap-2 rounded-lg px-2.5 text-left text-sm font-medium"

- className="h-10 px-6 text-sm font-medium"
+ className="h-11 min-w-[44px] px-6 text-sm font-medium"

- className="inline-flex h-8 items-center gap-1.5 rounded-full bg-[`#f5f5f5`] px-3 text-sm text-[`#2d2d2d`] hover:bg-[`#ececec`]"
+ className="inline-flex h-11 min-w-[44px] items-center gap-1.5 rounded-full bg-[`#f5f5f5`] px-3 text-sm text-[`#2d2d2d`] hover:bg-[`#ececec`]"

As per coding guidelines, "All interactive elements on mobile must be at least 44px × 44px - use h-11 min-w-[44px] for buttons".

Also applies to: 242-247, 254-261, 282-291, 304-307

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/src/components/settings/ConnectionsSettingsPage.tsx` around lines 159
- 163, In ConnectionsSettingsPage, several button elements (e.g., the button
using data-testid={testId} and other interactive elements in the same component)
use small height classes like h-8, h-9, h-10 and min-h-[31px]; update each
button's Tailwind classes to meet mobile accessibility (at least 44×44) by
replacing the height/size classes with h-11 and adding min-w-[44px] (and remove
or adjust conflicting min-h classes) for the buttons referenced around the noted
blocks (including the element with data-testid={testId} and the buttons at the
other ranges called out). Ensure visual style (padding, gap) remains consistent
after the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants