@@ -4,6 +4,7 @@ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, D
44import { Textarea } from "../ui/textarea"
55import { useClipboard } from "../ui/hooks"
66import { Check , Copy , X } from "lucide-react"
7+ import { useAppTranslation } from "@/i18n/TranslationContext"
78
89interface HumanRelayDialogProps {
910 isOpen : boolean
@@ -26,19 +27,20 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
2627 onSubmit,
2728 onCancel,
2829} ) => {
30+ const { t } = useAppTranslation ( )
2931 const [ response , setResponse ] = React . useState ( "" )
3032 const { copy } = useClipboard ( )
3133 const [ isCopyClicked , setIsCopyClicked ] = React . useState ( false )
3234
33- // Listen to isOpen changes, clear the input box when the dialog box is opened
35+ // Clear input when dialog opens
3436 React . useEffect ( ( ) => {
3537 if ( isOpen ) {
3638 setResponse ( "" )
3739 setIsCopyClicked ( false )
3840 }
3941 } , [ isOpen ] )
4042
41- // Copy to clipboard and show a success message
43+ // Copy to clipboard and show success message
4244 const handleCopy = ( ) => {
4345 copy ( promptText )
4446 setIsCopyClicked ( true )
@@ -47,7 +49,7 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
4749 } , 2000 )
4850 }
4951
50- // Submit the response
52+ // Submit response
5153 const handleSubmit = ( e : React . FormEvent ) => {
5254 e . preventDefault ( )
5355 if ( response . trim ( ) ) {
@@ -56,7 +58,7 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
5658 }
5759 }
5860
59- // Cancel the operation
61+ // Cancel operation
6062 const handleCancel = ( ) => {
6163 onCancel ( requestId )
6264 onClose ( )
@@ -66,10 +68,8 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
6668 < Dialog open = { isOpen } onOpenChange = { ( open ) => ! open && handleCancel ( ) } >
6769 < DialogContent className = "sm:max-w-[600px]" >
6870 < DialogHeader >
69- < DialogTitle > Human Relay - Please Help Copy and Paste Information</ DialogTitle >
70- < DialogDescription >
71- Please copy the text below to the web AI, then paste the AI's response into the input box below.
72- </ DialogDescription >
71+ < DialogTitle > { t ( "humanRelay:dialogTitle" ) } </ DialogTitle >
72+ < DialogDescription > { t ( "humanRelay:dialogDescription" ) } </ DialogDescription >
7373 </ DialogHeader >
7474
7575 < div className = "grid gap-4 py-4" >
@@ -84,12 +84,14 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
8484 </ Button >
8585 </ div >
8686
87- { isCopyClicked && < div className = "text-sm text-emerald-500 font-medium" > Copied to clipboard</ div > }
87+ { isCopyClicked && (
88+ < div className = "text-sm text-emerald-500 font-medium" > { t ( "humanRelay:copiedToClipboard" ) } </ div >
89+ ) }
8890
8991 < div >
90- < div className = "mb-2 font-medium" > Please enter the AI's response: </ div >
92+ < div className = "mb-2 font-medium" > { t ( "humanRelay:aiResponse.label" ) } </ div >
9193 < Textarea
92- placeholder = "Paste the AI's response here..."
94+ placeholder = { t ( "humanRelay:aiResponse.placeholder" ) }
9395 value = { response }
9496 onChange = { ( e ) => setResponse ( e . target . value ) }
9597 className = "min-h-[150px]"
@@ -100,11 +102,11 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
100102 < DialogFooter >
101103 < Button variant = "outline" onClick = { handleCancel } className = "gap-1" >
102104 < X className = "h-4 w-4" />
103- Cancel
105+ { t ( "humanRelay:actions.cancel" ) }
104106 </ Button >
105107 < Button onClick = { handleSubmit } disabled = { ! response . trim ( ) } className = "gap-1" >
106108 < Check className = "h-4 w-4" />
107- Submit
109+ { t ( "humanRelay:actions.submit" ) }
108110 </ Button >
109111 </ DialogFooter >
110112 </ DialogContent >
0 commit comments