@@ -25,25 +25,15 @@ type Props = {
2525 raw_instructions ?: string
2626}
2727
28- export const ResponseReview : FC < Props > = ( {
29- files,
30- has_multiple_workspaces,
31- on_discard,
32- on_approve,
33- on_focus_file,
34- on_go_to_file,
35- on_toggle_file,
36- on_intelligent_update,
37- raw_instructions
38- } ) => {
28+ export const ResponseReview : FC < Props > = ( props ) => {
3929 const [ last_clicked_file_index , set_last_clicked_file_index ] = useState ( 0 )
4030
4131 const handle_approve = ( ) => {
42- const accepted_files = files . filter ( ( f ) => f . is_checked )
43- on_approve ( accepted_files )
32+ const accepted_files = props . files . filter ( ( f ) => f . is_checked )
33+ props . on_approve ( accepted_files )
4434 }
4535
46- const fallback_count = files . filter ( ( f ) => f . is_fallback ) . length
36+ const fallback_count = props . files . filter ( ( f ) => f . is_fallback ) . length
4737
4838 const sorted_files = useMemo ( ( ) => {
4939 const get_sort_score = ( file : FileInReview ) : number => {
@@ -55,20 +45,22 @@ export const ResponseReview: FC<Props> = ({
5545 }
5646 return 2
5747 }
58- return [ ...files ] . sort ( ( a , b ) => get_sort_score ( a ) - get_sort_score ( b ) )
59- } , [ files ] )
48+ return [ ...props . files ] . sort (
49+ ( a , b ) => get_sort_score ( a ) - get_sort_score ( b )
50+ )
51+ } , [ props . files ] )
6052
6153 return (
6254 < div className = { styles . container } >
63- { raw_instructions && (
64- < div className = { styles . instructions } title = { raw_instructions } >
65- { raw_instructions }
55+ { props . raw_instructions && (
56+ < div className = { styles . instructions } title = { props . raw_instructions } >
57+ { props . raw_instructions }
6658 </ div >
6759 ) }
6860 { fallback_count > 0 && (
6961 < div className = { styles . info } >
70- { files . length > 1
71- ? `${ fallback_count } of ${ files . length } files`
62+ { props . files . length > 1
63+ ? `${ fallback_count } of ${ props . files . length } files`
7264 : 'The file' } { ' ' }
7365 required a fallback diff integration method, which may lead to
7466 inaccuracies. Looks off? Click{ ' ' }
@@ -92,7 +84,7 @@ export const ResponseReview: FC<Props> = ({
9284 } ) }
9385 onClick = { ( ) => {
9486 set_last_clicked_file_index ( index )
95- on_focus_file ( {
87+ props . on_focus_file ( {
9688 file_path : file . file_path ,
9789 workspace_name : file . workspace_name
9890 } )
@@ -105,11 +97,11 @@ export const ResponseReview: FC<Props> = ({
10597 } `}
10698 >
10799 < div className = { styles [ 'item__left' ] } >
108- { files . length > 1 && (
100+ { props . files . length > 1 && (
109101 < Checkbox
110102 checked = { file . is_checked }
111103 on_change = { ( checked ) => {
112- on_toggle_file ( {
104+ props . on_toggle_file ( {
113105 file_path : file . file_path ,
114106 workspace_name : file . workspace_name ,
115107 is_checked : checked
@@ -129,7 +121,7 @@ export const ResponseReview: FC<Props> = ({
129121 </ span >
130122
131123 < span >
132- { has_multiple_workspaces && file . workspace_name
124+ { props . has_multiple_workspaces && file . workspace_name
133125 ? `${ file . workspace_name } /`
134126 : '' }
135127 { dir_path }
@@ -151,7 +143,7 @@ export const ResponseReview: FC<Props> = ({
151143 on_click = { ( e ) => {
152144 e . stopPropagation ( )
153145 set_last_clicked_file_index ( index )
154- on_intelligent_update ( {
146+ props . on_intelligent_update ( {
155147 file_path : file . file_path ,
156148 workspace_name : file . workspace_name
157149 } )
@@ -164,7 +156,7 @@ export const ResponseReview: FC<Props> = ({
164156 on_click = { ( e ) => {
165157 e . stopPropagation ( )
166158 set_last_clicked_file_index ( index )
167- on_focus_file ( {
159+ props . on_focus_file ( {
168160 file_path : file . file_path ,
169161 workspace_name : file . workspace_name
170162 } )
@@ -175,7 +167,7 @@ export const ResponseReview: FC<Props> = ({
175167 title = "Go To File"
176168 on_click = { ( e ) => {
177169 e . stopPropagation ( )
178- on_go_to_file ( {
170+ props . on_go_to_file ( {
179171 file_path : file . file_path ,
180172 workspace_name : file . workspace_name
181173 } )
@@ -198,12 +190,12 @@ export const ResponseReview: FC<Props> = ({
198190 } ) }
199191 </ div >
200192 < div className = { styles . footer } >
201- < Button on_click = { on_discard } is_secondary >
193+ < Button on_click = { props . on_discard } is_secondary >
202194 Discard
203195 </ Button >
204196 < Button
205197 on_click = { handle_approve }
206- disabled = { files . filter ( ( f ) => f . is_checked ) . length == 0 }
198+ disabled = { props . files . filter ( ( f ) => f . is_checked ) . length == 0 }
207199 >
208200 Approve
209201 </ Button >
0 commit comments