Files
fusion/packages/dashboard/app/components/SetupWarningBanner.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

93 lines
2.6 KiB
TypeScript

import "./SetupWarningBanner.css";
import { X } from "lucide-react";
import { useTranslation } from "react-i18next";
interface SetupWarningBannerProps {
/** Whether an AI provider is connected */
hasAiProvider: boolean;
/** Whether GitHub is connected */
hasGithub: boolean;
/** Optional: compact mode for inline use (QuickEntryBox) */
compact?: boolean;
/** Optional callback to dismiss the banner */
onDismiss?: () => void;
}
interface WarningItem {
key: "ai" | "github";
title: string;
description: string;
}
export function SetupWarningBanner({
hasAiProvider,
hasGithub,
compact = false,
onDismiss,
}: SetupWarningBannerProps) {
const { t } = useTranslation("app");
if (hasAiProvider && hasGithub) {
return null;
}
const dismissButton = onDismiss ? (
<button
type="button"
className="setup-warning-banner__dismiss touch-target"
aria-label={t("setup.dismissWarning", "Dismiss setup warning")}
onClick={onDismiss}
>
<X size={16} aria-hidden="true" />
</button>
) : null;
if (compact) {
return (
<div
className={`setup-warning-banner setup-warning-banner--compact${onDismiss ? " setup-warning-banner--dismissible" : ""}`}
role="status"
aria-live="polite"
>
<p className="setup-warning-banner__compact-text">
{t("setup.compactWarning", "⚠ Setup incomplete — AI and/or GitHub features will be limited.")}
</p>
{dismissButton}
</div>
);
}
const warningItems: WarningItem[] = [];
if (!hasAiProvider) {
warningItems.push({
key: "ai",
title: t("setup.noAiProvider", "No AI provider connected"),
description: t("setup.noAiProviderDesc", "AI agents won't be able to work on tasks until you connect a provider. Set one up in Settings → AI Setup."),
});
}
if (!hasGithub) {
warningItems.push({
key: "github",
title: t("setup.noGithub", "GitHub not connected"),
description: t("setup.noGithubDesc", "You won't be able to import issues from GitHub, but you can still create tasks manually."),
});
}
return (
<div
className={`setup-warning-banner${onDismiss ? " setup-warning-banner--dismissible" : ""}`}
role="status"
aria-live="polite"
>
{dismissButton}
{warningItems.map((warning) => (
<div key={warning.key} className="setup-warning-banner__item">
<strong className="setup-warning-banner__title">{warning.title}</strong>
<p className="setup-warning-banner__description">{warning.description}</p>
</div>
))}
</div>
);
}