Skip to content
Open
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
82 changes: 78 additions & 4 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"electron-updater": "^6.8.9",
"i18next": "^26.3.4",
"lucide-react": "^1.17.0",
"openapi-fetch": "^0.17.0",
"posthog-js": "^1.390.2",
"radix-ui": "^1.5.0",
"react": "^19.2.7",
"react-dom": "^19.2.7",
"react-i18next": "^17.0.8",
"react-resizable-panels": "^4.11.2",
"tailwind-merge": "^3.6.0",
"zustand": "^5.0.14"
Expand Down
28 changes: 15 additions & 13 deletions frontend/src/renderer/components/SessionsBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { restartProjectOrchestrator } from "../lib/restart-orchestrator";
import { prBrowserUrl, sessionPRDisplaySummaries } from "../lib/pr-display";
import { cn } from "../lib/utils";
import { useUiStore } from "../stores/ui-store";
import { useTranslation } from "react-i18next";

type SessionsBoardProps = {
/** When set, the board shows only this project's sessions. */
Expand Down Expand Up @@ -75,6 +76,7 @@ const COLUMNS: Column[] = [
];

export function SessionsBoard({ projectId }: SessionsBoardProps) {
const { t } = useTranslation();
const navigate = useNavigate();
const queryClient = useQueryClient();
const workspaceQuery = useWorkspaceQuery();
Expand Down Expand Up @@ -160,7 +162,7 @@ export function SessionsBoard({ projectId }: SessionsBoardProps) {
// Never fail silently: the daemon's message (e.g. a worktree/branch
// conflict) is the only actionable signal the user gets.
console.error("Failed to spawn orchestrator:", err);
setSpawnError(err instanceof Error ? err.message : "Could not spawn orchestrator");
setSpawnError(err instanceof Error ? err.message : t("board.errors.spawnFailed"));
} finally {
setIsSpawning(false);
}
Expand Down Expand Up @@ -194,30 +196,30 @@ export function SessionsBoard({ projectId }: SessionsBoardProps) {
</span>
)}
<button
aria-label="New task"
aria-label={t("board.actions.newTask")}
className="dashboard-app-header__accent-btn"
disabled={isProjectRestarting}
onClick={() => setIsNewTaskOpen(true)}
type="button"
>
<Plus className="h-3.5 w-3.5" aria-hidden="true" />
New task
{t("board.actions.newTask")}
</button>
<button
aria-label={orchestrator ? "Orchestrator" : "Spawn Orchestrator"}
aria-label={orchestrator ? t("board.actions.orchestrator"): t("board.actions.spawnOrchestrator")}
className="dashboard-app-header__primary-btn"
disabled={isSpawning || isProjectRestarting}
onClick={() => void openOrchestrator()}
type="button"
>
<OrchestratorIcon className="h-3.5 w-3.5" aria-hidden="true" />
{isProjectRestarting
? "Restarting..."
? t("board.actions.restarting")
: isSpawning
? "Spawning..."
? t("board.actions.spawning")
: orchestrator
? "Orchestrator"
: "Spawn Orchestrator"}
? t("board.actions.orchestrator")
: t("board.actions.spawnOrchestrator")}
</button>
</>
) : undefined;
Expand All @@ -229,8 +231,8 @@ export function SessionsBoard({ projectId }: SessionsBoardProps) {
(review feedback on #2432). */}
{!showWelcome && (
<DashboardSubhead
title="Board"
subtitle="Live agent sessions flowing from work → review → merge."
title={t("board.title")}
subtitle={t("board.subtitle")}
actions={actions}
/>
)}
Expand All @@ -248,13 +250,13 @@ export function SessionsBoard({ projectId }: SessionsBoardProps) {
type="button"
>
<RotateCw className="size-3.5" aria-hidden="true" />
Restart
{t("board.actions.restart")}
</button>
) : null}
</div>
) : null}
{workspaceQuery.isError ? (
<p className="py-10 text-center text-[12px] text-passive">Could not load sessions.</p>
<p className="py-10 text-center text-[12px] text-passive">{t("board.errors.loadSessions")}</p>
) : showWelcome ? (
<BoardWelcome />
) : showProjectEmpty ? (
Expand Down Expand Up @@ -300,7 +302,7 @@ export function SessionsBoard({ projectId }: SessionsBoardProps) {
>
<path d="m9 18 6-6-6-6" />
</svg>
<span className="font-mono text-[10.5px] font-medium uppercase tracking-[0.05em]">Done / Terminated</span>
<span className="font-mono text-[10.5px] font-medium uppercase tracking-[0.05em]">{t("board.done")}</span>
<span className="ml-auto shrink-0 font-mono text-[10px] text-passive">{done.length}</span>
</button>
{doneExpanded && (
Expand Down
50 changes: 50 additions & 0 deletions frontend/src/renderer/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import i18n from "i18next";
import { initReactI18next } from "react-i18next";

import en from "../i18n/locales/en.json";
import zhCN from "../i18n/locales/zh-CN.json";

type Locale = "en" | "zh-CN"
const LOCAL_STORAGE_KEY = "ao.locale";

function getStoredLocale() : Locale | null{
const stored = localStorage.getItem(LOCAL_STORAGE_KEY);
if (stored === "en" || stored === "zh-CN") {
return stored;
}
return null;
}

function detectLocale(): Locale {
const stored = getStoredLocale();
if(stored) return stored;
return navigator.language.startsWith("zh") ? "zh-CN" : "en";
}

function saveLocale(locale : Locale){
localStorage.setItem(LOCAL_STORAGE_KEY, locale);
}

i18n.on("languageChanged", (language) => {
if (language === "en" || language === "zh-CN") {
saveLocale(language);
}
document.documentElement.lang = language;
});

export function initialiseI18n(){
console.log("INITIALISED");
return i18n.use(initReactI18next).init({
resources: {
en: {translation: en},
"zh-CN": {translation: zhCN}
},
fallbackLng: "en",
lng: detectLocale(),
interpolation: {
escapeValue: false,
},
});
}

export default i18n;
31 changes: 31 additions & 0 deletions frontend/src/renderer/i18n/locales/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"board": {
"title": "Board",
"subtitle": "Live agent sessions flowing from work → review → merge.",

"columns": {
"working": "Working",
"action": "Needs you",
"pending": "In review",
"merge": "Ready to merge"
},

"actions": {
"newTask": "New Task",
"orchestrator": "Orchestrator",
"spawnOrchestrator": "Spawn Orchestrator",
"restart": "Restart",
"restarting": "Restarting...",
"spawning": "Spawning..."
},

"errors": {
"spawnFailed": "Could not spawn orchestrator",
"loadSessions": "Could not load sessions."
},

"done": "Done / Terminated",

"noPR": "No PR yet"
}
}
31 changes: 31 additions & 0 deletions frontend/src/renderer/i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"board": {
"title": "看板",
"subtitle": "实时查看代理会话从开发 → 审查 → 合并的流程。",

"columns": {
"working": "开发中",
"action": "需要处理",
"pending": "审核中",
"merge": "准备合并"
},

"actions": {
"newTask": "新建任务",
"orchestrator": "编排器",
"spawnOrchestrator": "启动编排器",
"restart": "重启",
"restarting": "正在重启...",
"spawning": "正在启动..."
},

"errors": {
"spawnFailed": "无法启动编排器",
"loadSessions": "无法加载会话。"
},

"done": "已完成 / 已终止",

"noPR": "暂无 PR"
}
}
3 changes: 3 additions & 0 deletions frontend/src/renderer/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { createAppRouter } from "./router";
import { TelemetryBoundary } from "./components/TelemetryBoundary";
import { initTelemetry } from "./lib/telemetry";
import { startDaemonFailureTelemetry } from "./lib/daemon-telemetry";
import { initialiseI18n } from "./i18n";

const router = createAppRouter(queryClient);
void initTelemetry();
Expand All @@ -20,6 +21,8 @@ declare module "@tanstack/react-router" {
}
}

void initialiseI18n();

createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
<TelemetryBoundary>
Expand Down
Loading