@@ -21,6 +21,7 @@ import {
2121import BranchSelector from '@/components/tasks/BranchSelector' ;
2222import { useCallback , useEffect , useState } from 'react' ;
2323import { attemptsApi } from '@/lib/api.ts' ;
24+ import { useTranslation } from 'react-i18next' ;
2425
2526import {
2627 GitBranch ,
@@ -50,6 +51,7 @@ const CreatePrDialog = NiceModal.create(() => {
5051 const [ selectedHeadRemote , setSelectedHeadRemote ] = useState < string | null > (
5152 null
5253 ) ;
54+ const { t } = useTranslation ( [ 'tasks' ] ) ;
5355
5456 const getRemoteFromBranchName = useCallback ( ( branchName ?: string | null ) => {
5557 if ( ! branchName ) return null ;
@@ -88,10 +90,7 @@ const CreatePrDialog = NiceModal.create(() => {
8890 }
8991 }
9092
91- if (
92- ! projectBranches . length &&
93- ! data . attempt . target_branch
94- ) {
93+ if ( ! projectBranches . length && ! data . attempt . target_branch ) {
9594 setPrBaseBranch ( '' ) ;
9695 }
9796
@@ -219,7 +218,15 @@ const CreatePrDialog = NiceModal.create(() => {
219218 }
220219 }
221220 setCreatingPR ( false ) ;
222- } , [ data , prBaseBranch , prBody , prTitle , selectedRemote , modal ] ) ;
221+ } , [
222+ data ,
223+ prBaseBranch ,
224+ prBody ,
225+ prTitle ,
226+ selectedRemote ,
227+ selectedHeadRemote ,
228+ modal ,
229+ ] ) ;
223230
224231 const handleCancelCreatePR = useCallback ( ( ) => {
225232 modal . hide ( ) ;
@@ -247,26 +254,32 @@ const CreatePrDialog = NiceModal.create(() => {
247254 </ DialogHeader >
248255 < div className = "space-y-4 py-4" >
249256 < div className = "space-y-2" >
250- < Label htmlFor = "pr-title" > Title</ Label >
257+ < Label htmlFor = "pr-title" >
258+ { t ( 'tasks:git.createPr.labels.title' ) }
259+ </ Label >
251260 < Input
252261 id = "pr-title"
253262 value = { prTitle }
254263 onChange = { ( e ) => setPrTitle ( e . target . value ) }
255- placeholder = "Enter PR title"
264+ placeholder = { t ( 'tasks:git.createPr.placeholders. title' ) }
256265 />
257266 </ div >
258267 < div className = "space-y-2" >
259- < Label htmlFor = "pr-body" > Description (optional)</ Label >
268+ < Label htmlFor = "pr-body" >
269+ { t ( 'tasks:git.createPr.labels.descriptionOptional' ) }
270+ </ Label >
260271 < Textarea
261272 id = "pr-body"
262273 value = { prBody }
263274 onChange = { ( e ) => setPrBody ( e . target . value ) }
264- placeholder = "Enter PR description"
275+ placeholder = { t ( 'tasks:git.createPr.placeholders. description' ) }
265276 rows = { 4 }
266277 />
267278 </ div >
268279 < div className = "space-y-2" >
269- < Label htmlFor = "pr-remote" > Remote</ Label >
280+ < Label htmlFor = "pr-remote" >
281+ { t ( 'tasks:git.createPr.labels.remote' ) }
282+ </ Label >
270283 < Select
271284 value = { selectedRemote ?? undefined }
272285 onValueChange = { ( value ) => setSelectedRemote ( value ) }
@@ -281,24 +294,28 @@ const CreatePrDialog = NiceModal.create(() => {
281294 < SelectValue
282295 placeholder = {
283296 remotesLoading
284- ? 'Loading remotes...'
297+ ? t ( 'tasks:git.createPr.placeholders.remote.loading' )
285298 : remotes . length === 0
286- ? 'No remotes found'
287- : 'Select remote'
299+ ? t ( 'tasks:git.createPr.placeholders.remote.empty' )
300+ : t ( 'tasks:git.createPr.placeholders. remote.default' )
288301 }
289302 />
290303 </ SelectTrigger >
291304 < SelectContent >
292305 { remotes . map ( ( remote ) => (
293306 < SelectItem key = { remote . name } value = { remote . name } >
294- { remote . url ? `${ remote . name } (${ remote . url } )` : remote . name }
307+ { remote . url
308+ ? `${ remote . name } (${ remote . url } )`
309+ : remote . name }
295310 </ SelectItem >
296311 ) ) }
297312 </ SelectContent >
298313 </ Select >
299314 </ div >
300315 < div className = "space-y-2" >
301- < Label htmlFor = "pr-head-remote" > Source Remote</ Label >
316+ < Label htmlFor = "pr-head-remote" >
317+ { t ( 'tasks:git.createPr.labels.sourceRemote' ) }
318+ </ Label >
302319 < Select
303320 value = { selectedHeadRemote ?? undefined }
304321 onValueChange = { ( value ) => setSelectedHeadRemote ( value ) }
@@ -313,30 +330,38 @@ const CreatePrDialog = NiceModal.create(() => {
313330 < SelectValue
314331 placeholder = {
315332 remotesLoading
316- ? 'Loading remotes...'
333+ ? t ( 'tasks:git.createPr.placeholders.remote.loading' )
317334 : remotes . length === 0
318- ? 'No remotes found'
319- : 'Select source remote'
335+ ? t ( 'tasks:git.createPr.placeholders.remote.empty' )
336+ : t (
337+ 'tasks:git.createPr.placeholders.sourceRemote.default'
338+ )
320339 }
321340 />
322341 </ SelectTrigger >
323342 < SelectContent >
324343 { remotes . map ( ( remote ) => (
325344 < SelectItem key = { remote . name } value = { remote . name } >
326- { remote . url ? `${ remote . name } (${ remote . url } )` : remote . name }
345+ { remote . url
346+ ? `${ remote . name } (${ remote . url } )`
347+ : remote . name }
327348 </ SelectItem >
328349 ) ) }
329350 </ SelectContent >
330351 </ Select >
331352 </ div >
332353 < div className = "space-y-2" >
333- < Label htmlFor = "pr-base" > Base Branch</ Label >
354+ < Label htmlFor = "pr-base" >
355+ { t ( 'tasks:git.createPr.labels.baseBranch' ) }
356+ </ Label >
334357 < BranchSelector
335358 branches = { branches }
336359 selectedBranch = { prBaseBranch }
337360 onBranchSelect = { setPrBaseBranch }
338361 placeholder = {
339- branchesLoading ? 'Loading branches...' : 'Select base branch'
362+ branchesLoading
363+ ? t ( 'tasks:git.createPr.placeholders.baseBranch.loading' )
364+ : t ( 'tasks:git.createPr.placeholders.baseBranch.default' )
340365 }
341366 className = {
342367 branchesLoading ? 'opacity-50 cursor-not-allowed' : ''
0 commit comments