Skip to content

Commit

Permalink
Merge branch 'develop' into feat/image-rank-field
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperkristensen committed Nov 18, 2024
2 parents 0dc62eb + f5c580a commit 0bd2aac
Show file tree
Hide file tree
Showing 157 changed files with 5,164 additions and 1,129 deletions.
5 changes: 5 additions & 0 deletions .changeset/beige-rockets-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---

fix(dashboard): Add missing inventory_item.list.\* widgets
5 changes: 5 additions & 0 deletions .changeset/big-horses-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---

fix(dashboard): Ensure Breadcrumbs don't display stale data
5 changes: 5 additions & 0 deletions .changeset/good-yaks-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/auth-google": patch
---

feature: Add email to google provider-identity metadata
6 changes: 6 additions & 0 deletions .changeset/mean-rice-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@medusajs/admin-shared": patch
"@medusajs/dashboard": patch
---

fix(admin-shared,dashboard): Add missing Injection Zones and remove unused zones"
28 changes: 28 additions & 0 deletions .changeset/proud-pigs-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
"@medusajs/api-key": patch
"@medusajs/auth": patch
"@medusajs/cart": patch
"@medusajs/currency": patch
"@medusajs/file": patch
"@medusajs/fulfillment": patch
"@medusajs/index": patch
"@medusajs/inventory": patch
"@medusajs/locking": patch
"@medusajs/notification": patch
"@medusajs/order": patch
"@medusajs/payment": patch
"@medusajs/pricing": patch
"@medusajs/product": patch
"@medusajs/promotion": patch
"@medusajs/region": patch
"@medusajs/sales-channel": patch
"@medusajs/stock-location": patch
"@medusajs/store": patch
"@medusajs/tax": patch
"@medusajs/user": patch
"@medusajs/workflow-engine-inmemory": patch
"@medusajs/workflow-engine-redis": patch
"@medusajs/locking-postgres": patch
---

Fix/mikro orm cli wrapper
5 changes: 5 additions & 0 deletions .changeset/rich-pumpkins-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/file-local": patch
---

Throw error from local file provider
5 changes: 5 additions & 0 deletions .changeset/rude-cooks-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---

fix(dashboard): Fix active nav link styling for built-in routes
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 @@ -99,20 +99,27 @@ export const NavItem = ({

const navLinkClassNames = useCallback(
({
to,
isActive,
isNested = false,
isSetting = false,
}: {
to: string
isActive: boolean
isNested?: boolean
isSetting?: boolean
}) =>
clx(BASE_NAV_LINK_CLASSES, {
}) => {
if (["core", "setting"].includes(type)) {
isActive = pathname.startsWith(to)
}

return clx(BASE_NAV_LINK_CLASSES, {
[NESTED_NAV_LINK_CLASSES]: isNested,
[ACTIVE_NAV_LINK_CLASSES]: isActive,
[SETTING_NAV_LINK_CLASSES]: isSetting,
}),
[]
})
},
[type, pathname]
)

