Skip to content
Merged
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
12 changes: 10 additions & 2 deletions packages/agent-chat/src/ComputerManagePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { RanchLocale } from "./ranch-shell/i18n";
import { colors } from "./ranch-shell/styles";
import { computerName, type ComputerNameRow } from "./computerLabel";
import { computerManageCta, computerStatusLine, extraAsksBeforeCreate, pauseAsksBeforeCharge } from "./computerManageCta";
import type { ScreenChargeHint } from "./computerSendBoot";
import { screenAsksBeforeCharge, type ScreenChargeHint } from "./computerSendBoot";
import { ConfirmDialog } from "./ranch-shell/ConfirmDialog";

type ComputerRow = ComputerNameRow & {
Expand Down Expand Up @@ -43,6 +43,7 @@ const copy = {
running: "On",
runningAt: "On · {rate}/hr",
screen: "Open computer screen",
screenAt: "Open computer screen · {rate}/hr",
pause: "Pause",
pausing: "Pausing…",
pauseFailed: "The computer did not pause.",
Expand Down Expand Up @@ -77,6 +78,7 @@ const copy = {
running: "开着",
runningAt: "开着 {rate} 星币/小时",
screen: "打开电脑屏幕",
screenAt: "打开电脑屏幕 · {rate} 星币/小时",
pause: "暂停",
pausing: "正在暂停…",
pauseFailed: "没有停下来。",
Expand Down Expand Up @@ -337,7 +339,13 @@ export function ComputerManagePanel({
})
}
>
{t.screen}
{screenAsksBeforeCharge({
status: row.status,
resumeCreditsPerHour: row.resume_credits_per_hour,
screenCreditsPerHour: row.screen_credits_per_hour,
}) && row.screen_credits_per_hour != null
? withRate(t.screenAt, row.screen_credits_per_hour)
: t.screen}
</button>
{row.status === "running" ? (
<button
Expand Down
2 changes: 2 additions & 0 deletions tests/computer-manage-cta.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ test("a listed computer can open its screen without a chat", () => {
"utf8",
);
assert.match(panel, /screen: "打开电脑屏幕"/);
assert.match(panel, /screenAt: "打开电脑屏幕 · \{rate\} 星币\/小时"/);
assert.match(panel, /screenAsksBeforeCharge/);
assert.match(panel, /onOpenScreen\(row\.computer_id, label, row\.screen_credits_per_hour/);
assert.match(shell, /onOpenScreen=\{openCloudScreen\}/);
assert.match(shell, /active \|\| activeDock\.kind === "computer"/);
Expand Down
Loading