fix(studio): the commit history in the explorer follows the WB-Frame board: 32px heading, 26px rows inset from the edge, hash, subject and a bare age

This commit is contained in:
yhh committed 2026-11-06 07:00:05 -08:00
1 parent c9fb8f7ee3
commit 77d875db8d
3 files changed
+20 -2

No files matched your search

@@ -306,3 +306,9 @@ svg.studio-icon[data-lang="sheet"] { color: var(--ok); }
.blogin-go { height: 32px; padding: 0 14px; border: 1px solid var(--accent); border-radius: var(--r-sm); background: var(--accent); color: var(--accent-fg); font: var(--w-med) var(--fs-ui) var(--ui); cursor: pointer; }
.blogin-go:disabled { opacity: .5; cursor: default; }
.sidecontent > footer .sidequote { font-weight: var(--w-reg); }
.workbench-explorer .workbench-history > summary { height: 32px; margin-top: 4px; padding: 0 10px 0 12px; font: var(--w-bold, 700) var(--fs-meta)/1 var(--ui); }
.workbench-history > summary small { font: var(--w-med) var(--fs-meta)/1 var(--ui); }
.workbench-history .gh-row { gap: 8px; height: 26px; padding: 0 12px 0 30px; font: var(--w-med) var(--fs-meta)/1 var(--ui); }
.workbench-history .gh-row:has(.gh-lanes) { padding-left: 12px; }
.workbench-history .gh-hash { width: auto; font: var(--w-med) var(--fs-micro)/1 var(--mono); }
.workbench-history .gh-meta { font: var(--w-med) var(--fs-micro)/1 var(--ui); }
@@ -46,6 +46,10 @@ export const WORKBENCH: Messages = {
"workbench.go": { zh: "跳转", en: "Go" },
"workbench.go_to_line": { zh: "跳到行", en: "Go to line" },
"workbench.hide_file_tree": { zh: "收起文件树", en: "Hide file tree" },
"workbench.history_day": { zh: "{n} 天", en: "{n} d" },
"workbench.history_hour": { zh: "{n} 小时", en: "{n} h" },
"workbench.history_min": { zh: "{n} 分钟", en: "{n} min" },
"workbench.history_now": { zh: "刚刚", en: "now" },
"workbench.host_asks_you_to_sign": { zh: "{host} 需要登录", en: "{host} asks you to sign in" },
"workbench.i_confirm_these_can_be": { zh: "我确认这些内容可以提交", en: "I confirm these can be committed" },
"workbench.inside_the_project_folder_path": { zh: "位于项目文件夹 {path} 内,出于安全不从这里启动", en: "Inside the project folder {path}, so it is not started from here for safety" },
@@ -4,11 +4,19 @@ import { reason } from "../i18n/kernel";
import type { AgentPort } from "../port/port";
import type { GitHistory } from "../port/workspace";
import { layoutGraph, type GraphRow } from "../state/gitgraph";
import { since } from "./wallet";
import { GitCommitDetail } from "./GitCommitDetail";
import { StudioIcon } from "./StudioIcon";
import { WorkbenchState } from "./WorkbenchState";
// The board writes a commit's age as a bare count and unit, no "ago".
function age(at: number, now: number): string {
const minutes = Math.floor(Math.max(0, now - at * 1000) / 60000);
if (minutes < 1) return t("workbench.history_now");
if (minutes < 60) return t("workbench.history_min", { n: minutes });
const hours = Math.floor(minutes / 60);
return hours < 24 ? t("workbench.history_hour", { n: hours }) : t("workbench.history_day", { n: Math.floor(hours / 24) });
}
const ROW = 28;
const COL = 12;
const PAD = 8;
@@ -70,7 +78,7 @@ export function WorkbenchHistory({ port, repo, branch }: { port: AgentPort; repo
{row.commit.refs.map((ref) => (
<em className="gh-ref" key={ref} data-kind={ref.startsWith("tag: ") ? "tag" : "branch"}>{ref}</em>
))}
<small className="gh-meta" title={row.commit.author}>{since(new Date(row.commit.at * 1000).toISOString(), now)}</small>
<small className="gh-meta" title={row.commit.author}>{age(row.commit.at, now)}</small>
</button>
{openId === row.commit.id && <GitCommitDetail port={port} id={row.commit.id} repo={repo} />}
</li>