Skip to content

Commit 7d7a250

Browse files
committed
feat: display applied promotion per item on order details, show copy sku on hover
1 parent f67bf9f commit 7d7a250

File tree

1 file changed

+36
-15
lines changed

1 file changed

+36
-15
lines changed

packages/admin/dashboard/src/routes/orders/order-detail/components/order-summary-section/order-summary-section.tsx

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
DocumentText,
1111
ExclamationCircle,
1212
PencilSquare,
13+
ReceiptPercent,
1314
TriangleDownMini,
1415
} from "@medusajs/icons"
1516
import {
@@ -402,29 +403,49 @@ const Item = ({
402403
item.variant?.inventory_items?.some((i) => i.required_quantity > 1))
403404
const hasUnfulfilledItems = item.quantity - item.detail.fulfilled_quantity > 0
404405

406+
const appliedPromoCodes = (item.adjustments || []).map((a) => a.code)
407+
405408
return (
406409
<>
407410
<div
408411
key={item.id}
409412
className="text-ui-fg-subtle grid grid-cols-2 items-center gap-x-4 px-6 py-4"
410413
>
411-
<div className="flex items-start gap-x-4">
412-
<Thumbnail src={item.thumbnail} />
413-
<div>
414-
<Text size="small" leading="compact" className="text-ui-fg-base">
415-
{item.title}
416-
</Text>
414+
<div className=" flex justify-between gap-x-2 ">
415+
<div className=" group flex items-start gap-x-4">
416+
<Thumbnail src={item.thumbnail} />
417+
<div>
418+
<Text size="small" leading="compact" className="text-ui-fg-base">
419+
{item.title}
420+
</Text>
417421

418-
{item.variant_sku && (
419-
<div className="flex items-center gap-x-1">
420-
<Text size="small">{item.variant_sku}</Text>
421-
<Copy content={item.variant_sku} className="text-ui-fg-muted" />
422-
</div>
423-
)}
424-
<Text size="small">
425-
{item.variant?.options?.map((o) => o.value).join(" · ")}
426-
</Text>
422+
{item.variant_sku && (
423+
<div className="flex items-center gap-x-1">
424+
<Text size="small">{item.variant_sku}</Text>
425+
<Copy
426+
content={item.variant_sku}
427+
className="text-ui-fg-muted hidden group-hover:block"
428+
/>
429+
</div>
430+
)}
431+
<Text size="small">
432+
{item.variant?.options?.map((o) => o.value).join(" · ")}
433+
</Text>
434+
</div>
427435
</div>
436+
{appliedPromoCodes.length > 0 && (
437+
<Tooltip
438+
content={
439+
<span className="text-pretty">
440+
{appliedPromoCodes.map((code) => (
441+
<div key={code}>{code}</div>
442+
))}
443+
</span>
444+
}
445+
>
446+
<ReceiptPercent className="text-ui-fg-subtle flex-shrink self-center " />
447+
</Tooltip>
448+
)}
428449
</div>
429450

430451
<div className="grid grid-cols-3 items-center gap-x-4">

0 commit comments

Comments
 (0)