diff --git a/www/apps/book/app/customization/next-steps/page.mdx b/www/apps/book/app/customization/next-steps/page.mdx index 063789cac1..e8a366f424 100644 --- a/www/apps/book/app/customization/next-steps/page.mdx +++ b/www/apps/book/app/customization/next-steps/page.mdx @@ -20,7 +20,7 @@ While you can start playing around with Medusa and customize it, it's highly rec ## Helpful Resources Guides -The [Learning Resources](!resources!) documentation provides more helpful guides and references for your development journey. +The [Development Resources](!resources!) documentation provides more helpful guides and references for your development journey. Some of these guides and references are: @@ -33,6 +33,6 @@ Some of these guides and references are: ## More Examples in Recipes -In the Learning Resources documentation, you'll also find step-by-step guides of different use cases, such as building a marketplace, digital products, and more. +In the Development Resources documentation, you'll also find step-by-step guides of different use cases, such as building a marketplace, digital products, and more. Refer to the [Recipes](!resources!/recipes) documentation to learn more. diff --git a/www/apps/book/app/debugging-and-testing/testing-tools/integration-tests/page.mdx b/www/apps/book/app/debugging-and-testing/testing-tools/integration-tests/page.mdx index 681d272cd3..30c658dd2f 100644 --- a/www/apps/book/app/debugging-and-testing/testing-tools/integration-tests/page.mdx +++ b/www/apps/book/app/debugging-and-testing/testing-tools/integration-tests/page.mdx @@ -72,7 +72,7 @@ This runs your Medusa application and runs the tests available under the `src/in ## Other Options and Inputs -Refer to [this reference in the Learning Resources documentation](!resources!/test-tools-reference/medusaIntegrationTestRunner) for other available parameter options and inputs of the `testSuite` function. +Refer to [this reference in the Development Resources documentation](!resources!/test-tools-reference/medusaIntegrationTestRunner) for other available parameter options and inputs of the `testSuite` function. --- @@ -80,7 +80,7 @@ Refer to [this reference in the Learning Resources documentation](!resources!/te The `medusaIntegrationTestRunner` function creates a database with a random name before running the tests. Then, it drops that database after all the tests end. -To manage that database, such as changing its name or perform operations on it in your tests, refer to the [references in the Learning Resources documentation](!resources!/test-tools-reference/medusaIntegrationTestRunner). +To manage that database, such as changing its name or perform operations on it in your tests, refer to the [references in the Development Resources documentation](!resources!/test-tools-reference/medusaIntegrationTestRunner). --- diff --git a/www/apps/book/app/debugging-and-testing/testing-tools/modules-tests/page.mdx b/www/apps/book/app/debugging-and-testing/testing-tools/modules-tests/page.mdx index 7b657aba35..4ec365d0d4 100644 --- a/www/apps/book/app/debugging-and-testing/testing-tools/modules-tests/page.mdx +++ b/www/apps/book/app/debugging-and-testing/testing-tools/modules-tests/page.mdx @@ -121,7 +121,7 @@ moduleIntegrationTestRunner({ ### Other Options and Inputs -Refer to [this reference in the Learning Resources documentation](!resources!/test-tools-reference/moduleIntegrationTestRunner) for other available parameter options and inputs of the `testSuite` function. +Refer to [this reference in the Development Resources documentation](!resources!/test-tools-reference/moduleIntegrationTestRunner) for other available parameter options and inputs of the `testSuite` function. --- @@ -129,4 +129,4 @@ Refer to [this reference in the Learning Resources documentation](!resources!/te The `moduleIntegrationTestRunner` function creates a database with a random name before running the tests. Then, it drops that database after all the tests end. -To manage that database, such as changing its name or perform operations on it in your tests, refer to the [references in the Learning Resources documentation](!resources!/test-tools-reference/moduleIntegrationTestRunner). +To manage that database, such as changing its name or perform operations on it in your tests, refer to the [references in the Development Resources documentation](!resources!/test-tools-reference/moduleIntegrationTestRunner). diff --git a/www/apps/book/app/more-resources/page.mdx b/www/apps/book/app/more-resources/page.mdx index 0ee6c2be22..5deb5a1ee9 100644 --- a/www/apps/book/app/more-resources/page.mdx +++ b/www/apps/book/app/more-resources/page.mdx @@ -4,6 +4,6 @@ export const metadata = { # {metadata.title} -The Learning Resources documentation provides guides and references that are useful for your development. This documentation included links to parts of the Learning Resources documentation where necessary. +The Development Resources documentation provides guides and references that are useful for your development. This documentation included links to parts of the Development Resources documentation where necessary. -Check out the Learning Resources documentation [here](!resources!). \ No newline at end of file +Check out the Development Resources documentation [here](!resources!). \ No newline at end of file diff --git a/www/apps/book/app/not-found.mdx b/www/apps/book/app/not-found.mdx index c2bd96b625..bc4143fb6d 100644 --- a/www/apps/book/app/not-found.mdx +++ b/www/apps/book/app/not-found.mdx @@ -25,7 +25,7 @@ If you think this is a mistake, please [report this issue on GitHub](https://git icon: BookOpen }, { - title: "Learning Resources", + title: "Development Resources", href: "!resources!", icon: AcademicCapSolid }, diff --git a/www/apps/book/app/page.mdx b/www/apps/book/app/page.mdx index a84f661918..9838644f89 100644 --- a/www/apps/book/app/page.mdx +++ b/www/apps/book/app/page.mdx @@ -104,5 +104,5 @@ By the end of this documentation, you’ll be an expert Medusa developer, leadin The documentation for Medusa v2 is split into the following sections: 1. The main documentation, which is the one you're currently viewing. It's highly recommended to follow all the chapters in this documentation before jumping into other documentation sections. -2. The [Learning Resources documentation](!resources!) provides guides and resources useful during your development, such as tools, API references, recipes, step-by-step guides and examples, and more. +2. The [Development Resources documentation](!resources!) provides guides and resources useful during your development, such as tools, API references, recipes, step-by-step guides and examples, and more. 3. The [Store](!api!/store) and [Admin](!api!/admin) API references provide a reference to the Medusa application's endpoints and instructions related to authentication, parameter types, and more. diff --git a/www/apps/book/app/storefront-development/page.mdx b/www/apps/book/app/storefront-development/page.mdx index 9c456e8961..e19cf131e3 100644 --- a/www/apps/book/app/storefront-development/page.mdx +++ b/www/apps/book/app/storefront-development/page.mdx @@ -10,7 +10,7 @@ You're free to choose how to build your storefront. You can start with our Next. -To learn how to build a storefront from scratch, check out the [Storefront Development guides](!resources!/storefront-development) in the Learning Resources documentation. +To learn how to build a storefront from scratch, check out the [Storefront Development guides](!resources!/storefront-development) in the Development Resources documentation. diff --git a/www/apps/book/providers/main-nav.tsx b/www/apps/book/providers/main-nav.tsx index d5c2fa86d0..670c9d574c 100644 --- a/www/apps/book/providers/main-nav.tsx +++ b/www/apps/book/providers/main-nav.tsx @@ -51,6 +51,9 @@ export const MainNavProvider = ({ children }: MainNavProviderProps) => { navItems={navigationDropdownItems} reportIssueLink={reportLink} editDate={editDate} + breadcrumbOptions={{ + showCategories: false, + }} > {children} diff --git a/www/apps/resources/app/contribution-guidelines/docs/page.mdx b/www/apps/resources/app/contribution-guidelines/docs/page.mdx index 18cf49007f..a7a28ae3d2 100644 --- a/www/apps/resources/app/contribution-guidelines/docs/page.mdx +++ b/www/apps/resources/app/contribution-guidelines/docs/page.mdx @@ -20,7 +20,7 @@ The workspace has the following two directories: - `apps`: this directory holds the different documentation websites and projects. - `book`: includes the codebase for the Medusa Book. It's built with [Next.js 14](https://nextjs.org/). - - `resources`: includes the codebase for the Medusa Learning Resources documentation. It's built with [Next.js 14](https://nextjs.org/). + - `resources`: includes the codebase for the Medusa Development Resources documentation. It's built with [Next.js 14](https://nextjs.org/). - `api-reference`: includes the codebase for the API reference website. It's built with [Next.js 14](https://nextjs.org/). - `ui`: includes the codebase for the Medusa UI documentation website. It's built with [Next.js 14](https://nextjs.org/). - `packages`: this directory holds the shared packages and components necessary for the development of the projects in the `apps` directory. @@ -37,7 +37,7 @@ All documentation projects are built with Next.js. The content is writtin in MDX The content of the Medusa Book is placed under the `www/apps/book/app` directory. -### Medusa Learning Resources Content +### Medusa Development Resources Content The content of the Medusa Resources documentation is placed under the `www/apps/resources/app` directory. diff --git a/www/apps/resources/app/layout.tsx b/www/apps/resources/app/layout.tsx index 795717e2fc..7ee078e186 100644 --- a/www/apps/resources/app/layout.tsx +++ b/www/apps/resources/app/layout.tsx @@ -14,7 +14,7 @@ export const metadata: Metadata = { default: config.titleSuffix || "", }, description: - "Explore Medusa's recipes, API references, configurations, and more.", + "Explore Medusa's recipes, API references, configurations, storefront guides, and more.", metadataBase: new URL( process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000" ), diff --git a/www/apps/resources/app/not-found.mdx b/www/apps/resources/app/not-found.mdx index c2bd96b625..bc4143fb6d 100644 --- a/www/apps/resources/app/not-found.mdx +++ b/www/apps/resources/app/not-found.mdx @@ -25,7 +25,7 @@ If you think this is a mistake, please [report this issue on GitHub](https://git icon: BookOpen }, { - title: "Learning Resources", + title: "Development Resources", href: "!resources!", icon: AcademicCapSolid }, diff --git a/www/apps/resources/app/page.mdx b/www/apps/resources/app/page.mdx index 84b956e392..40c1023745 100644 --- a/www/apps/resources/app/page.mdx +++ b/www/apps/resources/app/page.mdx @@ -23,7 +23,7 @@ import { BuildingsSolid } from "@medusajs/icons" -# Medusa Learning Resources +# Medusa Development Resources Explore Medusa's commerce modules, SDKs, configurations, recipes, and more. diff --git a/www/apps/resources/config/index.ts b/www/apps/resources/config/index.ts index c9b7c3748a..d989fae0ec 100644 --- a/www/apps/resources/config/index.ts +++ b/www/apps/resources/config/index.ts @@ -5,7 +5,7 @@ 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", + titleSuffix: "Medusa Development Resources", baseUrl, basePath: process.env.NEXT_PUBLIC_BASE_PATH, sidebar: { diff --git a/www/apps/resources/providers/main-nav.tsx b/www/apps/resources/providers/main-nav.tsx index d5c2fa86d0..ea04fedd31 100644 --- a/www/apps/resources/providers/main-nav.tsx +++ b/www/apps/resources/providers/main-nav.tsx @@ -23,10 +23,14 @@ export const MainNavProvider = ({ children }: MainNavProviderProps) => { () => getNavDropdownItems({ basePath: config.baseUrl, - activePath: basePathUrl(), + activePath: basePathUrl( + pathname.startsWith("/commerce-modules") + ? "/commerce-modules" + : undefined + ), version: "v2", }), - [] + [pathname] ) const reportLink = useMemo( diff --git a/www/apps/ui/src/app/not-found.mdx b/www/apps/ui/src/app/not-found.mdx index c2bd96b625..bc4143fb6d 100644 --- a/www/apps/ui/src/app/not-found.mdx +++ b/www/apps/ui/src/app/not-found.mdx @@ -25,7 +25,7 @@ If you think this is a mistake, please [report this issue on GitHub](https://git icon: BookOpen }, { - title: "Learning Resources", + title: "Development Resources", href: "!resources!", icon: AcademicCapSolid }, diff --git a/www/apps/ui/src/app/not-found.tsx b/www/apps/ui/src/app/not-found.tsx index af661733ca..a57b1bcdec 100644 --- a/www/apps/ui/src/app/not-found.tsx +++ b/www/apps/ui/src/app/not-found.tsx @@ -35,7 +35,7 @@ export default function NotFound() { icon: BookOpen, }, { - title: "Learning Resources", + title: "Development Resources", href: "!resources!", icon: AcademicCapSolid, }, diff --git a/www/apps/user-guide/app/not-found.mdx b/www/apps/user-guide/app/not-found.mdx index c2bd96b625..bc4143fb6d 100644 --- a/www/apps/user-guide/app/not-found.mdx +++ b/www/apps/user-guide/app/not-found.mdx @@ -25,7 +25,7 @@ If you think this is a mistake, please [report this issue on GitHub](https://git icon: BookOpen }, { - title: "Learning Resources", + title: "Development Resources", href: "!resources!", icon: AcademicCapSolid }, diff --git a/www/packages/docs-ui/src/components/Icons/NavigationDropdown/Modules/index.tsx b/www/packages/docs-ui/src/components/Icons/NavigationDropdown/Modules/index.tsx new file mode 100644 index 0000000000..0ae3bebb89 --- /dev/null +++ b/www/packages/docs-ui/src/components/Icons/NavigationDropdown/Modules/index.tsx @@ -0,0 +1,33 @@ +import { IconProps } from "@medusajs/icons/dist/types" +import React from "react" + +export const NavigationDropdownModulesIcon = (props: IconProps) => { + return ( + + + + + + + + + + + + ) +} diff --git a/www/packages/docs-ui/src/components/MainNav/Breadcrumb/index.tsx b/www/packages/docs-ui/src/components/MainNav/Breadcrumb/index.tsx index 4af5df4be4..cccf1ad1ed 100644 --- a/www/packages/docs-ui/src/components/MainNav/Breadcrumb/index.tsx +++ b/www/packages/docs-ui/src/components/MainNav/Breadcrumb/index.tsx @@ -1,13 +1,17 @@ "use client" import React, { useMemo } from "react" -import { Button, CurrentItemsState, useSidebar } from "../../.." +import { Button, CurrentItemsState, useMainNav, useSidebar } from "../../.." import clsx from "clsx" import Link from "next/link" import { SidebarItemLink } from "types" export const MainNavBreadcrumbs = () => { const { currentItems, getActiveItem } = useSidebar() + const { + activeItem: mainNavActiveItem, + breadcrumbOptions: { showCategories }, + } = useMainNav() const getLinkPath = (item?: SidebarItemLink): string | undefined => { if (!item) { @@ -27,14 +31,26 @@ export const MainNavBreadcrumbs = () => { const parentPath = item.parentItem?.type === "link" ? getLinkPath(item.parentItem) + : (item.parentItem?.type === "category" && showCategories) || + item.parentItem?.type === "sub-category" + ? "#" : undefined const firstItemPath = - item.default[0].type === "link" ? getLinkPath(item.default[0]) : undefined + item.default[0].type === "link" + ? getLinkPath(item.default[0]) + : (item.default[0].type === "category" && showCategories) || + item.default[0].type === "sub-category" + ? "#" + : undefined - tempBreadcrumbItems.set( - parentPath || firstItemPath || "/", - item.parentItem?.childSidebarTitle || item.parentItem?.title || "" - ) + const breadcrumbPath = parentPath || firstItemPath || "/" + + if (!mainNavActiveItem?.path.endsWith(breadcrumbPath)) { + tempBreadcrumbItems.set( + breadcrumbPath, + item.parentItem?.childSidebarTitle || item.parentItem?.title || "" + ) + } return tempBreadcrumbItems } @@ -48,10 +64,21 @@ export const MainNavBreadcrumbs = () => { } const activeItem = getActiveItem() - if (activeItem) { + if (activeItem && !mainNavActiveItem?.path.endsWith(activeItem.path)) { + if ( + activeItem.parentItem && + (activeItem.parentItem.type !== "category" || showCategories) + ) { + tempBreadcrumbItems.set( + activeItem.parentItem.type === "link" + ? getLinkPath(activeItem.parentItem) || "#" + : "#", + activeItem.parentItem.title || "" + ) + } tempBreadcrumbItems.set( getLinkPath(activeItem) || "/", - activeItem?.title || "" + activeItem.title || "" ) } @@ -70,9 +97,17 @@ export const MainNavBreadcrumbs = () => { / ))} diff --git a/www/packages/docs-ui/src/constants.tsx b/www/packages/docs-ui/src/constants.tsx index 93257285ec..974a27a818 100644 --- a/www/packages/docs-ui/src/constants.tsx +++ b/www/packages/docs-ui/src/constants.tsx @@ -9,6 +9,7 @@ import { NavigationDropdownUiIcon } from "./components/Icons/NavigationDropdown/ import { NavigationDropdownDocV1Icon } from "./components/Icons/NavigationDropdown/DocV1" import { NavigationDropdownUserIcon } from "./components/Icons/NavigationDropdown/User" import { NavigationDropdownResourcesIcon } from "./components/Icons/NavigationDropdown/Resources" +import { NavigationDropdownModulesIcon } from "./components/Icons/NavigationDropdown/Modules" export const GITHUB_ISSUES_PREFIX = `https://github.com/medusajs/medusa/issues/new?assignees=&labels=type%3A+docs&template=docs.yml` export const GITHUB_UI_ISSUES_PREFIX = `https://github.com/medusajs/ui/issues/new?labels=documentation` @@ -20,11 +21,17 @@ export const navDropdownItemsV2: NavigationDropdownItem[] = [ icon: NavigationDropdownDocIcon, title: "Documentation", }, + { + type: "link", + path: `/v2/resources/commerce-modules`, + icon: NavigationDropdownModulesIcon, + title: "Commerce Modules", + }, { type: "link", path: `/v2/resources`, icon: NavigationDropdownResourcesIcon, - title: "Learning Resources", + title: "Development Resources", }, { type: "link", diff --git a/www/packages/docs-ui/src/providers/MainNav/index.tsx b/www/packages/docs-ui/src/providers/MainNav/index.tsx index 4037054c52..6b050e4943 100644 --- a/www/packages/docs-ui/src/providers/MainNav/index.tsx +++ b/www/packages/docs-ui/src/providers/MainNav/index.tsx @@ -1,13 +1,18 @@ "use client" import React, { createContext, useContext, useMemo } from "react" -import { NavigationDropdownItem } from "types" +import { + BreadcrumbOptions, + NavigationDropdownItem, + NavigationDropdownItemLink, +} from "types" export type MainNavContext = { navItems: NavigationDropdownItem[] - activeItem?: NavigationDropdownItem + activeItem?: NavigationDropdownItemLink reportIssueLink: string editDate?: string + breadcrumbOptions: BreadcrumbOptions } const MainNavContext = createContext(null) @@ -16,6 +21,7 @@ export type MainNavProviderProps = { navItems: NavigationDropdownItem[] reportIssueLink: string editDate?: string + breadcrumbOptions?: BreadcrumbOptions children?: React.ReactNode } @@ -24,9 +30,15 @@ export const MainNavProvider = ({ reportIssueLink, children, editDate, + breadcrumbOptions = { + showCategories: true, + }, }: MainNavProviderProps) => { const activeItem = useMemo( - () => navItems.find((item) => item.type === "link" && item.isActive), + () => + navItems.find( + (item) => item.type === "link" && item.isActive + ) as NavigationDropdownItemLink, [navItems] ) @@ -37,6 +49,7 @@ export const MainNavProvider = ({ activeItem, reportIssueLink, editDate, + breadcrumbOptions, }} > {children} diff --git a/www/packages/docs-ui/src/providers/Sidebar/index.tsx b/www/packages/docs-ui/src/providers/Sidebar/index.tsx index 2a6bfe1b2c..e9df8df7ad 100644 --- a/www/packages/docs-ui/src/providers/Sidebar/index.tsx +++ b/www/packages/docs-ui/src/providers/Sidebar/index.tsx @@ -20,6 +20,7 @@ import { SidebarItemLink, InteractiveSidebarItem, SidebarItemCategory, + SidebarItemLinkWithParent, } from "types" export type CurrentItemsState = SidebarSectionItems & { @@ -34,7 +35,7 @@ export type SidebarContextType = { items: SidebarSectionItems currentItems: CurrentItemsState | undefined activePath: string | null - getActiveItem: () => SidebarItemLink | undefined + getActiveItem: () => SidebarItemLinkWithParent | undefined setActivePath: (path: string | null) => void isLinkActive: (item: SidebarItem, checkChildren?: boolean) => boolean isChildrenActive: (item: SidebarItemCategory) => boolean @@ -100,8 +101,8 @@ const findItem = ( section: SidebarItem[], item: Partial, checkChildren = true -): SidebarItemLink | undefined => { - let foundItem: SidebarItemLink | undefined +): SidebarItemLinkWithParent | undefined => { + let foundItem: SidebarItemLinkWithParent | undefined section.some((i) => { if (i.type === "separator") { return false @@ -110,6 +111,9 @@ const findItem = ( foundItem = i } else if (checkChildren && i.children) { foundItem = findItem(i.children, item) + if (foundItem && !foundItem.parentItem) { + foundItem.parentItem = i + } } return foundItem !== undefined diff --git a/www/packages/types/src/navigation-dropdown.ts b/www/packages/types/src/navigation-dropdown.ts index c7f1a8044e..1fce274a6b 100644 --- a/www/packages/types/src/navigation-dropdown.ts +++ b/www/packages/types/src/navigation-dropdown.ts @@ -14,3 +14,7 @@ export type NavigationDropdownItem = | { type: "divider" } + +export type BreadcrumbOptions = { + showCategories?: boolean +} diff --git a/www/packages/types/src/sidebar.ts b/www/packages/types/src/sidebar.ts index b6fdbe4e88..0ddea0bac3 100644 --- a/www/packages/types/src/sidebar.ts +++ b/www/packages/types/src/sidebar.ts @@ -41,6 +41,10 @@ export type InteractiveSidebarItem = | SidebarItemCategory | SidebarItemSubCategory +export type SidebarItemLinkWithParent = SidebarItemLink & { + parentItem?: InteractiveSidebarItem +} + export type SidebarItem = InteractiveSidebarItem | SidebarItemSeparator export type SidebarSectionItems = {