diff --git a/packages/admin/dashboard/src/i18n/translations/en.json b/packages/admin/dashboard/src/i18n/translations/en.json index 8bad727101..c2d4ed74c3 100644 --- a/packages/admin/dashboard/src/i18n/translations/en.json +++ b/packages/admin/dashboard/src/i18n/translations/en.json @@ -546,6 +546,7 @@ "inventory": { "notManaged": "Not managed", "manageItems": "Manage inventory items", + "notManagedDesc":"Inventory is not managed for this variant. Turn on ‘Manage Inventory’ to track the variant's inventory.", "manageKit": "Manage inventory kit", "navigateToItem": "Go to inventory item", "actions": { diff --git a/packages/admin/dashboard/src/routes/orders/order-detail/components/order-active-edit-section/order-active-edit-section.tsx b/packages/admin/dashboard/src/routes/orders/order-detail/components/order-active-edit-section/order-active-edit-section.tsx index bd3cc3d541..ac56d1897e 100644 --- a/packages/admin/dashboard/src/routes/orders/order-detail/components/order-active-edit-section/order-active-edit-section.tsx +++ b/packages/admin/dashboard/src/routes/orders/order-detail/components/order-active-edit-section/order-active-edit-section.tsx @@ -33,7 +33,9 @@ function EditItem({ - {item.title} + + {item.title} + {item.variant_sku && " · "} diff --git a/packages/admin/dashboard/src/routes/product-variants/product-variant-detail/components/variant-inventory-section/variant-inventory-section.tsx b/packages/admin/dashboard/src/routes/product-variants/product-variant-detail/components/variant-inventory-section/variant-inventory-section.tsx index 91c5b16625..f7c1a4d158 100644 --- a/packages/admin/dashboard/src/routes/product-variants/product-variant-detail/components/variant-inventory-section/variant-inventory-section.tsx +++ b/packages/admin/dashboard/src/routes/product-variants/product-variant-detail/components/variant-inventory-section/variant-inventory-section.tsx @@ -2,24 +2,23 @@ import { useTranslation } from "react-i18next" import { Buildings, Component } from "@medusajs/icons" import { Container, Heading } from "@medusajs/ui" -import { InventoryItemDTO } from "@medusajs/types" +import { HttpTypes } from "@medusajs/types" import { ActionMenu } from "../../../../../components/common/action-menu" import { DataTable } from "../../../../../components/table/data-table" import { useDataTable } from "../../../../../hooks/use-data-table" import { useInventoryTableColumns } from "./use-inventory-table-columns" +import { LinkButton } from "../../../../../components/common/link-button" const PAGE_SIZE = 20 type VariantInventorySectionProps = { - inventoryItems: InventoryItemDTO[] - manageInventory?: boolean + inventoryItems: HttpTypes.AdminInventoryItem[] } export function VariantInventorySection({ inventoryItems, - manageInventory, }: VariantInventorySectionProps) { const { t } = useTranslation() @@ -43,25 +42,23 @@ export function VariantInventorySection({ {t("fields.inventoryItems")}
- {manageInventory && ( - : , - }, - ], - }, - ]} - /> - )} + : , + }, + ], + }, + ]} + />
@@ -75,3 +72,23 @@ export function VariantInventorySection({ ) } + +export function InventorySectionPlaceholder() { + const { t } = useTranslation() + + return ( + +
+
+ {t("fields.inventoryItems")} + + {t("products.variant.inventory.notManagedDesc")} + +
+
+ {t("products.variant.edit.header")} +
+
+
+ ) +} diff --git a/packages/admin/dashboard/src/routes/product-variants/product-variant-detail/product-variant-detail.tsx b/packages/admin/dashboard/src/routes/product-variants/product-variant-detail/product-variant-detail.tsx index 410f9f9380..a1b5cb5569 100644 --- a/packages/admin/dashboard/src/routes/product-variants/product-variant-detail/product-variant-detail.tsx +++ b/packages/admin/dashboard/src/routes/product-variants/product-variant-detail/product-variant-detail.tsx @@ -6,7 +6,10 @@ import { useProductVariant } from "../../../hooks/api/products" import { variantLoader } from "./loader" import { VARIANT_DETAIL_FIELDS } from "./constants" import { VariantGeneralSection } from "./components/variant-general-section" -import { VariantInventorySection } from "./components/variant-inventory-section" +import { + InventorySectionPlaceholder, + VariantInventorySection, +} from "./components/variant-inventory-section" import { VariantPricesSection } from "./components/variant-prices-section" export const ProductVariantDetail = () => { @@ -37,16 +40,19 @@ export const ProductVariantDetail = () => {
- { - return { - ...i.inventory, - required_quantity: i.required_quantity, - variant, - } - })} - manageInventory={variant.manage_inventory} - /> + {!variant.manage_inventory ? ( + + ) : ( + { + return { + ...i.inventory, + required_quantity: i.required_quantity, + variant, + } + })} + /> + )}