Files
fusion/packages/dashboard/app/components/WorktrunkInstallApprovalDetails.tsx
gsxdsm 1e49494bac feat(i18n): full-sweep string migration — 5,930 keys across 5 locales (#1352)
Migration (multi-agent sweep over 216 files, 60 batches):
- Every user-visible dashboard + TUI string moved to t() with the exact
  English inline default (en rendering byte-identical)
- Catalogs merged from per-batch fragments: en/zh-CN/zh-TW/fr/es now
  carry ~5,930 keys each across common/app/errors/cli namespaces;
  CLI bundles regenerated (6 locales incl. ko)

Integration fixes:
- 18 type errors: reserved {{count}} interpolations renamed, malformed
  plural call, hand-rolled t-param types replaced with TFunction<"app">
- 23 lint errors: superseded label constants/helpers removed
- ExecutorStatusBar hook-order violation (keyboard-open early return
  moved below hooks)
- TUI tests wrapped in I18nextProvider (uninitialized fallback renders
  literal {{placeholders}}); dashboard vitest.setup boots a minimal en
  i18next instance for the same reason

Known WIP (next commits): ~457 residual strings across 50 batches,
Korean drafts for swept keys, and a dashboard test-suite pass that is
still being stabilized (~283 failures under investigation — fake-timer
waitFor interaction, likely stale node_modules vs merged lockfile).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 19:06:53 -07:00

57 lines
2.5 KiB
TypeScript

import "./WorktrunkInstallApprovalDetails.css";
import { useTranslation } from "react-i18next";
import type { ApprovalRequestDetail } from "../api";
interface WorktrunkInstallApprovalDetailsProps {
targetAction: ApprovalRequestDetail["targetAction"];
}
function readString(value: unknown): string | null {
return typeof value === "string" && value.trim().length > 0 ? value : null;
}
function readAsset(context: Record<string, unknown> | undefined): { url: string | null; sha256: string | null } {
if (!context) return { url: null, sha256: null };
const assets = context.assets;
if (!assets || typeof assets !== "object") return { url: null, sha256: null };
const firstAsset = Object.values(assets as Record<string, unknown>)[0];
if (!firstAsset || typeof firstAsset !== "object") return { url: null, sha256: null };
const asset = firstAsset as Record<string, unknown>;
return {
url: readString(asset.url),
sha256: readString(asset.sha256),
};
}
export function WorktrunkInstallApprovalDetails({ targetAction }: WorktrunkInstallApprovalDetailsProps) {
const { t } = useTranslation("app");
const context = targetAction.context as Record<string, unknown> | undefined;
const version = readString(context?.version);
const installPath = readString(context?.installPath) ?? targetAction.resourceId;
const { url, sha256 } = readAsset(context);
return (
<section className="card worktrunk-install-approval-details" data-testid="worktrunk-install-approval-details">
<h4 className="worktrunk-install-approval-details__title">{t("worktrunk.installRequestTitle", "Worktrunk install request")}</h4>
<dl className="worktrunk-install-approval-details__list">
<div className="worktrunk-install-approval-details__row">
<dt>{t("worktrunk.version", "Version")}</dt>
<dd>{version ?? t("common.unknown", "Unknown")}</dd>
</div>
<div className="worktrunk-install-approval-details__row">
<dt>{t("worktrunk.assetUrl", "Asset URL")}</dt>
<dd>{url ?? t("common.unknown", "Unknown")}</dd>
</div>
<div className="worktrunk-install-approval-details__row">
<dt>{t("worktrunk.sha256", "SHA-256")}</dt>
<dd>{sha256 ?? t("common.unknown", "Unknown")}</dd>
</div>
<div className="worktrunk-install-approval-details__row">
<dt>{t("worktrunk.installPath", "Install path")}</dt>
<dd>{installPath ?? t("common.unknown", "Unknown")}</dd>
</div>
</dl>
</section>
);
}