@@ -46,7 +46,8 @@ import { AppState } from '../../modules';
46
46
import {
47
47
selectById as selectFeatureById ,
48
48
selectAll as selectAllFeatures ,
49
- listFeatures
49
+ listFeatures ,
50
+ updateFeature
50
51
} from '../../modules/features' ;
51
52
import { useCurrentEnvironment , useIsEditable } from '../../modules/me' ;
52
53
import {
@@ -69,6 +70,7 @@ import { CancelScheduleDialog } from '../CancelScheduleDialog';
69
70
import { Dialog } from '@headlessui/react' ;
70
71
import ProjectSvg from '../../assets/svg/project.svg' ;
71
72
import { Overlay } from '../Overlay' ;
73
+ import { Modal } from '../Modal' ;
72
74
73
75
interface FeatureTargetingFormProps {
74
76
featureId : string ;
@@ -78,6 +80,7 @@ interface FeatureTargetingFormProps {
78
80
export const FeatureTargetingForm : FC < FeatureTargetingFormProps > = memo (
79
81
( { featureId, onOpenConfirmDialog } ) => {
80
82
const { formatMessage : f } = useIntl ( ) ;
83
+ const dispatch = useDispatch < AppDispatch > ( ) ;
81
84
const editable = useIsEditable ( ) ;
82
85
const methods = useFormContext < TargetingForm > ( ) ;
83
86
const {
@@ -183,14 +186,63 @@ export const FeatureTargetingForm: FC<FeatureTargetingFormProps> = memo(
183
186
) ;
184
187
} ;
185
188
189
+ const handleApplyNow = ( ) => {
190
+ setIsApplyNowOpen ( false ) ;
191
+ dispatch (
192
+ updateFeature ( {
193
+ environmentId : currentEnvironment . id ,
194
+ id : featureId ,
195
+ applyScheduleUpdate : true
196
+ } )
197
+ ) ;
198
+ } ;
199
+
186
200
const [ open , setOpen ] = useState ( false ) ;
201
+ const [ isApplyNowOpen , setIsApplyNowOpen ] = useState ( false ) ;
187
202
const [ isSeeChangesModalOpen , setIsSeeChangesModalOpen ] = useState ( false ) ;
188
203
189
204
const disabled = false ;
190
205
206
+ console . log ( {
207
+ feature
208
+ } ) ;
209
+
191
210
return (
192
211
< div className = "p-10 bg-gray-100" >
193
212
< CancelScheduleDialog open = { open } onClose = { ( ) => setOpen ( false ) } />
213
+ < Modal open = { isApplyNowOpen } onClose = { ( ) => setIsApplyNowOpen ( false ) } >
214
+ < Dialog . Title
215
+ as = "h3"
216
+ className = "text-lg font-medium leading-6 text-gray-900"
217
+ >
218
+ Apply Changes
219
+ </ Dialog . Title >
220
+ < div className = "py-6 flex justify-center" > Icon</ div >
221
+ < div className = "mt-2 text-center px-5" >
222
+ < p className = "text-sm text-gray-500" >
223
+ Apply changes now description.
224
+ </ p >
225
+ </ div >
226
+ < div className = "pt-10" >
227
+ < div className = "flex justify-end" >
228
+ < button
229
+ type = "button"
230
+ className = "btn-cancel mr-3"
231
+ disabled = { false }
232
+ onClick = { ( ) => setIsApplyNowOpen ( false ) }
233
+ >
234
+ { f ( messages . button . cancel ) }
235
+ </ button >
236
+ < button
237
+ type = "button"
238
+ className = "btn btn-submit"
239
+ onClick = { handleApplyNow }
240
+ >
241
+ Apply Now
242
+ </ button >
243
+ </ div >
244
+ </ div >
245
+ </ Modal >
194
246
< div className = "bg-blue-50 p-4 border-l-4 border-blue-400 mb-7 inline-block" >
195
247
< div className = "flex" >
196
248
< div className = "flex-shrink-0" >
@@ -207,7 +259,12 @@ export const FeatureTargetingForm: FC<FeatureTargetingFormProps> = memo(
207
259
< div className = "flex items-center" >
208
260
< div className = "flex items-center text-primary border-r border-gray-300 pr-4 space-x-2" >
209
261
< CheckIcon className = "w-5 h-5" />
210
- < button className = "text-sm font-normal" > Apply Now</ button >
262
+ < button
263
+ className = "text-sm font-normal"
264
+ onClick = { ( ) => setIsApplyNowOpen ( true ) }
265
+ >
266
+ Apply Now
267
+ </ button >
211
268
</ div >
212
269
< div className = "flex items-center text-primary border-r border-gray-300 px-4 space-x-2" >
213
270
< PencilIcon className = "w-4 h-4" />
0 commit comments