Skip to content

Commit

Permalink
fix(admin-shared,dashboard): Add missing injection zones
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperkristensen committed Nov 14, 2024
1 parent 3e26522 commit 8aab651
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 27 deletions.
32 changes: 10 additions & 22 deletions packages/admin/admin-shared/src/extensions/widgets/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ const ORDER_INJECTION_ZONES = [
"order.list.after",
] as const

const DRAFT_ORDER_INJECTION_ZONES = [
"draft_order.list.before",
"draft_order.list.after",
"draft_order.details.side.before",
"draft_order.details.side.after",
"draft_order.details.before",
"draft_order.details.after",
] as const

const CUSTOMER_INJECTION_ZONES = [
"customer.details.before",
"customer.details.after",
Expand All @@ -39,6 +30,13 @@ const PRODUCT_INJECTION_ZONES = [
"product.details.side.after",
] as const

const PRODUCT_VARIANT_INJECTION_ZONES = [
"product_variant.details.before",
"product_variant.details.after",
"product_variant.details.side.before",
"product_variant.details.side.after",
] as const

const PRODUCT_COLLECTION_INJECTION_ZONES = [
"product_collection.details.before",
"product_collection.details.after",
Expand Down Expand Up @@ -96,15 +94,6 @@ const CAMPAIGN_INJECTION_ZONES = [
"campaign.list.after",
] as const

const GIFT_CARD_INJECTION_ZONES = [
"gift_card.details.before",
"gift_card.details.after",
"gift_card.list.before",
"gift_card.list.after",
"custom_gift_card.before",
"custom_gift_card.after",
] as const

const USER_INJECTION_ZONES = [
"user.details.before",
"user.details.after",
Expand Down Expand Up @@ -204,15 +193,16 @@ const INVENTORY_ITEM_INJECTION_ZONES = [
*/
export const INJECTION_ZONES = [
...ORDER_INJECTION_ZONES,
...DRAFT_ORDER_INJECTION_ZONES,
...CUSTOMER_INJECTION_ZONES,
...CUSTOMER_GROUP_INJECTION_ZONES,
...PRODUCT_INJECTION_ZONES,
...PRODUCT_VARIANT_INJECTION_ZONES,
...PRODUCT_COLLECTION_INJECTION_ZONES,
...PRODUCT_CATEGORY_INJECTION_ZONES,
...PRODUCT_TYPE_INJECTION_ZONES,
...PRODUCT_TAG_INJECTION_ZONES,
...PRICE_LIST_INJECTION_ZONES,
...PROMOTION_INJECTION_ZONES,
...GIFT_CARD_INJECTION_ZONES,
...USER_INJECTION_ZONES,
...STORE_INJECTION_ZONES,
...PROFILE_INJECTION_ZONES,
Expand All @@ -226,8 +216,6 @@ export const INJECTION_ZONES = [
...WORKFLOW_INJECTION_ZONES,
...CAMPAIGN_INJECTION_ZONES,
...TAX_INJECTION_ZONES,
...PRODUCT_TYPE_INJECTION_ZONES,
...PRODUCT_TAG_INJECTION_ZONES,
...RETURN_REASON_INJECTION_ZONES,
...INVENTORY_ITEM_INJECTION_ZONES,
] as const
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useProductVariant } from "../../../hooks/api/products"

import { TwoColumnPageSkeleton } from "../../../components/common/skeleton"
import { TwoColumnPage } from "../../../components/layout/pages"
import { useDashboardExtension } from "../../../extensions"
import { VariantGeneralSection } from "./components/variant-general-section"
import {
InventorySectionPlaceholder,
Expand All @@ -28,6 +29,8 @@ export const ProductVariantDetail = () => {
}
)

const { getWidgets } = useDashboardExtension()

if (isLoading || !variant) {
return (
<TwoColumnPageSkeleton
Expand All @@ -49,12 +52,11 @@ export const ProductVariantDetail = () => {
hasOutlet
showJSON
showMetadata
// TODO: Add widgets zones for variant detail page
widgets={{
after: [],
before: [],
sideAfter: [],
sideBefore: [],
after: getWidgets("product_variant.details.after"),
before: getWidgets("product_variant.details.before"),
sideAfter: getWidgets("product_variant.details.side.after"),
sideBefore: getWidgets("product_variant.details.side.before"),
}}
>
<TwoColumnPage.Main>
Expand Down

0 comments on commit 8aab651

Please sign in to comment.