Skip to content

Commit 1b61844

Browse files
committed
0 docs - Update
1 parent f1ade87 commit 1b61844

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+11972
-2907
lines changed

docs/.eslintrc.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@ yarn-error.log*
2525
# others
2626
.env*.local
2727
.vercel
28-
next-env.d.ts
28+
next-env.d.ts
29+
30+
# openapi
31+
content/docs/openapi/**/*.mdx
32+
!content/docs/openapi/index.mdx

docs/app/(docs)/[[...slug]]/page.tsx.bak2 renamed to docs/app/(docs)/[...slug]/page.tsx

Lines changed: 46 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,36 @@
11
import type { Metadata } from 'next';
2-
import {
3-
DocsBody,
4-
DocsDescription,
5-
DocsPage,
6-
DocsTitle,
7-
} from 'fumadocs-ui/page';
8-
import { notFound } from 'next/navigation';
9-
import {
10-
type ComponentProps,
11-
type FC,
12-
type ReactElement,
13-
type ReactNode,
14-
} from 'react';
2+
import { type ComponentProps, type FC, type ReactNode } from 'react';
153
import * as Twoslash from 'fumadocs-twoslash/ui';
164
import { Callout } from 'fumadocs-ui/components/callout';
175
import { TypeTable } from 'fumadocs-ui/components/type-table';
186
import * as Preview from '@/components/preview';
197
import { createMetadata } from '@/lib/metadata';
20-
import { openapi, source } from '@/lib/source';
8+
import { source } from '@/lib/source';
219
import { Wrapper } from '@/components/preview/wrapper';
2210
import { Mermaid } from '@/components/mdx/mermaid';
23-
import { Rate } from '@/components/rate';
11+
import { Feedback } from '@/components/feedback';
2412
import { onRateAction, owner, repo } from '@/lib/github';
2513
import {
2614
HoverCard,
2715
HoverCardContent,
2816
HoverCardTrigger,
2917
} from '@/components/ui/hover-card';
3018
import Link from 'fumadocs-core/link';
31-
import { UiOverview } from '@/components/ui-overview';
3219
import { AutoTypeTable } from 'fumadocs-typescript/ui';
3320
import { createGenerator } from 'fumadocs-typescript';
34-
import { getPageTreePeers } from 'fumadocs-core/server';
21+
import { getPageTreePeers } from 'fumadocs-core/page-tree';
3522
import { Card, Cards } from 'fumadocs-ui/components/card';
3623
import { getMDXComponents } from '@/mdx-components';
3724
import { APIPage } from 'fumadocs-openapi/ui';
38-
import { EditOnGitHub, LLMCopyButton } from './page.client';
25+
import { LLMCopyButton, ViewOptions } from '@/components/ai/page-actions';
26+
import * as path from 'node:path';
27+
import { Banner } from 'fumadocs-ui/components/banner';
28+
import { openapi } from '@/lib/openapi';
29+
import { Installation } from '@/components/preview/installation';
30+
import { Customisation } from '@/components/preview/customisation';
31+
import { DocsPage } from 'fumadocs-ui/page';
32+
import { NotFound } from '@/components/not-found';
33+
// import { getSuggestions } from '@/app/(docs)/[...slug]/suggestions';
3934

