File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { Rocket } from "lucide-react" ;
2+ import { useRouter } from "next/router" ;
3+ import { Button } from "@/components/ui/button" ;
4+ import { api } from "@/utils/api" ;
5+
6+ export const TrialBanner = ( ) => {
7+ const router = useRouter ( ) ;
8+ const { data : billingStatus } = api . stripe . getBillingStatus . useQuery ( ) ;
9+
10+ if ( ! billingStatus ?. isOnTrial ) {
11+ return null ;
12+ }
13+
14+ const daysRemaining = billingStatus . trialDaysRemaining ?? 0 ;
15+
16+ return (
17+ < div className = "sticky top-0 z-20 mx-4 mt-4 flex flex-wrap items-center justify-center gap-x-3 gap-y-2 rounded-lg border border-primary/20 bg-primary/10 px-4 py-2 text-sm" >
18+ < span className = "flex items-center gap-2" >
19+ < Rocket className = "h-4 w-4 text-primary shrink-0" />
20+ { daysRemaining > 0
21+ ? `You have ${ daysRemaining } day${ daysRemaining === 1 ? "" : "s" } left in your free trial.`
22+ : "Your free trial ends today." }
23+ </ span >
24+ < Button
25+ size = "sm"
26+ variant = "default"
27+ className = "h-7"
28+ onClick = { ( ) => router . push ( "/dashboard/settings/billing" ) }
29+ >
30+ Upgrade now
31+ </ Button >
32+ </ div >
33+ ) ;
34+ } ;
Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ import { authClient } from "@/lib/auth-client";
101101import { cn } from "@/lib/utils" ;
102102import type { AppRouter } from "@/server/api/root" ;
103103import { api } from "@/utils/api" ;
104+ import { TrialBanner } from "../dashboard/billing/trial-banner" ;
104105import { AddOrganization } from "../dashboard/organization/handle-organization" ;
105106import { DialogAction } from "../shared/dialog-action" ;
106107import { Logo } from "../shared/logo" ;
@@ -1229,6 +1230,7 @@ export default function Page({ children }: Props) {
12291230 < SidebarRail />
12301231 </ Sidebar >
12311232 < SidebarInset >
1233+ { isCloud === true && < TrialBanner /> }
12321234 { ! includesProjects && (
12331235 < header className = "flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12" >
12341236 < div className = "flex items-center justify-between w-full px-4" >
You can’t perform that action at this time.
0 commit comments