handle plan base and permium

This commit is contained in:
hamid zarghami
2025-12-27 11:22:38 +03:30
parent b8905e4b06
commit b9264a9d7e
2 changed files with 69 additions and 28 deletions
@@ -12,7 +12,11 @@ import { useGetProfile } from '@/app/[name]/(Profile)/profile/hooks/userProfileD
import { useGetCartItems } from '../hooks/useCartData';
import { useCartStore } from '../store/Store';
const CartSummary = () => {
interface CartSummaryProps {
isPremium: boolean;
}
const CartSummary = ({ isPremium }: CartSummaryProps) => {
const params = useParams();
const router = useRouter();
const pathname = usePathname();
@@ -62,20 +66,22 @@ const CartSummary = () => {
<>
{!isCartEmpty && (
<>
<div className='mt-2'>
<div className='relative'>
<h3 className='text-sm'>{t('InputDescription.Label')}</h3>
<textarea
className='w-full px-4 py-2.5 mt-4 text-sm2 leading-6 outline-0 border border-border rounded-normal resize-none focus:ring-0'
placeholder={t('InputDescription.Placeholder')}
id='description'
name='description'
value={description}
onChange={(e) => setDescription(e.target.value)}
></textarea>
<span className='absolute top-4 right-2 px-2 bg-background text-foreground text-xs'></span>
{isPremium && (
<div className='mt-2 mb-4'>
<div className='relative'>
<h3 className='text-sm'>{t('InputDescription.Label')}</h3>
<textarea
className='w-full px-4 py-2.5 mt-4 text-sm2 leading-6 outline-0 border border-border rounded-normal resize-none focus:ring-0'
placeholder={t('InputDescription.Placeholder')}
id='description'
name='description'
value={description}
onChange={(e) => setDescription(e.target.value)}
></textarea>
<span className='absolute top-4 right-2 px-2 bg-background text-foreground text-xs'></span>
</div>
</div>
</div>
)}
<div className='fixed bottom-0 left-0 right-0 z-50 bg-white border-t border-border p-4 w-full'>
<div className='flex justify-between items-center gap-4'>
@@ -84,19 +90,21 @@ const CartSummary = () => {
<div className='text-sm mt-2 font-semibold'>{formatPrice(totalPrice)} تومان</div>
</div>
<Link
href={'order/checkout/0'}
onClick={(event) => {
if (!isSuccess) {
event.preventDefault();
const redirectUrl = encodeURIComponent(pathname);
router.replace(`/${name}/auth?redirect=${redirectUrl}`);
return;
}
}}
>
<Button className='w-fit! px-10'>{t('ButtonCheckout')}</Button>
</Link>
{isPremium && (
<Link
href={'order/checkout/0'}
onClick={(event) => {
if (!isSuccess) {
event.preventDefault();
const redirectUrl = encodeURIComponent(pathname);
router.replace(`/${name}/auth?redirect=${redirectUrl}`);
return;
}
}}
>
<Button className='w-fit! px-10'>{t('ButtonCheckout')}</Button>
</Link>
)}
</div>
</div>
</>