Skip to content

Commit

Permalink
fix(dashboard): Fix size of buttons and use Link to navigate (#11366)
Browse files Browse the repository at this point in the history
**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.
  • Loading branch information
kasperkristensen authored Feb 14, 2025
1 parent 483f7b5 commit 03b8bda
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 28 deletions.
5 changes: 5 additions & 0 deletions .changeset/thick-deers-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---

fix(dashboard): Fix size of buttons and use Link to navigate
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReactNode, useMemo, useState } from "react"
import { useTranslation } from "react-i18next"
import { useNavigate } from "react-router-dom"
import { Link, useNavigate } from "react-router-dom"

import {
ArrowDownRightMini,
Expand All @@ -18,9 +18,9 @@ import {
AdminOrder,
AdminOrderLineItem,
AdminOrderPreview,
AdminPaymentCollection,
AdminRegion,
AdminReturn,
AdminPaymentCollection,
} from "@medusajs/types"
import {
Badge,
Expand Down Expand Up @@ -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">
{showReturns &&
(receivableReturns.length === 1 ? (
<Button
onClick={() =>
navigate(
`/orders/${order.id}/returns/${receivableReturns[0].id}/receive`
)
}
variant="secondary"
size="small"
>
{t("orders.returns.receive.action")}
<Button asChild variant="secondary" size="small">
<Link
to={`/orders/${order.id}/returns/${receivableReturns[0].id}/receive`}
>
{t("orders.returns.receive.action")}
</Link>
</Button>
) : (
<ActionMenu
Expand Down Expand Up @@ -236,11 +232,10 @@ export const OrderSummarySection = ({ order }: OrderSummarySectionProps) => {
))}

{showAllocateButton && (
<Button
onClick={() => navigate(`./allocate-items`)}
variant="secondary"
>
{t("orders.allocateItems.action")}
<Button asChild variant="secondary" size="small">
<Link to="allocate-items">
{t("orders.allocateItems.action")}
</Link>
</Button>
)}

Expand All @@ -262,17 +257,15 @@ export const OrderSummarySection = ({ order }: OrderSummarySectionProps) => {
)}

{showRefund && (
<Button
size="small"
variant="secondary"
onClick={() => navigate(`/orders/${order.id}/refund`)}
>
{t("orders.payment.refundAmount", {
amount: getStylizedAmount(
pendingDifference * -1,
order?.currency_code
),
})}
<Button size="small" variant="secondary" asChild>
<Link to={`/orders/${order.id}/refund`}>
{t("orders.payment.refundAmount", {
amount: getStylizedAmount(
pendingDifference * -1,
order?.currency_code
),
})}
</Link>
</Button>
)}
</div>
Expand Down

0 comments on commit 03b8bda

Please sign in to comment.