Localize the remaining dashboard UI clusters and refresh the generated i18n resources. - Replace hardcoded labels across agent, plugin, mission, workflow node, research, document, activity, and miscellaneous dashboard components with app namespace translations. - Add and synchronize locale catalog entries for English, Spanish, French, Korean, Simplified Chinese, and Traditional Chinese. - Update i18n lint configuration and generated resource types, with a patch changeset for the published CLI package. Files changed: .changeset/fn-6769-i18n-cluster.md | 5 + i18next.config.ts | 47 +-- .../dashboard/app/components/ActiveAgentsPanel.tsx | 2 +- packages/dashboard/app/components/ActivityFeed.tsx | 12 +- .../dashboard/app/components/ActivityLogModal.tsx | 4 +- packages/dashboard/app/components/AddNodeModal.tsx | 4 +- .../dashboard/app/components/AgentDetailView.tsx | 6 +- .../app/components/AgentGenerationModal.tsx | 2 +- .../dashboard/app/components/AgentImportModal.tsx | 4 +- .../app/components/AgentOnboardingModal.tsx | 4 +- .../app/components/AgentPromptsManager.tsx | 2 +- .../dashboard/app/components/AgentRunHistory.tsx | 2 +- .../dashboard/app/components/AgentsOverviewBar.tsx | 2 +- .../dashboard/app/components/BranchGroupCard.tsx | 4 +- .../dashboard/app/components/CliBinaryPanel.tsx | 8 +- .../app/components/CursorCliProviderCard.tsx | 4 +- .../dashboard/app/components/DashboardLoader.tsx | 4 +- .../dashboard/app/components/DevServerView.tsx | 8 +- .../dashboard/app/components/DocumentsView.tsx | 6 +- .../dashboard/app/components/ErrorBoundary.tsx | 9 +- .../dashboard/app/components/ExecutorStatusBar.tsx | 5 +- .../dashboard/app/components/GitHubStarPrompt.tsx | 14 +- .../dashboard/app/components/GitManagerModal.tsx | 4 +- .../dashboard/app/components/GroupTaskModal.tsx | 2 +- packages/dashboard/app/components/Header.tsx | 4 +- .../dashboard/app/components/HermesRuntimeCard.tsx | 2 +- packages/dashboard/app/components/InsightsView.tsx | 2 +- .../dashboard/app/components/IssueMentionPopup.tsx | 5 +- packages/dashboard/app/components/MailboxView.tsx | 6 +- .../components/MilestoneSliceInterviewModal.tsx | 2 +- .../app/components/MissionInterviewModal.tsx | 2 +- .../dashboard/app/components/MissionManager.tsx | 8 +- .../app/components/ModelOnboardingModal.tsx | 2 +- .../dashboard/app/components/NodeDetailModal.tsx | 2 +- .../app/components/PiExtensionsManager.tsx | 10 +- .../dashboard/app/components/ProjectSelector.tsx | 6 +- packages/dashboard/app/components/QuickChatFAB.tsx | 44 +-- packages/dashboard/app/components/ResearchView.tsx | 2 +- packages/dashboard/app/components/RoutineCard.tsx | 6 +- .../dashboard/app/components/RoutineEditor.tsx | 2 +- packages/dashboard/app/components/RoutingTab.tsx | 2 +- packages/dashboard/app/components/ScheduleCard.tsx | 6 +- packages/dashboard/app/components/ScheduleForm.tsx | 2 +- packages/dashboard/app/components/ScriptsModal.tsx | 2 +- .../app/components/StashConflictModal.tsx | 4 +- .../dashboard/app/components/TerminalModal.tsx | 2 +- .../app/components/nodes/WorkflowNodeTypes.tsx | 47 +-- packages/i18n/locales/en/app.json | 274 +++++++-------- packages/i18n/locales/es/app.json | 144 ++++++-- packages/i18n/locales/fr/app.json | 144 ++++++-- packages/i18n/locales/ko/app.json | 144 ++++++-- packages/i18n/locales/zh-CN/app.json | 144 ++++++-- packages/i18n/locales/zh-TW/app.json | 144 ++++++-- packages/i18n/src/resources.d.ts | 375 +++++++++++++++++++-- 54 files changed, 1261 insertions(+), 442 deletions(-) Fusion-Task-Id: FN-6769 Fusion-Task-Lineage: a8733dc9-3b48-47e6-88c4-020f83ab41de
118 lines
4.9 KiB
TypeScript
118 lines
4.9 KiB
TypeScript
import { useCallback, useEffect, useRef, useState } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import { Loader2 } from "lucide-react";
|
|
import { fetchCursorCliStatus, setCursorCliEnabled, type CursorCliStatus } from "../api";
|
|
import { ProviderIcon } from "./ProviderIcon";
|
|
import "./CursorCliProviderCard.css";
|
|
|
|
interface CursorCliProviderCardProps {
|
|
authenticated: boolean;
|
|
compact?: boolean;
|
|
onToggled?: (nextEnabled: boolean) => void;
|
|
}
|
|
|
|
export function CursorCliProviderCard({ authenticated, compact = false, onToggled }: CursorCliProviderCardProps) {
|
|
const { t } = useTranslation("app");
|
|
const [status, setStatus] = useState<CursorCliStatus | null>(null);
|
|
const [busy, setBusy] = useState<"enabling" | "disabling" | "testing" | null>(null);
|
|
const mountedRef = useRef(true);
|
|
|
|
useEffect(() => {
|
|
mountedRef.current = true;
|
|
return () => {
|
|
mountedRef.current = false;
|
|
};
|
|
}, []);
|
|
|
|
const refresh = useCallback(async () => {
|
|
try {
|
|
const next = await fetchCursorCliStatus();
|
|
if (mountedRef.current) setStatus(next);
|
|
return next;
|
|
} catch {
|
|
return null;
|
|
}
|
|
}, []);
|
|
|
|
useEffect(() => {
|
|
void refresh();
|
|
}, [refresh]);
|
|
|
|
const handleToggle = useCallback(
|
|
async (next: boolean) => {
|
|
setBusy(next ? "enabling" : "disabling");
|
|
try {
|
|
const result = await setCursorCliEnabled(next);
|
|
onToggled?.(result.enabled);
|
|
await refresh();
|
|
} finally {
|
|
if (mountedRef.current) setBusy(null);
|
|
}
|
|
},
|
|
[onToggled, refresh],
|
|
);
|
|
|
|
const currentlyEnabled = status?.enabled ?? authenticated;
|
|
const binaryAvailable = status?.binary.available ?? false;
|
|
|
|
const actions = (
|
|
<>
|
|
<button type="button" className="btn btn-sm" onClick={() => {
|
|
setBusy("testing");
|
|
void refresh().finally(() => {
|
|
if (mountedRef.current) setBusy(null);
|
|
});
|
|
}} disabled={busy !== null}>
|
|
{busy === "testing" ? <><Loader2 size={12} className="animate-spin" /> {t("setup.cursorCli.testing", "Testing…")}</> : t("setup.cursorCli.test", "Test")}
|
|
</button>
|
|
{currentlyEnabled ? (
|
|
<button type="button" className="btn btn-sm" onClick={() => void handleToggle(false)} disabled={busy !== null}>
|
|
{busy === "disabling" ? t("setup.cursorCli.disabling", "Disabling…") : t("setup.cursorCli.disable", "Disable")}
|
|
</button>
|
|
) : (
|
|
<button type="button" className="btn btn-primary btn-sm" onClick={() => void handleToggle(true)} disabled={busy !== null || !binaryAvailable}>
|
|
{busy === "enabling" ? t("setup.cursorCli.enabling", "Enabling…") : t("setup.cursorCli.enable", "Enable")}
|
|
</button>
|
|
)}
|
|
</>
|
|
);
|
|
|
|
const statusText = !status
|
|
? t("setup.cursorCli.probing", "Probing local CLI…")
|
|
: !status.binary.available
|
|
? status.binary.reason ?? t("setup.cursorCli.binaryNotFound", "`cursor-agent` not found on PATH")
|
|
: currentlyEnabled
|
|
? t("setup.cursorCli.connected", "Connected{{version}}", { version: status.binary.version ? ` — ${status.binary.version}` : "" })
|
|
: t("setup.cursorCli.detectedPrompt", "Detected. Click Enable to route calls through Cursor CLI.");
|
|
|
|
if (compact) {
|
|
return (
|
|
<div className={`cursor-cli-provider-card auth-provider-card auth-provider-card--cli${authenticated ? " auth-provider-card--authenticated" : ""}`} data-testid="cursor-cli-provider-card">
|
|
<div className="auth-provider-header">
|
|
<div className="auth-provider-info">
|
|
<ProviderIcon provider="cursor-cli" size="sm" />
|
|
<strong>{t("setup.cursorCli.providerName", "Cursor — via Cursor CLI")}</strong>
|
|
<span className={`auth-status-badge ${currentlyEnabled ? "authenticated" : "not-authenticated"}`}>{currentlyEnabled ? t("setup.cursorCli.active", "✓ Active") : t("setup.cursorCli.notConnected", "✗ Not connected")}</span>
|
|
</div>
|
|
<div className="auth-provider-cli-actions">{actions}</div>
|
|
</div>
|
|
<small className="settings-muted">{statusText}</small>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className={`cursor-cli-provider-card onboarding-provider-card${authenticated ? " onboarding-provider-card--connected" : ""}`} data-testid="cursor-cli-provider-card">
|
|
<div className="onboarding-provider-card__icon">
|
|
<ProviderIcon provider="cursor-cli" size="md" />
|
|
</div>
|
|
<div className="onboarding-provider-card__body">
|
|
<strong className="onboarding-provider-card__name">{t("setup.cursorCli.providerName", "Cursor — via Cursor CLI")}</strong>
|
|
<span className="onboarding-provider-card__description">{t("setup.cursorCli.description", "Route AI calls through your local Cursor agent runtime.")}</span>
|
|
<small className="settings-muted">{statusText}</small>
|
|
</div>
|
|
<div className="onboarding-provider-card__actions">{actions}</div>
|
|
</div>
|
|
);
|
|
}
|