@@ -21,6 +21,22 @@ import {
2121import { toast } from 'sonner'
2222import Link from 'next/link'
2323
24+ interface TicketReply {
25+ id : string
26+ ticket_id : string
27+ admin_id : string
28+ message : string
29+ created_at : string
30+ updated_at : string
31+ admin ?: {
32+ id : string
33+ email : string
34+ first_name ?: string
35+ last_name ?: string
36+ avatar_url ?: string
37+ }
38+ }
39+
2440interface SupportTicket {
2541 id : string
2642 user_id : string
@@ -37,6 +53,7 @@ interface SupportTicket {
3753 last_name ?: string
3854 avatar_url ?: string
3955 }
56+ replies ?: TicketReply [ ]
4057}
4158
4259export default function TicketDetailPage ( ) {
@@ -235,6 +252,55 @@ export default function TicketDetailPage() {
235252 </ CardContent >
236253 </ Card >
237254
255+ { /* Reply History */ }
256+ { ticket . replies && ticket . replies . length > 0 && (
257+ < Card >
258+ < CardHeader >
259+ < CardTitle className = "flex items-center gap-2" >
260+ < MessageSquare className = "h-5 w-5 text-purple-500" />
261+ Reply History ({ ticket . replies . length } )
262+ </ CardTitle >
263+ < CardDescription >
264+ Previous responses sent to the user
265+ </ CardDescription >
266+ </ CardHeader >
267+ < CardContent className = "space-y-4" >
268+ { ticket . replies . map ( ( reply , index ) => (
269+ < div
270+ key = { reply . id }
271+ className = "border-l-4 border-purple-500/30 bg-purple-500/5 rounded-r-lg p-4 space-y-2"
272+ >
273+ < div className = "flex items-center justify-between" >
274+ < div className = "flex items-center gap-2" >
275+ < div className = "h-8 w-8 rounded-full bg-gradient-to-br from-purple-500 to-blue-600 flex items-center justify-center text-white text-sm font-semibold" >
276+ { reply . admin ?. first_name ?. [ 0 ] || reply . admin ?. email [ 0 ] . toUpperCase ( ) || 'A' }
277+ </ div >
278+ < div >
279+ < p className = "text-sm font-medium" >
280+ { reply . admin ?. first_name && reply . admin ?. last_name
281+ ? `${ reply . admin . first_name } ${ reply . admin . last_name } `
282+ : reply . admin ?. email || 'Admin' }
283+ </ p >
284+ < p className = "text-xs text-muted-foreground" >
285+ { new Date ( reply . created_at ) . toLocaleString ( ) }
286+ </ p >
287+ </ div >
288+ </ div >
289+ < Badge variant = "outline" className = "text-xs" >
290+ Reply #{ index + 1 }
291+ </ Badge >
292+ </ div >
293+ < div className = "pl-10" >
294+ < p className = "text-sm text-foreground whitespace-pre-wrap" >
295+ { reply . message }
296+ </ p >
297+ </ div >
298+ </ div >
299+ ) ) }
300+ </ CardContent >
301+ </ Card >
302+ ) }
303+
238304 { /* Reply to User */ }
239305 < Card className = "border-blue-500/20 bg-blue-500/5" >
240306 < CardHeader >
0 commit comments