add: links to cart, address and checkout page

This commit is contained in:
Mahyar Khanbolooki
2025-08-12 03:56:14 +03:30
parent b4451d2495
commit 00c491aec5
3 changed files with 32 additions and 14 deletions
+7 -3
View File
@@ -5,6 +5,7 @@ import { useReceiptStore } from '@/zustand/receiptStore';
import { motion } from 'framer-motion';
import { ArrowLeft, Trash } from 'iconsax-react';
import { PlusIcon, MinusIcon } from 'lucide-react';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
import React from 'react'
import { useTranslation } from 'react-i18next';
@@ -114,9 +115,12 @@ const CartIndex = ({ }: Props) => {
<div className='text-xs'>{t('SumOfItemsLabel')}</div>
<div className="text-sm font-medium">{t('SumOfItemsValue').replace('{price}', '560.000')}</div>
</div>
<Button>
{t('ButtonCheckout')}
</Button>
<Link
href={'order/checkout/0'}>
<Button>
{t('ButtonCheckout')}
</Button>
</Link>
</div>
</div>
@@ -9,17 +9,18 @@ import clsx from 'clsx';
import { motion } from 'framer-motion';
import { ArrowLeft, Box, Card, Cup, Icon, Shop, Ticket, TicketDiscount, TruckTick, Wallet2 } from 'iconsax-react';
import { ChevronLeft, MinusIcon, PlusIcon } from 'lucide-react';
import Link from 'next/link';
import { useParams, useRouter } from 'next/navigation';
import React, { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next';
type Params = {
id: string
id: string,
name: string,
}
function OrderDetailInex() {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const params = useParams<Params>();
const { t } = useTranslation('parallels', { keyPrefix: 'OrderDetail' });
const router = useRouter();
@@ -87,13 +88,15 @@ function OrderDetailInex() {
<div className="py-3">
<div className='w-full flex justify-between items-center gap-2'>
<h3 className="text-sm2 font-medium leading-5 inline-block">{t("SectionAddress.Title")}</h3>
<button
className='text-sm2 text-primary cursor-pointer'
onClick={() => { /* Handle address change */ }}
>
{t("SectionAddress.ButtonChangeAddress")}
<ChevronLeft className='inline-block mr-1 mb-0.5 stroke-primary' size='16' />
</button>
<Link href={`/${params.name}/profile/address?redirect=/${params.name}/order/checkout/${params.id}`}>
<button
className='text-sm2 text-primary cursor-pointer'
onClick={() => { /* Handle address change */ }}
>
{t("SectionAddress.ButtonChangeAddress")}
<ChevronLeft className='inline-block mr-1 mb-0.5 stroke-primary' size='16' />
</button>
</Link>
</div>
<p className='mt-6 text-sm2'>
{address}
@@ -6,13 +6,21 @@ import { ef } from '@/lib/helpers/utfNumbers';
// import { useAuthStore } from '@/zustand/authStore';
import { ArrowLeft, Edit2, TickCircle } from 'iconsax-react';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
import { useRouter, useSearchParams } from 'next/navigation';
import React from 'react'
type Props = object
function UserAddressesPage({ }: Props) {
const router = useRouter();
const searchParams = useSearchParams();
const redirect = searchParams.get('redirect');
const onSelected = () => {
if(redirect) {
router.replace(redirect);
}
}
return (
<div className='overflow-y-auto h-full noscrollbar flex flex-col'>
@@ -43,7 +51,10 @@ function UserAddressesPage({ }: Props) {
{ef('ارسال: 10,000 تومان')}
</p>
<div className="flex justify-between items-center mt-4">
<Button className='!bg-background !text-foreground flex items-center gap-2 text-xs h-8'>
<Button
onClick={onSelected}
className='!bg-background !text-foreground flex items-center gap-2 text-xs h-8'
>
<TickCircle variant='Bold' className='fill-foreground stroke-background size-4.5 mb-0.5' />
تنظیم به عنوان فعال
</Button>