@@ -5,10 +5,10 @@ import {
55 Text ,
66 ShimmeredDetailsList ,
77 TextField ,
8+ IconButton ,
89 IColumn ,
910 IGroup ,
1011 CheckboxVisibility ,
11- ITextFieldStyleProps ,
1212 getTheme ,
1313} from 'office-ui-fabric-react'
1414
@@ -73,7 +73,7 @@ const TransactionList = ({
7373 onDescriptionPress,
7474 onDescriptionFieldBlur,
7575 onDescriptionChange,
76- onDescriptionFocus ,
76+ onDescriptionSelected ,
7777 } = useLocalDescription ( 'transaction' , walletID , dispatch )
7878
7979 const transactionColumns : IColumn [ ] = useMemo (
@@ -175,28 +175,37 @@ const TransactionList = ({
175175 minWidth : 100 ,
176176 maxWidth : 100 ,
177177 onRender : ( item ?: FormatTransaction ) => {
178+ const isSelected = item && localDescription . key === item . hash
178179 return item ? (
179- < TextField
180- title = { item . description }
181- value = { localDescription . key === item . hash ? localDescription . description : item . description || '' }
182- onFocus = { onDescriptionFocus }
183- onBlur = { onDescriptionFieldBlur ( item . hash , item . description ) }
184- onKeyPress = { onDescriptionPress ( item . hash , item . description ) }
185- onChange = { onDescriptionChange ( item . hash ) }
186- disabled = { localDescription . key === item . hash && isUpdatingDescription }
187- iconProps = { {
188- iconName : localDescription . key === item . hash && isUpdatingDescription ? 'Updating' : '' ,
189- } }
190- borderless
191- styles = { ( props : ITextFieldStyleProps ) => {
192- return {
180+ < >
181+ < TextField
182+ title = { item . description }
183+ value = { isSelected ? localDescription . description : item . description || '' }
184+ onBlur = { isSelected ? onDescriptionFieldBlur ( item . hash , item . description ) : undefined }
185+ onKeyPress = { isSelected ? onDescriptionPress ( item . hash , item . description ) : undefined }
186+ onChange = { isSelected ? onDescriptionChange ( item . hash ) : undefined }
187+ disabled = { isSelected && isUpdatingDescription }
188+ iconProps = { {
189+ iconName : isSelected && isUpdatingDescription ? 'Updating' : '' ,
190+ } }
191+ borderless
192+ readOnly = { ! isSelected }
193+ styles = { {
193194 fieldGroup : {
194- borderColor : '#ccc' ,
195- border : props . focused ? '1px solid' : 'none' ,
195+ backgroundColor : isSelected ? '#fff' : 'transparent' ,
196+ borderColor : 'transparent' ,
197+ border : isSelected ? '1px solid' : 'none' ,
196198 } ,
197- }
198- } }
199- />
199+ } }
200+ />
201+ { isSelected ? null : (
202+ < IconButton
203+ iconProps = { { iconName : 'Edit' } }
204+ className = "editButton"
205+ onClick = { onDescriptionSelected ( item . hash , item . description ) }
206+ />
207+ ) }
208+ </ >
200209 ) : null
201210 } ,
202211 } ,
@@ -224,7 +233,7 @@ const TransactionList = ({
224233 onDescriptionChange ,
225234 onDescriptionFieldBlur ,
226235 onDescriptionPress ,
227- onDescriptionFocus ,
236+ onDescriptionSelected ,
228237 isUpdatingDescription ,
229238 t ,
230239 ]
0 commit comments