From c6ff9efdea937109fe9bdd43f226c94f60c726f7 Mon Sep 17 00:00:00 2001
From: Kasper Fabricius Kristensen
<45367945+kasperkristensen@users.noreply.github.com>
Date: Mon, 2 Sep 2024 19:38:56 +0200
Subject: [PATCH] fix(dashboard,admin-shared): Fixes to inventory page (#8941)
**What**
- Adds qty column to reservations table.
- Adds missing injections zones
- Fixes layout on long description field.
Resolves CC-121
---
.../src/extensions/widgets/constants.ts | 10 +++
.../common/text-cell/text-cell.tsx | 28 ++++++-
.../variants-section.tsx | 75 ++++++++++---------
.../use-reservation-list-table-columns.tsx | 38 +++++-----
.../inventory-detail/inventory-detail.tsx | 74 ++++++++++--------
5 files changed, 138 insertions(+), 87 deletions(-)
diff --git a/packages/admin-next/admin-shared/src/extensions/widgets/constants.ts b/packages/admin-next/admin-shared/src/extensions/widgets/constants.ts
index 73e83f6758..9a3a4ab313 100644
--- a/packages/admin-next/admin-shared/src/extensions/widgets/constants.ts
+++ b/packages/admin-next/admin-shared/src/extensions/widgets/constants.ts
@@ -189,6 +189,15 @@ const RETURN_REASON_INJECTION_ZONES = [
"return_reason.list.after",
] as const
+const INVENTORY_ITEM_INJECTION_ZONES = [
+ "inventory_item.details.before",
+ "inventory_item.details.after",
+ "inventory_item.details.side.before",
+ "inventory_item.details.side.after",
+ "inventory_item.list.before",
+ "inventory_item.list.after",
+] as const
+
/**
* All valid injection zones in the admin panel. An injection zone is a specific place
* in the admin panel where a plugin can inject custom widgets.
@@ -220,4 +229,5 @@ export const INJECTION_ZONES = [
...PRODUCT_TYPE_INJECTION_ZONES,
...PRODUCT_TAG_INJECTION_ZONES,
...RETURN_REASON_INJECTION_ZONES,
+ ...INVENTORY_ITEM_INJECTION_ZONES,
] as const
diff --git a/packages/admin-next/dashboard/src/components/table/table-cells/common/text-cell/text-cell.tsx b/packages/admin-next/dashboard/src/components/table/table-cells/common/text-cell/text-cell.tsx
index a8694cce14..2804ef110c 100644
--- a/packages/admin-next/dashboard/src/components/table/table-cells/common/text-cell/text-cell.tsx
+++ b/packages/admin-next/dashboard/src/components/table/table-cells/common/text-cell/text-cell.tsx
@@ -1,28 +1,48 @@
+import { clx } from "@medusajs/ui"
+import { ConditionalTooltip } from "../../../../common/conditional-tooltip"
import { PlaceholderCell } from "../placeholder-cell"
type CellProps = {
text?: string | number
+ align?: "left" | "center" | "right"
+ maxWidth?: number
}
type HeaderProps = {
text: string
+ align?: "left" | "center" | "right"
}
-export const TextCell = ({ text }: CellProps) => {
+export const TextCell = ({ text, align = "left", maxWidth = 220 }: CellProps) => {
if (!text) {
return