Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
refactor(settings): reorganize navigation and integration settings (#8114)
Jiayuan Zhang53575a2a9583
diff --git a/apps/desktop/src/renderer/src/routes.tsx b/apps/desktop/src/renderer/src/routes.tsxindex 806d5d5ccd..37d3ade427 100644--- a/apps/desktop/src/renderer/src/routes.tsx+++ b/apps/desktop/src/renderer/src/routes.tsx@@ -46,10 +46,10 @@ function DesktopSettingsRoute() {const { t } = useT("settings");return (<SettingsPage- extraAccountTabs={[+ extraDeviceTabs={[{value: "daemon",- label: "Daemon",+ label: t(($) => $.desktop.daemon.title),icon: Server,content: <DaemonSettingsTab />,},diff --git a/e2e/settings.spec.ts b/e2e/settings.spec.tsindex 4bd8e233b8..8b8a2feee3 100644--- a/e2e/settings.spec.ts+++ b/e2e/settings.spec.ts@@ -47,7 +47,7 @@ test.describe("Settings", () => {page,}) => {const workspaceSlug = await loginAsDefault(page);- const settingsUrl = `/${workspaceSlug}/settings?tab=integrations`;+ const settingsUrl = `/${workspaceSlug}/settings?tab=integrations&integration=composio`;// Stateful: connections is empty until the (mocked) connect flow lands.let connected = false;diff --git a/packages/core/issues/stores/issue-create-settings-store.ts b/packages/core/issues/stores/issue-create-settings-store.tsindex b822b7000a..f4d8f542cb 100644--- a/packages/core/issues/stores/issue-create-settings-store.ts+++ b/packages/core/issues/stores/issue-create-settings-store.ts@@ -41,7 +41,7 @@ export const DEFAULT_MANUAL_CREATE_FIELDS: ManualCreateField[] = [];// Which optional fields each create-issue mode keeps on its toolbar. Owned by-// Settings → Issue and read by both create dialogs; a field toggled off here+// Settings → Preferences → Issue creation and read by both create dialogs; a field toggled off here// stays reachable from the dialog's ⋯ overflow and always re-surfaces while it// holds a value. Per-workspace via the workspace-aware storage (projects and// custom properties differ per workspace), per-user for free fromdiff --git a/packages/views/locales/en/settings.json b/packages/views/locales/en/settings.jsonindex b68248fb61..705a741e74 100644--- a/packages/views/locales/en/settings.json+++ b/packages/views/locales/en/settings.json@@ -127,7 +127,12 @@"sticky_comment_bar": {"title": "Sticky comment bar","hint": "Keep the comment bar pinned to the bottom while scrolling an issue page."- }+ },+ "description": "Customize how you work in Multica.",+ "issue_title": "Issue creation",+ "comments_title": "Comments",+ "device_hint": "Saved on this device.",+ "issue_scope": "These preferences apply to this workspace on this device. They only change which fields you see when creating an issue."},"shortcuts": {"title": "Keyboard Shortcuts",@@ -343,7 +348,16 @@"plugins": "Plugins","mcp": "MCP","billing": "Billing"- }+ },+ "groups": {+ "personal": "Personal",+ "workspace": "Workspace",+ "issues": "Issue configuration",+ "connections": "Connections & extensions",+ "device": "Desktop app"+ },+ "navigate": "Go to settings page",+ "device_scope": "This device"},"plugins": {"title": "Plugins",@@ -1311,5 +1325,21 @@"expiry_7d": "7 days","expiry_30d": "30 days","expiry_never": "Never"+ },+ "integrations": {+ "description": "Connect your tools and manage each integration in one place.",+ "code_title": "Code & repositories",+ "messaging_title": "Messaging channels",+ "apps_title": "Your connected apps",+ "apps_scope": "These app connections belong to your account. Workspace channel connections are managed above.",+ "github_hint": "Connect GitHub and configure pull request linking.",+ "vcs_hint": "Connect GitLab, Gitea, or Forgejo.",+ "apps_hint": "Authorize apps for your agents through Composio.",+ "back": "All integrations",+ "status_connected": "Connected",+ "status_not_connected": "Not connected",+ "status_loading": "Checking...",+ "status_unknown": "Status unavailable",+ "channel_hint": "Chat with agents and create issues from {{channel}}."}}diff --git a/packages/views/locales/ja/settings.json b/packages/views/locales/ja/settings.jsonindex 0a844f571e..07ea8aea73 100644--- a/packages/views/locales/ja/settings.json+++ b/packages/views/locales/ja/settings.json@@ -127,7 +127,12 @@"sticky_comment_bar": {"title": "コメントバーを固定","hint": "タスクのページをスクロールしても、コメントバーを常に下部に固定します。"- }+ },+ "description": "Multica の使い方をカスタマイズします。",+ "issue_title": "タスク作成",+ "comments_title": "コメント",+ "device_hint": "このデバイスに保存されます。",+ "issue_scope": "この設定は、このデバイスの現在のワークスペースに適用され、タスク作成時に表示するフィールドのみを変更します。"},"shortcuts": {"title": "キーボードショートカット",@@ -343,7 +348,16 @@"plugins": "Plugins","mcp": "MCP","billing": "請求とプラン"- }+ },+ "groups": {+ "personal": "個人設定",+ "workspace": "ワークスペース管理",+ "issues": "タスク設定",+ "connections": "接続と拡張機能",+ "device": "デスクトップアプリ"+ },+ "navigate": "設定ページへ移動",+ "device_scope": "このデバイス"},"plugins": {"title": "Plugins",@@ -1304,5 +1318,21 @@"expiry_7d": "7日","expiry_30d": "30日","expiry_never": "無期限"+ },+ "integrations": {+ "description": "ツールを接続して、各連携を管理します。",+ "code_title": "コードとリポジトリ",+ "messaging_title": "メッセージチャネル",+ "apps_title": "自分のアプリ接続",+ "apps_scope": "これらのアプリ接続はあなたのアカウントに属します。ワークスペースのチャネル接続は上で管理します。",+ "github_hint": "GitHub を接続し、プルリクエストの関連付けを設定します。",+ "vcs_hint": "GitLab、Gitea、Forgejo を接続します。",+ "apps_hint": "Composio 経由でエージェント用のアプリを認可します。",+ "back": "すべての連携",+ "status_connected": "接続済み",+ "status_not_connected": "未接続",+ "status_loading": "確認中...",+ "status_unknown": "状態を取得できません",+ "channel_hint": "{{channel}} でエージェントと会話し、タスクを作成します。"}}diff --git a/packages/views/locales/ko/settings.json b/packages/views/locales/ko/settings.jsonindex d36319c7f8..6707dbc1b0 100644--- a/packages/views/locales/ko/settings.json+++ b/packages/views/locales/ko/settings.json@@ -127,7 +127,12 @@"sticky_comment_bar": {"title": "댓글 입력창 고정","hint": "태스크 페이지를 스크롤할 때 댓글 입력창을 항상 하단에 고정합니다."- }+ },+ "description": "Multica 사용 환경을 맞춤 설정합니다.",+ "issue_title": "태스크 생성",+ "comments_title": "댓글",+ "device_hint": "현재 기기에 저장됩니다.",+ "issue_scope": "이 설정은 현재 기기의 현재 워크스페이스에 적용되며 태스크 생성 시 표시되는 필드만 변경합니다."},"shortcuts": {"title": "키보드 단축키",@@ -343,7 +348,16 @@"plugins": "Plugins","mcp": "MCP","billing": "결제 및 요금제"- }+ },+ "groups": {+ "personal": "개인 설정",+ "workspace": "워크스페이스 관리",+ "issues": "태스크 설정",+ "connections": "연결 및 확장",+ "device": "데스크톱 앱"+ },+ "navigate": "설정 페이지로 이동",+ "device_scope": "현재 기기"},"plugins": {"title": "Plugins",@@ -1304,5 +1318,21 @@"byo_credentials_unverifiable": "WeCom에 연결하지 못해 이 봇을 확인할 수 없었어요. 인증 정보는 변경되지 않았어요. 잠시 후 다시 시도해 주세요.","byo_install_failed": "봇을 저장하지 못했어요. 저희 쪽 문제입니다. 인증 정보는 변경되지 않았어요. 다시 시도해 보시고, 계속 실패하면 지원팀에 문의해 주세요.","byo_failed_toast": "WeCom 봇을 연결하지 못했어요"+ },+ "integrations": {+ "description": "도구를 연결하고 각 연동을 관리하세요.",+ "code_title": "코드 및 저장소",+ "messaging_title": "메시지 채널",+ "apps_title": "내 앱 연결",+ "apps_scope": "이 앱 연결은 내 계정에 속합니다. 워크스페이스 채널 연결은 위에서 관리합니다.",+ "github_hint": "GitHub를 연결하고 풀 리퀘스트 연결을 설정합니다.",+ "vcs_hint": "GitLab, Gitea 또는 Forgejo를 연결합니다.",+ "apps_hint": "Composio를 통해 에이전트용 앱을 승인합니다.",+ "back": "모든 연동",+ "status_connected": "연결됨",+ "status_not_connected": "연결되지 않음",+ "status_loading": "확인 중...",+ "status_unknown": "상태를 확인할 수 없음",+ "channel_hint": "{{channel}}에서 에이전트와 대화하고 태스크를 생성합니다."}}diff --git a/packages/views/locales/zh-Hans/settings.json b/packages/views/locales/zh-Hans/settings.jsonindex 8fac8a548d..2f7a2272ba 100644--- a/packages/views/locales/zh-Hans/settings.json+++ b/packages/views/locales/zh-Hans/settings.json@@ -127,7 +127,12 @@"sticky_comment_bar": {"title": "固定评论栏","hint": "滚动任务页面时,评论栏始终固定在底部。"- }+ },+ "description": "调整你在 Multica 中的使用偏好。",+ "issue_title": "任务创建",+ "comments_title": "评论",+ "device_hint": "保存在当前设备上。",+ "issue_scope": "这些偏好仅对当前设备上的当前工作区生效,只影响创建任务时显示的字段。"},"shortcuts": {"title": "快捷键",@@ -343,7 +348,16 @@"plugins": "Plugins","mcp": "MCP","billing": "账单与套餐"- }+ },+ "groups": {+ "personal": "个人设置",+ "workspace": "工作区管理",+ "issues": "任务配置",+ "connections": "连接与扩展",+ "device": "桌面应用"+ },+ "navigate": "前往设置页面",+ "device_scope": "当前设备"},"plugins": {"title": "Plugins",@@ -1304,5 +1318,21 @@"expiry_7d": "7 天","expiry_30d": "30 天","expiry_never": "永久有效"+ },+ "integrations": {+ "description": "连接常用工具,分别管理每项集成。",+ "code_title": "代码与仓库",+ "messaging_title": "消息渠道",+ "apps_title": "我的应用连接",+ "apps_scope": "这些应用连接属于你的账号。工作区的消息渠道连接在上方管理。",+ "github_hint": "连接 GitHub,配置拉取请求关联。",+ "vcs_hint": "连接 GitLab、Gitea 或 Forgejo。",+ "apps_hint": "通过 Composio 为智能体授权应用。",+ "back": "全部集成",+ "status_connected": "已连接",+ "status_not_connected": "未连接",+ "status_loading": "正在检查...",+ "status_unknown": "状态暂不可用",+ "channel_hint": "在 {{channel}} 中与智能体对话、创建任务。"}}diff --git a/packages/views/modals/create-issue.test.tsx b/packages/views/modals/create-issue.test.tsxindex 4cd4f4180b..002e282e62 100644--- a/packages/views/modals/create-issue.test.tsx+++ b/packages/views/modals/create-issue.test.tsx@@ -462,7 +462,7 @@ vi.mock("../issues/components", () => ({onClick={() => onOpenChange?.(false)}/>),- // Labels can now be hidden via Settings → Issue and revealed from the+ // Labels can now be hidden via Settings → Preferences → Issue creation and revealed from the// overflow, so surface open/onOpenChange like the date pickers.LabelPicker: ({ open, onOpenChange }: { open?: boolean; onOpenChange?: (v: boolean) => void }) => (<div@@ -1426,7 +1426,7 @@ describe("CreateIssueModal", () => {expect(screen.queryByTestId("due-date-picker")).not.toBeInTheDocument();});- it("hides toolbar fields turned off in Settings → Issue and re-reveals them from the overflow", async () => {+ it("hides toolbar fields turned off in Settings → Preferences → Issue creation and re-reveals them from the overflow", async () => {const user = userEvent.setup();mockCreateSettingsStore.manualCreateFields = ["status", "priority", "assignee", "project"];@@ -1454,7 +1454,7 @@ describe("CreateIssueModal", () => {expect(screen.queryByRole("button", { name: /Set labels/i })).not.toBeInTheDocument();});- it("renders due date inline when enabled in Settings → Issue", () => {+ it("renders due date inline when enabled in Settings → Preferences → Issue creation", () => {mockCreateSettingsStore.manualCreateFields = [...DEFAULT_MANUAL_FIELDS, "due_date"];renderModal(<CreateIssueModal onClose={vi.fn()} />);@@ -1463,7 +1463,7 @@ describe("CreateIssueModal", () => {expect(screen.queryByRole("button", { name: /Set due date/i })).not.toBeInTheDocument();});- it("routes Customize fields to Settings → Issue and closes the dialog", async () => {+ it("routes Customize fields to Settings → Preferences → Issue creation and closes the dialog", async () => {const user = userEvent.setup();const onClose = vi.fn();@@ -1472,7 +1472,7 @@ describe("CreateIssueModal", () => {await user.click(screen.getByRole("button", { name: /Customize fields/i }));expect(onClose).toHaveBeenCalled();- expect(mockPush).toHaveBeenCalledWith("/ws-test/settings?tab=issue");+ expect(mockPush).toHaveBeenCalledWith("/ws-test/settings?tab=preferences§ion=issue");});// MUL-5181: switching to agent must PRESERVE the manual draft. The agentdiff --git a/packages/views/modals/create-issue.tsx b/packages/views/modals/create-issue.tsxindex dceca0b11c..2d3ea3cc05 100644--- a/packages/views/modals/create-issue.tsx+++ b/packages/views/modals/create-issue.tsx@@ -296,7 +296,7 @@ export function ManualCreatePanel({typeof data?.stage === "number" ? (data.stage as number) : null,);const [parentPickerOpen, setParentPickerOpen] = useState(false);- // Toolbar fields hidden via Settings → Issue reuse the overflow reveal+ // Toolbar fields hidden via Settings → Preferences → Issue creation reuse the overflow reveal// pattern: the ⋯ menu item flips this open, which mounts the inline pill// (the popover's anchor) AND opens the picker. Closing without a value// unmounts the pill again; a field holding a non-default value always@@ -396,7 +396,7 @@ export function ManualCreatePanel({setManual({ propertyValues: next });};- // Inline pill reveal per toolbar field: kept by Settings → Issue, holding a+ // Inline pill reveal per toolbar field: kept by Settings → Preferences → Issue creation, holding a// non-default value (a hidden field with a value must stay visible — the// draft or a mode-switch carry may have set it), or just opened from the ⋯// overflow (the picker popover needs the inline pill as its anchor).@@ -975,7 +975,7 @@ export function ManualCreatePanel({when an agent assignee will pick the issue up. */}<CreateRunHint assigneeType={assigneeType} assigneeId={assigneeId} status={status} />- {/* Property toolbar — each field renders per the Settings → Issue+ {/* Property toolbar — each field renders per the Settings → Preferences → Issue creationselection (see showField above). */}<div className="flex items-center gap-1.5 px-4 py-2 shrink-0 flex-wrap">{/* Status */}@@ -1062,7 +1062,7 @@ export function ManualCreatePanel({)}{/* Start date — collapsed into the ⋯ menu by default since it's- a low-frequency field (exposable via Settings → Issue).+ a low-frequency field (exposable via Settings → Preferences → Issue creation).Renders inline when configured visible, when the field has avalue, OR when the user just opened it from the overflowmenu (the picker's calendar popover needs the inline pill@@ -1201,7 +1201,7 @@ export function ManualCreatePanel({/><DropdownMenuContent align="start" className="w-auto">{/* Re-entry points for toolbar fields hidden via- Settings → Issue. Listed in toolbar order; each opens+ Settings → Preferences → Issue creation. Listed in toolbar order; each opensthe picker inline (mounting the pill as its anchor). */}{!showField.status && (<DropdownMenuItem onClick={() => setFieldPickerOpen("status")}>@@ -1292,14 +1292,14 @@ export function ManualCreatePanel({</DropdownMenuSub>)}<DropdownMenuSeparator />- {/* Field visibility lives in Settings → Issue; the modal+ {/* Field visibility lives in Settings → Preferences → Issue creation; the modalcloses first so the dialog doesn't linger over thesettings page. The draft store already holds everythingtyped, so nothing is lost across the round-trip. */}<DropdownMenuItemrender={<AppLink- href={`${p.settings()}?tab=issue`}+ href={`${p.settings()}?tab=preferences§ion=issue`}onClick={(e) => {// A modifier click opens Settings in another tab —// the modal (and the draft in it) stays put. Onlydiff --git a/packages/views/modals/quick-create-issue.test.tsx b/packages/views/modals/quick-create-issue.test.tsxindex 3579d06709..440aebcd7f 100644--- a/packages/views/modals/quick-create-issue.test.tsx+++ b/packages/views/modals/quick-create-issue.test.tsx@@ -683,7 +683,7 @@ describe("AgentCreatePanel", () => {});});- it("routes Customize fields to Settings → Issue, keeping the typed prompt", async () => {+ it("routes Customize fields to Settings → Preferences → Issue creation, keeping the typed prompt", async () => {const user = userEvent.setup();const onClose = vi.fn();@@ -697,10 +697,10 @@ describe("AgentCreatePanel", () => {expect(mockSetAgent).toHaveBeenLastCalledWith({ prompt: "Half-typed request" });expect(onClose).toHaveBeenCalled();- expect(mockNavigationPush).toHaveBeenCalledWith("/ws-test/settings?tab=issue");+ expect(mockNavigationPush).toHaveBeenCalledWith("/ws-test/settings?tab=preferences§ion=issue");});- it("respects fields enabled in Settings → Issue by rendering them inline", () => {+ it("respects fields enabled in Settings → Preferences → Issue creation by rendering them inline", () => {mockCreateSettingsStore.quickCreateFields = ["project", "priority", "due_date"];renderPanel({ onClose: vi.fn(), isExpanded: false, setIsExpanded: vi.fn() });diff --git a/packages/views/modals/quick-create-issue.tsx b/packages/views/modals/quick-create-issue.tsxindex c1bd98a994..d6011f3344 100644--- a/packages/views/modals/quick-create-issue.tsx+++ b/packages/views/modals/quick-create-issue.tsx@@ -598,7 +598,7 @@ export function AgentCreatePanel({onSwitchMode?.(Object.keys(carry).length > 0 ? carry : null);};- // Field visibility lives in Settings → Issue. Persist the prompt draft+ // Field visibility lives in Settings → Preferences → Issue creation. Persist the prompt draft// before leaving so what the user typed survives the round-trip, then// close — the dialog would otherwise linger over the settings page.const openFieldSettings = (e: React.MouseEvent) => {@@ -820,7 +820,7 @@ export function AgentCreatePanel({<DropdownMenuItemrender={<AppLink- href={`${workspacePaths.settings()}?tab=issue`}+ href={`${workspacePaths.settings()}?tab=preferences§ion=issue`}onClick={openFieldSettings}/>}diff --git a/packages/views/settings/components/chat-tab.tsx b/packages/views/settings/components/chat-tab.tsxindex 6ece764fae..a1c2505a16 100644--- a/packages/views/settings/components/chat-tab.tsx+++ b/packages/views/settings/components/chat-tab.tsx@@ -4,15 +4,10 @@ import { Switch } from "@multica/ui/components/ui/switch";import { useChatStore } from "@multica/core/chat";import { toast } from "sonner";import { useT } from "../../i18n";-import {- SettingsCard,- SettingsRow,- SettingsSection,- SettingsTab,-} from "./settings-layout";+import { SettingsCard, SettingsRow, SettingsSection } from "./settings-layout";/**- * Chat settings — its own tab under "My Account". Currently just the+ * Chat preferences. Currently just the* floating-window toggle: when off, the FAB / overlay never mount and Chat* is reachable only from its dedicated tab. It is on by default. The preference is* a persisted client setting (`floatingChatEnabled`), so it applies@@ -24,26 +19,32 @@ export function ChatTab() {const setEnabled = useChatStore((s) => s.setFloatingChatEnabled);return (- <SettingsTab title={t(($) => $.page.tabs.chat)}>+ <div className="space-y-6">+ <p className="text-caption text-muted-foreground">+ {t(($) => $.preferences.device_hint)}+ </p><SettingsSection title={t(($) => $.chat.floating_title)}><SettingsCard><SettingsRowlabel={t(($) => $.chat.floating_label)}description={t(($) => $.chat.floating_hint)}>- <Switch- checked={enabled}- onCheckedChange={(checked) => {- setEnabled(checked);- toast.success(t(($) => $.auto_save.toast_saved), {- id: "settings-auto-save",- });- }}- aria-label={t(($) => $.chat.floating_label)}- />+ <Switch+ checked={enabled}+ onCheckedChange={(checked) => {+ setEnabled(checked);+ toast.success(+ t(($) => $.auto_save.toast_saved),+ {+ id: "settings-auto-save",+ },+ );+ }}+ aria-label={t(($) => $.chat.floating_label)}+ /></SettingsRow></SettingsCard></SettingsSection>- </SettingsTab>+ </div>);}diff --git a/packages/views/settings/components/composio-tab.test.tsx b/packages/views/settings/components/composio-tab.test.tsxindex deb21d0f9e..948dcede39 100644--- a/packages/views/settings/components/composio-tab.test.tsx+++ b/packages/views/settings/components/composio-tab.test.tsx@@ -169,7 +169,7 @@ describe("ComposioTab", () => {});expect(mockInvalidate).toHaveBeenCalledWith({ queryKey: ["composio", "connections"] });// The one-shot param is stripped while ?tab is preserved.- expect(mockReplace).toHaveBeenCalledWith("/acme/settings?tab=integrations");+ expect(mockReplace).toHaveBeenCalledWith("/acme/settings?tab=integrations&integration=composio");});it("toasts error on a failed callback", async () => {@@ -178,7 +178,7 @@ describe("ComposioTab", () => {await waitFor(() => {expect(mockToastError).toHaveBeenCalledWith(enSettings.composio.toast_connect_failed);});- expect(mockReplace).toHaveBeenCalledWith("/acme/settings?tab=integrations");+ expect(mockReplace).toHaveBeenCalledWith("/acme/settings?tab=integrations&integration=composio");});it("fires the success callback exactly once under StrictMode double-invoke", async () => {diff --git a/packages/views/settings/components/composio-tab.tsx b/packages/views/settings/components/composio-tab.tsxindex e40ad8075e..7e9c682e3d 100644--- a/packages/views/settings/components/composio-tab.tsx+++ b/packages/views/settings/components/composio-tab.tsx@@ -88,6 +88,7 @@ export function ComposioTab() {// Drop only the Composio one-shot params; keep everything else (notably// ?tab=integrations) so the user stays on this tab.const params = new URLSearchParams(navigation.searchParams);+ params.set("integration", "composio");params.delete("connected");params.delete("error");const qs = params.toString();diff --git a/packages/views/settings/components/integrations-tab.test.tsx b/packages/views/settings/components/integrations-tab.test.tsxindex 782769ed5f..3d4ba0d624 100644--- a/packages/views/settings/components/integrations-tab.test.tsx+++ b/packages/views/settings/components/integrations-tab.test.tsx@@ -1,139 +1,156 @@-// @vitest-environment jsdom--import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";-import "@testing-library/jest-dom/vitest";-import { cleanup, render, screen } from "@testing-library/react";+import { beforeEach, describe, expect, it, vi } from "vitest";+import { fireEvent, screen } from "@testing-library/react";import { ApiError } from "@multica/core/api";import { configStore } from "@multica/core/config";import { COMPOSIO_MCP_APPS_FLAG } from "@multica/core/feature-flags";-import { I18nProvider } from "@multica/core/i18n/react";-import enCommon from "../../locales/en/common.json";-import enSettings from "../../locales/en/settings.json";--const composioErrorRef = vi.hoisted(() => ({- current: null as Error | null,+import { renderWithI18n } from "../../test/i18n";++const state = vi.hoisted(() => ({+ search: "",+ error: null as Error | null,+ connectionError: false,+ pending: false,+ calls: [] as { queryKey: readonly unknown[]; enabled?: boolean }[],+ push: vi.fn(),}));-const queryCallsRef = vi.hoisted(() => ({- current: [] as { queryKey: unknown[]; enabled?: boolean }[],+vi.mock("../../navigation/context", async (importOriginal) => ({+ ...(await importOriginal<typeof import("../../navigation/context")>()),+ useNavigation: () => ({+ pathname: "/acme/settings",+ searchParams: new URLSearchParams(state.search),+ push: state.push,+ }),+}));+vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => "ws-1" }));+vi.mock("@multica/core/permissions", () => ({+ useCurrentMember: () => ({ member: { role: "admin" } }),}));-vi.mock("@tanstack/react-query", () => ({- useQuery: (opts: { queryKey: unknown[]; enabled?: boolean }) => {- queryCallsRef.current.push(opts);+ queryOptions: <T,>(opts: T) => opts,+ infiniteQueryOptions: <T,>(opts: T) => opts,+ useQuery: (opts: {+ queryKey: readonly unknown[];+ enabled?: boolean;+ select?: (data: unknown) => unknown;+ }) => {+ state.calls.push(opts);+ if (opts.queryKey.includes("toolkits"))+ return { error: opts.enabled === false ? null : state.error };+ const data =+ opts.queryKey[0] === "composio"+ ? [{ status: "active" }]+ : { installations: [{ id: "one" }], connections: [] };return {- data: undefined,- error: opts.enabled === false ? null : composioErrorRef.current,- isError: opts.enabled !== false && composioErrorRef.current != null,+ data: opts.select?.(data),+ isPending: state.pending,+ isError: state.connectionError,};},- queryOptions: <T,>(opts: T) => opts,}));--vi.mock("@multica/core/composio", () => ({- composioToolkitsOptions: () => ({ queryKey: ["composio", "toolkits"] }),-}));--vi.mock("./lark-tab", () => ({- LarkTab: () => <div data-testid="lark-tab" />,-}));-+vi.mock("./github-tab", () => ({ GitHubTab: () => <div>GitHub detail</div> }));+vi.mock("./lark-tab", () => ({ LarkTab: () => <div>Lark detail</div> }));vi.mock("./composio-tab", () => ({- ComposioTab: () => <div data-testid="composio-tab" />,+ ComposioTab: () => <div>Composio detail</div>,}));--vi.mock("./slack-tab", () => ({- SlackTab: () => <div data-testid="slack-tab" />,-}));-+vi.mock("./slack-tab", () => ({ SlackTab: () => <div>Slack detail</div> }));vi.mock("./dingtalk-tab", () => ({- DingTalkTab: () => <div data-testid="dingtalk-tab" />,-}));--vi.mock("./vcs-tab", () => ({- VCSTab: () => <div data-testid="vcs-tab" />,-}));--vi.mock("./wecom-tab", () => ({- WecomTab: () => <div data-testid="wecom-tab" />,+ DingTalkTab: () => <div>DingTalk detail</div>,}));-+vi.mock("./vcs-tab", () => ({ VCSTab: () => <div>VCS detail</div> }));+vi.mock("./wecom-tab", () => ({ WecomTab: () => <div>WeCom detail</div> }));vi.mock("./telegram-tab", () => ({- TelegramTab: () => <div data-testid="telegram-tab" />,+ TelegramTab: () => <div>Telegram detail</div>,}));import { IntegrationsTab } from "./integrations-tab";-afterEach(cleanup);--function renderTab() {- return render(- <I18nProvider locale="en" resources={{ en: { common: enCommon, settings: enSettings } }}>- <IntegrationsTab />- </I18nProvider>,- );-}+beforeEach(() => {+ state.search = "";+ state.error = null;+ state.connectionError = false;+ state.pending = false;+ state.calls = [];+ state.push.mockClear();+ configStore.getState().setFeatureFlags({ [COMPOSIO_MCP_APPS_FLAG]: true });+ configStore+ .getState()+ .setAuthConfig({ allowSignup: true, vcsIntegrationAvailable: false });+});-describe("Settings IntegrationsTab", () => {- beforeEach(() => {- queryCallsRef.current = [];- composioErrorRef.current = null;- configStore.getState().setFeatureFlags({ [COMPOSIO_MCP_APPS_FLAG]: true });- // Reset the self-host-only VCS gate to its default (hidden) so tests stay- // isolated; individual tests opt in below.- configStore.getState().setAuthConfig({ allowSignup: true, vcsIntegrationAvailable: false });+describe("Integration directory", () => {+ it("shows live connection summaries without mounting configuration forms", () => {+ renderWithI18n(<IntegrationsTab />);+ expect(+ screen.getByRole("link", { name: /GitHub Connected/ }),+ ).toBeInTheDocument();+ expect(screen.queryByText("GitHub detail")).not.toBeInTheDocument();+ const shapes = ["lark", "slack", "dingtalk", "wecom", "telegram"].map(+ (channel) =>+ screen.getByTestId(`integration-channel-icon-${channel}`).innerHTML,+ );+ expect(new Set(shapes).size).toBe(5);+ fireEvent.click(screen.getByRole("link", { name: /GitHub Connected/ }));+ expect(state.push).toHaveBeenCalledWith(+ "/acme/settings?tab=integrations&integration=github",+ );});-- it("hides Composio and disables the toolkits query when the feature flag is off", () => {- configStore.getState().setFeatureFlags({ [COMPOSIO_MCP_APPS_FLAG]: false });-- renderTab();-- expect(screen.queryByTestId("composio-tab")).toBeNull();- expect(queryCallsRef.current).toHaveLength(1);- expect(queryCallsRef.current[0]?.enabled).toBe(false);+ it("opens only the selected provider and offers a directory link", () => {+ state.search = "tab=integrations&integration=slack";+ renderWithI18n(<IntegrationsTab />);+ expect(screen.getByText("Slack detail")).toBeInTheDocument();+ expect(screen.queryByText("Lark detail")).not.toBeInTheDocument();+ expect(+ screen.getByRole("link", { name: "All integrations" }),+ ).toHaveAttribute("href", "/acme/settings?tab=integrations");});-- it("shows Composio when the feature flag is on and the integration is configured", () => {- renderTab();-- expect(screen.getByTestId("composio-tab")).toBeInTheDocument();- expect(queryCallsRef.current[0]?.enabled).toBe(true);+ it("handles the existing GitHub bookmark", () => {+ state.search = "tab=github";+ renderWithI18n(<IntegrationsTab />);+ expect(screen.getByText("GitHub detail")).toBeInTheDocument();});-- // Reaching for a generic lucide glyph is how Slack and WeCom ended up sharing- // one speech bubble, with nothing on the row saying which platform it was- // (#6585). Requiring five distinct shapes is the cheap guard against a- // regression to that.- it("gives every channel its own brand mark", () => {- renderTab();-- const shapes = ["lark", "slack", "dingtalk", "wecom", "telegram"].map(- (channel) => screen.getByTestId(`integration-channel-icon-${channel}`).innerHTML,- );-- expect(new Set(shapes).size).toBe(shapes.length);+ it.each(["connected=notion", "error=composio_connect_failed"])(+ "mounts the OAuth result handler for %s",+ (callback) => {+ state.search = `tab=integrations&${callback}`;+ renderWithI18n(<IntegrationsTab />);+ expect(screen.getByText("Composio detail")).toBeInTheDocument();+ },+ );+ it("hides disabled Composio entries and disables their queries", () => {+ configStore.getState().setFeatureFlags({ [COMPOSIO_MCP_APPS_FLAG]: false });+ state.search = "tab=integrations&integration=composio";+ renderWithI18n(<IntegrationsTab />);+ expect(screen.queryByText("Composio detail")).not.toBeInTheDocument();+ expect(+ state.calls+ .filter((call) => call.queryKey[0] === "composio")+ .every((call) => call.enabled === false),+ ).toBe(true);});-- it("hides Composio when the feature flag is on but the server reports 503", () => {- composioErrorRef.current = new ApiError("unavailable", 503, "Service Unavailable");-- renderTab();-- expect(screen.queryByTestId("composio-tab")).toBeNull();+ it("hides Composio when the server reports it unconfigured", () => {+ state.error = new ApiError("unavailable", 503, "Service Unavailable");+ renderWithI18n(<IntegrationsTab />);+ expect(+ screen.queryByRole("link", { name: /Composio/ }),+ ).not.toBeInTheDocument();});-- it("hides the Git providers section when the deployment reports it unavailable", () => {- // Default (managed cloud / older server): vcsIntegrationAvailable is false.- renderTab();-- expect(screen.queryByTestId("vcs-tab")).toBeNull();+ it("only offers self-hosted Git providers when the deployment enables them", () => {+ const { unmount } = renderWithI18n(<IntegrationsTab />);+ expect(+ screen.queryByRole("link", { name: /Git providers/i }),+ ).not.toBeInTheDocument();+ unmount();+ configStore+ .getState()+ .setAuthConfig({ allowSignup: true, vcsIntegrationAvailable: true });+ state.search = "tab=integrations&integration=vcs";+ renderWithI18n(<IntegrationsTab />);+ expect(screen.getByText("VCS detail")).toBeInTheDocument();});-- it("shows the Git providers section on a self-hosted deployment that enables it", () => {- configStore.getState().setAuthConfig({ allowSignup: true, vcsIntegrationAvailable: true });-- renderTab();-- expect(screen.getByTestId("vcs-tab")).toBeInTheDocument();+ it("does not report failed status reads as disconnected", () => {+ state.connectionError = true;+ renderWithI18n(<IntegrationsTab />);+ expect(screen.getAllByText("Status unavailable").length).toBeGreaterThan(0);+ expect(screen.queryByText("Not connected")).not.toBeInTheDocument();});});diff --git a/packages/views/settings/components/integrations-tab.tsx b/packages/views/settings/components/integrations-tab.tsxindex 5b1725f2fa..329a94795b 100644--- a/packages/views/settings/components/integrations-tab.tsx+++ b/packages/views/settings/components/integrations-tab.tsx@@ -1,6 +1,27 @@"use client";+import type { ReactNode } from "react";+import { ArrowLeft, ChevronRight, FolderGit2, Blocks } from "lucide-react";import { useQuery } from "@tanstack/react-query";+import { ApiError } from "@multica/core/api";+import { useWorkspaceId } from "@multica/core/hooks";+import { useCurrentMember } from "@multica/core/permissions";+import {+ composioToolkitsOptions,+ composioConnectionsOptions,+} from "@multica/core/composio";+import { githubInstallationsOptions } from "@multica/core/github";+import { larkInstallationsOptions } from "@multica/core/lark";+import { slackInstallationsOptions } from "@multica/core/slack";+import { dingtalkInstallationsOptions } from "@multica/core/dingtalk";+import { wecomInstallationsOptions } from "@multica/core/wecom";+import { telegramInstallationsOptions } from "@multica/core/telegram";+import { vcsConnectionsOptions } from "@multica/core/vcs";+import { useConfigStore, useFeatureEnabled } from "@multica/core/config";+import { COMPOSIO_MCP_APPS_FLAG } from "@multica/core/feature-flags";+import { cn } from "@multica/ui/lib/utils";+import { AppLink, useNavigation } from "../../navigation";+import { useT } from "../../i18n";import { LarkTab } from "./lark-tab";import { ComposioTab } from "./composio-tab";import { SlackTab } from "./slack-tab";@@ -8,104 +29,296 @@ import { DingTalkTab } from "./dingtalk-tab";import { VCSTab } from "./vcs-tab";import { WecomTab } from "./wecom-tab";import { TelegramTab } from "./telegram-tab";-import { ApiError } from "@multica/core/api";-import { composioToolkitsOptions } from "@multica/core/composio";-import { useConfigStore, useFeatureEnabled } from "@multica/core/config";-import { COMPOSIO_MCP_APPS_FLAG } from "@multica/core/feature-flags";-import { useT } from "../../i18n";-import { SettingsSection, SettingsTab } from "./settings-layout";+import { GitHubTab } from "./github-tab";+import { GitHubMark } from "./github-mark";+import { SettingsCard, SettingsSection, SettingsTab } from "./settings-layout";import { IntegrationChannelIcon } from "./integration-channel-icon";+import { resolveSettingsLocation, settingsHref } from "./settings-navigation";++interface ConnectionState {+ data?: boolean;+ isPending: boolean;+ isError: boolean;+}++interface IntegrationEntry {+ id: string;+ label: string;+ description: string;+ icon: ReactNode;+ content: ReactNode;+ state: ConnectionState;+}-// Integrations is the umbrella tab for third-party platform connections.-// GitHub has its own top-level tab (see github-tab.tsx); everything else-// — currently Lark, Composio, Slack, Telegram, the self-hosted Git providers-// (Forgejo / Gitea / GitLab), and WeCom smart-bot, with Linear etc. to follow —-// lives in here under its own section heading so additional integrations slot-// in without changing the IA. IntegrationsTab is just the host; each-// integration owns its own description and install flow.export function IntegrationsTab() {const { t } = useT("settings");-+ const navigation = useNavigation();+ const wsId = useWorkspaceId();+ const { member } = useCurrentMember(wsId);+ const canView = !!wsId && !!member;const composioEnabled = useFeatureEnabled(COMPOSIO_MCP_APPS_FLAG, false);- const composioToolkits = useQuery({+ const vcsAvailable = useConfigStore((s) => s.vcsIntegrationAvailable);+ const toolkits = useQuery({...composioToolkitsOptions(),enabled: composioEnabled,});- const composioUnconfigured =- composioToolkits.error instanceof ApiError && composioToolkits.error.status === 503;+ const composioAvailable =+ composioEnabled &&+ !(toolkits.error instanceof ApiError && toolkits.error.status === 503);- // Self-host-only integration: the managed cloud reports this false (field- // omitted from /api/config), so the whole section — header included — is- // hidden there rather than showing an operator-only "missing key" message.- const vcsAvailable = useConfigStore((s) => s.vcsIntegrationAvailable);+ // Reuse the detail pages' query caches. Never report a failed or pending read+ // as disconnected, and do not issue deployment-disabled integration queries.+ const github = useQuery({+ ...githubInstallationsOptions(wsId),+ enabled: canView,+ select: (data) => (data.installations?.length ?? 0) > 0,+ });+ const lark = useQuery({+ ...larkInstallationsOptions(wsId),+ enabled: canView,+ select: (data) => (data.installations?.length ?? 0) > 0,+ });+ const slack = useQuery({+ ...slackInstallationsOptions(wsId),+ enabled: canView,+ select: (data) => (data.installations?.length ?? 0) > 0,+ });+ const dingtalk = useQuery({+ ...dingtalkInstallationsOptions(wsId),+ enabled: canView,+ select: (data) => (data.installations?.length ?? 0) > 0,+ });+ const wecom = useQuery({+ ...wecomInstallationsOptions(wsId),+ enabled: canView,+ select: (data) => (data.installations?.length ?? 0) > 0,+ });+ const telegram = useQuery({+ ...telegramInstallationsOptions(wsId),+ enabled: canView,+ select: (data) => (data.installations?.length ?? 0) > 0,+ });+ const vcs = useQuery({+ ...vcsConnectionsOptions(wsId),+ enabled: canView && vcsAvailable,+ select: (data) => (data.connections?.length ?? 0) > 0,+ });+ const composio = useQuery({+ ...composioConnectionsOptions(),+ enabled: composioAvailable,+ select: (data) => data.some((connection) => connection.status === "active"),+ });+ const groups: {+ id: string;+ label: string;+ description?: string;+ entries: IntegrationEntry[];+ }[] = [+ {+ id: "code",+ label: t(($) => $.integrations.code_title),+ entries: [+ {+ id: "github",+ label: t(($) => $.page.tabs.github),+ description: t(($) => $.integrations.github_hint),+ icon: <GitHubMark className="size-5" />,+ content: <GitHubTab />,+ state: github,+ },+ ...(vcsAvailable+ ? [+ {+ id: "vcs",+ label: t(($) => $.vcs.section_title),+ description: t(($) => $.integrations.vcs_hint),+ icon: <FolderGit2 className="size-5" />,+ content: <VCSTab />,+ state: vcs,+ },+ ]+ : []),+ ],+ },+ {+ id: "messaging",+ label: t(($) => $.integrations.messaging_title),+ entries: [+ {+ id: "lark",+ label: t(($) => $.lark.section_title),+ description: t(($) => $.lark.page_description),+ icon: <IntegrationChannelIcon channel="lark" />,+ content: <LarkTab />,+ state: lark,+ },+ {+ id: "slack",+ label: t(($) => $.slack.section_title),+ description: t(($) => $.slack.page_description),+ icon: <IntegrationChannelIcon channel="slack" />,+ content: <SlackTab />,+ state: slack,+ },+ {+ id: "dingtalk",+ label: t(($) => $.dingtalk.section_title),+ description: t(($) => $.dingtalk.page_description),+ icon: <IntegrationChannelIcon channel="dingtalk" />,+ content: <DingTalkTab />,+ state: dingtalk,+ },+ {+ id: "wecom",+ label: t(($) => $.wecom.section_title),+ description: t(($) => $.wecom.page_description),+ icon: <IntegrationChannelIcon channel="wecom" />,+ content: <WecomTab />,+ state: wecom,+ },+ {+ id: "telegram",+ label: t(($) => $.telegram.section_title),+ description: t(($) => $.telegram.page_description),+ icon: <IntegrationChannelIcon channel="telegram" />,+ content: <TelegramTab />,+ state: telegram,+ },+ ],+ },+ ...(composioAvailable+ ? [+ {+ id: "apps",+ label: t(($) => $.integrations.apps_title),+ description: t(($) => $.integrations.apps_scope),+ entries: [+ {+ id: "composio",+ label: t(($) => $.composio.section_title),+ description: t(($) => $.integrations.apps_hint),+ icon: <Blocks className="size-5" />,+ content: <ComposioTab />,+ state: composio,+ },+ ],+ },+ ]+ : []),+ ];+ // The OAuth service still returns to ?tab=integrations with one-shot params.+ // Mount its owning page so it can consume the callback and refresh its cache.+ const hasComposioCallback =+ navigation.searchParams.has("connected") ||+ navigation.searchParams.get("error") === "composio_connect_failed";+ const requested = hasComposioCallback+ ? "composio"+ : resolveSettingsLocation(navigation.searchParams).integration;+ const selected = groups+ .flatMap((group) => group.entries)+ .find((item) => item.id === requested);+ const href = (integration?: string) =>+ settingsHref(navigation.pathname, navigation.searchParams, "integrations", {+ integration,+ });++ if (selected) {+ return (+ <div className="space-y-6">+ <AppLink+ href={href()}+ className="inline-flex items-center gap-2 rounded-md text-body text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring"+ >+ <ArrowLeft className="size-4" aria-hidden="true" />+ {t(($) => $.integrations.back)}+ </AppLink>+ {selected.id === "github" ? (+ selected.content+ ) : (+ <SettingsTab+ title={selected.label}+ description={selected.description}+ >+ {selected.content}+ </SettingsTab>+ )}+ </div>+ );+ }return (- <SettingsTab title={t(($) => $.page.tabs.integrations)}>- <SettingsSection- title={- <span className="flex items-center gap-2">- <IntegrationChannelIcon channel="lark" />- {t(($) => $.lark.section_title)}- </span>- }- description={t(($) => $.lark.page_description)}- >- <LarkTab />- </SettingsSection>- {composioEnabled && !composioUnconfigured && (- <SettingsSection title={t(($) => $.composio.section_title)}>- <ComposioTab />+ <SettingsTab+ title={t(($) => $.page.tabs.integrations)}+ description={t(($) => $.integrations.description)}+ >+ {groups.map((group) => (+ <SettingsSection+ key={group.id}+ title={group.label}+ description={group.description}+ >+ <SettingsCard>+ {group.entries.map((item) => (+ <AppLink+ key={item.id}+ href={href(item.id)}+ className="group flex items-center gap-4 px-4 py-5 first:rounded-t-xl last:rounded-b-xl hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring"+ >+ <span+ aria-hidden="true"+ className="flex size-11 shrink-0 items-center justify-center rounded-xl border border-surface-border bg-background text-foreground"+ >+ {item.icon}+ </span>+ <span className="min-w-0 flex-1">+ <span className="flex flex-wrap items-center gap-x-3 gap-y-1">+ <span className="text-body font-medium text-foreground">+ {item.label}+ </span>{" "}+ <ConnectionBadge state={item.state} />{" "}+ </span>+ <span className="mt-1 block text-caption leading-5 text-muted-foreground">+ {group.id === "messaging"+ ? t(($) => $.integrations.channel_hint, {+ channel: item.label,+ })+ : item.description}+ </span>+ </span>+ <ChevronRight+ className="size-4 shrink-0 text-muted-foreground group-hover:text-foreground"+ aria-hidden="true"+ />+ </AppLink>+ ))}+ </SettingsCard></SettingsSection>+ ))}+ </SettingsTab>+ );+}++function ConnectionBadge({ state }: { state: ConnectionState }) {+ const { t } = useT("settings");+ const connected = !state.isError && !state.isPending && state.data === true;+ const label = state.isError+ ? t(($) => $.integrations.status_unknown)+ : state.isPending+ ? t(($) => $.integrations.status_loading)+ : connected+ ? t(($) => $.integrations.status_connected)+ : t(($) => $.integrations.status_not_connected);+ return (+ <span+ className={cn(+ "inline-flex items-center gap-1.5 text-caption",+ connected ? "text-success" : "text-muted-foreground",)}- <SettingsSection- title={- <span className="flex items-center gap-2">- <IntegrationChannelIcon channel="slack" />- {t(($) => $.slack.section_title)}- </span>- }- description={t(($) => $.slack.page_description)}- >- <SlackTab />- </SettingsSection>- <SettingsSection- title={- <span className="flex items-center gap-2">- <IntegrationChannelIcon channel="dingtalk" />- {t(($) => $.dingtalk.section_title)}- </span>- }- description={t(($) => $.dingtalk.page_description)}- >- <DingTalkTab />- </SettingsSection>- {vcsAvailable && (- <SettingsSection title={t(($) => $.vcs.section_title)}>- <VCSTab />- </SettingsSection>+ >+ {connected && (+ <span aria-hidden="true" className="size-1.5 rounded-full bg-success" />)}- <SettingsSection- title={- <span className="flex items-center gap-2">- <IntegrationChannelIcon channel="wecom" />- {t(($) => $.wecom.section_title)}- </span>- }- description={t(($) => $.wecom.page_description)}- >- <WecomTab />- </SettingsSection>- <SettingsSection- title={- <span className="flex items-center gap-2">- <IntegrationChannelIcon channel="telegram" />- {t(($) => $.telegram.section_title)}- </span>- }- description={t(($) => $.telegram.page_description)}- >- <TelegramTab />- </SettingsSection>- </SettingsTab>+ {label}+ </span>);}diff --git a/packages/views/settings/components/issue-tab.tsx b/packages/views/settings/components/issue-tab.tsxindex e10c42def5..4711ba9a10 100644--- a/packages/views/settings/components/issue-tab.tsx+++ b/packages/views/settings/components/issue-tab.tsx@@ -8,15 +8,10 @@ import {} from "@multica/core/issues/stores/issue-create-settings-store";import { toast } from "sonner";import { useT } from "../../i18n";-import {- SettingsCard,- SettingsRow,- SettingsSection,- SettingsTab,-} from "./settings-layout";+import { SettingsCard, SettingsRow, SettingsSection } from "./settings-layout";/**- * Issue settings — its own tab under "My Account". One group per create-issue+ * Issue preferences. One group per create-issue* mode (agent quick create / manual create), each a switch list of the fields* that mode keeps on its dialog toolbar. Persisted client-side per workspace;* a field toggled off stays reachable from the dialog's ⋯ overflow and@@ -26,18 +21,25 @@ import {export function IssueTab() {const { t } = useT("settings");const quickFields = useIssueCreateSettingsStore((s) => s.quickCreateFields);- const setQuickVisible = useIssueCreateSettingsStore((s) => s.setQuickCreateFieldVisible);+ const setQuickVisible = useIssueCreateSettingsStore(+ (s) => s.setQuickCreateFieldVisible,+ );const manualFields = useIssueCreateSettingsStore((s) => s.manualCreateFields);- const setManualVisible = useIssueCreateSettingsStore((s) => s.setManualCreateFieldVisible);+ const setManualVisible = useIssueCreateSettingsStore(+ (s) => s.setManualCreateFieldVisible,+ );const savedToast = () =>- toast.success(t(($) => $.auto_save.toast_saved), { id: "settings-auto-save" });+ toast.success(+ t(($) => $.auto_save.toast_saved),+ { id: "settings-auto-save" },+ );return (- <SettingsTab- title={t(($) => $.page.tabs.issue)}- description={t(($) => $.issue.description)}- >+ <div className="space-y-8">+ <p className="text-caption text-muted-foreground">+ {t(($) => $.preferences.issue_scope)}+ </p><SettingsSectiontitle={t(($) => $.issue.quick_create_title)}description={t(($) => $.issue.quick_create_description)}@@ -77,6 +79,6 @@ export function IssueTab() {))}</SettingsCard></SettingsSection>- </SettingsTab>+ </div>);}diff --git a/packages/views/settings/components/labs-tab.tsx b/packages/views/settings/components/labs-tab.tsxdeleted file mode 100644index 23025e2772..0000000000--- a/packages/views/settings/components/labs-tab.tsx+++ /dev/null@@ -1,36 +0,0 @@-"use client";--import { FlaskConical } from "lucide-react";-import {- Empty,- EmptyDescription,- EmptyHeader,- EmptyMedia,- EmptyTitle,-} from "@multica/ui/components/ui/empty";-import { useT } from "../../i18n";-import { SettingsCard, SettingsTab } from "./settings-layout";--// The Co-authored-by trailer toggle moved into the dedicated GitHub Settings-// tab (see github-tab.tsx). Labs is kept as a container for future-// experimental flags rather than removed from the IA.-export function LabsTab() {- const { t } = useT("settings");- return (- <SettingsTab title={t(($) => $.page.tabs.labs)}>- <SettingsCard>- <Empty>- <EmptyHeader>- <EmptyMedia variant="icon">- <FlaskConical className="h-4 w-4" />- </EmptyMedia>- <EmptyTitle>{t(($) => $.labs.section_placeholder_title)}</EmptyTitle>- <EmptyDescription>- {t(($) => $.labs.section_placeholder_description)}- </EmptyDescription>- </EmptyHeader>- </Empty>- </SettingsCard>- </SettingsTab>- );-}diff --git a/packages/views/settings/components/preferences-tab.test.tsx b/packages/views/settings/components/preferences-tab.test.tsxindex 72d2973d25..1563cf6eb9 100644--- a/packages/views/settings/components/preferences-tab.test.tsx+++ b/packages/views/settings/components/preferences-tab.test.tsx@@ -16,6 +16,14 @@ import enCommon from "../../locales/en/common.json";import enAuth from "../../locales/en/auth.json";import enSettings from "../../locales/en/settings.json";+const navigationState = vi.hoisted(() => ({ search: "", replace: vi.fn() }));+vi.mock("../../navigation", () => ({+ useNavigation: () => ({+ pathname: "/acme/settings",+ searchParams: new URLSearchParams(navigationState.search),+ replace: navigationState.replace,+ }),+}));const mockPersist = vi.hoisted(() => vi.fn());const mockUpdateMe = vi.hoisted(() => vi.fn());const mockReload = vi.hoisted(() => vi.fn());@@ -33,10 +41,9 @@ vi.mock("@multica/ui/components/common/theme-provider", () => ({}));vi.mock("@multica/core/i18n/react", async () => {- const actual =- await vi.importActual<typeof import("@multica/core/i18n/react")>(- "@multica/core/i18n/react",- );+ const actual = await vi.importActual<+ typeof import("@multica/core/i18n/react")+ >("@multica/core/i18n/react");return {...actual,useLocaleAdapter: () => ({@@ -73,8 +80,7 @@ vi.mock("@multica/core/auth", async () => {setUser: mockSetUser,});const useAuthStore = Object.assign(- (sel?: (s: AuthState) => unknown) =>- sel ? sel(state()) : state(),+ (sel?: (s: AuthState) => unknown) => (sel ? sel(state()) : state()),{ getState: state },);return { ...actual, useAuthStore };@@ -247,7 +253,9 @@ describe("PreferencesTab — Timezone section", () => {user: ReturnType<typeof userEvent.setup>,name: RegExp | string,) {- await user.click(screen.getByRole("combobox", { name: "Viewing Timezone" }));+ await user.click(+ screen.getByRole("combobox", { name: "Viewing Timezone" }),+ );await user.click(await screen.findByRole("option", { name }));}@@ -338,3 +346,28 @@ describe("PreferencesTab — Sticky comment bar", () => {expect(mockToastSuccess).toHaveBeenCalledTimes(1);});});++describe("Preferences sections", () => {+ afterEach(() => {+ navigationState.search = "";+ cleanup();+ });+ it("opens the issue creation controls from an old bookmark", () => {+ navigationState.search = "tab=issue";+ render(+ <I18nWrapper>+ <PreferencesTab />+ </I18nWrapper>,+ );+ expect(screen.getByRole("tab", { name: "Issue creation" })).toHaveAttribute(+ "aria-selected",+ "true",+ );+ expect(+ screen.getByText(enSettings.preferences.issue_scope),+ ).toBeInTheDocument();+ expect(+ screen.queryByRole("combobox", { name: "Theme" }),+ ).not.toBeInTheDocument();+ });+});diff --git a/packages/views/settings/components/preferences-tab.tsx b/packages/views/settings/components/preferences-tab.tsxindex 357962d066..3de795a3b8 100644--- a/packages/views/settings/components/preferences-tab.tsx+++ b/packages/views/settings/components/preferences-tab.tsx@@ -21,6 +21,16 @@ import { useAuthStore } from "@multica/core/auth";import { useCommentComposerStore } from "@multica/core/issues/stores";import { api } from "@multica/core/api";import { browserTimezone, timezoneOptions } from "../../common/timezone-select";+import {+ Tabs,+ TabsList,+ TabsTrigger,+ TabsContent,+} from "@multica/ui/components/ui/tabs";+import { useNavigation } from "../../navigation";+import { resolveSettingsLocation, settingsHref } from "./settings-navigation";+import { IssueTab } from "./issue-tab";+import { ChatTab } from "./chat-tab";import { useT } from "../../i18n";import {SettingsCard,@@ -30,6 +40,57 @@ import {} from "./settings-layout";export function PreferencesTab() {+ const { t } = useT("settings");+ const navigation = useNavigation();+ const requested = resolveSettingsLocation(navigation.searchParams).section;+ const section =+ requested === "issue" || requested === "chat" ? requested : "general";+ return (+ <SettingsTab+ title={t(($) => $.page.tabs.preferences)}+ description={t(($) => $.preferences.description)}+ >+ <Tabs+ value={section}+ onValueChange={(next) =>+ navigation.replace(+ settingsHref(+ navigation.pathname,+ navigation.searchParams,+ "preferences",+ { section: String(next) },+ ),+ )+ }+ >+ <TabsList+ variant="line"+ className="mb-6 max-w-full justify-start"+ aria-label={t(($) => $.page.tabs.preferences)}+ >+ <TabsTrigger value="general">+ {t(($) => $.preferences.general_title)}+ </TabsTrigger>+ <TabsTrigger value="issue">+ {t(($) => $.preferences.issue_title)}+ </TabsTrigger>+ <TabsTrigger value="chat">{t(($) => $.page.tabs.chat)}</TabsTrigger>+ </TabsList>+ <TabsContent value="general">+ <GeneralPreferences />+ </TabsContent>+ <TabsContent value="issue">+ <IssueTab />+ </TabsContent>+ <TabsContent value="chat">+ <ChatTab />+ </TabsContent>+ </Tabs>+ </SettingsTab>+ );+}++function GeneralPreferences() {const { theme, setTheme } = useTheme();const { t, i18n } = useT("settings");const localeAdapter = useLocaleAdapter();@@ -85,15 +146,18 @@ export function PreferencesTab() {setTimeout(() => window.location.reload(), 2500);return;}- toast.success(t(($) => $.auto_save.toast_saved), {- id: "settings-auto-save",- });+ toast.success(+ t(($) => $.auto_save.toast_saved),+ {+ id: "settings-auto-save",+ },+ );// Keep the confirmation visible before the locale reload replaces the UI.setTimeout(() => window.location.reload(), 900);};return (- <SettingsTab title={t(($) => $.page.tabs.preferences)}>+ <><SettingsSection title={t(($) => $.preferences.general_title)}><SettingsCard><SettingsRow@@ -106,9 +170,12 @@ export function PreferencesTab() {onValueChange={(next) => {if (!next || next === theme) return;setTheme(next as (typeof themeOptions)[number]["value"]);- toast.success(t(($) => $.auto_save.toast_saved), {- id: "settings-auto-save",- });+ toast.success(+ t(($) => $.auto_save.toast_saved),+ {+ id: "settings-auto-save",+ },+ );}}><SelectTrigger@@ -147,7 +214,11 @@ export function PreferencesTab() {aria-label={t(($) => $.preferences.language.title)}><SelectValue>- {languageOptions.find((option) => option.value === currentLocale)?.label}+ {+ languageOptions.find(+ (option) => option.value === currentLocale,+ )?.label+ }</SelectValue></SelectTrigger><SelectContent align="end">@@ -161,11 +232,18 @@ export function PreferencesTab() {</SettingsRow><TimezoneRow />-+ </SettingsCard>+ </SettingsSection>+ <SettingsSection+ title={t(($) => $.preferences.comments_title)}+ description={t(($) => $.preferences.device_hint)}+ className="mt-8"+ >+ <SettingsCard><StickyCommentBarRow /></SettingsCard></SettingsSection>- </SettingsTab>+ </>);}@@ -183,9 +261,12 @@ function StickyCommentBarRow() {checked={sticky}onCheckedChange={() => {toggleSticky();- toast.success(t(($) => $.auto_save.toast_saved), {- id: "settings-auto-save",- });+ toast.success(+ t(($) => $.auto_save.toast_saved),+ {+ id: "settings-auto-save",+ },+ );}}aria-label={t(($) => $.preferences.sticky_comment_bar.title)}/>@@ -219,9 +300,12 @@ function TimezoneRow() {try {const updated = await api.updateMe({ timezone: payload });setUser(updated);- toast.success(t(($) => $.auto_save.toast_saved), {- id: "settings-auto-save",- });+ toast.success(+ t(($) => $.auto_save.toast_saved),+ {+ id: "settings-auto-save",+ },+ );} catch (err) {toast.error(err instanceof Error && err.message@@ -265,11 +349,18 @@ function TimezoneRow() {<SelectValue>{formatTZLabel(value)}</SelectValue></SelectTrigger><SelectContent align="end" className="max-h-72">- <SelectItem value={BROWSER_TZ_VALUE} className="font-mono text-caption">+ <SelectItem+ value={BROWSER_TZ_VALUE}+ className="font-mono text-caption"+ >{formatTZLabel(BROWSER_TZ_VALUE)}</SelectItem>{options.map((timezone) => (- <SelectItem key={timezone} value={timezone} className="font-mono text-caption">+ <SelectItem+ key={timezone}+ value={timezone}+ className="font-mono text-caption"+ >{formatTZLabel(timezone)}</SelectItem>))}diff --git a/packages/views/settings/components/settings-layout.tsx b/packages/views/settings/components/settings-layout.tsxindex 4553a4eec4..ae4b7050cc 100644--- a/packages/views/settings/components/settings-layout.tsx+++ b/packages/views/settings/components/settings-layout.tsx@@ -47,7 +47,9 @@ export function SettingsSection({{title || description || action ? (<div className="flex min-w-0 items-end justify-between gap-4 px-0.5"><div className="min-w-0">- {title ? <h3 className="text-body font-semibold">{title}</h3> : null}+ {title ? (+ <h3 className="text-body font-semibold">{title}</h3>+ ) : null}{description ? (<p className="mt-1 text-caption leading-5 text-muted-foreground">{description}@@ -119,8 +121,15 @@ export function SettingsRow({return (<divclassName={cn(- "flex min-h-16 flex-col gap-3 px-4 py-3.5 sm:flex-row sm:justify-between sm:gap-8",- align === "center" ? "sm:items-center" : "sm:items-start",+ "flex min-h-16 gap-4 px-4 py-3.5 sm:justify-between sm:gap-8",+ size ? "flex-col sm:flex-row" : "flex-row justify-between",+ align === "center"+ ? size+ ? "sm:items-center"+ : "items-center"+ : size+ ? "sm:items-start"+ : "items-start",className,)}>@@ -134,7 +143,8 @@ export function SettingsRow({</div><divclassName={cn(- "w-full shrink-0 sm:w-auto sm:max-w-[56%]",+ "shrink-0 sm:w-auto sm:max-w-[56%]",+ size ? "w-full" : "w-auto max-w-[56%]",size ? SETTINGS_CONTROL_WIDTHS[size] : undefined,)}>diff --git a/packages/views/settings/components/settings-navigation.test.ts b/packages/views/settings/components/settings-navigation.test.tsnew file mode 100644index 0000000000..b6117862a1--- /dev/null+++ b/packages/views/settings/components/settings-navigation.test.ts@@ -0,0 +1,28 @@+// @vitest-environment node+import { describe, expect, it } from "vitest";+import { resolveSettingsLocation, settingsHref } from "./settings-navigation";++describe("settings location", () => {+ it.each([+ ["issue", "preferences", "issue", null],+ ["chat", "preferences", "chat", null],+ ["github", "integrations", null, "github"],+ ["lark", "integrations", null, "lark"],+ ["labs", "workspace", null, null],+ ])("resolves the retired %s entry", (old, tab, section, integration) => {+ expect(resolveSettingsLocation(new URLSearchParams({ tab: old! }))).toEqual(+ { tab, section, integration },+ );+ });++ it("preserves unrelated query state while replacing page-specific state", () => {+ expect(+ settingsHref(+ "/acme/settings",+ new URLSearchParams("tab=preferences§ion=chat&keep=1"),+ "integrations",+ { integration: "slack" },+ ),+ ).toBe("/acme/settings?tab=integrations&keep=1&integration=slack");+ });+});diff --git a/packages/views/settings/components/settings-navigation.ts b/packages/views/settings/components/settings-navigation.tsnew file mode 100644index 0000000000..4c003326b8--- /dev/null+++ b/packages/views/settings/components/settings-navigation.ts@@ -0,0 +1,31 @@+/** Resolve bookmarks for settings pages that now live inside another page. */+export function resolveSettingsLocation(params: URLSearchParams) {+ const tab = params.get("tab") ?? "profile";+ if (tab === "issue" || tab === "chat") {+ return { tab: "preferences", section: tab, integration: null };+ }+ if (tab === "github" || tab === "lark") {+ return { tab: "integrations", section: null, integration: tab };+ }+ return {+ tab: tab === "labs" ? "workspace" : tab,+ section: params.get("section"),+ integration: params.get("integration"),+ };+}++/** Clear page-specific state while preserving unrelated callback parameters. */+export function settingsHref(+ pathname: string,+ searchParams: URLSearchParams,+ tab: string,+ detail: { section?: string; integration?: string } = {},+) {+ const params = new URLSearchParams(searchParams);+ params.set("tab", tab);+ params.delete("section");+ params.delete("integration");+ if (detail.section) params.set("section", detail.section);+ if (detail.integration) params.set("integration", detail.integration);+ return `${pathname}?${params.toString()}`;+}diff --git a/packages/views/settings/components/settings-page.test.tsx b/packages/views/settings/components/settings-page.test.tsxindex 081fd74330..4c2d1639ba 100644--- a/packages/views/settings/components/settings-page.test.tsx+++ b/packages/views/settings/components/settings-page.test.tsx@@ -1,4 +1,4 @@-import { fireEvent, screen } from "@testing-library/react";+import { fireEvent, screen, within } from "@testing-library/react";import { beforeEach, describe, expect, it, vi } from "vitest";import { SidebarProvider, useSidebar } from "@multica/ui/components/ui/sidebar";@@ -11,9 +11,9 @@ import { renderWithI18n } from "../../test/i18n";// This file tests the settings SHELL — the chrome around the tabs — so every// tab panel is stubbed out. Their contents have their own test files.-const stub = vi.hoisted(- () => (name: string) => () => ({ [name]: () => <div>{name}</div> }),-);+const stub = vi.hoisted(() => (name: string) => () => ({+ [name]: () => <div>{name}</div>,+}));vi.mock("./account-tab", stub("AccountTab"));vi.mock("./preferences-tab", stub("PreferencesTab"));vi.mock("./chat-tab", stub("ChatTab"));@@ -24,7 +24,6 @@ vi.mock("./members-tab", stub("MembersTab"));vi.mock("./repositories-tab", stub("RepositoriesTab"));vi.mock("./github-tab", stub("GitHubTab"));vi.mock("./integrations-tab", stub("IntegrationsTab"));-vi.mock("./labs-tab", stub("LabsTab"));vi.mock("./notifications-tab", stub("NotificationsTab"));vi.mock("./labels-tab", stub("LabelsTab"));vi.mock("./properties-tab", stub("PropertiesTab"));@@ -38,13 +37,16 @@ vi.mock("@multica/core/paths", () => ({}));const replace = vi.fn();+const push = vi.fn();const navigationState = { search: "" };-vi.mock("../../navigation", () => ({+vi.mock("../../navigation/context", async (importOriginal) => ({+ ...(await importOriginal<typeof import("../../navigation/context")>()),useNavigation: () => ({searchParams: new URLSearchParams(navigationState.search),hash: "",pathname: "/acme/settings",replace,+ push,}),}));@@ -123,7 +125,9 @@ describe("SettingsPage Plugin feature flag", () => {renderWithI18n(<SettingsPage />);- expect(screen.queryByRole("tab", { name: "Plugins" })).not.toBeInTheDocument();+ expect(+ screen.queryByRole("link", { name: "Plugins" }),+ ).not.toBeInTheDocument();expect(screen.queryByText("PluginsTab")).not.toBeInTheDocument();expect(screen.getByText("AccountTab")).toBeInTheDocument();});@@ -134,7 +138,7 @@ describe("SettingsPage Plugin feature flag", () => {renderWithI18n(<SettingsPage />);- expect(screen.getByRole("tab", { name: "Plugins" })).toBeInTheDocument();+ expect(screen.getByRole("link", { name: "Plugins" })).toBeInTheDocument();expect(screen.getByText("PluginsTab")).toBeInTheDocument();});});@@ -146,7 +150,7 @@ describe("SettingsPage workspace subscription feature flag", () => {renderWithI18n(<SettingsPage />);expect(- screen.queryByRole("tab", { name: "Billing" }),+ screen.queryByRole("link", { name: "Billing" }),).not.toBeInTheDocument();expect(screen.queryByText("BillingTab")).not.toBeInTheDocument();expect(screen.getByText("WorkspaceTab")).toBeInTheDocument();@@ -160,7 +164,62 @@ describe("SettingsPage workspace subscription feature flag", () => {renderWithI18n(<SettingsPage />);- expect(screen.getByRole("tab", { name: "Billing" })).toBeInTheDocument();+ expect(screen.getByRole("link", { name: "Billing" })).toBeInTheDocument();expect(screen.getByText("BillingTab")).toBeInTheDocument();});});++describe("SettingsPage information architecture", () => {+ it("groups workspace configuration and keeps retired pages out of navigation", () => {+ renderWithI18n(<SettingsPage />);+ const nav = screen.getByRole("navigation", { name: "Settings" });+ const issues = within(nav).getByRole("region", {+ name: "Issue configuration",+ });+ expect(+ within(issues).getByRole("link", { name: "Issue Statuses" }),+ ).toBeInTheDocument();+ expect(+ within(nav).queryByRole("link", { name: /^(Issue|Chat|GitHub|Labs)$/ }),+ ).not.toBeInTheDocument();+ });++ it("opens old issue bookmarks in preferences", () => {+ navigationState.search = "tab=issue";+ renderWithI18n(<SettingsPage />);+ expect(screen.getByText("PreferencesTab")).toBeInTheDocument();+ expect(screen.getByRole("link", { name: "Preferences" })).toHaveAttribute(+ "aria-current",+ "page",+ );+ });++ it("places platform settings in a device group", () => {+ renderWithI18n(+ <SettingsPage+ extraDeviceTabs={[+ {+ value: "updates",+ label: "Updates",+ icon: () => null,+ content: <div>Device updates</div>,+ },+ ]}+ />,+ );+ const device = screen.getByRole("region", { name: "Desktop app" });+ expect(+ within(device).getByRole("link", { name: "Updates" }),+ ).toBeInTheDocument();+ });++ it("navigates from the compact selector and clears the old detail", () => {+ navigationState.search = "tab=integrations&integration=github&keep=1";+ renderWithI18n(<SettingsPage />);+ fireEvent.change(+ screen.getByRole("combobox", { name: "Go to settings page" }),+ { target: { value: "preferences" } },+ );+ expect(push).toHaveBeenCalledWith("/acme/settings?tab=preferences&keep=1");+ });+});diff --git a/packages/views/settings/components/settings-page.tsx b/packages/views/settings/components/settings-page.tsxindex f379bc5ec7..70e5a86c3c 100644--- a/packages/views/settings/components/settings-page.tsx+++ b/packages/views/settings/components/settings-page.tsx@@ -2,46 +2,39 @@import React from "react";import {+ ChevronRight,User,SlidersHorizontal,Key,Settings,Users,FolderGit2,- FlaskConical,Bell,Plug,- MessageCircle,Tags,CircleDot,Keyboard,- ListTodo,Zap,Blocks,CreditCard,Server,} from "lucide-react";-import { GitHubMark } from "./github-mark";-import { Tabs, TabsList, TabsTrigger, TabsContent } from "@multica/ui/components/ui/tabs";-import { useIsMobile } from "@multica/ui/hooks/use-mobile";import { useCurrentWorkspace } from "@multica/core/paths";import { useFeatureEnabled } from "@multica/core/config";import {BILLING_WORKSPACE_SUBSCRIPTIONS_FLAG,PLUGINS_V1_FLAG,} from "@multica/core/feature-flags";-import { useNavigation } from "../../navigation";+import { cn } from "@multica/ui/lib/utils";+import { resolveSettingsLocation, settingsHref } from "./settings-navigation";+import { AppLink, useNavigation } from "../../navigation";import { AccountTab } from "./account-tab";import { PreferencesTab } from "./preferences-tab";-import { ChatTab } from "./chat-tab";-import { IssueTab } from "./issue-tab";import { TokensTab } from "./tokens-tab";import { WorkspaceTab } from "./workspace-tab";import { MembersTab } from "./members-tab";import { RepositoriesTab } from "./repositories-tab";-import { GitHubTab } from "./github-tab";import { IntegrationsTab } from "./integrations-tab";-import { LabsTab } from "./labs-tab";import { NotificationsTab } from "./notifications-tab";import { LabelsTab } from "./labels-tab";import { IssueStatusesTab } from "./issue-statuses-tab";@@ -54,77 +47,6 @@ import { BillingTab } from "./billing-tab";import { CollapsedNavTrigger } from "../../layout/page-header";import { useT } from "../../i18n";-const ACCOUNT_TAB_KEYS = ["profile", "preferences", "shortcuts", "issue", "chat", "notifications", "tokens"] as const;-const ACCOUNT_TAB_ICONS = {- profile: User,- preferences: SlidersHorizontal,- shortcuts: Keyboard,- issue: ListTodo,- chat: MessageCircle,- notifications: Bell,- tokens: Key,-} as const;--const WORKSPACE_TAB_KEYS = [- "general",- "repositories",- "github",- "integrations",- "labs",- "members",- "billing",- "labels",- "issue_statuses",- "properties",- "quick_actions",- "mcp",- "plugins",-] as const;-const WORKSPACE_TAB_VALUES = {- general: "workspace",- repositories: "repositories",- github: "github",- integrations: "integrations",- labs: "labs",- members: "members",- billing: "billing",- labels: "labels",- issue_statuses: "issue-statuses",- properties: "properties",- quick_actions: "quick-actions",- mcp: "mcp",- plugins: "plugins",-} as const;-const WORKSPACE_TAB_ICONS = {- general: Settings,- repositories: FolderGit2,- github: GitHubMark,- integrations: Plug,- labs: FlaskConical,- members: Users,- billing: CreditCard,- labels: Tags,- issue_statuses: CircleDot,- properties: SlidersHorizontal,- quick_actions: Zap,- mcp: Server,- plugins: Blocks,-} as const;--const DEFAULT_TAB = "profile";-const TAB_QUERY_KEY = "tab";--// Legacy `?tab=…` values that have been collapsed into another tab. Old-// bookmarks still land on the correct surface without us preserving a-// dead TabsContent entry. Lark used to be its own top-level workspace-// tab; it now lives inside Integrations.-const LEGACY_WORKSPACE_TAB_REDIRECTS: Record<string, string> = {- lark: "integrations",-};--const SETTINGS_TAB_TRIGGER_CLASS =- "h-8 shrink-0 px-2.5 hover:bg-surface-hover data-active:!bg-surface-selected data-active:!text-surface-selected-foreground data-active:hover:!bg-surface-selected md:!w-full md:px-2 md:after:hidden";-export interface ExtraSettingsTab {value: string;label: string;@@ -133,167 +55,283 @@ export interface ExtraSettingsTab {}interface SettingsPageProps {- /** Additional tabs injected by platform (e.g. desktop daemon settings) */- extraAccountTabs?: ExtraSettingsTab[];+ /** Device settings supplied by the desktop platform. */+ extraDeviceTabs?: ExtraSettingsTab[];}-export function SettingsPage({ extraAccountTabs }: SettingsPageProps = {}) {+type SettingsEntry = ExtraSettingsTab & { wide?: boolean };++export function SettingsPage({ extraDeviceTabs = [] }: SettingsPageProps = {}) {const { t } = useT("settings");- const workspaceName = useCurrentWorkspace()?.name;+ const workspaceName =+ useCurrentWorkspace()?.name ?? t(($) => $.page.workspace_fallback);const navigation = useNavigation();- const isMobile = useIsMobile();const pluginsEnabled = useFeatureEnabled(PLUGINS_V1_FLAG, false);const billingEnabled = useFeatureEnabled(BILLING_WORKSPACE_SUBSCRIPTIONS_FLAG,false,);-- const visibleWorkspaceTabKeys = React.useMemo(- () =>- WORKSPACE_TAB_KEYS.filter(- (key) =>- (key !== "plugins" || pluginsEnabled) &&- (key !== "billing" || billingEnabled),- ),- [billingEnabled, pluginsEnabled],- );-- // Whitelist of valid tab values; unknown ?tab=… values silently fall back to- // the default. Whitelisting also blocks junk like ?tab=<script> from- // surfacing in the DOM via Radix Tabs internals.- const validTabs = React.useMemo(- () =>- new Set<string>([- ...ACCOUNT_TAB_KEYS,- ...visibleWorkspaceTabKeys.map((key) => WORKSPACE_TAB_VALUES[key]),- ...(extraAccountTabs?.map((tab) => tab.value) ?? []),- ]),- [extraAccountTabs, visibleWorkspaceTabKeys],- );-- const tabFromUrl = navigation.searchParams.get(TAB_QUERY_KEY);- const candidateTab = tabFromUrl- ? tabFromUrl === "billing" && !billingEnabled- ? "workspace"- : LEGACY_WORKSPACE_TAB_REDIRECTS[tabFromUrl] ?? tabFromUrl- : null;- const activeTab =- candidateTab && validTabs.has(candidateTab) ? candidateTab : DEFAULT_TAB;-- // replace (not push) so settings tab switches don't pollute browser history.- // Preserve any other query params the page may carry.- const handleTabChange = (next: string) => {- const params = new URLSearchParams(navigation.searchParams);- params.set(TAB_QUERY_KEY, next);- navigation.replace(`${navigation.pathname}?${params.toString()}`);- };+ const entry = (+ value: string,+ label: string,+ icon: ExtraSettingsTab["icon"],+ content: React.ReactNode,+ wide = false,+ ): SettingsEntry => ({ value, label, icon, content, wide });+ const groups = [+ {+ key: "personal",+ label: t(($) => $.page.groups.personal),+ scope: t(($) => $.page.groups.personal),+ entries: [+ entry(+ "profile",+ t(($) => $.page.tabs.profile),+ User,+ <AccountTab />,+ ),+ entry(+ "preferences",+ t(($) => $.page.tabs.preferences),+ SlidersHorizontal,+ <PreferencesTab />,+ ),+ entry(+ "notifications",+ t(($) => $.page.tabs.notifications),+ Bell,+ <NotificationsTab />,+ ),+ entry(+ "shortcuts",+ t(($) => $.page.tabs.shortcuts),+ Keyboard,+ <KeyboardShortcutsTab />,+ ),+ entry(+ "tokens",+ t(($) => $.page.tabs.tokens),+ Key,+ <TokensTab />,+ ),+ ],+ },+ {+ key: "workspace",+ label: t(($) => $.page.groups.workspace),+ scope: workspaceName,+ entries: [+ entry(+ "workspace",+ t(($) => $.page.tabs.general),+ Settings,+ <WorkspaceTab />,+ ),+ entry(+ "members",+ t(($) => $.page.tabs.members),+ Users,+ <MembersTab />,+ ),+ ...(billingEnabled+ ? [+ entry(+ "billing",+ t(($) => $.page.tabs.billing),+ CreditCard,+ <BillingTab />,+ ),+ ]+ : []),+ ],+ },+ {+ key: "issues",+ label: t(($) => $.page.groups.issues),+ scope: workspaceName,+ entries: [+ entry(+ "issue-statuses",+ t(($) => $.page.tabs.issue_statuses),+ CircleDot,+ <IssueStatusesTab />,+ true,+ ),+ entry(+ "labels",+ t(($) => $.page.tabs.labels),+ Tags,+ <LabelsTab />,+ true,+ ),+ entry(+ "properties",+ t(($) => $.page.tabs.properties),+ SlidersHorizontal,+ <PropertiesTab />,+ true,+ ),+ entry(+ "quick-actions",+ t(($) => $.page.tabs.quick_actions),+ Zap,+ <QuickActionsTab />,+ true,+ ),+ ],+ },+ {+ key: "connections",+ label: t(($) => $.page.groups.connections),+ scope: workspaceName,+ entries: [+ entry(+ "repositories",+ t(($) => $.page.tabs.repositories),+ FolderGit2,+ <RepositoriesTab />,+ ),+ entry(+ "integrations",+ t(($) => $.page.tabs.integrations),+ Plug,+ <IntegrationsTab />,+ ),+ entry(+ "mcp",+ t(($) => $.page.tabs.mcp),+ Server,+ <McpTab />,+ ),+ ...(pluginsEnabled+ ? [+ entry(+ "plugins",+ t(($) => $.page.tabs.plugins),+ Blocks,+ <PluginsTab />,+ ),+ ]+ : []),+ ],+ },+ ...(extraDeviceTabs.length+ ? [+ {+ key: "device",+ label: t(($) => $.page.groups.device),+ scope: t(($) => $.page.device_scope),+ entries: extraDeviceTabs as SettingsEntry[],+ },+ ]+ : []),+ ];+ const location = resolveSettingsLocation(navigation.searchParams);+ const candidate =+ location.tab === "billing" && !billingEnabled ? "workspace" : location.tab;+ const active =+ groups+ .flatMap((group) => group.entries)+ .find((item) => item.value === candidate) ?? groups[0]!.entries[0]!;+ const activeGroup = groups.find((group) => group.entries.includes(active))!;+ const href = (value: string) =>+ settingsHref(navigation.pathname, navigation.searchParams, value);return (- <Tabs- value={activeTab}- onValueChange={handleTabChange}- orientation={isMobile ? "horizontal" : "vertical"}- className="flex flex-1 min-h-0 flex-col gap-0 overflow-y-auto md:flex-row md:overflow-hidden"- >- {/* Structural navigation; bounded setting groups remain in the content surface.- Stays on the content surface color (no shell tint): the desktop's active- tab merges into the card top, and a tinted panel under the first tabs- breaks that seam (MUL-4439). Zoning comes from the divider instead. */}- <div className="shrink-0 overflow-x-auto border-b border-surface-border p-2 md:w-56 md:overflow-y-auto md:border-b-0 md:border-r md:p-4">- {/* This page builds its own chrome instead of a PageHeader, so it has- to supply the nav trigger itself — below `xl` the nav is a sheet or- auto-collapsed, and settings has no other way back to it. */}- {/* The gap below this row belongs to the row, not to the heading: with- `items-center`, a bottom margin on the `h1` is part of the box being- centred, so it offsets the heading against the trigger beside it. */}- <div className="flex items-center md:mb-4">+ <div className="flex min-h-0 flex-1 flex-col overflow-hidden bg-background md:flex-row">+ <aside className="shrink-0 border-b border-surface-border md:flex md:w-60 md:flex-col md:border-b-0 md:border-r">+ <div className="flex h-16 shrink-0 items-center gap-1 px-4 md:px-5"><CollapsedNavTrigger />- <h1 className="sr-only text-body font-semibold md:not-sr-only md:px-2">{t(($) => $.page.title)}</h1>+ <h1 className="text-title font-semibold tracking-tight">+ {t(($) => $.page.title)}+ </h1>+ </div>+ <div className="px-4 pb-4 md:hidden">+ <label className="sr-only" htmlFor="settings-navigation">+ {t(($) => $.page.navigate)}+ </label>+ <select+ id="settings-navigation"+ className="h-10 w-full rounded-lg border border-input bg-background px-3 text-body text-foreground focus-visible:outline-2 focus-visible:outline-ring"+ value={active.value}+ onChange={(event) => navigation.push(href(event.target.value))}+ >+ {groups.map((group) => (+ <optgroup key={group.key} label={group.label}>+ {group.entries.map((item) => (+ <option key={item.value} value={item.value}>+ {item.label}+ </option>+ ))}+ </optgroup>+ ))}+ </select></div>- <TabsList- variant="line"- className="flex w-max min-w-full flex-row items-center gap-1 p-0 md:w-full md:flex-col md:items-stretch"+ <nav+ aria-label={t(($) => $.page.title)}+ className="hidden min-h-0 space-y-5 overflow-y-auto px-3 pb-6 md:block">- {/* My Account group */}- <span className="hidden px-2 pb-1 pt-2 text-caption font-medium text-muted-foreground md:block">- {t(($) => $.page.my_account)}- </span>- {ACCOUNT_TAB_KEYS.map((key) => {- const Icon = ACCOUNT_TAB_ICONS[key];- return (- <TabsTrigger- key={key}- value={key}- className={SETTINGS_TAB_TRIGGER_CLASS}- >- <Icon className="h-4 w-4" />- {t(($) => $.page.tabs[key])}- </TabsTrigger>- );- })}- {extraAccountTabs?.map((tab) => (- <TabsTrigger- key={tab.value}- value={tab.value}- className={SETTINGS_TAB_TRIGGER_CLASS}+ {groups.map((group) => (+ <section+ key={group.key}+ aria-labelledby={`settings-group-${group.key}`}>- <tab.icon className="h-4 w-4" />- {tab.label}- </TabsTrigger>- ))}-- {/* Workspace group */}- <span className="hidden truncate px-2 pb-1 pt-4 text-caption font-medium text-muted-foreground md:block">- {workspaceName ?? t(($) => $.page.workspace_fallback)}- </span>- {visibleWorkspaceTabKeys.map((key) => {- const Icon = WORKSPACE_TAB_ICONS[key];- return (- <TabsTrigger- key={key}- value={WORKSPACE_TAB_VALUES[key]}- className={SETTINGS_TAB_TRIGGER_CLASS}+ <h2+ id={`settings-group-${group.key}`}+ className="mb-1.5 px-3 text-caption font-medium text-muted-foreground">- <Icon className="h-4 w-4" />- {t(($) => $.page.tabs[key])}- </TabsTrigger>- );- })}- </TabsList>- </div>-- {/* Right content */}- <div className="min-w-0 flex-1 md:overflow-y-auto">- <div className={`mx-auto w-full p-4 sm:p-6 md:p-8 ${activeTab === "labels" || activeTab === "issue-statuses" || activeTab === "properties" || activeTab === "quick-actions"- ? "max-w-5xl"- : "max-w-3xl"}`}>- <TabsContent value="profile"><AccountTab /></TabsContent>- <TabsContent value="preferences"><PreferencesTab /></TabsContent>- <TabsContent value="shortcuts"><KeyboardShortcutsTab /></TabsContent>- <TabsContent value="issue"><IssueTab /></TabsContent>- <TabsContent value="chat"><ChatTab /></TabsContent>- <TabsContent value="notifications"><NotificationsTab /></TabsContent>- <TabsContent value="tokens"><TokensTab /></TabsContent>- <TabsContent value="workspace"><WorkspaceTab /></TabsContent>- <TabsContent value="repositories"><RepositoriesTab /></TabsContent>- <TabsContent value="github"><GitHubTab /></TabsContent>- <TabsContent value="integrations"><IntegrationsTab /></TabsContent>- <TabsContent value="labs"><LabsTab /></TabsContent>- <TabsContent value="members"><MembersTab /></TabsContent>- {billingEnabled ? (- <TabsContent value="billing"><BillingTab /></TabsContent>- ) : null}- <TabsContent value="labels"><LabelsTab /></TabsContent>- <TabsContent value="issue-statuses"><IssueStatusesTab /></TabsContent>- <TabsContent value="properties"><PropertiesTab /></TabsContent>- <TabsContent value="quick-actions"><QuickActionsTab /></TabsContent>- <TabsContent value="mcp"><McpTab /></TabsContent>- {pluginsEnabled ? <TabsContent value="plugins"><PluginsTab /></TabsContent> : null}- {extraAccountTabs?.map((tab) => (- <TabsContent key={tab.value} value={tab.value}>{tab.content}</TabsContent>+ {group.label}+ </h2>+ <ul className="space-y-0.5">+ {group.entries.map((item) => (+ <li key={item.value}>+ <AppLink+ href={href(item.value)}+ aria-current={+ active.value === item.value ? "page" : undefined+ }+ className={cn(+ "flex min-h-9 items-center gap-2.5 rounded-lg px-3 py-2 text-body transition-colors focus-visible:outline-2 focus-visible:outline-ring",+ active.value === item.value+ ? "bg-surface-selected font-medium text-surface-selected-foreground hover:bg-surface-selected"+ : "text-muted-foreground hover:bg-surface-hover hover:text-foreground",+ )}+ >+ <item.icon+ className="size-4 shrink-0"+ aria-hidden="true"+ />+ <span className="min-w-0 truncate">{item.label}</span>+ </AppLink>+ </li>+ ))}+ </ul>+ </section>))}+ </nav>+ </aside>+ <div+ key={`${active.value}:${location.integration ?? ""}`}+ className="min-w-0 flex-1 overflow-y-auto overscroll-contain"+ >+ <div+ className={cn(+ "mx-auto w-full px-4 py-6 sm:px-6 md:px-10 md:py-8",+ active.wide ? "max-w-5xl" : "max-w-4xl",+ )}+ >+ <div className="mb-3 flex min-w-0 items-center gap-2 text-caption text-muted-foreground">+ <span className="truncate">{activeGroup.scope}</span>+ {activeGroup.scope !== activeGroup.label && (+ <>+ <ChevronRight aria-hidden="true" className="size-3 shrink-0" />+ <span className="shrink-0">{activeGroup.label}</span>+ </>+ )}+ </div>+ {active.content}</div></div>- </Tabs>+ </div>);}