1
1
import { Input , Modal } from 'antd' ;
2
- import { debounce } from 'lodash' ;
3
2
import React from 'react' ;
4
3
import styled from 'styled-components' ;
5
4
@@ -53,13 +52,6 @@ const IconColorPicker: React.FC<IconColorPickerProps> = ({
53
52
const [ stagedColor , setStagedColor ] = React . useState < string > ( color || '#000000' ) ;
54
53
const [ stagedIcon , setStagedIcon ] = React . useState < string > ( icon || 'account_circle' ) ;
55
54
56
- // a debounced version of updateDisplayProperties that takes in the same arguments
57
- // eslint-disable-next-line react-hooks/exhaustive-deps
58
- const debouncedUpdateDisplayProperties = React . useCallback (
59
- debounce ( ( ...args ) => updateDisplayProperties ( ...args ) . then ( ( ) => setTimeout ( ( ) => refetch ( ) , 1000 ) ) , 500 ) ,
60
- [ ] ,
61
- ) ;
62
-
63
55
return (
64
56
< Modal
65
57
open = { open }
@@ -77,7 +69,7 @@ const IconColorPicker: React.FC<IconColorPickerProps> = ({
77
69
} ,
78
70
} ,
79
71
} ,
80
- } ) ;
72
+ } ) . then ( ( ) => refetch ( ) ) ;
81
73
onChangeColor ?.( stagedColor ) ;
82
74
onChangeIcon ?.( stagedIcon ) ;
83
75
onClose ( ) ;
@@ -93,44 +85,10 @@ const IconColorPicker: React.FC<IconColorPickerProps> = ({
93
85
marginBottom : 30 ,
94
86
marginTop : 15 ,
95
87
} }
96
- onChange = { ( e ) => {
97
- setStagedColor ( e . target . value ) ;
98
- debouncedUpdateDisplayProperties ?.( {
99
- variables : {
100
- urn,
101
- input : {
102
- colorHex : e . target . value ,
103
- icon : {
104
- iconLibrary : IconLibrary . Material ,
105
- name : stagedIcon ,
106
- style : 'Outlined' ,
107
- } ,
108
- } ,
109
- } ,
110
- } ) ;
111
- } }
88
+ onChange = { ( e ) => setStagedColor ( e . target . value ) }
112
89
/>
113
90
< Title > Choose an icon for { name || 'Domain' } </ Title >
114
- < ChatIconPicker
115
- color = { stagedColor }
116
- onIconPick = { ( i ) => {
117
- console . log ( 'picking icon' , i ) ;
118
- debouncedUpdateDisplayProperties ?.( {
119
- variables : {
120
- urn,
121
- input : {
122
- colorHex : stagedColor ,
123
- icon : {
124
- iconLibrary : IconLibrary . Material ,
125
- name : capitalize ( snakeToCamel ( i ) ) ,
126
- style : 'Outlined' ,
127
- } ,
128
- } ,
129
- } ,
130
- } ) ;
131
- setStagedIcon ( i ) ;
132
- } }
133
- />
91
+ < ChatIconPicker color = { stagedColor } onIconPick = { ( i ) => setStagedIcon ( i ) } />
134
92
</ Modal >
135
93
) ;
136
94
} ;
0 commit comments