mirror of
https://github.com/MODSetter/SurfSense.git
synced 2025-09-02 18:49:09 +00:00
feat: Added FumaDocs
This commit is contained in:
parent
3155e7b0ac
commit
0436d2ab64
16 changed files with 1919 additions and 8 deletions
5
surfsense_web/.source/index.ts
Normal file
5
surfsense_web/.source/index.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
// @ts-nocheck -- skip type checking
|
||||||
|
import * as docs_0 from "../content/docs/index.mdx?collection=docs&hash=1745310068376"
|
||||||
|
import { _runtime } from "fumadocs-mdx"
|
||||||
|
import * as _source from "../source.config"
|
||||||
|
export const docs = _runtime.docs<typeof _source.docs>([{ info: {"path":"index.mdx","absolutePath":"C:/Users/91882/Documents/SurfSense/surfsense_web/content/docs/index.mdx"}, data: docs_0 }], [])
|
8
surfsense_web/.source/source.config.mjs
Normal file
8
surfsense_web/.source/source.config.mjs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
// source.config.ts
|
||||||
|
import { defineDocs } from "fumadocs-mdx/config";
|
||||||
|
var docs = defineDocs({
|
||||||
|
dir: "content/docs"
|
||||||
|
});
|
||||||
|
export {
|
||||||
|
docs
|
||||||
|
};
|
4
surfsense_web/app/api/search/route.ts
Normal file
4
surfsense_web/app/api/search/route.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
import { source } from '@/lib/source';
|
||||||
|
import { createFromSource } from 'fumadocs-core/search/server';
|
||||||
|
|
||||||
|
export const { GET } = createFromSource(source);
|
46
surfsense_web/app/docs/[[...slug]]/page.tsx
Normal file
46
surfsense_web/app/docs/[[...slug]]/page.tsx
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
import { source } from '@/lib/source';
|
||||||
|
import {
|
||||||
|
DocsBody,
|
||||||
|
DocsDescription,
|
||||||
|
DocsPage,
|
||||||
|
DocsTitle,
|
||||||
|
} from 'fumadocs-ui/page';
|
||||||
|
import { notFound } from 'next/navigation';
|
||||||
|
import { getMDXComponents } from '@/mdx-components';
|
||||||
|
|
||||||
|
export default async function Page(props: {
|
||||||
|
params: Promise<{ slug?: string[] }>;
|
||||||
|
}) {
|
||||||
|
const params = await props.params;
|
||||||
|
const page = source.getPage(params.slug);
|
||||||
|
if (!page) notFound();
|
||||||
|
|
||||||
|
const MDX = page.data.body;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DocsPage toc={page.data.toc} full={page.data.full}>
|
||||||
|
<DocsTitle>{page.data.title}</DocsTitle>
|
||||||
|
<DocsDescription>{page.data.description}</DocsDescription>
|
||||||
|
<DocsBody>
|
||||||
|
<MDX components={getMDXComponents()} />
|
||||||
|
</DocsBody>
|
||||||
|
</DocsPage>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function generateStaticParams() {
|
||||||
|
return source.generateParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function generateMetadata(props: {
|
||||||
|
params: Promise<{ slug?: string[] }>;
|
||||||
|
}) {
|
||||||
|
const params = await props.params;
|
||||||
|
const page = source.getPage(params.slug);
|
||||||
|
if (!page) notFound();
|
||||||
|
|
||||||
|
return {
|
||||||
|
title: page.data.title,
|
||||||
|
description: page.data.description,
|
||||||
|
};
|
||||||
|
}
|
12
surfsense_web/app/docs/layout.tsx
Normal file
12
surfsense_web/app/docs/layout.tsx
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import { source } from '@/lib/source';
|
||||||
|
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
|
||||||
|
import type { ReactNode } from 'react';
|
||||||
|
import { baseOptions } from '@/app/layout.config';
|
||||||
|
|
||||||
|
export default function Layout({ children }: { children: ReactNode }) {
|
||||||
|
return (
|
||||||
|
<DocsLayout tree={source.pageTree} {...baseOptions}>
|
||||||
|
{children}
|
||||||
|
</DocsLayout>
|
||||||
|
);
|
||||||
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
@import "tailwindcss";
|
@import 'tailwindcss';
|
||||||
|
@import 'fumadocs-ui/css/neutral.css';
|
||||||
|
@import 'fumadocs-ui/css/preset.css';
|
||||||
|
|
||||||
@plugin "tailwindcss-animate";
|
@plugin "tailwindcss-animate";
|
||||||
|
|
||||||
|
|
7
surfsense_web/app/layout.config.tsx
Normal file
7
surfsense_web/app/layout.config.tsx
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
|
||||||
|
|
||||||
|
export const baseOptions: BaseLayoutProps = {
|
||||||
|
nav: {
|
||||||
|
title: 'SurfSense Documentation',
|
||||||
|
},
|
||||||
|
};
|
|
@ -5,6 +5,7 @@ import { Roboto } from "next/font/google";
|
||||||
|
|
||||||
import { Toaster } from "@/components/ui/sonner";
|
import { Toaster } from "@/components/ui/sonner";
|
||||||
import { ThemeProvider } from "@/components/theme/theme-provider";
|
import { ThemeProvider } from "@/components/theme/theme-provider";
|
||||||
|
import { RootProvider } from 'fumadocs-ui/provider';
|
||||||
|
|
||||||
const roboto = Roboto({
|
const roboto = Roboto({
|
||||||
subsets: ["latin"],
|
subsets: ["latin"],
|
||||||
|
@ -64,8 +65,10 @@ export default async function RootLayout({
|
||||||
disableTransitionOnChange
|
disableTransitionOnChange
|
||||||
defaultTheme="light"
|
defaultTheme="light"
|
||||||
>
|
>
|
||||||
{children}
|
<RootProvider>
|
||||||
<Toaster />
|
{children}
|
||||||
|
<Toaster />
|
||||||
|
</RootProvider>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
7
surfsense_web/content/docs/index.mdx
Normal file
7
surfsense_web/content/docs/index.mdx
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
title: Welcome Docs
|
||||||
|
---
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
I love Docs.
|
7
surfsense_web/lib/source.ts
Normal file
7
surfsense_web/lib/source.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import { docs } from '@/.source';
|
||||||
|
import { loader } from 'fumadocs-core/source';
|
||||||
|
|
||||||
|
export const source = loader({
|
||||||
|
baseUrl: '/docs',
|
||||||
|
source: docs.toFumadocsSource(),
|
||||||
|
});
|
9
surfsense_web/mdx-components.tsx
Normal file
9
surfsense_web/mdx-components.tsx
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import defaultMdxComponents from 'fumadocs-ui/mdx';
|
||||||
|
import type { MDXComponents } from 'mdx/types';
|
||||||
|
|
||||||
|
export function getMDXComponents(components?: MDXComponents): MDXComponents {
|
||||||
|
return {
|
||||||
|
...defaultMdxComponents,
|
||||||
|
...components,
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
import type { NextConfig } from "next";
|
import type { NextConfig } from "next";
|
||||||
|
import { createMDX } from 'fumadocs-mdx/next';
|
||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
typescript: {
|
typescript: {
|
||||||
|
@ -9,4 +10,7 @@ const nextConfig: NextConfig = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
// Wrap the config with createMDX
|
||||||
|
const withMDX = createMDX({});
|
||||||
|
|
||||||
|
export default withMDX(nextConfig);
|
||||||
|
|
|
@ -4,13 +4,15 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "SurfSense Frontend",
|
"description": "SurfSense Frontend",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev --turbopack",
|
"dev": "next dev",
|
||||||
|
"dev:turbopack": "next dev --turbopack",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
"debug": "cross-env NODE_OPTIONS=--inspect next dev --turbopack",
|
"debug": "cross-env NODE_OPTIONS=--inspect next dev --turbopack",
|
||||||
"debug:browser": "cross-env NODE_OPTIONS=--inspect next dev --turbopack",
|
"debug:browser": "cross-env NODE_OPTIONS=--inspect next dev --turbopack",
|
||||||
"debug:server": "cross-env NODE_OPTIONS=--inspect=0.0.0.0:9229 next dev --turbopack"
|
"debug:server": "cross-env NODE_OPTIONS=--inspect=0.0.0.0:9229 next dev --turbopack",
|
||||||
|
"postinstall": "fumadocs-mdx"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ai-sdk/react": "^1.1.21",
|
"@ai-sdk/react": "^1.1.21",
|
||||||
|
@ -31,12 +33,16 @@
|
||||||
"@radix-ui/react-tooltip": "^1.1.8",
|
"@radix-ui/react-tooltip": "^1.1.8",
|
||||||
"@tabler/icons-react": "^3.30.0",
|
"@tabler/icons-react": "^3.30.0",
|
||||||
"@tanstack/react-table": "^8.21.2",
|
"@tanstack/react-table": "^8.21.2",
|
||||||
|
"@types/mdx": "^2.0.13",
|
||||||
"ai": "^4.1.54",
|
"ai": "^4.1.54",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"date-fns": "^4.1.0",
|
"date-fns": "^4.1.0",
|
||||||
"emblor": "^1.4.7",
|
"emblor": "^1.4.7",
|
||||||
"framer-motion": "^12.4.7",
|
"framer-motion": "^12.4.7",
|
||||||
|
"fumadocs-core": "^15.2.9",
|
||||||
|
"fumadocs-mdx": "^11.6.1",
|
||||||
|
"fumadocs-ui": "^15.2.9",
|
||||||
"geist": "^1.3.1",
|
"geist": "^1.3.1",
|
||||||
"lucide-react": "^0.477.0",
|
"lucide-react": "^0.477.0",
|
||||||
"next": "15.2.3",
|
"next": "15.2.3",
|
||||||
|
|
1788
surfsense_web/pnpm-lock.yaml
generated
1788
surfsense_web/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
5
surfsense_web/source.config.ts
Normal file
5
surfsense_web/source.config.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import { defineDocs } from 'fumadocs-mdx/config';
|
||||||
|
|
||||||
|
export const docs = defineDocs({
|
||||||
|
dir: 'content/docs',
|
||||||
|
});
|
|
@ -22,6 +22,6 @@
|
||||||
"@/*": ["./*"]
|
"@/*": ["./*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "next.config.mjs"],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue