diff --git a/packages/admin-next/dashboard/src/components/common/section/section-row.tsx b/packages/admin-next/dashboard/src/components/common/section/section-row.tsx index 3b4e4ed973..27879e533b 100644 --- a/packages/admin-next/dashboard/src/components/common/section/section-row.tsx +++ b/packages/admin-next/dashboard/src/components/common/section/section-row.tsx @@ -24,7 +24,11 @@ export const SectionRow = ({ title, value, actions }: SectionRowProps) => { {isValueString ? ( - + {value ?? "-"} ) : ( diff --git a/packages/admin-next/dashboard/src/i18n/translations/en.json b/packages/admin-next/dashboard/src/i18n/translations/en.json index c2bc18066b..007b385204 100644 --- a/packages/admin-next/dashboard/src/i18n/translations/en.json +++ b/packages/admin-next/dashboard/src/i18n/translations/en.json @@ -502,6 +502,7 @@ "associatedVariants": "Associated variants", "manageLocations": "Manage locations", "deleteWarning": "You are about to delete an inventory item. This action cannot be undone.", + "editItemDetails": "Edit item details", "create": { "title": "Add item", "details": "Details", diff --git a/packages/admin-next/dashboard/src/routes/inventory/inventory-detail/components/inventory-item-general-section.tsx b/packages/admin-next/dashboard/src/routes/inventory/inventory-detail/components/inventory-item-general-section.tsx index cb143e90c5..8eb1328f85 100644 --- a/packages/admin-next/dashboard/src/routes/inventory/inventory-detail/components/inventory-item-general-section.tsx +++ b/packages/admin-next/dashboard/src/routes/inventory/inventory-detail/components/inventory-item-general-section.tsx @@ -5,26 +5,14 @@ import { InventoryItemRes } from "../../../../types/api-responses" import { PencilSquare } from "@medusajs/icons" import { SectionRow } from "../../../../components/common/section" import { useTranslation } from "react-i18next" -import { HttpTypes } from "@medusajs/types" type InventoryItemGeneralSectionProps = { - inventoryItem: InventoryItemRes["inventory_item"] & { - variant: HttpTypes.AdminProductVariant | HttpTypes.AdminProductVariant[] - } + inventoryItem: InventoryItemRes["inventory_item"] } export const InventoryItemGeneralSection = ({ inventoryItem, }: InventoryItemGeneralSectionProps) => { const { t } = useTranslation() - - const variantArray = inventoryItem.variant - ? Array.isArray(inventoryItem.variant) - ? inventoryItem.variant - : [inventoryItem.variant] - : [] - - const variantTitles = variantArray.map((variant) => variant.title) - return (
@@ -44,10 +32,6 @@ export const InventoryItemGeneralSection = ({ />
- () @@ -17,11 +18,18 @@ export const useProductTypeTableColumns = () => { }), columnHelper.accessor("created_at", { header: () => t("fields.createdAt"), - cell: ({ getValue }) => getValue(), + + cell: ({ getValue }) => { + const date = new Date(getValue()) + return + }, }), columnHelper.accessor("updated_at", { header: () => t("fields.updatedAt"), - cell: ({ getValue }) => getValue(), + cell: ({ getValue }) => { + const date = new Date(getValue()) + return + }, }), columnHelper.display({ id: "actions", diff --git a/packages/admin-next/dashboard/src/routes/product-variants/product-variant-detail/components/variant-prices-section/variant-prices-section.tsx b/packages/admin-next/dashboard/src/routes/product-variants/product-variant-detail/components/variant-prices-section/variant-prices-section.tsx index 1dbcfdc329..5615365f64 100644 --- a/packages/admin-next/dashboard/src/routes/product-variants/product-variant-detail/components/variant-prices-section/variant-prices-section.tsx +++ b/packages/admin-next/dashboard/src/routes/product-variants/product-variant-detail/components/variant-prices-section/variant-prices-section.tsx @@ -15,19 +15,16 @@ type VariantPricesSectionProps = { export function VariantPricesSection({ variant }: VariantPricesSectionProps) { const { t } = useTranslation() - const prices = variant.prices .filter((p) => !Object.keys(p.rules || {}).length) // display just currency prices .sort((p1, p2) => p1.currency_code?.localeCompare(p2.currency_code)) - const [current, setCurrent] = useState(Math.min(prices.length, 3)) - const hasPrices = !!prices.length - - const displayPrices = prices.slice(0, current) + const [pageSize, setPageSize] = useState(3) + const displayPrices = prices.slice(0, pageSize) const onShowMore = () => { - setCurrent(Math.min(current + 3, prices.length)) + setPageSize(pageSize + 3) } return ( @@ -67,12 +64,12 @@ export function VariantPricesSection({ variant }: VariantPricesSectionProps) { {t("products.variant.pricesPagination", { total: prices.length, - current, + current: Math.min(pageSize, prices.length), })}