@@ -30,9 +30,8 @@ export default function CommitDetails({
3030 dateFormatFn,
3131 currentBranch,
3232 fullSha,
33- clicked,
3433 getDiff,
35- forDolt
34+ forDolt,
3635} : Props ) {
3736 const date = dateFormatFn
3837 ? dateFormatFn ( commit . commitDate )
@@ -44,6 +43,7 @@ export default function CommitDetails({
4443 const [ color , setColor ] = useState ( commit . commitColor ) ;
4544
4645 const [ showDiff , setShowDiff ] = useState ( false ) ;
46+ const [ showDiffButton , setShowDiffButton ] = useState ( false ) ;
4747 const diffRef = useRef < HTMLDivElement > ( null ) ;
4848 useOnClickOutside ( diffRef , ( ) => {
4949 setShowDiff ( false ) ;
@@ -53,29 +53,39 @@ export default function CommitDetails({
5353 < >
5454 < div
5555 className = { css . container }
56- onMouseOver = { mouseOver }
57- onMouseLeave = { mouseLeave }
58- onClick = { ( ) => {
59- onClick ( ) ;
60- if ( ! showDiff ) {
61- setShowDiff ( true ) ;
62- }
56+ onMouseOver = { ( ) => {
57+ mouseOver ( ) , setShowDiffButton ( true ) ;
6358 } }
59+ onMouseLeave = { ( ) => {
60+ mouseLeave ( ) , setShowDiffButton ( false ) ;
61+ } }
62+ onClick = { onClick }
6463 >
6564 < div style = { { color : commit . commitColor } } className = { css . labelAndLink } >
66- { commit . commitLink ? (
67- < a
68- style = { { color : color } }
69- href = { commit . commitLink }
70- className = { css . bold }
71- onMouseOver = { ( ) => setColor ( "#1f6dc6" ) }
72- onMouseLeave = { ( ) => setColor ( commit . commitColor ) }
73- >
74- { commitHashAuthorDate }
75- </ a >
76- ) : (
77- < span className = { css . bold } > { commitHashAuthorDate } </ span >
78- ) }
65+ < div >
66+ { commit . commitLink ? (
67+ < a
68+ style = { { color : color } }
69+ href = { commit . commitLink }
70+ className = { css . bold }
71+ onMouseOver = { ( ) => setColor ( "#1f6dc6" ) }
72+ onMouseLeave = { ( ) => setColor ( commit . commitColor ) }
73+ >
74+ { commitHashAuthorDate }
75+ </ a >
76+ ) : (
77+ < span className = { css . bold } > { commitHashAuthorDate } </ span >
78+ ) }
79+ { showDiffButton && ! ! getDiff && ! ! commit . parents . length && (
80+ < button
81+ type = "button"
82+ className = { css . button }
83+ onClick = { ( ) => setShowDiff ( true ) }
84+ >
85+ See commit overview
86+ </ button >
87+ ) }
88+ </ div >
7989 < BranchLabel
8090 branchColor = { commit . commitColor }
8191 branches = { branch }
@@ -98,9 +108,9 @@ export default function CommitDetails({
98108 />
99109 ) }
100110 </ div >
101- { showDiff && clicked && ! ! getDiff && (
111+ { showDiff && ! ! getDiff && (
102112 < div className = { css . diffSection } ref = { diffRef } >
103- < DiffSection commit = { commit } getDiff = { getDiff } forDolt = { forDolt } />
113+ < DiffSection commit = { commit } getDiff = { getDiff } forDolt = { forDolt } />
104114 </ div >
105115 ) }
106116 </ >
0 commit comments