diff --git a/app/src/components/CodeDiff.tsx b/app/src/components/CodeDiff.tsx index 3138424..68f4fcb 100644 --- a/app/src/components/CodeDiff.tsx +++ b/app/src/components/CodeDiff.tsx @@ -43,9 +43,27 @@ class CodeDiff extends React.Component { }) return ( -
-        {code}
-      
+
+
+          {code}
+        
+ {this.renderChangeAmount(changes)} +
+ ) + } + + private renderChangeAmount(changes: Diff.Change[]) { + const additions = changes.map(change => (change.added === true) ? (change.count || 0) : 0).reduce((a, b) => a + b) + const deletions = changes.map(change => (change.removed === true) ? (change.count || 0) : 0).reduce((a, b) => a + b) + if (additions === 0 && deletions === 0) { + return null + } + + return ( + + Diff: + {additions} line{additions === 1 ? '' : 's'} + , - {deletions} line{deletions === 1 ? '' : 's'} + ) } @@ -79,6 +97,12 @@ const style = (theme: Theme) => { // width: '8px', } return { + additions: { + color: 'rgb(10, 255, 10)', + }, + deletions: { + color: 'rgb(255, 10, 10)', + }, line: { lineHeight: 'normal', },