@@ -40,12 +40,21 @@ function SnapshotCommitListItem({data: itemData, index, style}: Props) {
4040 const commitDuration = commitDurations [ index ] ;
4141 const commitTime = commitTimes [ index ] ;
4242
43- // Guard against commits with duration 0
44- const percentage =
43+ // Use natural log for bar height.
44+ // This prevents one (or a few) outliers from squishing the majority of other commits.
45+ // So rather than e.g. _█_ we get something more like e.g. ▄█_
46+ const heightScale =
4547 Math . min (
4648 1 ,
4749 Math . max ( 0 , Math . log ( commitDuration ) / Math . log ( maxDuration ) ) ,
4850 ) || 0 ;
51+
52+ // Use a linear scale for color.
53+ // This gives some visual contrast between cheaper and more expensive commits
54+ // and somewhat compensates for the log scale height.
55+ const colorScale =
56+ Math . min ( 1 , Math . max ( 0 , commitDuration / maxDuration ) ) || 0 ;
57+
4958 const isSelected = selectedCommitIndex === index ;
5059
5160 // Leave a 1px gap between snapshots
@@ -80,9 +89,9 @@ function SnapshotCommitListItem({data: itemData, index, style}: Props) {
8089 < div
8190 className = { styles . Inner }
8291 style = { {
83- height : `${ Math . round ( percentage * 100 ) } %` ,
92+ height : `${ Math . round ( heightScale * 100 ) } %` ,
8493 backgroundColor :
85- commitDuration > 0 ? getGradientColor ( percentage ) : undefined ,
94+ commitDuration > 0 ? getGradientColor ( colorScale ) : undefined ,
8695 } }
8796 />
8897 </ div >
0 commit comments