@@ -41,6 +41,7 @@ export function SupportCaseDetails({ ticket, team }: SupportCaseDetailsProps) {
4141 // rating/feedback
4242 const [ rating , setRating ] = useState ( 0 ) ;
4343 const [ feedback , setFeedback ] = useState ( "" ) ;
44+ const [ feedbackSubmitted , setFeedbackSubmitted ] = useState ( false ) ;
4445
4546 const handleStarClick = ( starIndex : number ) => {
4647 setRating ( starIndex + 1 ) ;
@@ -63,6 +64,7 @@ export function SupportCaseDetails({ ticket, team }: SupportCaseDetailsProps) {
6364 }
6465
6566 toast . success ( "Thank you for your feedback!" ) ;
67+ setFeedbackSubmitted ( true ) ;
6668 setRating ( 0 ) ;
6769 setFeedback ( "" ) ;
6870 } catch ( error ) {
@@ -183,58 +185,74 @@ export function SupportCaseDetails({ ticket, team }: SupportCaseDetailsProps) {
183185 ) }
184186 </ div >
185187
188+ { /* Feedback Section - Only show for closed tickets */ }
186189 { ticket . status === "closed" && (
187- < div className = "border-t p-6" >
188- < p className = "text-muted-foreground text-sm" >
189- This ticket is closed. Give us a quick rating to let us know how
190- we did!
191- </ p >
192- </ div >
193- ) }
194-
195- < div className = "flex gap-2 mb-6 px-6" >
196- { [ 1 , 2 , 3 , 4 , 5 ] . map ( ( starValue ) => (
197- < button
198- key = { `star-${ starValue } ` }
199- type = "button"
200- onClick = { ( ) => handleStarClick ( starValue - 1 ) }
201- className = "transition-colors"
202- aria-label = { `Rate ${ starValue } out of 5 stars` }
203- >
204- < svg
205- width = "32"
206- height = "32"
207- viewBox = "0 0 24 24"
208- fill = { starValue <= rating ? "#ff00aa" : "none" }
209- stroke = { starValue <= rating ? "#ff00aa" : "#666" }
210- strokeWidth = { starValue <= rating ? "2" : "1" }
211- className = "hover:fill-pink-500 hover:stroke-pink-500 rounded-sm"
212- rx = "2"
213- aria-hidden = "true"
214- >
215- < polygon points = "12,2 15.09,8.26 22,9.27 17,14.14 18.18,21.02 12,17.77 5.82,21.02 7,14.14 2,9.27 8.91,8.26" />
216- </ svg >
217- </ button >
218- ) ) }
219- </ div >
190+ < >
191+ { ! feedbackSubmitted && (
192+ < >
193+ < div className = "border-t p-6" >
194+ < p className = "text-muted-foreground text-sm" >
195+ This ticket is closed. Give us a quick rating to let us know
196+ how we did!
197+ </ p >
198+ </ div >
199+
200+ < div className = "flex gap-2 mb-6 px-6" >
201+ { [ 1 , 2 , 3 , 4 , 5 ] . map ( ( starValue ) => (
202+ < button
203+ key = { `star-${ starValue } ` }
204+ type = "button"
205+ onClick = { ( ) => handleStarClick ( starValue - 1 ) }
206+ className = "transition-colors"
207+ aria-label = { `Rate ${ starValue } out of 5 stars` }
208+ >
209+ < svg
210+ width = "32"
211+ height = "32"
212+ viewBox = "0 0 24 24"
213+ fill = { starValue <= rating ? "#ff00aa" : "none" }
214+ stroke = { starValue <= rating ? "#ff00aa" : "#666" }
215+ strokeWidth = { starValue <= rating ? "2" : "1" }
216+ className = "hover:fill-pink-500 hover:stroke-pink-500 rounded-sm"
217+ rx = "2"
218+ aria-hidden = "true"
219+ >
220+ < polygon points = "12,2 15.09,8.26 22,9.27 17,14.14 18.18,21.02 12,17.77 5.82,21.02 7,14.14 2,9.27 8.91,8.26" />
221+ </ svg >
222+ </ button >
223+ ) ) }
224+ </ div >
225+
226+ < div className = "relative p-6" >
227+ < div className = "relative" >
228+ < textarea
229+ value = { feedback }
230+ onChange = { ( e ) => setFeedback ( e . target . value ) }
231+ placeholder = "Optional: Tell us how we can improve."
232+ className = "text-muted-foreground text-sm w-full bg-black text-white rounded-lg p-4 pr-28 min-h-[100px] resize-none border border-[#262626] focus:border-[#262626] focus:outline-none placeholder-[#A1A1A1]"
233+ />
234+ < button
235+ type = "button"
236+ onClick = { handleSendFeedback }
237+ className = "absolute mb-2 bottom-3 right-3 bg-white text-black px-4 py-2 rounded-full text-sm font-medium hover:bg-gray-100 transition-colors"
238+ >
239+ Send Feedback
240+ </ button >
241+ </ div >
242+ </ div >
243+ </ >
244+ ) }
220245
221- < div className = "relative p-6" >
222- < div className = "relative" >
223- < textarea
224- value = { feedback }
225- onChange = { ( e ) => setFeedback ( e . target . value ) }
226- placeholder = "Optional: Tell us how we can improve."
227- className = "text-muted-foreground text-sm w-full bg-black text-white rounded-lg p-4 pr-28 min-h-[100px] resize-none border border-[#262626] focus:border-[#262626] focus:outline-none placeholder-[#A1A1A1]"
228- />
229- < button
230- type = "button"
231- onClick = { handleSendFeedback }
232- className = "absolute mb-2 bottom-3 right-3 bg-white text-black px-4 py-2 rounded-full text-sm font-medium hover:bg-gray-100 transition-colors"
233- >
234- Send Feedback
235- </ button >
236- </ div >
237- </ div >
246+ { feedbackSubmitted && (
247+ < div className = "border-t p-6" >
248+ < p className = "text-muted-foreground text-sm" >
249+ This ticket is closed. If you need further assistance, please
250+ create a new ticket.
251+ </ p >
252+ </ div >
253+ ) }
254+ </ >
255+ ) }
238256 </ div >
239257
240258 < div className = "h-8" />
0 commit comments