@@ -45,6 +45,34 @@ function formatFileCount(count: number, suffix: string): string {
4545 return `${ count } ${ noun } ${ suffix } ` ;
4646}
4747
48+ function getVisibleFileSummary (
49+ commentFilter : CommentFileFilter ,
50+ fileCount : number ,
51+ commentedFileCount : number ,
52+ unresolvedCommentedFileCount : number ,
53+ ) : { count : number ; label : string } {
54+ switch ( commentFilter ) {
55+ case "commented" :
56+ return {
57+ count : commentedFileCount ,
58+ label : formatFileCount ( commentedFileCount , "with comments" ) ,
59+ } ;
60+ case "unresolved" :
61+ return {
62+ count : unresolvedCommentedFileCount ,
63+ label : formatFileCount (
64+ unresolvedCommentedFileCount ,
65+ "with unresolved comments" ,
66+ ) ,
67+ } ;
68+ case "none" :
69+ return {
70+ count : fileCount ,
71+ label : formatFileCount ( fileCount , "changed" ) ,
72+ } ;
73+ }
74+ }
75+
4876export const ReviewToolbar = memo ( function ReviewToolbar ( {
4977 taskId,
5078 fileCount,
@@ -79,21 +107,13 @@ export const ReviewToolbar = memo(function ReviewToolbar({
79107 setReviewMode ( taskId , "closed" ) ;
80108 } ;
81109
82- const visibleFileCount =
83- commentFilter === "commented"
84- ? commentedFileCount
85- : commentFilter === "unresolved"
86- ? unresolvedCommentedFileCount
87- : fileCount ;
88- const fileCountLabel =
89- commentFilter === "commented"
90- ? formatFileCount ( commentedFileCount , "with comments" )
91- : commentFilter === "unresolved"
92- ? formatFileCount (
93- unresolvedCommentedFileCount ,
94- "with unresolved comments" ,
95- )
96- : formatFileCount ( fileCount , "changed" ) ;
110+ const { count : visibleFileCount , label : fileCountLabel } =
111+ getVisibleFileSummary (
112+ commentFilter ,
113+ fileCount ,
114+ commentedFileCount ,
115+ unresolvedCommentedFileCount ,
116+ ) ;
97117
98118 return (
99119 < Flex
0 commit comments