From 900e8825d6c21f4f62d6245f2c30e43cf949d91f Mon Sep 17 00:00:00 2001 From: Hamhire Hu Date: Tue, 28 Jul 2026 09:21:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(chat):=20commit=20divider=20=E2=80=94?= =?UTF-8?q?=20gap/alignment=20+=20show=20the=20commit=20message=20on=20hov?= =?UTF-8?q?er?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two polish fixes for the run-timeline commit divider: - The chip's commit icon and short sha were flush and vertically misaligned (the chip mixin sets no gap). Add a small gap and make the svg a block so it aligns to the sha's line box. - The hover tooltip showed a generic "code changed" string. Show the new head commit's actual message instead (resolved via diff:listCommits — the head is the PR's newest introduced commit; main-cached), falling back to the short sha. This is more meaningful and removes the chatPane.commitDividerTitle i18n key from all four locales. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/components/features/chat/ChatPane.tsx | 25 ++++++++++++++++++- .../chat/components/CommitDivider.tsx | 13 +++++----- .../src/renderer/src/i18n/locales/de-DE.json | 1 - .../src/renderer/src/i18n/locales/en-US.json | 1 - .../src/renderer/src/i18n/locales/ja-JP.json | 1 - .../src/renderer/src/i18n/locales/zh-CN.json | 1 - .../src/styles/features/chat/pane.scss | 8 +++++- 7 files changed, 37 insertions(+), 13 deletions(-) diff --git a/apps/desktop/src/renderer/src/components/features/chat/ChatPane.tsx b/apps/desktop/src/renderer/src/components/features/chat/ChatPane.tsx index b3f976a1..a3268332 100644 --- a/apps/desktop/src/renderer/src/components/features/chat/ChatPane.tsx +++ b/apps/desktop/src/renderer/src/components/features/chat/ChatPane.tsx @@ -4,10 +4,12 @@ import type { Finding, LocalPrStatus, PrAgentStatus, + PrCommit, ReviewRun, ReviewRunCommitScope, StoredPullRequest, } from '@meebox/shared'; +import { invoke } from '../../../api'; import { ChatIcon, TrashIcon, ConfirmModal, PaneLoading } from '../../common'; import { useChatRunStore } from '../../../stores/chat-run-store'; import { useDraftsForPr } from '../../../stores/drafts-store'; @@ -260,6 +262,27 @@ export function ChatPane({ return head !== lastRunHeadSha ? head : null; }, [timeline, hasMyActive, pr?.sourceRef.sha]); + // The new head commit's message, for the divider tooltip. diff:listCommits is the PR's introduced commits (the head + // is the newest); main-cached, so this is cheap. Falls back to the short sha when unavailable. + const [staleHeadMessage, setStaleHeadMessage] = useState(undefined); + useEffect(() => { + if (!staleHeadSha || !prLocalId) { + setStaleHeadMessage(undefined); + return; + } + let cancelled = false; + void invoke('diff:listCommits', { localId: prLocalId }) + .then((commits: PrCommit[]) => { + if (!cancelled) setStaleHeadMessage(commits.find((c) => c.sha === staleHeadSha)?.message); + }) + .catch(() => { + if (!cancelled) setStaleHeadMessage(undefined); + }); + return () => { + cancelled = true; + }; + }, [staleHeadSha, prLocalId]); + // Pure UI state: rule preview modal / clear confirm modal / merge confirm modal const [showRulePreview, setShowRulePreview] = useState(false); const [showClearConfirm, setShowClearConfirm] = useState(false); @@ -418,7 +441,7 @@ export function ChatPane({ )} {/* Commit divider: the PR head advanced past the last reviewed commit → mark the new head at the bottom of the run list (prior reviews are stale). Shown even when no run has been started against the new code yet. */} - {staleHeadSha && } + {staleHeadSha && } {/* This PR's queued tasks: placed after running ones, each cancellable individually. The position uses the **global** queue order (the queue is shared across PRs, otherwise every PR showing "position 1" would be misleading) — the runId's index in the global waiting array +1. */} {myWaiting.map((w) => ( diff --git a/apps/desktop/src/renderer/src/components/features/chat/components/CommitDivider.tsx b/apps/desktop/src/renderer/src/components/features/chat/components/CommitDivider.tsx index e1385cbb..93917e83 100644 --- a/apps/desktop/src/renderer/src/components/features/chat/components/CommitDivider.tsx +++ b/apps/desktop/src/renderer/src/components/features/chat/components/CommitDivider.tsx @@ -1,17 +1,16 @@ -import { useTranslation } from 'react-i18next'; import { CommitIcon } from '../../../common'; /** * Sawtooth "commit divider" shown at the bottom of the run timeline when the PR head has advanced past the commit the * most recent run reviewed (see ChatPane staleHeadSha). It marks the new head — signalling that the reviews above are - * now based on stale code — even if no run has been started against the new commit yet. The label is the abbreviated - * commit id (the full SHA is in the tooltip), reusing the same chip vocabulary as the single-commit scope badge in - * RunResultView. + * now based on stale code — even if no run has been started against the new commit yet. The chip shows the abbreviated + * commit id; the tooltip shows that commit's message (falls back to the short sha when unavailable). Reuses the same + * chip vocabulary as the single-commit scope badge in RunResultView. */ -export function CommitDivider({ sha }: { sha: string }) { - const { t } = useTranslation(); +export function CommitDivider({ sha, message }: { sha: string; message?: string }) { const short = sha.slice(0, 8); - const title = t('chatPane.commitDividerTitle', { sha }); + // Tooltip = the actual commit message (more meaningful than a generic "code changed" string, and needs no i18n). + const title = message?.trim() || short; return (