@@ -33,7 +33,13 @@ export interface EditTaskDialogProps {
3333 projectId ?: string | null ;
3434 comments ?: string ;
3535 } ;
36- onInputChange : ( e : React . ChangeEvent < HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement > ) => void ;
36+ onTitleChange ?: ( title : string ) => Promise < void > | void ;
37+ onDescriptionChange ?: ( description : string ) => Promise < void > | void ;
38+ onPriorityChange ?: ( priority : string ) => Promise < void > | void ;
39+ onStatusChange ?: ( status : string ) => Promise < void > | void ;
40+ onStartDateChange ?: ( startDate : string ) => Promise < void > | void ;
41+ onEndDateChange ?: ( endDate : string ) => Promise < void > | void ;
42+ onAssignedToChange ?: ( assignedTo : string [ ] ) => Promise < void > | void ;
3743 onSubmit : ( e : React . FormEvent ) => void ;
3844 assignableUsers ?: User [ ] ;
3945 isLoadingAssignableUsers ?: boolean ;
@@ -67,7 +73,13 @@ export default function EditTaskDialog({
6773 open,
6874 onOpenChange,
6975 form,
70- onInputChange,
76+ onTitleChange,
77+ onDescriptionChange,
78+ onPriorityChange,
79+ onStatusChange,
80+ onStartDateChange,
81+ onEndDateChange,
82+ onAssignedToChange,
7183 onSubmit,
7284 onDeleteClick,
7385 isSubmitting = false ,
@@ -104,17 +116,9 @@ export default function EditTaskDialog({
104116
105117 function handleAssignedUserSelect ( _ : unknown , data : { optionValue ?: string | number ; selectedOptions : string [ ] } ) {
106118 const selectedIds = data . selectedOptions ;
107-
108- const syntheticEvent = {
109- target : {
110- name : 'assignedTo' ,
111- value : selectedIds ,
112- tagName : 'SELECT' ,
113- type : 'select-multiple' ,
114- } ,
115- } as unknown as React . ChangeEvent < HTMLSelectElement > ;
116-
117- onInputChange ( syntheticEvent ) ;
119+ if ( onAssignedToChange ) {
120+ onAssignedToChange ( selectedIds ) ;
121+ }
118122 }
119123
120124 function handleTitleBlur ( ) {
@@ -140,32 +144,25 @@ export default function EditTaskDialog({
140144 return isNaN ( date . getTime ( ) ) ? undefined : date ;
141145 }
142146
143- // Helper to convert Date to YYYY-MM-DD string
147+ // Helper to convert Date to YYYY-MM-DD string using local timezone
144148 function formatDateToString ( date : Date ) : string {
145- return date . toISOString ( ) . split ( 'T' ) [ 0 ] ;
149+ const year = date . getFullYear ( ) ;
150+ const month = String ( date . getMonth ( ) + 1 ) . padStart ( 2 , '0' ) ;
151+ const day = String ( date . getDate ( ) ) . padStart ( 2 , '0' ) ;
152+ return `${ year } -${ month } -${ day } ` ;
146153 }
147154
148155 function handleStartDateSelect ( date : Date ) : void {
149- const syntheticEvent = {
150- target : {
151- name : 'startDate' ,
152- value : formatDateToString ( date ) ,
153- type : 'date' ,
154- } ,
155- } as React . ChangeEvent < HTMLInputElement > ;
156- onInputChange ( syntheticEvent ) ;
156+ if ( onStartDateChange ) {
157+ onStartDateChange ( formatDateToString ( date ) ) ;
158+ }
157159 setStartDatePopoverOpen ( false ) ;
158160 }
159161
160162 function handleEndDateSelect ( date : Date ) : void {
161- const syntheticEvent = {
162- target : {
163- name : 'endDate' ,
164- value : formatDateToString ( date ) ,
165- type : 'date' ,
166- } ,
167- } as React . ChangeEvent < HTMLInputElement > ;
168- onInputChange ( syntheticEvent ) ;
163+ if ( onEndDateChange ) {
164+ onEndDateChange ( formatDateToString ( date ) ) ;
165+ }
169166 setEndDatePopoverOpen ( false ) ;
170167 }
171168
@@ -200,7 +197,11 @@ export default function EditTaskDialog({
200197 < Input
201198 name = "title"
202199 value = { form . title }
203- onChange = { onInputChange }
200+ onChange = { ( e ) => {
201+ if ( onTitleChange ) {
202+ onTitleChange ( e . target . value ) ;
203+ }
204+ } }
204205 onBlur = { handleTitleBlur }
205206 onKeyDown = { handleTitleKeyDown }
206207 ref = { inputRef }
@@ -406,19 +407,44 @@ export default function EditTaskDialog({
406407 </ div >
407408 { /* Row 3: Description */ }
408409 < Field label = "Description" style = { { marginBottom : 16 } } >
409- < Input name = "description" value = { form . description } onChange = { onInputChange } placeholder = "Build low-fidelity wireframes for the dashboard layout and task management screens." />
410+ < Input
411+ name = "description"
412+ value = { form . description }
413+ onChange = { ( e ) => {
414+ if ( onDescriptionChange ) {
415+ onDescriptionChange ( e . target . value ) ;
416+ }
417+ } }
418+ placeholder = "Build low-fidelity wireframes for the dashboard layout and task management screens."
419+ />
410420 </ Field >
411421 { /* Row 4: Status, Priority */ }
412422 < div style = { { display : 'flex' , gap : 16 , marginBottom : 16 } } >
413423 < Field label = "Status" style = { { flex : 1 } } >
414- < Select name = "status" value = { form . status } onChange = { onInputChange } >
424+ < Select
425+ name = "status"
426+ value = { form . status }
427+ onChange = { ( e ) => {
428+ if ( onStatusChange ) {
429+ onStatusChange ( e . target . value ) ;
430+ }
431+ } }
432+ >
415433 < option value = "To Do" > To Do</ option >
416434 < option value = "In Progress" > In Progress</ option >
417435 < option value = "Done" > Done</ option >
418436 </ Select >
419437 </ Field >
420438 < Field label = "Priority" style = { { flex : 1 } } >
421- < Select name = "priority" value = { form . priority } onChange = { onInputChange } >
439+ < Select
440+ name = "priority"
441+ value = { form . priority }
442+ onChange = { ( e ) => {
443+ if ( onPriorityChange ) {
444+ onPriorityChange ( e . target . value ) ;
445+ }
446+ } }
447+ >
422448 < option value = "Low" > Low</ option >
423449 < option value = "Medium" > Medium</ option >
424450 < option value = "Important" > Important</ option >
0 commit comments