11<script setup lang="ts">
2+ import { ref } from ' vue'
3+ // import GitGraph from './GitGraph.vue'
4+ import CopyButton from ' ../CopyButton/index.vue'
5+
26import { WEBVIEW_CHANNEL } from ' @/constant'
3- import type { Commit } from ' @/git'
7+
8+ import type { Commit , GitOperation } from ' @/git'
49
510const props = defineProps <{
611 commit: Commit
12+ graphData: GitOperation
13+ prevGraphData? : GitOperation
14+ nextGraphData? : GitOperation
715 columnWidths: Record <string , number >
816}>()
917
18+ const hoveredCell = ref <string | null >(null )
19+
1020function handleCommitClick() {
1121 try {
1222 if (window .vscode ) {
@@ -37,17 +47,45 @@ function handleDoubleClick() {
3747
3848<template >
3949 <li class =" commit-row" @click =" handleCommitClick" @dblclick =" handleDoubleClick" >
40- <span class =" hash-col commit-cell" :style =" { width: `${columnWidths.hash}px` }" >{{ commit.hash.substring(0, 7)
41- }}</span >
42- <span class =" commit-cell" :style =" { width: `${columnWidths.message}px` }" >{{ commit.message }}</span >
50+ <!-- <div class="branch-col commit-cell" :style="{ width: `${columnWidths.branch}px` }">
51+ <GitGraph
52+ :graph-data="graphData"
53+ :prev-graph-data="prevGraphData"
54+ :next-graph-data="nextGraphData"
55+ />
56+ </div> -->
57+ <span
58+ class =" hash-col commit-cell" :style =" { width: `${columnWidths.hash}px` }" @mouseenter =" hoveredCell = 'hash'"
59+ @mouseleave =" hoveredCell = null"
60+ >
61+ {{ commit.hash.substring(0, 7) }}
62+ <CopyButton v-show =" hoveredCell === 'hash'" :copy-text =" commit.hash" />
63+ </span >
64+
65+ <span
66+ class =" commit-cell" :style =" { width: `${columnWidths.message}px` }" @mouseenter =" hoveredCell = 'message'"
67+ @mouseleave =" hoveredCell = null"
68+ >
69+ {{ commit.message }}
70+ <CopyButton v-show =" hoveredCell === 'message'" :copy-text =" commit.message" />
71+ </span >
72+
4373 <span class =" commit-cell" :style =" { width: `${columnWidths.stats}px` }" >
4474 <span v-if =" commit.diff" class =" commit-stats" >
4575 <span class =" files" >{{ commit.diff.changed }} files</span >
4676 <span v-if =" commit.diff.insertions" class =" additions" >+{{ commit.diff.insertions }}</span >
4777 <span v-if =" commit.diff.deletions" class =" deletions" >-{{ commit.diff.deletions }}</span >
4878 </span >
4979 </span >
50- <span class =" commit-cell" :style =" { width: `${columnWidths.author}px` }" >{{ commit.authorName }}</span >
80+
81+ <span
82+ class =" commit-cell" :style =" { width: `${columnWidths.author}px` }" @mouseenter =" hoveredCell = 'authorName'"
83+ @mouseleave =" hoveredCell = null"
84+ >
85+ {{ commit.authorName }}
86+ <CopyButton v-show =" hoveredCell === 'authorName'" :copy-text =" `${commit.authorName} <${commit.authorEmail}>`" />
87+ </span >
88+
5189 <span class =" commit-cell date" :style =" { width: `${columnWidths.date}px` }" >{{ commit.date }}</span >
5290 </li >
5391</template >
@@ -60,7 +98,7 @@ function handleDoubleClick() {
6098 cursor : pointer ;
6199 width : 100% ;
62100 box-sizing : border-box ;
63- padding : 8 px ;
101+ position : relative ;
64102}
65103
66104.commit-row :hover {
@@ -71,22 +109,24 @@ function handleDoubleClick() {
71109 white-space : nowrap ;
72110 overflow : hidden ;
73111 text-overflow : ellipsis ;
112+ padding : 8px ;
113+ position : relative ;
74114}
75115
76- .hash-col {
77- color : var (--vscode-gitDecoration-addedResourceForeground );
116+ .branch-col {
117+ position : relative ;
118+ padding : 0px ;
119+ z-index : 1 ;
78120}
79121
80- .date {
81- padding-right : 16px ;
82- color : var (--vscode-descriptionForeground );
122+ .hash-col {
123+ color : var (--vscode-gitDecoration-addedResourceForeground );
83124}
84125
85126.commit-stats {
86- display : inline-flex ;
127+ font-size : 0.85em ;
128+ display : flex ;
87129 gap : 8px ;
88- font-size : 12px ;
89- white-space : nowrap ;
90130}
91131
92132.additions {
@@ -96,4 +136,9 @@ function handleDoubleClick() {
96136.deletions {
97137 color : var (--vscode-gitDecoration-deletedResourceForeground );
98138}
139+
140+ .date {
141+ color : var (--vscode-descriptionForeground );
142+ font-size : 0.9em ;
143+ }
99144 </style >
0 commit comments