@@ -137,8 +137,7 @@ interface CommitChangeProps {
137137}
138138
139139function CommitChange ( props : CommitChangeProps ) : JSX . Element {
140- const commit = props . commit
141- const [ message , description ] = commit . message . split ( "\n\n" , 2 )
140+ const [ message , ...description ] = props . commit . message . split ( / ( \r \n | \n | \r ) / g)
142141
143142 const [ hide , setHide ] = useState ( true )
144143
@@ -148,8 +147,8 @@ function CommitChange(props: CommitChangeProps): JSX.Element {
148147
149148 return (
150149 < span >
151- < a href = { commit . htmlUrl } className = "gitploy-link" > < strong > { message . substring ( 0 , 50 ) } </ strong > </ a >
152- { ( description ) ?
150+ < a href = { props . commit . htmlUrl } className = "gitploy-link" > < strong > { message . substring ( 0 , 50 ) } </ strong > </ a >
151+ { ( description . length ) ?
153152 < Button size = "small" type = "text" onClick = { onClickHide } >
154153 < Text className = "gitploy-code" code > ...</ Text >
155154 </ Button > :
@@ -158,16 +157,14 @@ function CommitChange(props: CommitChangeProps): JSX.Element {
158157 { ( ! hide ) ?
159158 < Paragraph style = { { margin : 0 } } >
160159 < pre style = { { marginBottom : 0 , fontSize : 12 } } >
161- { description . split ( / ( \r \n ) / g) . map ( ( line , idx ) => {
162- return ( line !== "\r\n" ) ? < Text key = { idx } > { line } </ Text > : < br />
163- } ) }
160+ { description . join ( "" ) . trim ( ) }
164161 </ pre >
165162 </ Paragraph > :
166163 null }
167164 < br />
168- { ( commit ?. author ) ?
165+ { ( props . commit ?. author ) ?
169166 < span >
170- < Text > < Avatar size = "small" src = { commit . author . avatarUrl } /> { commit . author . login } </ Text > < Text > committed { moment ( commit . author ?. date ) . fromNow ( ) } </ Text >
167+ < Text > < Avatar size = "small" src = { props . commit . author . avatarUrl } /> { props . commit . author . login } </ Text > < Text > committed { moment ( props . commit . author ?. date ) . fromNow ( ) } </ Text >
171168 </ span > :
172169 null }
173170 </ span >
0 commit comments