File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed
app/(authenticated)/(dashboard)/[publicId]/settings/billing
components/billing/plan-details Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { PlanDetails } from "@/components/billing/plan-details" ;
1
2
import { Pricing } from "@/components/billing/pricing" ;
2
3
import { PageLayout } from "@/components/dashboard/page-layout" ;
3
4
import { api } from "@/trpc/server" ;
@@ -14,6 +15,7 @@ const BillingPage = async () => {
14
15
15
16
return (
16
17
< PageLayout title = "Billing" description = "manage your billing" >
18
+ < PlanDetails subscription = { subscription } />
17
19
< Pricing products = { products } subscription = { subscription } />
18
20
</ PageLayout >
19
21
) ;
Original file line number Diff line number Diff line change
1
+ import { dayjsExt } from "@/common/dayjs" ;
2
+ import { Alert , AlertDescription , AlertTitle } from "@/components/ui/alert" ;
3
+ import { badgeVariants } from "@/components/ui/badge" ;
4
+
5
+ import type { RouterOutputs } from "@/trpc/shared" ;
6
+
7
+ type TSubscription =
8
+ RouterOutputs [ "billing" ] [ "getSubscription" ] [ "subscription" ] ;
9
+
10
+ interface PlanDetailsProps {
11
+ subscription : TSubscription ;
12
+ }
13
+
14
+ export function PlanDetails ( { subscription } : PlanDetailsProps ) {
15
+ return (
16
+ < div >
17
+ < Alert >
18
+ < AlertTitle > Plan Details</ AlertTitle >
19
+ < AlertDescription >
20
+ < p >
21
+ You are currently on the{ " " }
22
+ < span className = { badgeVariants ( ) } >
23
+ { subscription ? subscription . price . product . name : "Free" }
24
+ </ span > { " " }
25
+ plan.{ " " }
26
+ { subscription ? (
27
+ < >
28
+ Current billing cycle:{ " " }
29
+ { dayjsExt ( subscription ?. currentPeriodStart ) . format ( "ll" ) } -{ " " }
30
+ { dayjsExt ( subscription ?. currentPeriodEnd ) . format ( "ll" ) }
31
+ </ >
32
+ ) : null }
33
+ </ p >
34
+ </ AlertDescription >
35
+ </ Alert >
36
+ </ div >
37
+ ) ;
38
+ }
You can’t perform that action at this time.
0 commit comments