11import React , { useState } from 'react' ;
2- import { inject , hooksObserver } from 'app/componentConnectors ' ;
2+ import { useOvermind } from 'app/overmind ' ;
33import { format } from 'date-fns' ;
44import { LinkButton } from 'app/components/LinkButton' ;
55
@@ -17,20 +17,23 @@ interface Props {
1717 markedAsCancelled : boolean ;
1818 cancelSubscription : ( ) => void ;
1919 updateSubscription : ( params : { coupon : string } ) => void ;
20- store : any ;
21- signals : any ;
2220}
2321
2422function ChangeSubscriptionComponent ( {
2523 date,
2624 markedAsCancelled,
2725 cancelSubscription,
2826 updateSubscription,
29- store,
30- signals,
3127} : Props ) {
32- const isLoading = store . patron . isUpdatingSubscription ;
33- const { error } = store . patron ;
28+ const {
29+ state : {
30+ patron : { isUpdatingSubscription, error } ,
31+ } ,
32+ actions : {
33+ modalOpened,
34+ patron : { tryAgainClicked } ,
35+ } ,
36+ } = useOvermind ( ) ;
3437
3538 const [ coupon , setCoupon ] = useState ( '' ) ;
3639
@@ -40,7 +43,7 @@ function ChangeSubscriptionComponent({
4043 There was a problem updating this subscription.
4144 < SmallText > { error } </ SmallText >
4245 < Buttons >
43- < StyledButton onClick = { ( ) => signals . patron . tryAgainClicked ( ) } >
46+ < StyledButton onClick = { ( ) => tryAgainClicked ( ) } >
4447 Try again
4548 </ StyledButton >
4649 </ Buttons >
@@ -80,7 +83,7 @@ function ChangeSubscriptionComponent({
8083 ) ;
8184 }
8285
83- if ( isLoading ) {
86+ if ( isUpdatingSubscription ) {
8487 buttons = (
8588 < Buttons >
8689 < StyledButton disabled > Processing...</ StyledButton >
@@ -98,7 +101,7 @@ function ChangeSubscriptionComponent({
98101 < LinkButton
99102 onClick = { e => {
100103 e . preventDefault ( ) ;
101- signals . modalOpened ( { modal : 'preferences' } ) ;
104+ modalOpened ( { modal : 'preferences' } ) ;
102105 } }
103106 >
104107 user preferences
@@ -109,6 +112,4 @@ function ChangeSubscriptionComponent({
109112 ) ;
110113}
111114
112- export const ChangeSubscription = inject ( 'signals' , 'store' ) (
113- hooksObserver ( ChangeSubscriptionComponent )
114- ) ;
115+ export const ChangeSubscription = ChangeSubscriptionComponent ;
0 commit comments