4035
function PreviewRenderer({ preview }: { preview: string }): ReactNode {
4136
if (preview && preview in Preview) {
@@ -50,48 +45,46 @@ const generator = createGenerator();
5045

5146
export const revalidate = false;
5247

53-
export default async function Page(props: {
54-
params: Promise<{ slug: string[] }>;
55-
}): Promise<ReactElement> {
48+
export default async function Page(props: PageProps<'/[...slug]'>) {
5649
const params = await props.params;
5750
const page = source.getPage(params.slug);
5851

59-
if (!page) notFound();
52+
if (!page)
53+
return (
54+
// <NotFound getSuggestions={() => getSuggestions(params.slug.join(' '))} />
55+
<NotFound getSuggestions={() => Promise.resolve([])} />
56+
);
6057

61-
const path = `apps/docs/content/docs/${page.file.path}`;
6258
const preview = page.data.preview;
63-
const { body: Mdx, toc } = await page.data.load();
59+
const { body: Mdx, toc, lastModified } = page.data;
6460

6561
return (
6662
<DocsPage
6763
toc={toc}
68-
full={page.data.full}
64+
lastUpdate={lastModified ? new Date(lastModified) : undefined}
6965
tableOfContent={{
7066
style: 'clerk',
71-
single: false,
72-
}}
73-
article={{
74-
className: 'max-sm:pb-16',
7567
}}
7668
>
77-
<DocsTitle>{page.data.title}</DocsTitle>
78-
<DocsDescription className="mb-0">
69+
<h1 className="text-[1.75em] font-semibold">{page.data.title}</h1>
70+
<p className="text-lg text-fd-muted-foreground">
7971
{page.data.description}
80-
</DocsDescription>
81-
<div className="flex flex-row gap-2 items-center mb-4">
82-
<LLMCopyButton slug={params.slug} />
83-
<EditOnGitHub
84-
url={`https://github.com/${owner}/${repo}/blob/dev/${path}`}
72+
</p>
73+
<div className="flex flex-row gap-2 items-center border-b pt-2 pb-6">
74+
<LLMCopyButton markdownUrl={`${page.url}.mdx`} />
75+
<ViewOptions
76+
markdownUrl={`${page.url}.mdx`}
77+
githubUrl={`https://github.com/${owner}/${repo}/blob/master/docs/content/docs/${page.path}`}
8578
/>
8679
</div>
87-
<DocsBody className="text-fd-foreground/80">
80+
<div className="prose flex-1 text-fd-foreground/90">
8881
{preview ? <PreviewRenderer preview={preview} /> : null}
8982
<Mdx
9083
components={getMDXComponents({
9184
...Twoslash,
9285
a: ({ href, ...props }) => {
9386
const found = source.getPageByHref(href ?? '', {
94-
dir: page.file.dirname,
87+
dir: path.dirname(page.path),
9588
});
9689

9790
if (!found) return <Link href={href} {...props} />;
@@ -117,6 +110,7 @@ export default async function Page(props: {
117110
</HoverCard>
118111
);
119112
},
113+
Banner,
120114
Mermaid,
121115
TypeTable,
122116
AutoTypeTable: (props) => (
@@ -128,15 +122,13 @@ export default async function Page(props: {
128122
DocsCategory: ({ url }) => {
129123
return <DocsCategory url={url ?? page.url} />;
130124
},
131-
UiOverview,
132-
133-
...(await import('@/content/docs/ui/components/tabs.client')),
134-
...(await import('@/content/docs/ui/theme.client')),
125+
Installation,
126+
Customisation,
135127
})}
136128
/>
137129
{page.data.index ? <DocsCategory url={page.url} /> : null}
138-
</DocsBody>
139-
<Rate onRateAction={onRateAction} />
130+
</div>
131+
<Feedback onRateAction={onRateAction} />
140132
</DocsPage>
141133
);
142134
}
@@ -153,18 +145,21 @@ function DocsCategory({ url }: { url: string }) {
153145
);
154146
}
155147

156-
export async function generateMetadata(props: {
157-
params: Promise<{ slug: string[] }>;
158-
}): Promise<Metadata> {
148+
export async function generateMetadata(
149+
props: PageProps<'/[...slug]'>,
150+
): Promise<Metadata> {
159151
const { slug = [] } = await props.params;
160152
const page = source.getPage(slug);
161-
if (!page) notFound();
153+
if (!page)
154+
return createMetadata({
155+
title: 'Not Found',
156+
});
162157

163158
const description =
164-
page.data.description ?? 'The library for building documentation sites';
159+
page.data.description ?? 'The platform for building ai-driven automations';
165160

166161
const image = {
167-
url: ['/og', ...slug, 'image.png'].join('/'),
162+
url: ['/og', ...slug, 'image.webp'].join('/'),
168163
width: 1200,
169164
height: 630,
170165
};
@@ -173,7 +168,7 @@ export async function generateMetadata(props: {
173168
title: page.data.title,
174169
description,
175170
openGraph: {
176-
url: `/docs/${page.slugs.join('/')}`,
171+
url: `/${page.slugs.join('/')}`,
177172
images: [image],
178173
},
179174
twitter: {
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { OramaClient } from '@oramacloud/client';
2+
import type { Suggestion } from '@/components/not-found';
3+
4+
const client = new OramaClient({
5+
endpoint: 'https://cloud.orama.run/v1/indexes/docs-fk97oe',
6+
api_key: '',
7+
});
8+
9+
export async function getSuggestions(pathname: string): Promise<Suggestion[]> {
10+
const results = await client.search({
11+
term: pathname,
12+
mode: 'vector',
13+
groupBy: {
14+
properties: ['url'],
15+
maxResult: 1,
16+
},
17+
});
18+
19+
if (!results?.groups) return [];
20+
21+
return results.groups.map((group) => {
22+
const doc = group.result[0];
23+
24+
return {
25+
id: doc.id,
26+
href: doc.document.url,
27+
title: doc.document.title,
28+
};
29+
});
30+
}

docs/app/(docs)/[[...slug]]/page.client.tsx

Lines changed: 0 additions & 70 deletions
This file was deleted.

docs/app/(docs)/[[...slug]]/page.tsx

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)