mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
feat: change subscription plan
This commit is contained in:
@@ -1,12 +1,20 @@
|
|||||||
import { Group } from '@/components';
|
import { Group, GroupProps } from '@/components';
|
||||||
import { SubscriptionPlan } from './SubscriptionPlan';
|
import { SubscriptionPlan } from './SubscriptionPlan';
|
||||||
import { useSubscriptionPlans } from './hooks';
|
import { useSubscriptionPlans } from './hooks';
|
||||||
|
|
||||||
export function SubscriptionPlans() {
|
interface SubscriptionPlansProps {
|
||||||
|
wrapProps?: GroupProps;
|
||||||
|
onSubscribe?: (variantId: number) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SubscriptionPlans({
|
||||||
|
wrapProps,
|
||||||
|
onSubscribe
|
||||||
|
}: SubscriptionPlansProps) {
|
||||||
const subscriptionPlans = useSubscriptionPlans();
|
const subscriptionPlans = useSubscriptionPlans();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Group spacing={14} noWrap align="stretch">
|
<Group spacing={14} noWrap align="stretch" {...wrapProps}>
|
||||||
{subscriptionPlans.map((plan, index) => (
|
{subscriptionPlans.map((plan, index) => (
|
||||||
<SubscriptionPlan
|
<SubscriptionPlan
|
||||||
key={index}
|
key={index}
|
||||||
@@ -21,6 +29,7 @@ export function SubscriptionPlans() {
|
|||||||
annuallyPriceLabel={plan.annuallyPriceLabel}
|
annuallyPriceLabel={plan.annuallyPriceLabel}
|
||||||
monthlyVariantId={plan.monthlyVariantId}
|
monthlyVariantId={plan.monthlyVariantId}
|
||||||
annuallyVariantId={plan.annuallyVariantId}
|
annuallyVariantId={plan.annuallyVariantId}
|
||||||
|
onSubscribe={onSubscribe}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Group>
|
</Group>
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import React, { lazy } from 'react';
|
||||||
|
import * as R from 'ramda';
|
||||||
|
import { Drawer, DrawerHeaderContent, DrawerSuspense } from '@/components';
|
||||||
|
import withDrawers from '@/containers/Drawer/withDrawers';
|
||||||
|
import { Position } from '@blueprintjs/core';
|
||||||
|
import { DRAWERS } from '@/constants/drawers';
|
||||||
|
|
||||||
|
const ChangeSubscriptionPlanContent = lazy(
|
||||||
|
() => import('./ChangeSubscriptionPlanContent'),
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Account drawer.
|
||||||
|
*/
|
||||||
|
function ChangeSubscriptionPlanDrawer({
|
||||||
|
name,
|
||||||
|
// #withDrawer
|
||||||
|
isOpen,
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<Drawer
|
||||||
|
isOpen={isOpen}
|
||||||
|
name={name}
|
||||||
|
size={'calc(100% - 5px)'}
|
||||||
|
position={Position.BOTTOM}
|
||||||
|
>
|
||||||
|
<DrawerSuspense>
|
||||||
|
<DrawerHeaderContent
|
||||||
|
name={DRAWERS.CHANGE_SUBSCARIPTION_PLAN}
|
||||||
|
title={'Change Subscription Plan'}
|
||||||
|
/>
|
||||||
|
<ChangeSubscriptionPlanContent />
|
||||||
|
</DrawerSuspense>
|
||||||
|
</Drawer>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default R.compose(withDrawers())(ChangeSubscriptionPlanDrawer);
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * as default from './ChangeSubscriptionPlanDrawer';
|
||||||
Reference in New Issue
Block a user