From abc74eb970b658dec7b1d4de18e7eb64c0b34f16 Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Mon, 27 Oct 2025 13:00:03 +0330 Subject: [PATCH] contact information + ... --- src/app/cart/components/TitleBack.tsx | 7 +++- src/app/cart/shipping/page.tsx | 41 +++++++++---------- src/app/contact/page.tsx | 16 +++++--- src/app/guide-order/page.tsx | 3 +- src/app/product/hooks/useProductData.ts | 2 +- src/app/product/service/Service.ts | 2 +- .../return/components/ProductSelection.tsx | 3 +- 7 files changed, 41 insertions(+), 33 deletions(-) diff --git a/src/app/cart/components/TitleBack.tsx b/src/app/cart/components/TitleBack.tsx index e13de42..96b76db 100644 --- a/src/app/cart/components/TitleBack.tsx +++ b/src/app/cart/components/TitleBack.tsx @@ -1,15 +1,18 @@ import { ArrowRight } from 'iconsax-react' import { FC } from 'react' +import { useRouter } from 'next/navigation' type Props = { title: string + href?: string } const TitleBack: FC = (props) => { - const { title } = props + const router = useRouter() + const { title, href } = props return ( -
+
href ? router.push(href) : router.back()} className='h-16 border border-border rounded-2xl flex gap-1.5 items-center px-6'>
{title}
diff --git a/src/app/cart/shipping/page.tsx b/src/app/cart/shipping/page.tsx index f948780..c9194f9 100644 --- a/src/app/cart/shipping/page.tsx +++ b/src/app/cart/shipping/page.tsx @@ -11,6 +11,8 @@ import { useGetCart, useSaveShipmentCart, useShippingCost } from '../hooks/useCa import { useGetProfile } from '@/app/profile/hooks/useProfileData' import Link from 'next/link' import { useState, useEffect } from 'react' +import { toast } from '@/components/Toast' +import { extractErrorMessage } from '@/helpers/errorUtils' const CartShipping: NextPage = () => { @@ -67,30 +69,27 @@ const CartShipping: NextPage = () => { setIsSavingShipment(true) - try { - // تبدیل selectedShipments به فرمت مورد نیاز API - const shipmentsInfo = Object.entries(selectedShipments).map(([shopId, shipperId]) => ({ - shopId, - shipmentId: shipperId - })) + // تبدیل selectedShipments به فرمت مورد نیاز API + const shipmentsInfo = Object.entries(selectedShipments).map(([shopId, shipperId]) => ({ + shopId, + shipmentId: shipperId + })) - // ذخیره انتخاب‌ها در API - await new Promise((resolve, reject) => { - saveShipmentCart({ shipmentsInfo }, { - onSuccess: () => resolve(), - onError: (error) => reject(error) - }) + // ذخیره انتخاب‌ها در API + await new Promise((resolve, reject) => { + saveShipmentCart({ shipmentsInfo }, { + onSuccess: () => { + resolve() + window.location.href = '/cart/payment' + }, + onError: (error) => { + setIsSavingShipment(false) + toast(extractErrorMessage(error)) + reject(error) + } }) + }) - // انتقال به صفحه پرداخت - window.location.href = '/cart/payment' - } catch (error) { - console.error('Error saving shipment cart:', error) - // در صورت خطا همچنان به صفحه پرداخت برویم - window.location.href = '/cart/payment' - } finally { - setIsSavingShipment(false) - } } if (cartLoading || shippingLoading || profileLoading) { diff --git a/src/app/contact/page.tsx b/src/app/contact/page.tsx index 0316866..a5248e7 100644 --- a/src/app/contact/page.tsx +++ b/src/app/contact/page.tsx @@ -5,19 +5,21 @@ import { Button } from '@/components/ui/button' import Layout from '@/hoc/Layout' import { NextPage } from 'next' import Image from 'next/image' -import { Call, Location, Sms } from 'iconsax-react' +import { Call, Location } from 'iconsax-react' import { useForm } from 'react-hook-form' import { ContactUsType } from './types/Types' import { useContactUs } from './hooks/useContactData' import { useState } from 'react' import { toast } from '@/components/Toast' import { extractErrorMessage } from '@/helpers/errorUtils' +import { useGetSiteSetting } from '../privacy/hooks/usePrivacyData' const ContactPage: NextPage = () => { const { mutate: contactUs, isPending } = useContactUs() const { register, handleSubmit, reset, formState: { errors } } = useForm() const [successMessage, setSuccessMessage] = useState('') + const { data: siteSetting } = useGetSiteSetting('all') const onSubmit = (data: ContactUsType) => { contactUs(data, { @@ -103,19 +105,21 @@ const ContactPage: NextPage = () => {
تلفن:
- 67341 + {siteSetting?.results.siteSetting.footerPhone}
-
+ {/*
کدپستی:
- 1136834843 + + {siteSetting?.results.siteSetting.} +
-
+
*/}
@@ -123,7 +127,7 @@ const ContactPage: NextPage = () => {
دفتر مرکزی:
- تهران، میدان امام خمینی، خیابان فردوسی، خیابان سرهنگ سخائی نبش کوچه بهنیا، پلاک 40، طبقه چهارم، واحد 12 + {siteSetting?.results.siteSetting.footerAddress}
diff --git a/src/app/guide-order/page.tsx b/src/app/guide-order/page.tsx index b9b8d1b..99d1503 100644 --- a/src/app/guide-order/page.tsx +++ b/src/app/guide-order/page.tsx @@ -1,3 +1,4 @@ +import { SHOP_CONFIG } from '@/config/const' import Layout from '@/hoc/Layout' import { type FC } from 'react' @@ -9,7 +10,7 @@ const GuideOrder: FC = () => {

نحوه ثبت سفارش در
- فروشگاه اینترنتی سندس کالا + {SHOP_CONFIG.fullName}

diff --git a/src/app/product/hooks/useProductData.ts b/src/app/product/hooks/useProductData.ts index 4a077d2..78fa521 100644 --- a/src/app/product/hooks/useProductData.ts +++ b/src/app/product/hooks/useProductData.ts @@ -43,7 +43,7 @@ export const useGetPriceHistory = (productId: string) => { }); }; -export const useGetProductQuestion = (productId: string) => { +export const useGetProductQuestion = (productId: number) => { return useQuery({ queryKey: ["product-question", productId], queryFn: () => api.getProductQuestion(productId), diff --git a/src/app/product/service/Service.ts b/src/app/product/service/Service.ts index 722b3e3..d61b111 100644 --- a/src/app/product/service/Service.ts +++ b/src/app/product/service/Service.ts @@ -50,7 +50,7 @@ export const getPriceHistory = async ( }; export const getProductQuestion = async ( - productId: string + productId: number ): Promise => { const { data } = await axios.get(`/product/${productId}/report/questions`); return data; diff --git a/src/app/profile/orders/[id]/return/components/ProductSelection.tsx b/src/app/profile/orders/[id]/return/components/ProductSelection.tsx index e394990..fc7cf46 100644 --- a/src/app/profile/orders/[id]/return/components/ProductSelection.tsx +++ b/src/app/profile/orders/[id]/return/components/ProductSelection.tsx @@ -3,6 +3,7 @@ import React from 'react' import Image from 'next/image' import { Checkbox } from '@/components/ui/checkbox' import { ShipmentItemDetail } from '../../../types/Types' +import { SHOP_CONFIG } from '@/config/const' interface ProductSelectionProps { items: ShipmentItemDetail[] @@ -63,7 +64,7 @@ const ProductSelection: React.FC = ({

- فروشنده: سندس کالا + فروشنده: {SHOP_CONFIG.fullName}