tasko/components/modals/pro-modal.tsx

68 lines
2.2 KiB
TypeScript
Raw Normal View History

2024-02-16 01:49:19 +00:00
'use client';
2024-02-15 02:30:10 +00:00
2024-02-16 01:49:19 +00:00
import Image from 'next/image';
import { toast } from 'sonner';
2024-09-28 02:53:25 +00:00
import { useRouter } from 'next/navigation';
import * as VisuallyHidden from '@radix-ui/react-visually-hidden';
2024-02-15 02:30:10 +00:00
import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog';
2024-02-16 01:49:19 +00:00
import { useProModal } from '@/hooks/use-pro-modal';
import { Button } from '@/components/ui/button';
import { useAction } from '@/hooks/use-action';
import { stripeRedirect } from '@/actions/stripe-redirect';
2024-02-15 02:30:10 +00:00
export const ProModal = () => {
const proModal = useProModal();
2024-09-28 02:53:25 +00:00
const router = useRouter();
2024-02-15 02:30:10 +00:00
const { execute, isLoading } = useAction(stripeRedirect, {
onSuccess: (data) => {
2024-09-28 02:53:25 +00:00
router.push(data);
2024-02-15 02:30:10 +00:00
},
onError: (error) => {
toast.error(error);
},
});
const onClick = () => {
execute({});
};
return (
<Dialog open={proModal.isOpen} onOpenChange={proModal.onClose}>
2024-02-16 01:49:19 +00:00
<DialogContent className='max-w-md overflow-hidden p-0'>
<VisuallyHidden.Root>
<DialogTitle>Upgrade to Tasko Pro</DialogTitle>
</VisuallyHidden.Root>
2024-02-16 01:49:19 +00:00
<div className='relative flex aspect-video items-center justify-center'>
<Image src='/hero.svg' alt='hero' className='object-cover' fill />
2024-02-15 02:30:10 +00:00
</div>
<div className='mx-auto space-y-6 p-6 text-neutral-700 dark:text-neutral-200'>
2024-02-16 01:49:19 +00:00
<h1 className='text-xl font-semibold'>Upgrade to Tasko Pro Today!</h1>
<p className='text-xs font-semibold text-neutral-600 dark:text-neutral-300'>
2024-02-15 02:30:10 +00:00
Explore the best of Tasko
</p>
2024-02-16 01:49:19 +00:00
<div className='pl-3'>
<ul className='list-disc text-sm'>
2024-02-15 02:30:10 +00:00
<li>Unlimited boards</li>
2024-02-16 01:49:19 +00:00
<li className='italic'>Advanced Checklists (Coming Soon)</li>
<li className='italic'>
2024-02-15 02:30:10 +00:00
Admin and Security Features (Coming Soon)
</li>
2024-02-16 01:49:19 +00:00
<li className='italic'>And More to Come Soon!</li>
2024-02-15 02:30:10 +00:00
</ul>
</div>
<Button
disabled={isLoading}
onClick={onClick}
2024-02-16 01:49:19 +00:00
className='w-full'
variant='primary'
2024-02-15 02:30:10 +00:00
>
Upgrade
</Button>
</div>
</DialogContent>
</Dialog>
);
};