@@ -2,19 +2,26 @@ import React from "react"
22import { WOQLClientObj } from '../init-woql-client'
33import { Modal , Button , Stack , Card } from "react-bootstrap"
44import { MdEuroSymbol } from "react-icons/md"
5+ import { StripeManager } from "./StripeManager"
56
6- export const PaymentPage = ( { showModal, setShowModal, tier } ) => {
7+ export const CancelSubscription = ( { showModal, setShowModal} ) => {
78 const { woqlClient, } = WOQLClientObj ( )
89 if ( ! woqlClient ) return ""
910
1011 const closeModal = ( ) => {
1112 setShowModal ( false )
1213 }
1314
15+ const { succeeded,
16+ error,
17+ processing, deleteSubscrition} = StripeManager ( )
18+
19+
20+
1421 return < Modal size = "lg" className = "modal-dialog-right" show = { showModal } onHide = { closeModal } >
15- < Modal . Header style = { { background : subscriptionObj . color } } >
22+ < Modal . Header >
1623 < Stack direction = "horizontal" gap = { 10 } className = "justify-content-center" >
17- < Modal . Title className = "h4 fw-bold" > Remove the { tier } Subscription </ Modal . Title >
24+ < Modal . Title className = "h4 fw-bold" > Downgrade to Community </ Modal . Title >
1825 </ Stack >
1926 < Button variant = "close" aria-label = "Close" onClick = { closeModal } />
2027 </ Modal . Header >
@@ -25,13 +32,13 @@ export const PaymentPage = ({showModal, setShowModal, tier}) => {
2532 < Card . Text > < MdEuroSymbol /> 0</ Card . Text >
2633 </ Stack >
2734 < div className = "d-flex justify-content-end mt-2" >
28- < Button onClick = { props . closeModal } disabled = { processing } variant = "light" > Cancel</ Button >
29- < Button type = { "submit" } disabled = { processing || ! enableSubmit || ! stripe } className = "ml-3" >
35+ < Button onClick = { closeModal } disabled = { processing } variant = "light" > Cancel</ Button >
36+ < Button type = { "submit" } disabled = { processing } className = "ml-3" onClick = { deleteSubscrition } >
3037 { processing ? "Processing…" : "Downgrade" }
3138 </ Button >
3239 </ div >
3340 < div className = "d-flex justify-content-end mt-2" >
34- < span style = { { fontSize : "15px" , color : "#888" } } > * your account will be billed monthly until cancelled.
41+ < span style = { { fontSize : "15px" , color : "#888" } } >
3542 </ span >
3643 </ div >
3744 </ Card >
0 commit comments