diff --git a/www/apps/api-reference/app/admin/page.tsx b/www/apps/api-reference/app/admin/page.tsx
index 700c2a512d..0449685f2c 100644
--- a/www/apps/api-reference/app/admin/page.tsx
+++ b/www/apps/api-reference/app/admin/page.tsx
@@ -22,7 +22,11 @@ const ReferencePage = async () => {
}
- codeContent={}
+ codeContent={
+
+
+
+ }
className="flex-col-reverse"
/>
diff --git a/www/apps/api-reference/app/store/page.tsx b/www/apps/api-reference/app/store/page.tsx
index 367744b971..be7e8e8119 100644
--- a/www/apps/api-reference/app/store/page.tsx
+++ b/www/apps/api-reference/app/store/page.tsx
@@ -22,7 +22,11 @@ const ReferencePage = async () => {
}
- codeContent={}
+ codeContent={
+
+
+
+ }
className="flex-col-reverse"
/>
diff --git a/www/apps/api-reference/components/DownloadFull/index.tsx b/www/apps/api-reference/components/DownloadFull/index.tsx
index f1022fc772..d60c6d42b4 100644
--- a/www/apps/api-reference/components/DownloadFull/index.tsx
+++ b/www/apps/api-reference/components/DownloadFull/index.tsx
@@ -14,7 +14,7 @@ const DownloadFull = () => {
download
target="_blank"
>
- Download openapi.yaml
+ Download OpenApi Specs Collection
)
diff --git a/www/apps/api-reference/config/index.ts b/www/apps/api-reference/config/index.ts
index aaf1087012..ee1e190655 100644
--- a/www/apps/api-reference/config/index.ts
+++ b/www/apps/api-reference/config/index.ts
@@ -1,8 +1,10 @@
import { DocsConfig } from "types"
-import { mobileSidebarItemsV2 } from "docs-ui"
+import { getMobileSidebarItems } from "docs-ui"
+
+const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000"
export const config: DocsConfig = {
- baseUrl: process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000",
+ baseUrl,
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
// sidebar is auto generated
sidebar: {
@@ -14,6 +16,9 @@ export const config: DocsConfig = {
},
],
bottom: [],
- mobile: mobileSidebarItemsV2,
+ mobile: getMobileSidebarItems({
+ baseUrl,
+ version: "v2",
+ }),
},
}
diff --git a/www/apps/book/components/Navbar/index.tsx b/www/apps/book/components/Navbar/index.tsx
index bd19bdbfc7..7dd1b52d29 100644
--- a/www/apps/book/components/Navbar/index.tsx
+++ b/www/apps/book/components/Navbar/index.tsx
@@ -13,7 +13,7 @@ const Navbar = () => {
() =>
getNavbarItems({
basePath: config.baseUrl,
- activePath: basePathUrl(""),
+ activePath: basePathUrl(),
version: "v2",
}),
[]
diff --git a/www/apps/book/config/index.ts b/www/apps/book/config/index.ts
index 07a390c998..7633e17214 100644
--- a/www/apps/book/config/index.ts
+++ b/www/apps/book/config/index.ts
@@ -1,9 +1,11 @@
import { DocsConfig } from "types"
import { sidebarConfig } from "./sidebar"
+const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000"
+
export const config: DocsConfig = {
titleSuffix: "Medusa v2 Docs",
- baseUrl: process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000",
+ baseUrl,
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
- sidebar: sidebarConfig,
+ sidebar: sidebarConfig(baseUrl),
}
diff --git a/www/apps/book/config/sidebar.tsx b/www/apps/book/config/sidebar.tsx
index 0e9b7a6d39..836a964ea5 100644
--- a/www/apps/book/config/sidebar.tsx
+++ b/www/apps/book/config/sidebar.tsx
@@ -1,4 +1,4 @@
-import { Badge, mobileSidebarItemsV2 } from "docs-ui"
+import { Badge, getMobileSidebarItems } from "docs-ui"
import type { SidebarConfig, SidebarItemType } from "@/types"
import { sidebar } from "../sidebar.mjs"
@@ -17,8 +17,13 @@ const normalizeSidebarItems = (items: SidebarItemType[]) =>
return item
})
-export const sidebarConfig: SidebarConfig = {
- top: normalizeSidebarItems(sidebar),
- bottom: [],
- mobile: mobileSidebarItemsV2,
+export const sidebarConfig = (baseUrl: string): SidebarConfig => {
+ return {
+ top: normalizeSidebarItems(sidebar),
+ bottom: [],
+ mobile: getMobileSidebarItems({
+ baseUrl,
+ version: "v2",
+ }),
+ }
}
diff --git a/www/apps/resources/config/index.ts b/www/apps/resources/config/index.ts
index 3481324851..5aa1b772fc 100644
--- a/www/apps/resources/config/index.ts
+++ b/www/apps/resources/config/index.ts
@@ -1,14 +1,19 @@
import { DocsConfig } from "types"
-import { mobileSidebarItemsV2 } from "docs-ui"
+import { getMobileSidebarItems } from "docs-ui"
import { generatedSidebar } from "../generated/sidebar.mjs"
+const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000"
+
export const config: DocsConfig = {
titleSuffix: "Medusa Learning Resources",
- baseUrl: process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000",
+ baseUrl,
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
sidebar: {
top: generatedSidebar,
bottom: [],
- mobile: mobileSidebarItemsV2,
+ mobile: getMobileSidebarItems({
+ baseUrl,
+ version: "v2",
+ }),
},
}
diff --git a/www/apps/ui/src/config/docs.tsx b/www/apps/ui/src/config/docs.tsx
index 2cc08d708a..eeff671044 100644
--- a/www/apps/ui/src/config/docs.tsx
+++ b/www/apps/ui/src/config/docs.tsx
@@ -1,5 +1,5 @@
import { ArrowUpRightOnBox } from "@medusajs/icons"
-import { NavbarItem, getNavbarItems, mobileSidebarItemsV1 } from "docs-ui"
+import { NavbarItem, getMobileSidebarItems, getNavbarItems } from "docs-ui"
import { SidebarSectionItemsType } from "types"
import { siteConfig } from "./site"
@@ -280,6 +280,9 @@ export const docsConfig: DocsConfig = {
],
},
],
- mobile: mobileSidebarItemsV1,
+ mobile: getMobileSidebarItems({
+ baseUrl: siteConfig.baseUrl,
+ version: "v1",
+ }),
},
}
diff --git a/www/apps/user-guide/config/index.ts b/www/apps/user-guide/config/index.ts
index db049ff267..e23446dc85 100644
--- a/www/apps/user-guide/config/index.ts
+++ b/www/apps/user-guide/config/index.ts
@@ -1,14 +1,19 @@
import { DocsConfig } from "types"
-import { mobileSidebarItemsV2 } from "docs-ui"
+import { getMobileSidebarItems } from "docs-ui"
import { generatedSidebar as sidebar } from "@/generated/sidebar.mjs"
+const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000"
+
export const config: DocsConfig = {
titleSuffix: "Medusa Admin User Guide",
- baseUrl: process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000",
+ baseUrl,
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
sidebar: {
top: sidebar,
bottom: [],
- mobile: mobileSidebarItemsV2,
+ mobile: getMobileSidebarItems({
+ baseUrl,
+ version: "v2",
+ }),
},
}
diff --git a/www/packages/docs-ui/src/constants.tsx b/www/packages/docs-ui/src/constants.tsx
index abbbba3436..1e2f1a9c09 100644
--- a/www/packages/docs-ui/src/constants.tsx
+++ b/www/packages/docs-ui/src/constants.tsx
@@ -52,23 +52,22 @@ export const navbarItemsV1: NavbarItem[] = [
href: `/ui`,
},
},
- // TODO enable them later
- // {
- // type: "divider",
- // },
- // {
- // type: "link",
- // props: {
- // label: "Learn Medusa v2",
- // target: "_blank",
- // rel: "noreferrer",
- // href: `/v2`,
- // badge: {
- // variant: "blue",
- // children: "New",
- // },
- // },
- // },
+ {
+ type: "divider",
+ },
+ {
+ type: "link",
+ props: {
+ label: "Learn Medusa v2",
+ target: "_blank",
+ rel: "noreferrer",
+ href: `/v2`,
+ badge: {
+ variant: "blue",
+ children: "New",
+ },
+ },
+ },
]
export const navbarItemsV2: NavbarItem[] = [
@@ -162,13 +161,13 @@ export const mobileSidebarItemsV1: SidebarItemType[] = [
loaded: true,
isPathHref: true,
},
- // {
- // title: "Learn Medusa V2",
- // path: `/v2`,
- // loaded: true,
- // isPathHref: true,
- // additionalElms: v2,
- // },
+ {
+ title: "Learn Medusa V2",
+ path: `/v2`,
+ loaded: true,
+ isPathHref: true,
+ additionalElms: v2,
+ },
]
export const mobileSidebarItemsV2: SidebarItemType[] = [
diff --git a/www/packages/docs-ui/src/utils/get-mobile-sidebar-items.ts b/www/packages/docs-ui/src/utils/get-mobile-sidebar-items.ts
new file mode 100644
index 0000000000..eaf3761523
--- /dev/null
+++ b/www/packages/docs-ui/src/utils/get-mobile-sidebar-items.ts
@@ -0,0 +1,21 @@
+import { SidebarItemType } from "types"
+import { mobileSidebarItemsV1, mobileSidebarItemsV2 } from ".."
+
+type Options = {
+ baseUrl: string
+ version?: "v1" | "v2"
+}
+
+export function getMobileSidebarItems({
+ baseUrl,
+ version = "v1",
+}: Options): SidebarItemType[] {
+ const mobileItems =
+ version === "v2" ? mobileSidebarItemsV2 : mobileSidebarItemsV1
+ return mobileItems.map((item) => {
+ return {
+ ...item,
+ path: `${baseUrl}${item.path}`,
+ }
+ })
+}
diff --git a/www/packages/docs-ui/src/utils/index.ts b/www/packages/docs-ui/src/utils/index.ts
index 61dba63340..824941baa9 100644
--- a/www/packages/docs-ui/src/utils/index.ts
+++ b/www/packages/docs-ui/src/utils/index.ts
@@ -5,6 +5,7 @@ export * from "./decode-str"
export * from "./dom-utils"
export * from "./format-report-link"
export * from "./get-link-with-base-path"
+export * from "./get-mobile-sidebar-items"
export * from "./get-navbar-items"
export * from "./get-os-shortcut"
export * from "./get-scrolled-top"