@@ -29,7 +29,6 @@ interface Props {
29
29
30
30
const FeedbackButtons = ( { message } : Props ) => {
31
31
const { onFeedbackUpdated } = useContext ( MessageContext ) ;
32
-
33
32
const [ showFeedbackDialog , setShowFeedbackDialog ] = useState < number > ( ) ;
34
33
const [ commentInput , setCommentInput ] = useState < string > ( ) ;
35
34
@@ -69,6 +68,8 @@ const FeedbackButtons = ({ message }: Props) => {
69
68
}
70
69
} ;
71
70
71
+ const disabled = ! ! message . streaming ;
72
+
72
73
const buttons = useMemo ( ( ) => {
73
74
const iconSx = {
74
75
width : ICON_SIZE ,
@@ -82,51 +83,60 @@ const FeedbackButtons = ({ message }: Props) => {
82
83
const baseButtons = [
83
84
( ) => (
84
85
< Tooltip title = "Negative feedback" >
85
- < Button
86
- className = { `negative-feedback-${ feedback === - 1 ? 'on' : 'off' } ` }
87
- onClick = { ( ) => {
88
- handleFeedbackClick ( - 1 ) ;
89
- } }
90
- size = "small"
91
- >
92
- < DownIcon sx = { iconSx } />
93
- </ Button >
86
+ < span >
87
+ < Button
88
+ disabled = { disabled }
89
+ className = { `negative-feedback-${ feedback === - 1 ? 'on' : 'off' } ` }
90
+ onClick = { ( ) => {
91
+ handleFeedbackClick ( - 1 ) ;
92
+ } }
93
+ size = "small"
94
+ >
95
+ < DownIcon sx = { iconSx } />
96
+ </ Button >
97
+ </ span >
94
98
</ Tooltip >
95
99
) ,
96
100
( ) => (
97
101
< Tooltip title = "Positive feedback" >
98
- < Button
99
- className = { `positive-feedback-${ feedback === 1 ? 'on' : 'off' } ` }
100
- onClick = { ( ) => {
101
- handleFeedbackClick ( 1 ) ;
102
- } }
103
- size = "small"
104
- >
105
- < UpIcon sx = { iconSx } />
106
- </ Button >
102
+ < span >
103
+ < Button
104
+ disabled = { disabled }
105
+ className = { `positive-feedback-${ feedback === 1 ? 'on' : 'off' } ` }
106
+ onClick = { ( ) => {
107
+ handleFeedbackClick ( 1 ) ;
108
+ } }
109
+ size = "small"
110
+ >
111
+ < UpIcon sx = { iconSx } />
112
+ </ Button >
113
+ </ span >
107
114
</ Tooltip >
108
115
)
109
116
] ;
110
117
111
118
if ( comment ) {
112
119
baseButtons . push ( ( ) => (
113
120
< Tooltip title = "Feedback comment" >
114
- < Button
115
- onClick = { ( ) => {
116
- setShowFeedbackDialog ( feedback ) ;
117
- setCommentInput ( comment ) ;
118
- } }
119
- className = "feedback-comment-edit"
120
- size = "small"
121
- >
122
- < StickyNote2Outlined sx = { iconSx } />
123
- </ Button >
121
+ < span >
122
+ < Button
123
+ disabled = { disabled }
124
+ onClick = { ( ) => {
125
+ setShowFeedbackDialog ( feedback ) ;
126
+ setCommentInput ( comment ) ;
127
+ } }
128
+ className = "feedback-comment-edit"
129
+ size = "small"
130
+ >
131
+ < StickyNote2Outlined sx = { iconSx } />
132
+ </ Button >
133
+ </ span >
124
134
</ Tooltip >
125
135
) ) ;
126
136
}
127
137
128
138
return baseButtons ;
129
- } , [ feedback , comment ] ) ;
139
+ } , [ feedback , comment , disabled ] ) ;
130
140
131
141
return (
132
142
< >
0 commit comments