const isSetting = type === "setting"
Expand All @@ -130,11 +137,11 @@ export const NavItem = ({
}
: undefined
}
className={(props) =>
clx(navLinkClassNames({ ...props, isSetting }), {
className={({ isActive }) => {
return clx(navLinkClassNames({ isActive, isSetting, to }), {
"max-lg:hidden": !!items?.length,
})
}
}}
>
{type !== "setting" && (
<div className="flex size-6 items-center justify-center">
Expand Down Expand Up @@ -169,15 +176,16 @@ export const NavItem = ({
<NavLink
to={to}
end
className={(props) =>
clx(
className={({ isActive }) => {
return clx(
navLinkClassNames({
...props,
isNested: true,
to,
isActive,
isSetting,
isNested: true,
})
)
}
}}
>
<Text size="small" weight="plus" leading="compact">
{label}
Expand All @@ -192,15 +200,16 @@ export const NavItem = ({
<NavLink
to={item.to}
end
className={(props) =>
clx(
className={({ isActive }) => {
return clx(
navLinkClassNames({
...props,
isNested: true,
to: item.to,
isActive,
isSetting,
isNested: true,
})
)
}
}}
>
<Text size="small" weight="plus" leading="compact">
{item.label}
Expand Down
14 changes: 8 additions & 6 deletions packages/admin/dashboard/src/components/layout/shell/shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as Dialog from "@radix-ui/react-dialog"

import { SidebarLeft, TriangleRightMini, XMark } from "@medusajs/icons"
import { IconButton, clx } from "@medusajs/ui"
import { PropsWithChildren } from "react"
import { PropsWithChildren, ReactNode } from "react"
import { useTranslation } from "react-i18next"
import { Link, Outlet, UIMatch, useMatches } from "react-router-dom"

Expand Down Expand Up @@ -45,18 +45,20 @@ const Gutter = ({ children }: PropsWithChildren) => {
const Breadcrumbs = () => {
const matches = useMatches() as unknown as UIMatch<
unknown,
{ crumb?: (data?: unknown) => string }
{
breadcrumb?: (match?: UIMatch) => string | ReactNode
}
>[]

const crumbs = matches
.filter((match) => Boolean(match.handle?.crumb))
.filter((match) => match.handle?.breadcrumb)
.map((match) => {
const handle = match.handle

let label: string | null = null
let label: string | ReactNode | undefined = undefined

try {
label = handle.crumb!(match.data)
label = handle.breadcrumb?.(match)
} catch (error) {
// noop
}
Expand All @@ -70,7 +72,7 @@ const Breadcrumbs = () => {
path: match.pathname,
}
})
.filter(Boolean) as { label: string; path: string }[]
.filter(Boolean) as { label: string | ReactNode; path: string }[]

return (
<ol
Expand Down
17 changes: 13 additions & 4 deletions packages/admin/dashboard/src/hooks/api/products.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,12 @@ export const useProduct = (
id: string,
query?: Record<string, any>,
options?: Omit<
UseQueryOptions<any, FetchError, any, QueryKey>,
UseQueryOptions<
HttpTypes.AdminProductResponse,
FetchError,
HttpTypes.AdminProductResponse,
QueryKey
>,
"queryFn" | "queryKey"
>
) => {
Expand Down Expand Up @@ -302,9 +307,13 @@ export const useUpdateProduct = (
) => {
return useMutation({
mutationFn: (payload) => sdk.admin.product.update(id, payload),
onSuccess: (data, variables, context) => {
queryClient.invalidateQueries({ queryKey: productsQueryKeys.lists() })
queryClient.invalidateQueries({ queryKey: productsQueryKeys.detail(id) })
onSuccess: async (data, variables, context) => {
await queryClient.invalidateQueries({
queryKey: productsQueryKeys.lists(),
})
await queryClient.invalidateQueries({
queryKey: productsQueryKeys.detail(id),
})

options?.onSuccess?.(data, variables, context)
},
Expand Down
13 changes: 8 additions & 5 deletions packages/admin/dashboard/src/hooks/api/shipping-profiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ export const useCreateShippingProfile = (
export const useShippingProfile = (
id: string,
query?: Record<string, any>,
options?: UseQueryOptions<
HttpTypes.AdminShippingProfileResponse,
FetchError,
HttpTypes.AdminShippingProfileResponse,
QueryKey
options?: Omit<
UseQueryOptions<
HttpTypes.AdminShippingProfileResponse,
FetchError,
HttpTypes.AdminShippingProfileResponse,
QueryKey
>,
"queryFn" | "queryKey"
>
) => {
const { data, ...rest } = useQuery({
Expand Down
8 changes: 7 additions & 1 deletion packages/admin/dashboard/src/i18n/languages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { de, enUS, pl } from "date-fns/locale"
import { de, enUS, pl, tr } from "date-fns/locale"
import { Language } from "./types"

export const languages: Language[] = [
Expand All @@ -20,4 +20,10 @@ export const languages: Language[] = [
ltr: true,
date_locale: pl,
},
{
code: "tr",
display_name: "Türkçe",
ltr: true,
date_locale: tr,
},
]
4 changes: 4 additions & 0 deletions packages/admin/dashboard/src/i18n/translations/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import de from "./de.json"
import en from "./en.json"
import pl from "./pl.json"
import tr from "./tr.json"

export default {
en: {
Expand All @@ -12,4 +13,7 @@ export default {
pl: {
translation: pl,
},
tr: {
translation: tr,
},
}
Loading

0 comments on commit 0bd2aac

Please sign in to comment.