docs: change report issue link (#10160)
This commit is contained in:
1 parent
156494c646
commit
a1738f823c
23 files changed
+29
-179
No files matched your search
@@ -10,7 +10,6 @@ import MDXContentClient from "@/components/MDXContent/Client"
|
|||||||
import { useArea } from "../../../../providers/area"
|
import { useArea } from "../../../../providers/area"
|
||||||
import { Feedback, Badge, Link, FeatureFlagNotice } from "docs-ui"
|
import { Feedback, Badge, Link, FeatureFlagNotice } from "docs-ui"
|
||||||
import { usePathname } from "next/navigation"
|
import { usePathname } from "next/navigation"
|
||||||
import formatReportLink from "../../../../utils/format-report-link"
|
|
||||||
import { TagsOperationDescriptionSectionWorkflowBadgeProps } from "./WorkflowBadge"
|
import { TagsOperationDescriptionSectionWorkflowBadgeProps } from "./WorkflowBadge"
|
||||||
|
|
||||||
const TagsOperationDescriptionSectionSecurity =
|
const TagsOperationDescriptionSectionSecurity =
|
||||||
@@ -82,7 +81,6 @@ const TagsOperationDescriptionSection = ({
|
|||||||
section: operation.summary,
|
section: operation.summary,
|
||||||
}}
|
}}
|
||||||
pathName={pathname}
|
pathName={pathname}
|
||||||
reportLink={formatReportLink(area, operation.summary)}
|
|
||||||
className="!my-2"
|
className="!my-2"
|
||||||
vertical={true}
|
vertical={true}
|
||||||
question="Did this API Route run successfully?"
|
question="Did this API Route run successfully?"
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import SectionDivider from "../../Section/Divider"
|
|||||||
import clsx from "clsx"
|
import clsx from "clsx"
|
||||||
import { Feedback, Loading, Link } from "docs-ui"
|
import { Feedback, Loading, Link } from "docs-ui"
|
||||||
import { usePathname, useRouter } from "next/navigation"
|
import { usePathname, useRouter } from "next/navigation"
|
||||||
import formatReportLink from "@/utils/format-report-link"
|
|
||||||
import { PathsObject, SchemaObject, TagObject } from "@/types/openapi"
|
import { PathsObject, SchemaObject, TagObject } from "@/types/openapi"
|
||||||
import { TagSectionSchemaProps } from "./Schema"
|
import { TagSectionSchemaProps } from "./Schema"
|
||||||
import checkElementInViewport from "../../../utils/check-element-in-viewport"
|
import checkElementInViewport from "../../../utils/check-element-in-viewport"
|
||||||
@@ -165,7 +164,6 @@ const TagSectionComponent = ({ tag }: TagSectionProps) => {
|
|||||||
section: tag.name,
|
section: tag.name,
|
||||||
}}
|
}}
|
||||||
pathName={pathname}
|
pathName={pathname}
|
||||||
reportLink={formatReportLink(area, tag.name)}
|
|
||||||
vertical
|
vertical
|
||||||
question="Was this section helpful?"
|
question="Was this section helpful?"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
DividedMarkdownCode
|
DividedMarkdownCode
|
||||||
} from "@/layouts/DividedMarkdown/Sections"
|
} from "@/layouts/DividedMarkdown/Sections"
|
||||||
import Section from "@/components/Section"
|
import Section from "@/components/Section"
|
||||||
import formatReportLink from "@/utils/format-report-link"
|
|
||||||
|
|
||||||
import ClientLibraries from "./client-libraries.mdx"
|
import ClientLibraries from "./client-libraries.mdx"
|
||||||
|
|
||||||
@@ -28,7 +27,6 @@ All API Routes are prefixed with `/admin`. So, during development, the API Route
|
|||||||
area: "admin",
|
area: "admin",
|
||||||
section: "introduction"
|
section: "introduction"
|
||||||
}}
|
}}
|
||||||
reportLink={formatReportLink("admin", "Introduction")}
|
|
||||||
pathName="/api/admin"
|
pathName="/api/admin"
|
||||||
question="Was this section helpful?"
|
question="Was this section helpful?"
|
||||||
vertical={true}
|
vertical={true}
|
||||||
@@ -305,7 +303,6 @@ fetch(`<BACKEND_URL>/admin/products`, {
|
|||||||
area: "admin",
|
area: "admin",
|
||||||
section: "authentication-cookie"
|
section: "authentication-cookie"
|
||||||
}}
|
}}
|
||||||
reportLink={formatReportLink("admin", "Authentication - Cookie Session ID")}
|
|
||||||
pathName="/api/admin"
|
pathName="/api/admin"
|
||||||
question="Was this section helpful?"
|
question="Was this section helpful?"
|
||||||
vertical={true}
|
vertical={true}
|
||||||
@@ -355,7 +352,6 @@ x-no-compression: true
|
|||||||
area: "admin",
|
area: "admin",
|
||||||
section: "http-compression"
|
section: "http-compression"
|
||||||
}}
|
}}
|
||||||
reportLink={formatReportLink("admin", "Authentication - Cookie Session ID")}
|
|
||||||
pathName="/api/admin"
|
pathName="/api/admin"
|
||||||
question="Was this section helpful?"
|
question="Was this section helpful?"
|
||||||
vertical={true}
|
vertical={true}
|
||||||
@@ -687,7 +683,6 @@ curl -g "http://localhost:9000/admin/products?created_at[$lt]=2023-02-17&created
|
|||||||
area: "admin",
|
area: "admin",
|
||||||
section: "query-parameters"
|
section: "query-parameters"
|
||||||
}}
|
}}
|
||||||
reportLink={formatReportLink("admin", "Query Parameter Types")}
|
|
||||||
pathName="/api/admin"
|
pathName="/api/admin"
|
||||||
question="Was this section helpful?"
|
question="Was this section helpful?"
|
||||||
vertical={true}
|
vertical={true}
|
||||||
@@ -814,7 +809,6 @@ This sorts the products by their `created_at` field in the descending order.
|
|||||||
area: "admin",
|
area: "admin",
|
||||||
section: "pagination"
|
section: "pagination"
|
||||||
}}
|
}}
|
||||||
reportLink={formatReportLink("admin", "Pagination")}
|
|
||||||
pathName="/api/admin"
|
pathName="/api/admin"
|
||||||
question="Was this section helpful?"
|
question="Was this section helpful?"
|
||||||
vertical={true}
|
vertical={true}
|
||||||
@@ -846,7 +840,6 @@ Refer to [this guide](https://docs.medusajs.com/customization/extend-models/exte
|
|||||||
area: "admin",
|
area: "admin",
|
||||||
section: "workflows"
|
section: "workflows"
|
||||||
}}
|
}}
|
||||||
reportLink={formatReportLink("admin", "Workflows")}
|
|
||||||
pathName="/api/admin"
|
pathName="/api/admin"
|
||||||
question="Was this section helpful?"
|
question="Was this section helpful?"
|
||||||
vertical={true}
|
vertical={true}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
} from "@/layouts/DividedMarkdown/Sections"
|
} from "@/layouts/DividedMarkdown/Sections"
|
||||||
import Section from "@/components/Section"
|
import Section from "@/components/Section"
|
||||||
import { Feedback, CodeTabs, CodeTab } from "docs-ui"
|
import { Feedback, CodeTabs, CodeTab } from "docs-ui"
|
||||||
import formatReportLink from "@/utils/format-report-link"
|
|
||||||
|
|
||||||
import ClientLibraries from "./client-libraries.mdx"
|
import ClientLibraries from "./client-libraries.mdx"
|
||||||
|
|
||||||
@@ -28,7 +27,6 @@ All API Routes are prefixed with `/store`. So, during development, the API Route
|
|||||||
area: "store",
|
area: "store",
|
||||||
section: "introduction"
|
section: "introduction"
|
||||||
}}
|
}}
|
||||||
reportLink={formatReportLink("store", "Introduction")}
|
|
||||||
pathName="/api/store"
|
pathName="/api/store"
|
||||||
question="Was this section helpful?"
|
question="Was this section helpful?"
|
||||||
vertical={true}
|
vertical={true}
|
||||||
@@ -242,7 +240,6 @@ fetch(`<BACKEND_URL>/store/products`, {
|
|||||||
area: "store",
|
area: "store",
|
||||||
section: "authentication-cookie"
|
section: "authentication-cookie"
|
||||||
}}
|
}}
|
||||||
reportLink={formatReportLink("store", "Authentication - Cookie Session ID")}
|
|
||||||
pathName="/api/store"
|
pathName="/api/store"
|
||||||
question="Was this section helpful?"
|
question="Was this section helpful?"
|
||||||
vertical={true}
|
vertical={true}
|
||||||
@@ -307,7 +304,6 @@ Where `{your_publishable_api_key}` is the token of the publishable API key.
|
|||||||
area: "store",
|
area: "store",
|
||||||
section: "publishable-api-key"
|
section: "publishable-api-key"
|
||||||
}}
|
}}
|
||||||
reportLink={formatReportLink("store", "Publishable API Key")}
|
|
||||||
pathName="/api/store"
|
pathName="/api/store"
|
||||||
question="Was this section helpful?"
|
question="Was this section helpful?"
|
||||||
vertical={true}
|
vertical={true}
|
||||||
@@ -357,7 +353,6 @@ x-no-compression: true
|
|||||||
area: "store",
|
area: "store",
|
||||||
section: "http-compression"
|
section: "http-compression"
|
||||||
}}
|
}}
|
||||||
reportLink={formatReportLink("store", "HTTP Compression")}
|
|
||||||
pathName="/api/store"
|
pathName="/api/store"
|
||||||
question="Was this section helpful?"
|
question="Was this section helpful?"
|
||||||
vertical={true}
|
vertical={true}
|
||||||
@@ -481,7 +476,6 @@ This returns the variants of each product, but the variants only have their `id`
|
|||||||
area: "store",
|
area: "store",
|
||||||
section: "select-fields"
|
section: "select-fields"
|
||||||
}}
|
}}
|
||||||
reportLink={formatReportLink("store", "Selecting Fields")}
|
|
||||||
pathName="/api/store"
|
pathName="/api/store"
|
||||||
question="Was this section helpful?"
|
question="Was this section helpful?"
|
||||||
vertical={true}
|
vertical={true}
|
||||||
@@ -694,7 +688,6 @@ curl -g "http://localhost:9000/store/products?created_at[$lt]=2023-02-17&created
|
|||||||
area: "store",
|
area: "store",
|
||||||
section: "query-parameters"
|
section: "query-parameters"
|
||||||
}}
|
}}
|
||||||
reportLink={formatReportLink("store", "Query Parameter Types")}
|
|
||||||
pathName="/api/store"
|
pathName="/api/store"
|
||||||
question="Was this section helpful?"
|
question="Was this section helpful?"
|
||||||
vertical={true}
|
vertical={true}
|
||||||
@@ -819,7 +812,6 @@ This sorts the products by their `created_at` field in the descending order.
|
|||||||
area: "store",
|
area: "store",
|
||||||
section: "pagination"
|
section: "pagination"
|
||||||
}}
|
}}
|
||||||
reportLink={formatReportLink("store", "Pagination")}
|
|
||||||
pathName="/api/store"
|
pathName="/api/store"
|
||||||
question="Was this section helpful?"
|
question="Was this section helpful?"
|
||||||
vertical={true}
|
vertical={true}
|
||||||
@@ -847,7 +839,6 @@ Refer to [this guide](https://docs.medusajs.com/customization/extend-models/exte
|
|||||||
area: "admin",
|
area: "admin",
|
||||||
section: "workflows"
|
section: "workflows"
|
||||||
}}
|
}}
|
||||||
reportLink={formatReportLink("admin", "Workflows")}
|
|
||||||
pathName="/api/admin"
|
pathName="/api/admin"
|
||||||
question="Was this section helpful?"
|
question="Was this section helpful?"
|
||||||
vertical={true}
|
vertical={true}
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
formatReportLink,
|
|
||||||
getNavDropdownItems,
|
getNavDropdownItems,
|
||||||
MainNavProvider as UiMainNavProvider,
|
MainNavProvider as UiMainNavProvider,
|
||||||
useIsBrowser,
|
|
||||||
} from "docs-ui"
|
} from "docs-ui"
|
||||||
import { useMemo } from "react"
|
import { useMemo } from "react"
|
||||||
import { config } from "../config"
|
import { config } from "../config"
|
||||||
@@ -14,7 +12,6 @@ type MainNavProviderProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const MainNavProvider = ({ children }: MainNavProviderProps) => {
|
export const MainNavProvider = ({ children }: MainNavProviderProps) => {
|
||||||
const { isBrowser } = useIsBrowser()
|
|
||||||
const navigationDropdownItems = useMemo(
|
const navigationDropdownItems = useMemo(
|
||||||
() =>
|
() =>
|
||||||
getNavDropdownItems({
|
getNavDropdownItems({
|
||||||
@@ -23,20 +20,8 @@ export const MainNavProvider = ({ children }: MainNavProviderProps) => {
|
|||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|
||||||
const reportLink = useMemo(
|
|
||||||
() =>
|
|
||||||
formatReportLink(
|
|
||||||
config.titleSuffix || "",
|
|
||||||
isBrowser ? document.title : ""
|
|
||||||
),
|
|
||||||
[isBrowser]
|
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<UiMainNavProvider
|
<UiMainNavProvider navItems={navigationDropdownItems}>
|
||||||
navItems={navigationDropdownItems}
|
|
||||||
reportIssueLink={reportLink}
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</UiMainNavProvider>
|
</UiMainNavProvider>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
import { formatReportLink as uiFormatReportLink } from "docs-ui"
|
|
||||||
|
|
||||||
export default function formatReportLink(area = "admin", sectionTitle: string) {
|
|
||||||
return uiFormatReportLink(`API Ref(${area})`, sectionTitle)
|
|
||||||
}
|
|
||||||
@@ -3,11 +3,8 @@
|
|||||||
import {
|
import {
|
||||||
Feedback as UiFeedback,
|
Feedback as UiFeedback,
|
||||||
FeedbackProps as UiFeedbackProps,
|
FeedbackProps as UiFeedbackProps,
|
||||||
formatReportLink,
|
|
||||||
useIsBrowser,
|
|
||||||
} from "docs-ui"
|
} from "docs-ui"
|
||||||
import { usePathname } from "next/navigation"
|
import { usePathname } from "next/navigation"
|
||||||
import { config } from "../../config"
|
|
||||||
import { basePathUrl } from "../../utils/base-path-url"
|
import { basePathUrl } from "../../utils/base-path-url"
|
||||||
import { useMemo } from "react"
|
import { useMemo } from "react"
|
||||||
|
|
||||||
@@ -15,23 +12,13 @@ type FeedbackProps = Omit<UiFeedbackProps, "event" | "pathName">
|
|||||||
|
|
||||||
const Feedback = (props: FeedbackProps) => {
|
const Feedback = (props: FeedbackProps) => {
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
const { isBrowser } = useIsBrowser()
|
|
||||||
|
|
||||||
const feedbackPathname = useMemo(() => basePathUrl(pathname), [pathname])
|
const feedbackPathname = useMemo(() => basePathUrl(pathname), [pathname])
|
||||||
const reportLink = useMemo(
|
|
||||||
() =>
|
|
||||||
formatReportLink(
|
|
||||||
config.titleSuffix || "",
|
|
||||||
isBrowser ? document.title : ""
|
|
||||||
),
|
|
||||||
[isBrowser]
|
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<UiFeedback
|
<UiFeedback
|
||||||
event="survey"
|
event="survey"
|
||||||
pathName={feedbackPathname}
|
pathName={feedbackPathname}
|
||||||
reportLink={reportLink}
|
|
||||||
question={props.question || "Was this chapter helpful?"}
|
question={props.question || "Was this chapter helpful?"}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
formatReportLink,
|
|
||||||
getNavDropdownItems,
|
getNavDropdownItems,
|
||||||
MainNavProvider as UiMainNavProvider,
|
MainNavProvider as UiMainNavProvider,
|
||||||
useIsBrowser,
|
|
||||||
} from "docs-ui"
|
} from "docs-ui"
|
||||||
import { useMemo } from "react"
|
import { useMemo } from "react"
|
||||||
import { config } from "../config"
|
import { config } from "../config"
|
||||||
@@ -16,7 +14,6 @@ type MainNavProviderProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const MainNavProvider = ({ children }: MainNavProviderProps) => {
|
export const MainNavProvider = ({ children }: MainNavProviderProps) => {
|
||||||
const { isBrowser } = useIsBrowser()
|
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
const navigationDropdownItems = useMemo(
|
const navigationDropdownItems = useMemo(
|
||||||
() =>
|
() =>
|
||||||
@@ -26,15 +23,6 @@ export const MainNavProvider = ({ children }: MainNavProviderProps) => {
|
|||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|
||||||
const reportLink = useMemo(
|
|
||||||
() =>
|
|
||||||
formatReportLink(
|
|
||||||
config.titleSuffix || "",
|
|
||||||
isBrowser ? document.title : ""
|
|
||||||
),
|
|
||||||
[isBrowser]
|
|
||||||
)
|
|
||||||
|
|
||||||
const editDate = useMemo(
|
const editDate = useMemo(
|
||||||
() =>
|
() =>
|
||||||
(generatedEditDates as Record<string, string>)[
|
(generatedEditDates as Record<string, string>)[
|
||||||
@@ -44,11 +32,7 @@ export const MainNavProvider = ({ children }: MainNavProviderProps) => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<UiMainNavProvider
|
<UiMainNavProvider navItems={navigationDropdownItems} editDate={editDate}>
|
||||||
navItems={navigationDropdownItems}
|
|
||||||
reportIssueLink={reportLink}
|
|
||||||
editDate={editDate}
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</UiMainNavProvider>
|
</UiMainNavProvider>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,11 +3,8 @@
|
|||||||
import {
|
import {
|
||||||
Feedback as UiFeedback,
|
Feedback as UiFeedback,
|
||||||
FeedbackProps as UiFeedbackProps,
|
FeedbackProps as UiFeedbackProps,
|
||||||
formatReportLink,
|
|
||||||
useIsBrowser,
|
|
||||||
} from "docs-ui"
|
} from "docs-ui"
|
||||||
import { usePathname } from "next/navigation"
|
import { usePathname } from "next/navigation"
|
||||||
import { config } from "../../config"
|
|
||||||
import { useMemo } from "react"
|
import { useMemo } from "react"
|
||||||
import { basePathUrl } from "../../utils/base-path-url"
|
import { basePathUrl } from "../../utils/base-path-url"
|
||||||
|
|
||||||
@@ -15,23 +12,13 @@ type FeedbackProps = Omit<UiFeedbackProps, "event" | "pathName">
|
|||||||
|
|
||||||
export const Feedback = (props: FeedbackProps) => {
|
export const Feedback = (props: FeedbackProps) => {
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
const { isBrowser } = useIsBrowser()
|
|
||||||
|
|
||||||
const feedbackPathname = useMemo(() => basePathUrl(pathname), [pathname])
|
const feedbackPathname = useMemo(() => basePathUrl(pathname), [pathname])
|
||||||
const reportLink = useMemo(
|
|
||||||
() =>
|
|
||||||
formatReportLink(
|
|
||||||
config.titleSuffix || "",
|
|
||||||
isBrowser ? document.title : ""
|
|
||||||
),
|
|
||||||
[isBrowser]
|
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<UiFeedback
|
<UiFeedback
|
||||||
event="survey"
|
event="survey"
|
||||||
pathName={feedbackPathname}
|
pathName={feedbackPathname}
|
||||||
reportLink={reportLink}
|
|
||||||
question="Was this page helpful?"
|
question="Was this page helpful?"
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
formatReportLink,
|
|
||||||
getNavDropdownItems,
|
getNavDropdownItems,
|
||||||
MainNavProvider as UiMainNavProvider,
|
MainNavProvider as UiMainNavProvider,
|
||||||
useIsBrowser,
|
|
||||||
} from "docs-ui"
|
} from "docs-ui"
|
||||||
import { useMemo } from "react"
|
import { useMemo } from "react"
|
||||||
import { config } from "../config"
|
import { config } from "../config"
|
||||||
@@ -16,7 +14,6 @@ type MainNavProviderProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const MainNavProvider = ({ children }: MainNavProviderProps) => {
|
export const MainNavProvider = ({ children }: MainNavProviderProps) => {
|
||||||
const { isBrowser } = useIsBrowser()
|
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
const navigationDropdownItems = useMemo(
|
const navigationDropdownItems = useMemo(
|
||||||
() =>
|
() =>
|
||||||
@@ -26,15 +23,6 @@ export const MainNavProvider = ({ children }: MainNavProviderProps) => {
|
|||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|
||||||
const reportLink = useMemo(
|
|
||||||
() =>
|
|
||||||
formatReportLink(
|
|
||||||
config.titleSuffix || "",
|
|
||||||
isBrowser ? document.title : ""
|
|
||||||
),
|
|
||||||
[isBrowser]
|
|
||||||
)
|
|
||||||
|
|
||||||
const editDate = useMemo(
|
const editDate = useMemo(
|
||||||
() =>
|
() =>
|
||||||
(generatedEditDates as Record<string, string>)[
|
(generatedEditDates as Record<string, string>)[
|
||||||
@@ -44,11 +32,7 @@ export const MainNavProvider = ({ children }: MainNavProviderProps) => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<UiMainNavProvider
|
<UiMainNavProvider navItems={navigationDropdownItems} editDate={editDate}>
|
||||||
navItems={navigationDropdownItems}
|
|
||||||
reportIssueLink={reportLink}
|
|
||||||
editDate={editDate}
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</UiMainNavProvider>
|
</UiMainNavProvider>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
import {
|
import {
|
||||||
Feedback as UiFeedback,
|
Feedback as UiFeedback,
|
||||||
FeedbackProps as UiFeedbackProps,
|
FeedbackProps as UiFeedbackProps,
|
||||||
formatReportLink,
|
|
||||||
} from "docs-ui"
|
} from "docs-ui"
|
||||||
import { usePathname } from "next/navigation"
|
import { usePathname } from "next/navigation"
|
||||||
import { absoluteUrl } from "@/lib/absolute-url"
|
import { absoluteUrl } from "@/lib/absolute-url"
|
||||||
@@ -20,7 +19,6 @@ export const Feedback = ({ title, ...props }: FeedbackProps) => {
|
|||||||
<UiFeedback
|
<UiFeedback
|
||||||
event="survey"
|
event="survey"
|
||||||
pathName={absoluteUrl(pathname)}
|
pathName={absoluteUrl(pathname)}
|
||||||
reportLink={formatReportLink("UI Docs", title, "ui")}
|
|
||||||
extraData={{
|
extraData={{
|
||||||
section: title,
|
section: title,
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
formatReportLink,
|
|
||||||
getNavDropdownItems,
|
getNavDropdownItems,
|
||||||
MainNavProvider as UiMainNavProvider,
|
MainNavProvider as UiMainNavProvider,
|
||||||
useIsBrowser,
|
|
||||||
} from "docs-ui"
|
} from "docs-ui"
|
||||||
import { useMemo } from "react"
|
import { useMemo } from "react"
|
||||||
import { siteConfig } from "../config/site"
|
import { siteConfig } from "../config/site"
|
||||||
@@ -14,7 +12,6 @@ type MainNavProviderProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const MainNavProvider = ({ children }: MainNavProviderProps) => {
|
export const MainNavProvider = ({ children }: MainNavProviderProps) => {
|
||||||
const { isBrowser } = useIsBrowser()
|
|
||||||
const navigationDropdownItems = useMemo(
|
const navigationDropdownItems = useMemo(
|
||||||
() =>
|
() =>
|
||||||
getNavDropdownItems({
|
getNavDropdownItems({
|
||||||
@@ -23,16 +20,8 @@ export const MainNavProvider = ({ children }: MainNavProviderProps) => {
|
|||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|
||||||
const reportLink = useMemo(
|
|
||||||
() => formatReportLink("UI Docs", isBrowser ? document.title : "", "ui"),
|
|
||||||
[isBrowser]
|
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<UiMainNavProvider
|
<UiMainNavProvider navItems={navigationDropdownItems}>
|
||||||
navItems={navigationDropdownItems}
|
|
||||||
reportIssueLink={reportLink}
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</UiMainNavProvider>
|
</UiMainNavProvider>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,11 +3,8 @@
|
|||||||
import {
|
import {
|
||||||
Feedback as UiFeedback,
|
Feedback as UiFeedback,
|
||||||
FeedbackProps as UiFeedbackProps,
|
FeedbackProps as UiFeedbackProps,
|
||||||
formatReportLink,
|
|
||||||
useIsBrowser,
|
|
||||||
} from "docs-ui"
|
} from "docs-ui"
|
||||||
import { usePathname } from "next/navigation"
|
import { usePathname } from "next/navigation"
|
||||||
import { config } from "../../config"
|
|
||||||
import { basePathUrl } from "../../utils/base-path-url"
|
import { basePathUrl } from "../../utils/base-path-url"
|
||||||
import { useMemo } from "react"
|
import { useMemo } from "react"
|
||||||
|
|
||||||
@@ -15,23 +12,13 @@ type FeedbackProps = Omit<UiFeedbackProps, "event" | "pathName">
|
|||||||
|
|
||||||
const Feedback = (props: FeedbackProps) => {
|
const Feedback = (props: FeedbackProps) => {
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
const { isBrowser } = useIsBrowser()
|
|
||||||
|
|
||||||
const feedbackPathname = useMemo(() => basePathUrl(pathname), [pathname])
|
const feedbackPathname = useMemo(() => basePathUrl(pathname), [pathname])
|
||||||
const reportLink = useMemo(
|
|
||||||
() =>
|
|
||||||
formatReportLink(
|
|
||||||
config.titleSuffix || "",
|
|
||||||
isBrowser ? document.title : ""
|
|
||||||
),
|
|
||||||
[isBrowser]
|
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<UiFeedback
|
<UiFeedback
|
||||||
event="survey"
|
event="survey"
|
||||||
pathName={feedbackPathname}
|
pathName={feedbackPathname}
|
||||||
reportLink={reportLink}
|
|
||||||
question="Was this chapter helpful?"
|
question="Was this chapter helpful?"
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
formatReportLink,
|
|
||||||
getNavDropdownItems,
|
getNavDropdownItems,
|
||||||
MainNavProvider as UiMainNavProvider,
|
MainNavProvider as UiMainNavProvider,
|
||||||
useIsBrowser,
|
|
||||||
} from "docs-ui"
|
} from "docs-ui"
|
||||||
import { useMemo } from "react"
|
import { useMemo } from "react"
|
||||||
import { config } from "../config"
|
import { config } from "../config"
|
||||||
@@ -14,7 +12,6 @@ type MainNavProviderProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const MainNavProvider = ({ children }: MainNavProviderProps) => {
|
export const MainNavProvider = ({ children }: MainNavProviderProps) => {
|
||||||
const { isBrowser } = useIsBrowser()
|
|
||||||
const navigationDropdownItems = useMemo(
|
const navigationDropdownItems = useMemo(
|
||||||
() =>
|
() =>
|
||||||
getNavDropdownItems({
|
getNavDropdownItems({
|
||||||
@@ -23,20 +20,8 @@ export const MainNavProvider = ({ children }: MainNavProviderProps) => {
|
|||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|
||||||
const reportLink = useMemo(
|
|
||||||
() =>
|
|
||||||
formatReportLink(
|
|
||||||
config.titleSuffix || "",
|
|
||||||
isBrowser ? document.title : ""
|
|
||||||
),
|
|
||||||
[isBrowser]
|
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<UiMainNavProvider
|
<UiMainNavProvider navItems={navigationDropdownItems}>
|
||||||
navItems={navigationDropdownItems}
|
|
||||||
reportIssueLink={reportLink}
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</UiMainNavProvider>
|
</UiMainNavProvider>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import clsx from "clsx"
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import { Link, Tooltip } from "@/components"
|
import { Link, Tooltip } from "@/components"
|
||||||
import { ExclamationCircle, PlaySolid } from "@medusajs/icons"
|
import { ExclamationCircle, PlaySolid } from "@medusajs/icons"
|
||||||
import { GITHUB_ISSUES_PREFIX } from "@/constants"
|
import { GITHUB_ISSUES_LINK } from "@/constants"
|
||||||
import { CodeBlockCopyAction } from "./Copy"
|
import { CodeBlockCopyAction } from "./Copy"
|
||||||
|
|
||||||
export type CodeBlockActionsProps = {
|
export type CodeBlockActionsProps = {
|
||||||
@@ -109,9 +109,7 @@ export const CodeBlockActions = ({
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Link
|
<Link
|
||||||
href={`${GITHUB_ISSUES_PREFIX}&title=${encodeURIComponent(
|
href={GITHUB_ISSUES_LINK}
|
||||||
`Docs(Code Issue): `
|
|
||||||
)}`}
|
|
||||||
target="_blank"
|
target="_blank"
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"bg-transparent border-none cursor-pointer rounded",
|
"bg-transparent border-none cursor-pointer rounded",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import React, { useRef, useState } from "react"
|
import React, { useMemo, useRef, useState } from "react"
|
||||||
// @ts-expect-error can't install the types package because it doesn't support React v19
|
// @ts-expect-error can't install the types package because it doesn't support React v19
|
||||||
import { CSSTransition, SwitchTransition } from "react-transition-group"
|
import { CSSTransition, SwitchTransition } from "react-transition-group"
|
||||||
import { Solutions } from "./Solutions"
|
import { Solutions } from "./Solutions"
|
||||||
@@ -16,6 +16,7 @@ import {
|
|||||||
} from "@/components"
|
} from "@/components"
|
||||||
import { ChatBubbleLeftRight, ThumbDown, ThumbUp } from "@medusajs/icons"
|
import { ChatBubbleLeftRight, ThumbDown, ThumbUp } from "@medusajs/icons"
|
||||||
import Link from "next/link"
|
import Link from "next/link"
|
||||||
|
import { useSiteConfig } from "../../providers"
|
||||||
|
|
||||||
export type FeedbackProps = {
|
export type FeedbackProps = {
|
||||||
event: string
|
event: string
|
||||||
@@ -39,7 +40,7 @@ export type FeedbackProps = {
|
|||||||
export const Feedback = ({
|
export const Feedback = ({
|
||||||
event,
|
event,
|
||||||
pathName,
|
pathName,
|
||||||
reportLink,
|
reportLink: initReportLink,
|
||||||
question = "Was this page helpful?",
|
question = "Was this page helpful?",
|
||||||
positiveBtn = "It was helpful",
|
positiveBtn = "It was helpful",
|
||||||
negativeBtn = "It wasn't helpful",
|
negativeBtn = "It wasn't helpful",
|
||||||
@@ -54,6 +55,12 @@ export const Feedback = ({
|
|||||||
showLongForm = false,
|
showLongForm = false,
|
||||||
showDottedSeparator = true,
|
showDottedSeparator = true,
|
||||||
}: FeedbackProps) => {
|
}: FeedbackProps) => {
|
||||||
|
const {
|
||||||
|
config: { reportIssueLink },
|
||||||
|
} = useSiteConfig()
|
||||||
|
const reportLink = useMemo(() => {
|
||||||
|
return initReportLink || reportIssueLink
|
||||||
|
}, [initReportLink, reportIssueLink])
|
||||||
const [showForm, setShowForm] = useState(false)
|
const [showForm, setShowForm] = useState(false)
|
||||||
const [submittedFeedback, setSubmittedFeedback] = useState(false)
|
const [submittedFeedback, setSubmittedFeedback] = useState(false)
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type MainNavProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const MainNav = ({ className, itemsClassName }: MainNavProps) => {
|
export const MainNav = ({ className, itemsClassName }: MainNavProps) => {
|
||||||
const { reportIssueLink, editDate } = useMainNav()
|
const { editDate } = useMainNav()
|
||||||
const { setMobileSidebarOpen, isSidebarShown } = useSidebar()
|
const { setMobileSidebarOpen, isSidebarShown } = useSidebar()
|
||||||
const { config } = useSiteConfig()
|
const { config } = useSiteConfig()
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ export const MainNav = ({ className, itemsClassName }: MainNavProps) => {
|
|||||||
<MainNavVersion />
|
<MainNavVersion />
|
||||||
{editDate && <MainNavEditDate date={editDate} />}
|
{editDate && <MainNavEditDate date={editDate} />}
|
||||||
<LinkButton
|
<LinkButton
|
||||||
href={reportIssueLink}
|
href={config.reportIssueLink || ""}
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
className="text-compact-small-plus"
|
className="text-compact-small-plus"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { OptionType } from "@/hooks"
|
import { OptionType } from "@/hooks"
|
||||||
import { NavigationItem } from "types"
|
import { NavigationItem } from "types"
|
||||||
|
|
||||||
export const GITHUB_ISSUES_PREFIX = `https://github.com/medusajs/medusa/issues/new?assignees=&labels=type%3A+docs&template=docs.yml`
|
export const GITHUB_ISSUES_LINK =
|
||||||
export const GITHUB_UI_ISSUES_PREFIX = `https://github.com/medusajs/ui/issues/new?labels=documentation`
|
"https://github.com/medusajs/medusa/issues/new/choose"
|
||||||
|
|
||||||
export const navDropdownItems: NavigationItem[] = [
|
export const navDropdownItems: NavigationItem[] = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ export type MainNavContext = {
|
|||||||
navItems: NavigationItem[]
|
navItems: NavigationItem[]
|
||||||
activeItemIndex?: number
|
activeItemIndex?: number
|
||||||
activeItem?: NavigationItem
|
activeItem?: NavigationItem
|
||||||
reportIssueLink: string
|
|
||||||
editDate?: string
|
editDate?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,14 +16,12 @@ const MainNavContext = createContext<MainNavContext | null>(null)
|
|||||||
|
|
||||||
export type MainNavProviderProps = {
|
export type MainNavProviderProps = {
|
||||||
navItems: NavigationItem[]
|
navItems: NavigationItem[]
|
||||||
reportIssueLink: string
|
|
||||||
editDate?: string
|
editDate?: string
|
||||||
children?: React.ReactNode
|
children?: React.ReactNode
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MainNavProvider = ({
|
export const MainNavProvider = ({
|
||||||
navItems,
|
navItems,
|
||||||
reportIssueLink,
|
|
||||||
children,
|
children,
|
||||||
editDate,
|
editDate,
|
||||||
}: MainNavProviderProps) => {
|
}: MainNavProviderProps) => {
|
||||||
@@ -90,7 +87,6 @@ export const MainNavProvider = ({
|
|||||||
value={{
|
value={{
|
||||||
navItems,
|
navItems,
|
||||||
activeItemIndex,
|
activeItemIndex,
|
||||||
reportIssueLink,
|
|
||||||
editDate,
|
editDate,
|
||||||
activeItem,
|
activeItem,
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import React, { createContext, useContext, useState } from "react"
|
import React, { createContext, useContext, useState } from "react"
|
||||||
import { DocsConfig } from "types"
|
import { DocsConfig } from "types"
|
||||||
import { globalConfig } from "../../global-config"
|
import { globalConfig } from "../../global-config"
|
||||||
|
import { GITHUB_ISSUES_LINK } from "../.."
|
||||||
|
|
||||||
export type SiteConfigContextType = {
|
export type SiteConfigContextType = {
|
||||||
config: DocsConfig
|
config: DocsConfig
|
||||||
@@ -21,7 +22,8 @@ export const SiteConfigProvider = ({
|
|||||||
children,
|
children,
|
||||||
}: SiteConfigProviderProps) => {
|
}: SiteConfigProviderProps) => {
|
||||||
const [config, setConfig] = useState<DocsConfig>(
|
const [config, setConfig] = useState<DocsConfig>(
|
||||||
initConfig || {
|
Object.assign(
|
||||||
|
{
|
||||||
baseUrl: "",
|
baseUrl: "",
|
||||||
sidebar: {
|
sidebar: {
|
||||||
default: [],
|
default: [],
|
||||||
@@ -34,8 +36,11 @@ export const SiteConfigProvider = ({
|
|||||||
breadcrumbOptions: {
|
breadcrumbOptions: {
|
||||||
showCategories: true,
|
showCategories: true,
|
||||||
},
|
},
|
||||||
...globalConfig,
|
reportIssueLink: GITHUB_ISSUES_LINK,
|
||||||
}
|
},
|
||||||
|
globalConfig,
|
||||||
|
initConfig || {}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
import { GITHUB_ISSUES_PREFIX, GITHUB_UI_ISSUES_PREFIX } from "../constants"
|
|
||||||
|
|
||||||
export type ReportLinkType = "default" | "ui"
|
|
||||||
|
|
||||||
export function formatReportLink(
|
|
||||||
title: string,
|
|
||||||
sectionTitle: string,
|
|
||||||
type?: ReportLinkType
|
|
||||||
) {
|
|
||||||
let prefix = GITHUB_ISSUES_PREFIX
|
|
||||||
if (type === "ui") {
|
|
||||||
prefix = GITHUB_UI_ISSUES_PREFIX
|
|
||||||
}
|
|
||||||
return `${prefix}&title=${encodeURI(title)}%3A%20Issue%20in%20${encodeURI(
|
|
||||||
sectionTitle
|
|
||||||
)}`
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,6 @@ export * from "./capitalize"
|
|||||||
export * from "./check-sidebar-item-visibility"
|
export * from "./check-sidebar-item-visibility"
|
||||||
export * from "./decode-str"
|
export * from "./decode-str"
|
||||||
export * from "./dom-utils"
|
export * from "./dom-utils"
|
||||||
export * from "./format-report-link"
|
|
||||||
export * from "./get-link-with-base-path"
|
export * from "./get-link-with-base-path"
|
||||||
export * from "./get-navbar-items"
|
export * from "./get-navbar-items"
|
||||||
export * from "./get-os-shortcut"
|
export * from "./get-os-shortcut"
|
||||||
|
|||||||
@@ -20,4 +20,5 @@ export declare type DocsConfig = {
|
|||||||
number: string
|
number: string
|
||||||
releaseUrl: string
|
releaseUrl: string
|
||||||
}
|
}
|
||||||
|
reportIssueLink?: string
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user