Skip to content

Commit 0073cd1

Browse files
authored
fix: subscription mobile responsive tweaks (#245)
* update * fix: update * fix: responsiveness * fix: update * fix: few clean up * fix: rm unused image * fix: rm unused image
1 parent bc35b62 commit 0073cd1

File tree

9 files changed

+21
-20
lines changed

9 files changed

+21
-20
lines changed

apps/masterbots.ai/components/checkout.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export function InnerCheckout({ prev, next }: WizardStepProps) {
1717
secret,
1818
handlePaymentIntent
1919
} = usePayment()
20+
2021
const [mounted, setMounted] = useState(false)
2122

2223
useEffect(() => {
@@ -45,7 +46,7 @@ export function InnerCheckout({ prev, next }: WizardStepProps) {
4546
})
4647

4748
if (error) {
48-
console.error('Error creating payment intent:', error)
49+
console.error('Error confirm payment intent:', error)
4950
handleSetLoading(false)
5051
handleSetError(error.message)
5152
return
@@ -56,7 +57,7 @@ export function InnerCheckout({ prev, next }: WizardStepProps) {
5657
window.history.pushState({}, '', `/u/s/subs/${paymentIntent.id}`)
5758
next()
5859
} catch (error: any) {
59-
console.error('Error creating payment intent:', error)
60+
console.error('Error confirm payment intent:', error)
6061
handleSetLoading(false)
6162
handleSetError(error?.message)
6263
}
@@ -70,7 +71,7 @@ export function InnerCheckout({ prev, next }: WizardStepProps) {
7071
Subscribe using <span className="text-[#837de6]">Stripe</span>{' '}
7172
</span>
7273
</div>
73-
<div className="text-left mt-5">
74+
<div className="text-left mt-5 md:pr-0 pr-10">
7475
<div className="w-40 leading-[14.88px]">
7576
<span className="text-[12px] font-bold text-[#71717A] w-10">
7677
Pay The{' '}
@@ -91,7 +92,7 @@ export function InnerCheckout({ prev, next }: WizardStepProps) {
9192
</div>
9293
)}
9394
</div>
94-
<div className="w-full mt-5">
95+
<div className="w-full mt-5 md:pr-0 pr-10">
9596
<div className="flex justify-between">
9697
<div className="flex flex-col">
9798
<span>

apps/masterbots.ai/components/payment-information.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export function PaymentInformation({ prev, next }: WizardStepProps) {
6666
Subscribe using <span className="text-[#837de6]">Stripe</span>{' '}
6767
</span>
6868
</div>
69-
<div className="min-h-[480px] w-full flex items-center justify-center [&_div]:w-full">
69+
<div className="min-h-[480px] w-full max-w-[360px] flex items-center justify-center [&_div]:w-full mb-5">
7070
<PaymentElement />
7171
</div>
7272
</div>

apps/masterbots.ai/components/plan-card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default function PlanCard({
1515
return (
1616
<div
1717
className={cn(
18-
'border-gradient w-full h-[275px] dark:[&>_div]:hover:bg-tertiary ',
18+
'border-gradient md:w-full w-[340px] h-[275px] dark:[&>_div]:hover:bg-tertiary ',
1919
{
2020
'selected': selectedPlan === duration
2121
},

apps/masterbots.ai/components/plans.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,16 @@ export function Plans({ next, goTo }: PlansPros) {
9292

9393
return (
9494
<form className="flex flex-col w-full min-h-[480px]" onSubmit={submitSubscription}>
95-
<div className="text-center pt-2">
95+
<div className="text-center pt-2 mb-3">
9696
<span className="font-bold text-[16px]">
9797
Subscribe using{' '}
9898
<span className="dark:text-[#635BFF] text-[#625af5]">Stripe</span>{' '}
9999
</span>
100100
</div>
101-
<div className="flex flex-col size-full space-y-3 p-5">
101+
<div className="flex flex-col size-full justify-center space-y-3 px-4">
102102
<div
103103
className={cn(
104-
'border-gradient w-full md:h-[135px] z-0 dark:[&>_div]:hover:bg-tertiary',
104+
'border-gradient w-[340px] md:w-full md:h-[135px] z-0 dark:[&>_div]:hover:bg-tertiary',
105105
{
106106
'selected': selectedPlan === 'free'
107107
}
@@ -176,10 +176,10 @@ export function Plans({ next, goTo }: PlansPros) {
176176
<div>No plans available</div>
177177
)}
178178
</div>
179-
<div>
179+
<div >
180180
<a
181181
href="#referral"
182-
className="text-[16px] flex items-center space-x-2"
182+
className="text-[16px] flex items-center space-x-2 mb-5"
183183
>
184184
<span>
185185
I have a&nbsp;<strong> Referral Code</strong>{' '}

apps/masterbots.ai/components/subscription.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,18 @@ const steps: WizardStep[] = [
2121

2222
export default function Subscription({ user }: { user: { email: string; name: string } }) {
2323
const router = useRouter()
24-
const { handleSetUser, handleDeleteCustomer, handleSetLoading, handleSetError } = usePayment()
24+
const { handleSetUser, handleDeleteCustomer, handleSetLoading, handleSetError, paymentIntent } = usePayment()
2525

2626
const { value: openDialog } = useAsync(async () =>
2727
await checkIfCustomerHasActiveSub(user.email)
2828
)
2929
handleSetUser(user)
3030

3131
const handleCloseWizard = async () => {
32-
32+
if ( typeof paymentIntent === 'object' && paymentIntent !== "") return router.push('/c/p')
3333
const del = await handleDeleteCustomer(user?.email)
3434
handleSetLoading(false)
3535
handleSetError('')
36-
if (!openDialog) return router.push('/c/p')
3736
if (del) return router.push('/c')
3837
}
3938

apps/masterbots.ai/components/ui/dialog.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ const DialogHeader = ({
5757
}: React.HTMLAttributes<HTMLDivElement>) => (
5858
<div
5959
className={cn(
60-
'flex flex-col space-y-1.5 text-center sm:text-left',
60+
'flex flex-col space-y-1.5 md:text-center sm:text-left',
6161
className
6262
)}
6363
{...props}
6464

65-
65+
6666
>
6767
{children}
68-
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
68+
<DialogPrimitive.Close className="absolute right-[3.5rem] md:right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
6969
<IconClose className="h-4 w-4" />
7070
<span className="sr-only">Close</span>
7171
</DialogPrimitive.Close>

apps/masterbots.ai/components/ui/wizard/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ const DialogWizard: React.FC<DialogWizardProps> = ({
4848
}) => {
4949
return (
5050
<Dialog open={dialogOpen} onOpenChange={handleCloseWizard}>
51-
<DialogContent className="rounded-sm max-h-screen md:min-h-[540px] w-full md:w-11/12 p-0 md:max-w-2xl z-50 bg-gray-100 dark:bg-[#27272A] border border-iron dark:border-mirage overflow-y-auto">
52-
<DialogHeader className="sticky top-0 flex z-50 md:max-h-auto max-h-20 justify-between mb-0 items-center dark:bg-[#1E293B] bg-gray-200 dark:text-white text-black p-5 pb-10">
51+
<DialogContent className="flex flex-col rounded-sm max-h-screen md:min-h-[540px] w-full md:w-11/12 p-0 md:max-w-2xl z-50 bg-gray-100 dark:bg-[#27272A] border border-iron dark:border-mirage overflow-y-auto ">
52+
<DialogHeader className="sticky top-0 flex md:px-10 z-50 md:max-h-auto max-h-20 md:justify-between mb-0 dark:bg-[#1E293B] bg-gray-200 dark:text-white text-black p-5 pb-10">
5353
<DialogTitle>{headerTitle}</DialogTitle>
5454
</DialogHeader>
55-
<div className="">
55+
<div className="flex-grow md:mb-0 mb-20">
5656
<Content
5757
errorComponent={errorComponent}
5858
steps={steps}

apps/masterbots.ai/lib/hooks/use-payment.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ interface PaymentContextProps {
3939
}
4040

4141
const PaymentContext = createContext<PaymentContextProps | undefined>(undefined)
42+
4243
interface PaymentProviderProps {
4344
children: React.ReactNode
4445
}

bun.lockb

-248 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)