diff --git a/src/components/cells/ProductDetailsSeller/ProductDetailsSeller.tsx b/src/components/cells/ProductDetailsSeller/ProductDetailsSeller.tsx index 9fe15414..696fac0b 100644 --- a/src/components/cells/ProductDetailsSeller/ProductDetailsSeller.tsx +++ b/src/components/cells/ProductDetailsSeller/ProductDetailsSeller.tsx @@ -1,5 +1,3 @@ -import LocalizedClientLink from "@/components/molecules/LocalizedLink/LocalizedLink" -import { CollapseIcon } from "@/icons" import { SellerInfo } from "@/components/molecules" import { SellerProps } from "@/types/seller" @@ -8,13 +6,10 @@ export const ProductDetailsSeller = ({ seller }: { seller?: SellerProps }) => { return (
-
- +
- - +
-
) diff --git a/src/components/cells/SellerAvatar/SellerAvatar.tsx b/src/components/cells/SellerAvatar/SellerAvatar.tsx index 52bd99f8..cf9703d4 100644 --- a/src/components/cells/SellerAvatar/SellerAvatar.tsx +++ b/src/components/cells/SellerAvatar/SellerAvatar.tsx @@ -15,15 +15,17 @@ export const SellerAvatar = ({ alt={alt} width={size} height={size} - style={{ width: size, height: size }} + className="shrink-0" + style={{ maxWidth: size, maxHeight: size }} /> ) : ( {alt} ) } diff --git a/src/components/molecules/SellerInfo/SellerInfo.tsx b/src/components/molecules/SellerInfo/SellerInfo.tsx index 225f1e1f..3b7ffd9f 100644 --- a/src/components/molecules/SellerInfo/SellerInfo.tsx +++ b/src/components/molecules/SellerInfo/SellerInfo.tsx @@ -1,14 +1,18 @@ -import { StarRating } from "@/components/atoms" -import { SellerAvatar } from "@/components/cells/SellerAvatar/SellerAvatar" import { SellerProps } from "@/types/seller" import { SellerReview } from "../SellerReview/SellerReview" +import LocalizedClientLink from "../LocalizedLink/LocalizedLink" +import { SellerInfoHeader } from "../SellerInfoHeader/SellerInfoHeader" export const SellerInfo = ({ seller, header = false, + showArrow = false, + bottomBorder = false, }: { seller: SellerProps header?: boolean + showArrow?: boolean + bottomBorder?: boolean }) => { const { photo, name, reviews } = seller @@ -24,26 +28,39 @@ export const SellerInfo = ({ : 0 return ( -
-
- -
-
-

{name}

-
- - {reviewCount} reviews +
+ {showArrow ? ( + + + + ) : ( + + )} + {!header && ( +
+

Seller reviews

+ {reviews + ?.filter((rev) => rev !== null) + .slice(-3) + .map((review) => ( + + ))}
-
- {!header && - reviews - ?.filter((rev) => rev !== null) - .slice(-3) - .map((review) => ( - - ))} -
-
+ )}
) } diff --git a/src/components/molecules/SellerInfoHeader/SellerInfoHeader.tsx b/src/components/molecules/SellerInfoHeader/SellerInfoHeader.tsx new file mode 100644 index 00000000..602d5b60 --- /dev/null +++ b/src/components/molecules/SellerInfoHeader/SellerInfoHeader.tsx @@ -0,0 +1,39 @@ +import { StarRating } from "@/components/atoms" +import { SellerAvatar } from "@/components/cells/SellerAvatar/SellerAvatar" +import { CollapseIcon } from "@/icons" +import clsx from "clsx" + +export const SellerInfoHeader = ({ + photo, + name, + rating, + reviewCount, + showArrow, + bottomBorder = false, +}: { + photo: string + name: string + rating: number + reviewCount: number + showArrow: boolean + bottomBorder?: boolean +}) => ( +
+
+ +
+
+

{name}

+
+ + {reviewCount} reviews +
+
+ {showArrow && } +
+) diff --git a/src/components/molecules/SellerReview/SellerReview.tsx b/src/components/molecules/SellerReview/SellerReview.tsx index 0256ddb1..a3d12715 100644 --- a/src/components/molecules/SellerReview/SellerReview.tsx +++ b/src/components/molecules/SellerReview/SellerReview.tsx @@ -1,40 +1,53 @@ import { StarRating } from "@/components/atoms" import { SingleProductReview } from "@/types/product" import { Divider } from "@medusajs/ui" +import clsx from "clsx" import { formatDistanceToNow } from "date-fns" export const SellerReview = ({ review }: { review: SingleProductReview }) => { return ( -
-
-

- {review.customer.first_name} {review.customer.last_name} -

- -

- {formatDistanceToNow(new Date(review.created_at), { - addSuffix: true, - })} -

+
+
+ +
+

+ {review.customer.first_name} {review.customer.last_name} +

+ +

+ {formatDistanceToNow(new Date(review.created_at), { + addSuffix: true, + })} +

+
-

+

{review.customer_note}

{review.seller_note && ( -
+
-
-

- Reply from {review.seller.name}{" "} - - |{" "} +

+
+

+ Reply from {review.seller.name} +

+ + +

{formatDistanceToNow(new Date(review.updated_at), { addSuffix: true, })} - -

-

{review.seller_note}

+

+
+

{review.seller_note}

)} diff --git a/src/components/molecules/index.ts b/src/components/molecules/index.ts index da5c1551..a677090b 100644 --- a/src/components/molecules/index.ts +++ b/src/components/molecules/index.ts @@ -13,6 +13,7 @@ import { ProductCarouselIndicator } from "./ProductCarouselIndicator/ProductCaro import { Modal } from "./Modal/Modal" import { ReportListingForm } from "./ReportListingForm/ReportListingForm" import { SellerInfo } from "./SellerInfo/SellerInfo" +import { SellerInfoHeader } from "./SellerInfoHeader/SellerInfoHeader" import { TabsList } from "./TabsList/TabsList" import { TabsContent } from "./TabsContent/TabsContent" import { SellerScore } from "./SellerScore/SellerScore" @@ -49,6 +50,7 @@ export { Modal, ReportListingForm, SellerInfo, + SellerInfoHeader, TabsList, TabsContent, SellerScore, diff --git a/src/components/organisms/Chat/Chat.tsx b/src/components/organisms/Chat/Chat.tsx index dbb10ab7..3128ffc3 100644 --- a/src/components/organisms/Chat/Chat.tsx +++ b/src/components/organisms/Chat/Chat.tsx @@ -18,6 +18,8 @@ export const Chat = ({ product, subject, order_id, + variant = "tonal", + buttonSize = "small", }: { user: HttpTypes.StoreCustomer | null seller: SellerProps @@ -26,6 +28,8 @@ export const Chat = ({ product?: HttpTypes.StoreProduct subject?: string order_id?: string + variant?: "tonal" | "filled" + buttonSize?: "small" | "large" }) => { const [modal, setModal] = useState(false) @@ -36,9 +40,10 @@ export const Chat = ({ return ( <> diff --git a/src/components/organisms/SellerFooter/SellerFooter.tsx b/src/components/organisms/SellerFooter/SellerFooter.tsx index 6a6897db..266c12fa 100644 --- a/src/components/organisms/SellerFooter/SellerFooter.tsx +++ b/src/components/organisms/SellerFooter/SellerFooter.tsx @@ -10,7 +10,7 @@ import { useState } from "react" export const SellerFooter = ({ seller }: { seller: SellerProps }) => { const [openModal, setOpenModal] = useState(false) return ( -
+
{/* {seller.verified && (
@@ -29,7 +29,7 @@ export const SellerFooter = ({ seller }: { seller: SellerProps }) => { className="uppercase" onClick={() => setOpenModal(true)} > - Report + Report Seller {openModal && ( setOpenModal(false)}> diff --git a/src/components/organisms/SellerHeading/SellerHeading.tsx b/src/components/organisms/SellerHeading/SellerHeading.tsx index 09f5cceb..a921804d 100644 --- a/src/components/organisms/SellerHeading/SellerHeading.tsx +++ b/src/components/organisms/SellerHeading/SellerHeading.tsx @@ -2,6 +2,7 @@ import { SellerInfo } from "@/components/molecules" import { SellerProps } from "@/types/seller" import { Chat } from "../Chat/Chat" import { HttpTypes } from "@medusajs/types" +import { Button } from "@medusajs/ui" export const SellerHeading = ({ seller, @@ -13,18 +14,31 @@ export const SellerHeading = ({ user: HttpTypes.StoreCustomer | null }) => { return ( -
- - {user && ( -
- +
+
+
+
- )} + {user && ( +
+ +
+ )} +
+
+

+

) } diff --git a/src/components/sections/SellerPageHeader/SellerPageHeader.tsx b/src/components/sections/SellerPageHeader/SellerPageHeader.tsx index 82f31055..69b49c31 100644 --- a/src/components/sections/SellerPageHeader/SellerPageHeader.tsx +++ b/src/components/sections/SellerPageHeader/SellerPageHeader.tsx @@ -11,14 +11,8 @@ export const SellerPageHeader = ({ user: HttpTypes.StoreCustomer | null }) => { return ( -
+
-

)