docs: preparations for preview (#7267)
* configured base paths + added development banner * fix typelist site url * added navbar and sidebar badges * configure algolia filters * remove AI assistant * remove unused imports * change navbar text and badge * lint fixes * fix build error * add to api reference rewrites * fix build error * fix build errors in user-guide * fix feedback component * add parent title to pagination * added breadcrumbs component * remove user-guide links * resolve todos * fix details about authentication * change documentation title * lint content
This commit is contained in:
1 parent
3e3b8a483f
commit
728c5ee53c
62 files changed
+855
-506
No files matched your search
@@ -1,5 +1,4 @@
|
||||
import { Table } from "docs-ui"
|
||||
import TypeList from "@/components/TypeList"
|
||||
import { Table, TypeList } from "docs-ui"
|
||||
|
||||
export const metadata = {
|
||||
title: `Medusa Admin Configurations`,
|
||||
|
||||
@@ -175,7 +175,9 @@ The client accepts the following options on initialization:
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
A string indicating publishable API key used for storefront requests. You can create a publishable API key either using the [Medusa Admin](!user-guide!/settings/developer/api-key-management) or the [Admin API Routes](https://docs.medusajs.com/api/admin#publishable-api-keys).
|
||||
{/* TODO add link [Medusa Admin](!user-guide!/settings/developer/api-key-management) */}
|
||||
|
||||
A string indicating publishable API key used for storefront requests. You can create a publishable API key either using the Medusa Admin or the [Admin API Routes](https://docs.medusajs.com/api/admin#publishable-api-keys).
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
@@ -408,7 +410,9 @@ You can learn more about publishable API keys and how to use them in [this docum
|
||||
|
||||
### Create a Publishable API Key
|
||||
|
||||
You can create a publishable API key either using the [Admin API Routes](https://docs.medusajs.com/api/admin#publishable-api-keys), or using the [Medusa Admin](!user-guide!/settings/developer/api-key-management).
|
||||
{/* TODO add link [Medusa Admin](!user-guide!/settings/developer/api-key-management) */}
|
||||
|
||||
You can create a publishable API key either using the [Admin API Routes](https://docs.medusajs.com/api/admin#publishable-api-keys), or using the Medusa Admin.
|
||||
|
||||
### Use a Publishable API Key
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Inter, Roboto_Mono } from "next/font/google"
|
||||
import Navbar from "@/components/Navbar"
|
||||
import Providers from "@/providers"
|
||||
import "./globals.css"
|
||||
import { TightLayout } from "docs-ui"
|
||||
import { Bannerv2, Breadcrumbs, TightLayout } from "docs-ui"
|
||||
import { config } from "@/config"
|
||||
import clsx from "clsx"
|
||||
import { Feedback } from "@/components/Feedback"
|
||||
@@ -44,9 +44,11 @@ export default function RootLayout({
|
||||
NavbarComponent={Navbar}
|
||||
sidebarProps={{
|
||||
expandItems: true,
|
||||
banner: <Bannerv2 />,
|
||||
}}
|
||||
bodyClassName={clsx(inter.variable, robotoMono.variable)}
|
||||
>
|
||||
<Breadcrumbs />
|
||||
{children}
|
||||
<Feedback className="my-2" />
|
||||
<EditButton />
|
||||
|
||||
@@ -327,7 +327,9 @@ You can learn more about publishable API keys and how to use them in [this docum
|
||||
|
||||
### Create a Publishable API Key
|
||||
|
||||
You can create a publishable API key either using the [Admin API Routes](https://docs.medusajs.com/api/admin#publishable-api-keys), or using the [Medusa Admin](!user-guide!/settings/developer/api-key-management).
|
||||
{/* TODO add link [Medusa Admin](!user-guide!/settings/developer/api-key-management) */}
|
||||
|
||||
You can create a publishable API key either using the [Admin API Routes](https://docs.medusajs.com/api/admin#publishable-api-keys), or using the Medusa Admin.
|
||||
|
||||
### Use a Publishable API Key
|
||||
|
||||
|
||||
@@ -4,23 +4,34 @@ import {
|
||||
Feedback as UiFeedback,
|
||||
FeedbackProps as UiFeedbackProps,
|
||||
formatReportLink,
|
||||
useIsBrowser,
|
||||
} from "docs-ui"
|
||||
import { usePathname } from "next/navigation"
|
||||
import { config } from "../../config"
|
||||
import { useMemo } from "react"
|
||||
import { basePathUrl } from "../../utils/base-path-url"
|
||||
|
||||
type FeedbackProps = Omit<UiFeedbackProps, "event" | "pathName">
|
||||
|
||||
export const Feedback = (props: FeedbackProps) => {
|
||||
const pathname = usePathname()
|
||||
const isBrowser = useIsBrowser()
|
||||
|
||||
const feedbackPathname = useMemo(() => basePathUrl(pathname), [pathname])
|
||||
const reportLink = useMemo(
|
||||
() =>
|
||||
formatReportLink(
|
||||
config.titleSuffix || "",
|
||||
isBrowser ? document.title : ""
|
||||
),
|
||||
[isBrowser]
|
||||
)
|
||||
|
||||
return (
|
||||
<UiFeedback
|
||||
event="survey"
|
||||
pathName={pathname}
|
||||
reportLink={formatReportLink(
|
||||
config.titleSuffix || "",
|
||||
typeof document !== "undefined" ? document.title : ""
|
||||
)}
|
||||
pathName={feedbackPathname}
|
||||
reportLink={reportLink}
|
||||
question="Was this page helpful?"
|
||||
{...props}
|
||||
/>
|
||||
|
||||
@@ -12,7 +12,8 @@ const Navbar = () => {
|
||||
() =>
|
||||
getNavbarItems({
|
||||
basePath: config.baseUrl,
|
||||
activePath: process.env.NEXT_PUBLIC_BASE_PATH || "/resources",
|
||||
activePath: basePathUrl(""),
|
||||
version: "v2",
|
||||
}),
|
||||
[]
|
||||
)
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import { TypeList as UiTypeList } from "docs-ui"
|
||||
import { ComponentProps } from "react"
|
||||
import { config } from "@/config"
|
||||
|
||||
const TypeList = (props: ComponentProps<typeof UiTypeList>) => {
|
||||
return <UiTypeList {...props} siteUrl={config.baseUrl} />
|
||||
}
|
||||
|
||||
export default TypeList
|
||||
@@ -1,13 +1,14 @@
|
||||
import { DocsConfig } from "types"
|
||||
import { mobileSidebarItems } from "docs-ui"
|
||||
import { mobileSidebarItemsV2 } from "docs-ui"
|
||||
import { generatedSidebar } from "../generated/sidebar.mjs"
|
||||
|
||||
export const config: DocsConfig = {
|
||||
titleSuffix: "Medusa Resources",
|
||||
baseUrl: process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000",
|
||||
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
||||
sidebar: {
|
||||
top: generatedSidebar,
|
||||
bottom: [],
|
||||
mobile: mobileSidebarItems,
|
||||
mobile: mobileSidebarItemsV2,
|
||||
},
|
||||
}
|
||||
@@ -12,7 +12,6 @@ import remarkDirective from "remark-directive"
|
||||
const mdxPluginOptions = {
|
||||
options: {
|
||||
rehypePlugins: [
|
||||
// TODO add V2 to path if necessary
|
||||
[
|
||||
crossProjectLinksPlugin,
|
||||
{
|
||||
@@ -23,13 +22,14 @@ const mdxPluginOptions = {
|
||||
process.env.VERCEL_ENV !== "production"
|
||||
? process.env.NEXT_PUBLIC_DOCS_URL
|
||||
: undefined,
|
||||
path: "v2",
|
||||
},
|
||||
"user-guide": {
|
||||
url:
|
||||
process.env.VERCEL_ENV !== "production"
|
||||
? process.env.NEXT_PUBLIC_USER_GUIDE_URL
|
||||
: undefined,
|
||||
path: "user-guide",
|
||||
path: "v2/user-guide",
|
||||
},
|
||||
ui: {
|
||||
url:
|
||||
|
||||
@@ -28,9 +28,7 @@ const nextConfig = {
|
||||
|
||||
transpilePackages: ["docs-ui"],
|
||||
|
||||
// TODO uncomment if we decide on baes path
|
||||
// basePath: process.env.NEXT_PUBLIC_BASE_PATH || "/v2/resources",
|
||||
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "/resources",
|
||||
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "/v2/resources",
|
||||
async rewrites() {
|
||||
return {
|
||||
fallback: [
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import {
|
||||
SearchProvider as UiSearchProvider,
|
||||
AiAssistantCommandIcon,
|
||||
AiAssistantProvider,
|
||||
searchFilters,
|
||||
} from "docs-ui"
|
||||
import { SearchProvider as UiSearchProvider, searchFiltersV2 } from "docs-ui"
|
||||
import { config } from "../config"
|
||||
|
||||
type SearchProviderProps = {
|
||||
@@ -39,32 +34,10 @@ const SearchProvider = ({ children }: SearchProviderProps) => {
|
||||
],
|
||||
},
|
||||
],
|
||||
checkInternalPattern: new RegExp(`^${config.baseUrl}/resources/.*`),
|
||||
filterOptions: searchFilters,
|
||||
checkInternalPattern: new RegExp(`^${config.baseUrl}/v2/resources/.*`),
|
||||
filterOptions: searchFiltersV2,
|
||||
}}
|
||||
// TODO change once we have a dedicated index
|
||||
initialDefaultFilters={["docs"]}
|
||||
commands={[
|
||||
{
|
||||
name: "ai-assistant",
|
||||
icon: <AiAssistantCommandIcon />,
|
||||
component: (
|
||||
<AiAssistantProvider
|
||||
apiUrl={process.env.NEXT_PUBLIC_AI_ASSISTANT_URL || "temp"}
|
||||
websiteId={process.env.NEXT_PUBLIC_AI_WEBSITE_ID || "temp"}
|
||||
recaptchaSiteKey={
|
||||
process.env.NEXT_PUBLIC_AI_API_ASSISTANT_RECAPTCHA_SITE_KEY ||
|
||||
"temp"
|
||||
}
|
||||
/>
|
||||
),
|
||||
title: "AI Assistant",
|
||||
badge: {
|
||||
variant: "purple",
|
||||
children: "Beta",
|
||||
},
|
||||
},
|
||||
]}
|
||||
initialDefaultFilters={["resources"]}
|
||||
>
|
||||
{children}
|
||||
</UiSearchProvider>
|
||||
|
||||
Reference in new issue
Block a user