@@ -23,6 +23,20 @@ const CollectionListRowBase = (props) => {
23
23
const [ renameValue , setRenameValue ] = useState ( '' ) ;
24
24
const renameInput = useRef ( null ) ;
25
25
26
+ const closeAll = ( ) => {
27
+ setOptionsOpen ( false ) ;
28
+ setRenameOpen ( false ) ;
29
+ } ;
30
+
31
+ const updateName = ( ) => {
32
+ const isValid = renameValue . trim ( ) . length !== 0 ;
33
+ if ( isValid ) {
34
+ props . editCollection ( props . collection . id , {
35
+ name : renameValue . trim ( )
36
+ } ) ;
37
+ }
38
+ } ;
39
+
26
40
const onFocusComponent = ( ) => {
27
41
setIsFocused ( true ) ;
28
42
} ;
@@ -52,11 +66,6 @@ const CollectionListRowBase = (props) => {
52
66
}
53
67
} ;
54
68
55
- const closeAll = ( ) => {
56
- setOptionsOpen ( false ) ;
57
- setRenameOpen ( false ) ;
58
- } ;
59
-
60
69
const handleAddSketches = ( ) => {
61
70
closeAll ( ) ;
62
71
props . onAddSketches ( ) ;
@@ -100,15 +109,6 @@ const CollectionListRowBase = (props) => {
100
109
closeAll ( ) ;
101
110
} ;
102
111
103
- const updateName = ( ) => {
104
- const isValid = renameValue . trim ( ) . length !== 0 ;
105
- if ( isValid ) {
106
- props . editCollection ( props . collection . id , {
107
- name : renameValue . trim ( )
108
- } ) ;
109
- }
110
- } ;
111
-
112
112
const renderActions = ( ) => {
113
113
const { mobile } = props ;
114
114
const userIsOwner = props . user . username === props . username ;
@@ -264,4 +264,3 @@ function mapDispatchToPropsSketchListRow(dispatch) {
264
264
export default withTranslation ( ) (
265
265
connect ( null , mapDispatchToPropsSketchListRow ) ( CollectionListRowBase )
266
266
) ;
267
-
0 commit comments