fix(dashboard): Fix size of buttons and use Link to navigate (#11366)

**What**
- Fixes the wrong `size` being used for the allocate items button.
- Updates the buttons that link to somewhere to use a Link and asChild instead of an onClick.
This commit is contained in:
Kasper Fabricius Kristensen authored and GitHub committed 2025-02-14 15:19:31 +00:00
1 parent 483f7b556c
commit 03b8bda1ba
2 files changed
+26 -28

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---
fix(dashboard): Fix size of buttons and use Link to navigate
@@ -1,6 +1,6 @@
import { ReactNode, useMemo, useState } from "react" import { ReactNode, useMemo, useState } from "react"
import { useTranslation } from "react-i18next" import { useTranslation } from "react-i18next"
import { useNavigate } from "react-router-dom" import { Link, useNavigate } from "react-router-dom"
import { import {
ArrowDownRightMini, ArrowDownRightMini,
@@ -18,9 +18,9 @@ import {
AdminOrder, AdminOrder,
AdminOrderLineItem, AdminOrderLineItem,
AdminOrderPreview, AdminOrderPreview,
AdminPaymentCollection,
AdminRegion, AdminRegion,
AdminReturn, AdminReturn,
AdminPaymentCollection,
} from "@medusajs/types" } from "@medusajs/types"
import { import {
Badge, Badge,
@@ -188,16 +188,12 @@ export const OrderSummarySection = ({ order }: OrderSummarySectionProps) => {
<div className="bg-ui-bg-subtle flex items-center justify-end gap-x-2 rounded-b-xl px-4 py-4"> <div className="bg-ui-bg-subtle flex items-center justify-end gap-x-2 rounded-b-xl px-4 py-4">
{showReturns && {showReturns &&
(receivableReturns.length === 1 ? ( (receivableReturns.length === 1 ? (
<Button <Button asChild variant="secondary" size="small">
onClick={() => <Link
navigate( to={`/orders/${order.id}/returns/${receivableReturns[0].id}/receive`}
`/orders/${order.id}/returns/${receivableReturns[0].id}/receive` >
) {t("orders.returns.receive.action")}
} </Link>
variant="secondary"
size="small"
>
{t("orders.returns.receive.action")}
</Button> </Button>
) : ( ) : (
<ActionMenu <ActionMenu
@@ -236,11 +232,10 @@ export const OrderSummarySection = ({ order }: OrderSummarySectionProps) => {
))} ))}
{showAllocateButton && ( {showAllocateButton && (
<Button <Button asChild variant="secondary" size="small">
onClick={() => navigate(`./allocate-items`)} <Link to="allocate-items">
variant="secondary" {t("orders.allocateItems.action")}
> </Link>
{t("orders.allocateItems.action")}
</Button> </Button>
)} )}
@@ -262,17 +257,15 @@ export const OrderSummarySection = ({ order }: OrderSummarySectionProps) => {
)} )}
{showRefund && ( {showRefund && (
<Button <Button size="small" variant="secondary" asChild>
size="small" <Link to={`/orders/${order.id}/refund`}>
variant="secondary" {t("orders.payment.refundAmount", {
onClick={() => navigate(`/orders/${order.id}/refund`)} amount: getStylizedAmount(
> pendingDifference * -1,
{t("orders.payment.refundAmount", { order?.currency_code
amount: getStylizedAmount( ),
pendingDifference * -1, })}
order?.currency_code </Link>
),
})}
</Button> </Button>
)} )}
</div> </div>