@@ -733,12 +733,9 @@ class HistoryItemGroupRenderer implements ICompressibleTreeRenderer<SCMHistoryIt
733
733
734
734
interface HistoryItemTemplate {
735
735
readonly iconContainer : HTMLElement ;
736
- // readonly avatarImg: HTMLImageElement;
737
- readonly iconLabel : IconLabel ;
736
+ readonly label : IconLabel ;
738
737
readonly statsContainer : HTMLElement ;
739
738
readonly statsLabel : IconLabel ;
740
- // readonly timestampContainer: HTMLElement;
741
- // readonly timestamp: HTMLSpanElement;
742
739
readonly disposables : IDisposable ;
743
740
}
744
741
@@ -759,12 +756,7 @@ class HistoryItemRenderer implements ICompressibleTreeRenderer<SCMHistoryItemTre
759
756
const statsContainer = append ( element , $ ( '.stats-container' ) ) ;
760
757
const statsLabel = new IconLabel ( statsContainer , { supportIcons : true } ) ;
761
758
762
- // const avatarImg = append(iconContainer, $('img.avatar')) as HTMLImageElement;
763
-
764
- // const timestampContainer = append(iconLabel.element, $('.timestamp-container'));
765
- // const timestamp = append(timestampContainer, $('span.timestamp'));
766
-
767
- return { iconContainer, iconLabel, statsContainer, statsLabel, disposables : new DisposableStore ( ) } ;
759
+ return { iconContainer, label : iconLabel , statsContainer, statsLabel, disposables : new DisposableStore ( ) } ;
768
760
}
769
761
770
762
renderElement ( node : ITreeNode < SCMHistoryItemTreeElement , void > , index : number , templateData : HistoryItemTemplate , height : number | undefined ) : void {
@@ -775,47 +767,47 @@ class HistoryItemRenderer implements ICompressibleTreeRenderer<SCMHistoryItemTre
775
767
templateData . iconContainer . classList . add ( ...ThemeIcon . asClassNameArray ( historyItem . icon ) ) ;
776
768
}
777
769
778
- // if (commit.authorAvatar) {
779
- // templateData.avatarImg.src = commit.authorAvatar;
780
- // templateData.avatarImg.style.display = 'block';
781
- // templateData.iconContainer.classList.remove(...ThemeIcon.asClassNameArray(Codicon.account));
782
- // } else {
783
- // templateData.avatarImg.style.display = 'none';
784
- // templateData.iconContainer.classList.add(...ThemeIcon.asClassNameArray(Codicon.account));
785
- // }
770
+ templateData . label . setLabel ( historyItem . label , historyItem . description ) ;
771
+ this . renderStatistics ( node , index , templateData , height ) ;
772
+ }
773
+
774
+ renderCompressedElements ( node : ITreeNode < ICompressedTreeNode < SCMHistoryItemTreeElement > , void > , index : number , templateData : HistoryItemTemplate , height : number | undefined ) : void {
775
+ throw new Error ( 'Should never happen since node is incompressible' ) ;
776
+ }
786
777
787
- templateData . iconLabel . setLabel ( historyItem . label , historyItem . description ) ;
778
+ private renderStatistics ( node : ITreeNode < SCMHistoryItemTreeElement , void > , index : number , templateData : HistoryItemTemplate , height : number | undefined ) : void {
779
+ const historyItem = node . element ;
788
780
789
781
if ( historyItem . statistics ?. files || historyItem . statistics ?. insertions || historyItem . statistics ?. deletions ) {
790
782
const statsLabelTitle : string [ ] = [ ] ;
783
+
791
784
const filesLabel = historyItem . statistics ?. files ? `${ historyItem . statistics . files } $(files)` : '' ;
792
- if ( filesLabel !== '' ) {
793
- statsLabelTitle . push ( `${ historyItem . statistics . files } ${ historyItem . statistics . files === 1 ? 'file' : 'files' } changed` ) ;
785
+ const insertionsLabel = historyItem . statistics ?. insertions ? ` ${ historyItem . statistics . insertions } $(diff-added)` : '' ;
786
+ const deletionsLabel = historyItem . statistics ?. deletions ? ` ${ historyItem . statistics . deletions } $(diff-removed)` : '' ;
787
+
788
+ if ( historyItem . statistics ?. files ) {
789
+ const filesDescription = historyItem . statistics . files === 1 ?
790
+ localize ( 'fileChanged' , "file changed" ) : localize ( 'filesChanged' , "files changed" ) ;
791
+ statsLabelTitle . push ( `${ historyItem . statistics . files } ${ filesDescription } ` ) ;
794
792
}
795
793
796
- const insertionsLabel = historyItem . statistics ?. insertions ? ` ${ historyItem . statistics . insertions } $(diff-added)` : '' ;
797
- if ( insertionsLabel !== '' ) {
798
- statsLabelTitle . push ( `${ historyItem . statistics . insertions } insertions(+) ` ) ;
794
+ if ( historyItem . statistics ?. insertions ) {
795
+ const insertionsDescription = localize ( 'insertions' , "insertions{0}" , '(+)' ) ;
796
+ statsLabelTitle . push ( `${ historyItem . statistics . insertions } ${ insertionsDescription } ` ) ;
799
797
}
800
798
801
- const deletionsLabel = historyItem . statistics ?. deletions ? ` ${ historyItem . statistics . deletions } $(diff-removed)` : '' ;
802
- if ( deletionsLabel !== '' ) {
803
- statsLabelTitle . push ( `${ historyItem . statistics . deletions } deletions(-) ` ) ;
799
+ if ( historyItem . statistics ?. deletions ) {
800
+ const deletionsDescription = localize ( 'deletions' , "deletions{0}" , '(-)' ) ;
801
+ statsLabelTitle . push ( `${ historyItem . statistics . deletions } ${ deletionsDescription } ` ) ;
804
802
}
805
803
806
804
templateData . statsLabel . setLabel ( `${ filesLabel } ${ insertionsLabel } ${ deletionsLabel } ` , undefined , { title : statsLabelTitle . join ( ', ' ) } ) ;
807
805
templateData . statsContainer . style . display = '' ;
808
806
} else {
809
807
templateData . statsContainer . style . display = 'none' ;
810
808
}
811
-
812
- // templateData.timestampContainer.classList.toggle('timestamp-duplicate', commit.hideTimestamp === true);
813
- // templateData.timestamp.textContent = fromNow(commit.timestamp);
814
809
}
815
810
816
- renderCompressedElements ( node : ITreeNode < ICompressedTreeNode < SCMHistoryItemTreeElement > , void > , index : number , templateData : HistoryItemTemplate , height : number | undefined ) : void {
817
- throw new Error ( 'Should never happen since node is incompressible' ) ;
818
- }
819
811
disposeTemplate ( templateData : HistoryItemTemplate ) : void {
820
812
templateData . disposables . dispose ( ) ;
821
813
}
0 commit comments