diff --git a/src/app/product/components/AddComment.tsx b/src/app/product/components/AddComment.tsx index 2369226..989bace 100644 --- a/src/app/product/components/AddComment.tsx +++ b/src/app/product/components/AddComment.tsx @@ -19,13 +19,15 @@ import { extractErrorMessage } from '@/helpers/errorUtils' type Props = { open: boolean, close: () => void, + productId?: string, } const AddComment: FC = (props) => { - const { open, close } = props + const { open, close, productId: propProductId } = props const { id } = useParams() + const productId = propProductId || (id as string) const [advantages, setAdvantages] = useState([]) const [disadvantages, setDisadvantages] = useState([]) const [currentAdvantage, setCurrentAdvantage] = useState('') @@ -55,7 +57,7 @@ const AddComment: FC = (props) => { disAdvantage: [], content: '', rate: 0, - productId: id as string + productId: productId } }) diff --git a/src/app/profile/orders/[id]/components/OrderProductItem.tsx b/src/app/profile/orders/[id]/components/OrderProductItem.tsx index 2d2f4e9..f3a7dc1 100644 --- a/src/app/profile/orders/[id]/components/OrderProductItem.tsx +++ b/src/app/profile/orders/[id]/components/OrderProductItem.tsx @@ -1,10 +1,13 @@ 'use client' -import React from 'react' +import React, { useState } from 'react' import Image from 'next/image' -import { MessageText, ShieldTick, Truck, CloseCircle } from 'iconsax-react' +import { MessageText, ShieldTick, Truck, CloseCircle, MessageAdd } from 'iconsax-react' import { ShipmentItemDetail } from '../../types/Types' import Link from 'next/link' import { useParams } from 'next/navigation' +import AddComment from '@/app/product/components/AddComment' +import { PRIMARY_COLOR } from '@/config/const' +import { Separator } from '@/components/ui/separator' interface OrderProductItemProps { item: ShipmentItemDetail @@ -15,6 +18,7 @@ interface OrderProductItemProps { const OrderProductItem: React.FC = ({ item, shipperName }) => { const { id } = useParams() + const [isCommentModalOpen, setIsCommentModalOpen] = useState(false) return (
@@ -84,18 +88,36 @@ const OrderProductItem: React.FC = ({ item, shipperName }
تومان
- {item.quantity !== item.cancelled_quantity && ( - - - - )} +
+ + + + + {item.quantity !== item.cancelled_quantity && ( + + + + )} +
+ + setIsCommentModalOpen(false)} + productId={item.product._id.toString()} + /> ) } diff --git a/src/components/MenuItem.tsx b/src/components/MenuItem.tsx index 4b40e67..96684a7 100644 --- a/src/components/MenuItem.tsx +++ b/src/components/MenuItem.tsx @@ -30,13 +30,13 @@ const MenuItem: FC = ({ const content = (
-
+
{icon}
-
+
{title}