@@ -446,6 +446,12 @@ type EditStatsT = {
446
446
+ rejected_count : number ,
447
447
} ;
448
448
449
+ type SecondaryStatsT = {
450
+ + downvoted_tag_count ? : number ,
451
+ + rating_count ? : number ,
452
+ + upvoted_tag_count ? : number ,
453
+ } ;
454
+
449
455
type VoteStatsT = Array < {
450
456
+ all : {
451
457
+ count : number ,
@@ -477,6 +483,7 @@ type UserProfileStatisticsProps = {
477
483
+ $c : CatalystContextT ,
478
484
+ addedEntities : EntitiesStatsT ,
479
485
+ editStats : EditStatsT ,
486
+ + secondaryStats : SecondaryStatsT ,
480
487
+ user : UnsanitizedEditorT ,
481
488
+ votes : VoteStatsT ,
482
489
} ;
@@ -486,6 +493,7 @@ const UserProfileStatistics = ({
486
493
editStats,
487
494
user,
488
495
votes,
496
+ secondaryStats,
489
497
addedEntities,
490
498
} : UserProfileStatisticsProps ) => {
491
499
const voteTotals = votes . pop ( ) ;
@@ -494,6 +502,11 @@ const UserProfileStatistics = ({
494
502
editStats . accepted_auto_count ;
495
503
const hasAddedEntities =
496
504
Object . values ( addedEntities ) . some ( ( number ) => number !== 0 ) ;
505
+ const hasPublicRatings = secondaryStats . rating_count != null ;
506
+ const hasPublicTags = secondaryStats . upvoted_tag_count != null ;
507
+ const ratingCount = secondaryStats . rating_count ?? 0 ;
508
+ const upvotedTagCount = secondaryStats . upvoted_tag_count ?? 0 ;
509
+ const downvotedTagCount = secondaryStats . downvoted_tag_count ?? 0 ;
497
510
498
511
return (
499
512
< >
@@ -679,7 +692,7 @@ const UserProfileStatistics = ({
679
692
< abbr title = { l ( 'Newly applied edits may ' +
680
693
'need 24 hours to appear' ) }
681
694
>
682
- { exp . l ( 'Added entities' ) }
695
+ { l ( 'Added entities' ) }
683
696
</ abbr >
684
697
</ th >
685
698
</ tr >
@@ -709,6 +722,58 @@ const UserProfileStatistics = ({
709
722
) }
710
723
</ tbody >
711
724
</ table >
725
+
726
+ { hasPublicTags || hasPublicRatings ? (
727
+ < table
728
+ className = "statistics"
729
+ title = { l ( 'This table shows a summary ' +
730
+ 'of secondary data added by this editor.' ) }
731
+ >
732
+ < thead >
733
+ < tr >
734
+ < th colSpan = "2" >
735
+ { l ( 'Tags and ratings' ) }
736
+ </ th >
737
+ </ tr >
738
+ </ thead >
739
+ < tbody >
740
+ { hasPublicTags ? (
741
+ < >
742
+ < UserProfileProperty name = { l ( 'Tags upvoted' ) } >
743
+ { $c . user && upvotedTagCount > 0 ? exp . l (
744
+ '{count} ({view_url|view})' ,
745
+ {
746
+ count : formatCount ( $c , upvotedTagCount ) ,
747
+ view_url : `/user/${ encodedName } /tags` ,
748
+ } ,
749
+ ) : formatCount ( $c , upvotedTagCount ) }
750
+ </ UserProfileProperty >
751
+
752
+ < UserProfileProperty name = { l ( 'Tags downvoted' ) } >
753
+ { $c . user && downvotedTagCount > 0 ? exp . l (
754
+ '{count} ({view_url|view})' ,
755
+ {
756
+ count : formatCount ( $c , downvotedTagCount ) ,
757
+ view_url : `/user/${ encodedName } /tags?show_downvoted=1` ,
758
+ } ,
759
+ ) : formatCount ( $c , downvotedTagCount ) }
760
+ </ UserProfileProperty >
761
+ </ >
762
+ ) : null }
763
+ { hasPublicRatings ? (
764
+ < UserProfileProperty name = { l ( 'Ratings' ) } >
765
+ { $c . user && ratingCount > 0 ? exp . l (
766
+ '{count} ({view_url|view})' ,
767
+ {
768
+ count : formatCount ( $c , ratingCount ) ,
769
+ view_url : `/user/${ encodedName } /ratings` ,
770
+ } ,
771
+ ) : formatCount ( $c , ratingCount ) }
772
+ </ UserProfileProperty >
773
+ ) : null }
774
+ </ tbody >
775
+ </ table >
776
+ ) : null }
712
777
</ >
713
778
) ;
714
779
} ;
@@ -718,6 +783,7 @@ type UserProfileProps = {
718
783
+ addedEntities : EntitiesStatsT ,
719
784
+ editStats : EditStatsT ,
720
785
+ ipHashes : $ReadOnlyArray < string > ,
786
+ + secondaryStats : SecondaryStatsT ,
721
787
+ subscribed : boolean ,
722
788
+ subscriberCount : number ,
723
789
+ user : UnsanitizedEditorT ,
@@ -728,6 +794,7 @@ const UserProfile = ({
728
794
$c,
729
795
editStats,
730
796
ipHashes,
797
+ secondaryStats,
731
798
subscribed,
732
799
subscriberCount,
733
800
user,
@@ -755,6 +822,7 @@ const UserProfile = ({
755
822
$c = { $c }
756
823
addedEntities = { addedEntities }
757
824
editStats = { editStats }
825
+ secondaryStats = { secondaryStats }
758
826
user = { user }
759
827
votes = { votes }
760
828
/>
0 commit comments