Files
fusion/packages/dashboard/app/components/ErrorBoundary.tsx
gsxdsm b760fa0df9 FN-6769: localize remaining dashboard strings
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
2026-06-20 05:04:25 -07:00

99 lines
3.0 KiB
TypeScript

import { Component, type ReactNode, type ErrorInfo } from "react";
import { AlertTriangle } from "lucide-react";
import { handleChunkLoadError } from "../versionCheck";
import i18n from "../i18n";
import "./ErrorBoundary.css";
interface ErrorBoundaryProps {
children: ReactNode;
fallback?: ReactNode;
level?: "page" | "modal" | "root";
onError?: (error: Error, errorInfo: ErrorInfo) => void;
}
interface ErrorBoundaryState {
hasError: boolean;
error: Error | null;
}
export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
constructor(props: ErrorBoundaryProps) {
super(props);
this.state = { hasError: false, error: null };
}
static getDerivedStateFromError(error: Error): ErrorBoundaryState {
return { hasError: true, error };
}
componentDidCatch(error: Error, errorInfo: ErrorInfo): void {
console.error("[ErrorBoundary]", error, errorInfo);
if (handleChunkLoadError(error)) return;
this.props.onError?.(error, errorInfo);
}
resetErrorBoundary = (): void => {
this.setState({ hasError: false, error: null });
};
render(): ReactNode {
if (!this.state.hasError) {
return this.props.children;
}
if (this.props.fallback) {
return this.props.fallback;
}
const level = this.props.level ?? "page";
const isModal = level === "modal";
const title = isModal
? i18n.t("app:errorBoundary.sectionError", "This section encountered an error")
: i18n.t("app:errorBoundary.genericError", "Something went wrong");
return (
<div className={`error-boundary error-boundary--${level}`}>
<div className="error-boundary__icon">
<AlertTriangle size={40} />
</div>
<div className="error-boundary__title">{title}</div>
{this.state.error && (
<pre className="error-boundary__message">{this.state.error.message}</pre>
)}
<div className="error-boundary__actions">
<button className="btn btn-primary" onClick={this.resetErrorBoundary}>
{i18n.t("app:errorBoundary.retry", "Retry")}
</button>
<button className="btn" onClick={() => window.location.reload()}>
{i18n.t("app:errorBoundary.reloadPage", "Reload page")}
</button>
</div>
</div>
);
}
}
export function PageErrorBoundary({ children, onError }: { children: ReactNode; onError?: (error: Error, errorInfo: ErrorInfo) => void }) {
return (
<ErrorBoundary level="page" onError={onError}>
{children}
</ErrorBoundary>
);
}
export function ModalErrorBoundary({ children, onError }: { children: ReactNode; onError?: (error: Error, errorInfo: ErrorInfo) => void }) {
return (
<ErrorBoundary level="modal" onError={onError}>
{children}
</ErrorBoundary>
);
}
export function RootErrorBoundary({ children, onError }: { children: ReactNode; onError?: (error: Error, errorInfo: ErrorInfo) => void }) {
return (
<ErrorBoundary level="root" onError={onError}>
{children}
</ErrorBoundary>
);
}