mirror of
https://github.com/MoonshotAI/kimi-code.git
synced 2026-07-10 01:39:25 +00:00
feat: align chat-header diff stats with git ++/-- red/green style
This commit is contained in:
parent
69d83e55cc
commit
b57f274a72
4 changed files with 27 additions and 1 deletions
5
.changeset/chat-header-git-diff-stats.md
Normal file
5
.changeset/chat-header-git-diff-stats.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@moonshot-ai/kimi-web": minor
|
||||
---
|
||||
|
||||
Show git diff line stats in the chat header using green `+N` and red `-N` counts, with a placeholder prop ready for backend wiring.
|
||||
|
|
@ -638,6 +638,7 @@ function openPr(url: string): void {
|
|||
:compaction="client.compaction.value"
|
||||
:workspace-name="client.visibleWorkspace.value?.name"
|
||||
:workspace-root="client.visibleWorkspace.value?.root ?? client.status.value.cwd"
|
||||
:git-diff-stats="null"
|
||||
:workspaces="client.workspacesView.value"
|
||||
:active-workspace-id="client.activeWorkspaceId.value"
|
||||
:session-title="activeSessionTitle"
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ const props = defineProps<{
|
|||
ahead?: number;
|
||||
behind?: number;
|
||||
changesCount?: number;
|
||||
/** Git diff line stats: additions / deletions. Zero/null values are hidden. */
|
||||
gitDiffStats?: { totalAdditions: number; totalDeletions: number } | null;
|
||||
isGitRepo?: boolean;
|
||||
/** GitHub PR for the current branch, when known (null/undefined = none). */
|
||||
pr?: { number: number; state: string; url: string } | null;
|
||||
|
|
@ -38,6 +40,9 @@ const emit = defineEmits<{
|
|||
const ahead = computed(() => props.ahead ?? 0);
|
||||
const behind = computed(() => props.behind ?? 0);
|
||||
const changes = computed(() => props.changesCount ?? 0);
|
||||
const adds = computed(() => props.gitDiffStats?.totalAdditions ?? 0);
|
||||
const dels = computed(() => props.gitDiffStats?.totalDeletions ?? 0);
|
||||
const hasLineStats = computed(() => adds.value > 0 || dels.value > 0);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// More-menu (kebab dropdown)
|
||||
|
|
@ -265,7 +270,11 @@ function startArchive(): void {
|
|||
<span class="ch-branch">{{ branch }}</span>
|
||||
<span v-if="ahead > 0" class="ch-ahead">↑{{ ahead }}</span>
|
||||
<span v-if="behind > 0" class="ch-behind">↓{{ behind }}</span>
|
||||
<span v-if="changes > 0" class="ch-changes">{{ t('header.changed', { n: changes }) }}</span>
|
||||
<template v-if="hasLineStats">
|
||||
<span v-if="adds > 0" class="ch-add">+{{ adds }}</span>
|
||||
<span v-if="dels > 0" class="ch-del">-{{ dels }}</span>
|
||||
</template>
|
||||
<span v-else-if="changes > 0" class="ch-changes">{{ t('header.changed', { n: changes }) }}</span>
|
||||
</div>
|
||||
|
||||
<!-- GitHub PR status -->
|
||||
|
|
@ -342,6 +351,14 @@ function startArchive(): void {
|
|||
flex: none;
|
||||
color: var(--warn);
|
||||
}
|
||||
.ch-add {
|
||||
flex: none;
|
||||
color: var(--ok);
|
||||
}
|
||||
.ch-del {
|
||||
flex: none;
|
||||
color: var(--err);
|
||||
}
|
||||
.ch-spacer { flex: 1; min-width: 0; }
|
||||
|
||||
.ch-act {
|
||||
|
|
|
|||
|
|
@ -78,6 +78,8 @@ const props = defineProps<{
|
|||
workspaceName?: string;
|
||||
/** Absolute workspace root path shown by the Open menu. */
|
||||
workspaceRoot?: string;
|
||||
/** Git diff line stats for the header diff counter (mirrors kimi-cli/web). */
|
||||
gitDiffStats?: { totalAdditions: number; totalDeletions: number } | null;
|
||||
/** Workspaces for the empty-composer picker (start a conversation elsewhere). */
|
||||
workspaces?: WorkspaceView[];
|
||||
/** Active workspace id, to highlight the current entry in the picker. */
|
||||
|
|
@ -685,6 +687,7 @@ onUnmounted(() => {
|
|||
:ahead="gitInfo?.ahead"
|
||||
:behind="gitInfo?.behind"
|
||||
:changes-count="changesCount"
|
||||
:git-diff-stats="gitDiffStats"
|
||||
:is-git-repo="!!gitInfo"
|
||||
:pr="pr"
|
||||
:copied="copyConversationCopied"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue