Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cloud/TASKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
- **Acceptance:** Tests cover three states (loading, success, error-with-cache).

### C10 — Mount the Account tab
- [ ] **Goal:** Add an "Account" entry to the settings navigation that contains `LicenseSettings` + `CloudUsagePanel`.
- [x] **Goal:** Add an "Account" entry to the settings navigation that contains `LicenseSettings` + `CloudUsagePanel`.
- **Approach:** Locate the existing settings nav. **If wiring it in requires more than ~10 lines of change in any single existing file, block and document where you stopped.**
- **Acceptance:** "Account" tab appears, both panels render.

Expand Down Expand Up @@ -137,3 +137,4 @@
[x] C9 — 2026-04-28 — ae19918 — CloudUsagePanel with 60s polling and stale-cache-on-error; 7 tests cover loading/success/error-with-cache + cold error + cadence + cleanup
[x] C12 — 2026-04-28 — 381004c — e2e test (license → setLicense → visible → mock chat → usage delta) + invalid-signature + lifetime-only-no-cloud_ai paths; 3 tests
[x] C3 — 2026-04-28 — d684a85 — license storage via safeStorage + Linux 0600 fallback; 3 additive lines in ipc.ts; 16 tests (11 main, 5 renderer)
[x] C10 — 2026-04-28 — 9873ab7 — Account tab mounted in SettingsModal between Network and System; locale strings in en/zh-CN/zh-TW/ja; 7 tests pass (existing modal tests + new account-tab assertion)
27 changes: 26 additions & 1 deletion src/components/layout/SettingsModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ vi.mock("@/stores/useLocaleStore", () => ({
ai: "AI",
sync: "Sync",
network: "Network",
account: "Account",
system: "System",
},
},
Expand Down Expand Up @@ -191,6 +192,14 @@ vi.mock("../settings/ProxySection", () => ({
ProxySection: () => <div>Proxy</div>,
}));

vi.mock("../settings/LicenseSettings", () => ({
LicenseSettings: () => <div>LicenseSettings</div>,
}));

vi.mock("../settings/CloudUsagePanel", () => ({
CloudUsagePanel: () => <div>CloudUsagePanel</div>,
}));

describe("SettingsModal", () => {
const onOpenUpdateModal = vi.fn();

Expand All @@ -203,7 +212,7 @@ describe("SettingsModal", () => {
onOpenUpdateModal.mockClear();
});

it("renders tabbed navigation with 5 tabs", () => {
it("renders tabbed navigation with 6 tabs", () => {
render(
<SettingsModal
isOpen
Expand All @@ -216,9 +225,25 @@ describe("SettingsModal", () => {
expect(screen.getByText("AI")).toBeInTheDocument();
expect(screen.getByText("Sync")).toBeInTheDocument();
expect(screen.getByText("Network")).toBeInTheDocument();
expect(screen.getByText("Account")).toBeInTheDocument();
expect(screen.getByText("System")).toBeInTheDocument();
});

it("switches to account tab and shows license + usage panels", () => {
render(
<SettingsModal
isOpen
onClose={() => undefined}
onOpenUpdateModal={onOpenUpdateModal}
/>,
);

fireEvent.click(screen.getByText("Account"));

expect(screen.getByText("LicenseSettings")).toBeInTheDocument();
expect(screen.getByText("CloudUsagePanel")).toBeInTheDocument();
});

it("defaults to general tab showing theme and editor", () => {
render(
<SettingsModal
Expand Down
16 changes: 13 additions & 3 deletions src/components/layout/SettingsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,29 @@
import { useState } from "react";
import { createPortal } from "react-dom";
import { useLocaleStore } from "@/stores/useLocaleStore";
import { Settings, Bot, RefreshCw, Globe, Info, X } from "lucide-react";
import { Settings, Bot, RefreshCw, Globe, Info, User, X } from "lucide-react";
import { GeneralSection } from "../settings/GeneralSection";
import { SystemSection } from "../settings/SystemSection";
import { AISettingsContent } from "../ai/AISettingsModal";
import { WebDAVSettings } from "../settings/WebDAVSettings";
import { MobileGatewaySection } from "../settings/MobileGatewaySection";
import { MobileOptionsSection } from "../settings/MobileOptionsSection";
import { ProxySection } from "../settings/ProxySection";
import { LicenseSettings } from "../settings/LicenseSettings";
import { CloudUsagePanel } from "../settings/CloudUsagePanel";

type TabId = "general" | "ai" | "sync" | "network" | "system";
type TabId = "general" | "ai" | "sync" | "network" | "account" | "system";

const TAB_ICONS: Record<TabId, typeof Settings> = {
general: Settings,
ai: Bot,
sync: RefreshCw,
network: Globe,
account: User,
system: Info,
};

const TAB_ORDER: TabId[] = ["general", "ai", "sync", "network", "system"];
const TAB_ORDER: TabId[] = ["general", "ai", "sync", "network", "account", "system"];

interface SettingsModalProps {
isOpen: boolean;
Expand Down Expand Up @@ -61,6 +64,13 @@ export function SettingsModal({ isOpen, onClose, onOpenUpdateModal }: SettingsMo
<ProxySection />
</>
);
case "account":
return (
<>
<LicenseSettings />
<CloudUsagePanel />
</>
);
case "system":
return <SystemSection onOpenUpdateModal={onOpenUpdateModal} />;
}
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,7 @@ export default {
ai: "AI",
sync: "Sync",
network: "Network",
account: "Account",
system: "System",
},
diagnosticsTitle: "Diagnostics",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,7 @@ export default {
ai: "AI",
sync: "同期",
network: "ネットワーク",
account: "アカウント",
system: "システム",
},
diagnosticsTitle: "診断",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,7 @@ export default {
ai: "AI",
sync: "同步",
network: "网络",
account: "账户",
system: "系统",
},
diagnosticsTitle: "诊断",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/zh-TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,7 @@ export default {
ai: "AI",
sync: "同步",
network: "網路",
account: "帳戶",
system: "系統",
},
diagnosticsTitle: "診斷",
Expand Down