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:
Shahed Nasser
2024-05-13 11:32:52 +03:00
committed by GitHub
parent 3e3b8a483f
commit 728c5ee53c
62 changed files with 855 additions and 506 deletions
+2 -1
View File
@@ -15,4 +15,5 @@ ANALYZE_BUNDLE=
NEXT_PUBLIC_AI_ASSISTANT_URL=
NEXT_PUBLIC_AI_WEBSITE_ID=
NEXT_PUBLIC_AI_API_ASSISTANT_RECAPTCHA_SITE_KEY=
NEXT_PUBLIC_VERSIONING=
NEXT_PUBLIC_VERSIONING=
NEXT_PUBLIC_SHOW_V2=
@@ -24,6 +24,7 @@ const Navbar = () => {
getNavbarItems({
basePath: config.baseUrl,
activePath: pathname,
version: process.env.NEXT_PUBLIC_SHOW_V2 ? "v1" : "legacy",
}),
[pathname]
)
+2 -2
View File
@@ -1,5 +1,5 @@
import { DocsConfig } from "types"
import { mobileSidebarItems } from "docs-ui"
import { mobileSidebarItemsV1, legacyMobileSidebarItems } from "docs-ui"
export const config: DocsConfig = {
baseUrl: process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000",
@@ -13,6 +13,6 @@ export const config: DocsConfig = {
},
],
bottom: [],
mobile: mobileSidebarItems,
mobile: process.env.NEXT_PUBLIC_SHOW_V2 ? mobileSidebarItemsV1 : legacyMobileSidebarItems,
},
}
+37 -23
View File
@@ -4,30 +4,44 @@ import bundleAnalyzer from "@next/bundle-analyzer"
/** @type {import('next').NextConfig} */
const nextConfig = {
async rewrites() {
const fallbacks = [
{
source: "/ui",
destination: `${process.env.NEXT_PUBLIC_UI_URL}/ui`,
},
{
source: "/ui/:path*",
destination: `${process.env.NEXT_PUBLIC_UI_URL}/ui/:path*`,
},
{
source: "/:path*",
destination: `${process.env.NEXT_PUBLIC_DOCS_URL}/:path*`,
},
]
if (process.env.NEXT_PUBLIC_SHOW_V2) {
fallbacks.push(
{
source: "/v2/resources",
destination: `${process.env.NEXT_PUBLIC_DOCS_V2_URL}/v2/resources`,
},
{
source: "/v2/resources/:path*",
destination: `${process.env.NEXT_PUBLIC_DOCS_V2_URL}/v2/resources/:path*`,
},
{
source: "/v2",
destination: `${process.env.NEXT_PUBLIC_DOCS_V2_URL}/v2`,
},
{
source: "/v2/:path*",
destination: `${process.env.NEXT_PUBLIC_DOCS_V2_URL}/v2/:path*`,
}
)
}
return {
fallback: [
{
source: "/ui",
destination: `${process.env.NEXT_PUBLIC_UI_URL}/ui`,
},
{
source: "/ui/:path*",
destination: `${process.env.NEXT_PUBLIC_UI_URL}/ui/:path*`,
},
// TODO uncomment for v2
// {
// source: "/v2",
// destination: `${process.env.NEXT_PUBLIC_DOCS_V2_URL}/resources`,
// },
// {
// source: "/v2/:path*",
// destination: `${process.env.NEXT_PUBLIC_DOCS_V2_URL}/resources/:path*`,
// },
{
source: "/:path*",
destination: `${process.env.NEXT_PUBLIC_DOCS_URL}/:path*`,
},
],
fallback: fallbacks,
}
},
webpack: (config) => {
+2 -2
View File
@@ -5,7 +5,7 @@ import {
SearchProvider as UiSearchProvider,
AiAssistantCommandIcon,
AiAssistantProvider,
searchFilters,
searchFiltersV1,
} from "docs-ui"
import { config } from "../config"
@@ -53,7 +53,7 @@ const SearchProvider = ({ children }: SearchProviderProps) => {
checkInternalPattern: new RegExp(
`^${config.baseUrl}/api/(admin|store)`
),
filterOptions: searchFilters,
filterOptions: searchFiltersV1,
}}
commands={[
{
@@ -1,7 +1,6 @@
"use client"
import {
SidebarProvider as UiSidebarProvider,
mobileSidebarItems,
usePageLoading,
useScrollController,
} from "docs-ui"