Skip to content

Commit

Permalink
fix(docs): broken search not seeing the basePath when calling the api
Browse files Browse the repository at this point in the history
  • Loading branch information
matyson committed Apr 8, 2024
1 parent 5aedd64 commit d46eef9
Show file tree
Hide file tree
Showing 6 changed files with 876 additions and 390 deletions.
12 changes: 6 additions & 6 deletions apps/docs/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import "./global.css";
import { RootProvider } from "fumadocs-ui/provider";
import { Provider } from "@/components/providers";
import { Inter } from "next/font/google";
import type { ReactNode } from "react";
import type { Metadata } from 'next';
import type { Metadata } from "next";

const inter = Inter({
subsets: ["latin"],
});

export const metadata: Metadata = {
description: 'Pimega Annotator Documentation',
description: "Pimega Annotator Documentation",
title: {
template: '%s | pianno',
default: 'pianno',
template: "%s | pianno",
default: "pianno",
},
};

export default function Layout({ children }: { children: ReactNode }) {
return (
<html lang="en" className={inter.className}>
<body>
<RootProvider>{children}</RootProvider>
<Provider>{children}</Provider>
</body>
</html>
);
Expand Down
17 changes: 17 additions & 0 deletions apps/docs/components/providers.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"use client";

import { RootProvider } from "fumadocs-ui/provider";
import type { ReactNode } from "react";
import SearchDialog from "@/components/search";

export function Provider({ children }: { children: ReactNode }) {
return (
<RootProvider
search={{
SearchDialog,
}}
>
{children}
</RootProvider>
);
}
8 changes: 8 additions & 0 deletions apps/docs/components/search.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"use client";
import SearchDialog from "fumadocs-ui/components/dialog/search-default";
import type { SharedProps } from "fumadocs-ui/components/dialog/search";

export default function CustomSearchDialog(props: SharedProps) {
// hardcoded api path in the search dialog does not sees next basePath
return <SearchDialog api="/uwu/api/search" {...props} />;
}
10 changes: 5 additions & 5 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"build": "next build",
"clean": "rf -rf node_modules .turbo",
"clean": "rm -rf .next node_modules .turbo",
"dev": "next dev -p 4321",
"start": "next start"
},
Expand All @@ -14,11 +14,11 @@
"@radix-ui/react-slot": "^1.0.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"fumadocs-core": "8.1.1",
"fumadocs-mdx": "8.0.2",
"fumadocs-ui": "8.1.1",
"fumadocs-core": "10.1.3",
"fumadocs-mdx": "8.2.8",
"fumadocs-ui": "10.1.3",
"lucide-react": "^0.263.1",
"next": "14.0.4",
"next": "14.1.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwind-merge": "^2.2.1",
Expand Down
2 changes: 1 addition & 1 deletion apps/pianno/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"clean": "rm -rf .turbo node_modules",
"clean": "rm -rf .next .turbo node_modules",
"dev": "next dev",
"build": "next build",
"start": "next start",
Expand Down
Loading

0 comments on commit d46eef9

Please sign in to comment.