-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from classchartsapi/feat/fumadocs
Feat/fumadocs
- Loading branch information
Showing
89 changed files
with
3,613 additions
and
6,128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
NEXT_PUBLIC_PROXY_URL=http://localhost:8787 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,28 @@ | ||
# build output | ||
dist/ | ||
# generated types | ||
.astro/ | ||
# deps | ||
/node_modules | ||
|
||
# dependencies | ||
node_modules/ | ||
# generated content | ||
.contentlayer | ||
.content-collections | ||
.source | ||
|
||
# logs | ||
# test & build | ||
/coverage | ||
/.next/ | ||
/out/ | ||
/build | ||
*.tsbuildinfo | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
/.pnp | ||
.pnp.js | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
|
||
|
||
# environment variables | ||
.env | ||
.env.production | ||
|
||
# macOS-specific files | ||
.DS_Store | ||
# others | ||
.env*.local | ||
.vercel | ||
next-env.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
# ClassCharts API Docs | ||
# api-docs | ||
|
||
Unofficial API documentation for ClassCharts. | ||
This is a Next.js application generated with | ||
[Create Fumadocs](https://github.com/fuma-nama/fumadocs). | ||
|
||
Run development server: | ||
|
||
[](https://starlight.astro.build) | ||
```bash | ||
npm run dev | ||
# or | ||
pnpm dev | ||
# or | ||
yarn dev | ||
``` | ||
|
||
Open http://localhost:3000 with your browser to see the result. | ||
|
||
## Development Commands | ||
## Learn More | ||
|
||
All commands are run from the root of the project, from a terminal: | ||
To learn more about Next.js and Fumadocs, take a look at the following | ||
resources: | ||
|
||
| Command | Action | | ||
| :------------------------- | :----------------------------------------------- | | ||
| `pnpm install` | Installs dependencies | | ||
| `pnpm run dev` | Starts local dev server at `localhost:4321` | | ||
| `pnpm run build` | Build your production site to `./dist/` | | ||
| `pnpm run preview` | Preview your build locally, before deploying | | ||
| `pnpm run astro ...` | Run CLI commands like `astro add`, `astro check` | | ||
| `pnpm run astro -- --help` | Get help using the Astro CLI | | ||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js | ||
features and API. | ||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. | ||
- [Fumadocs](https://fumadocs.vercel.app) - learn about Fumadocs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { openapi, source } from "@/app/source"; | ||
import type { Metadata } from "next"; | ||
import { | ||
DocsPage, | ||
DocsBody, | ||
DocsDescription, | ||
DocsTitle, | ||
} from "fumadocs-ui/page"; | ||
import { notFound } from "next/navigation"; | ||
import defaultMdxComponents from "fumadocs-ui/mdx"; | ||
|
||
export default async function Page({ | ||
params, | ||
}: { | ||
params: { slug?: string[] }; | ||
}) { | ||
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={{ ...defaultMdxComponents, APIPage: openapi.APIPage }} | ||
/> | ||
</DocsBody> | ||
</DocsPage> | ||
); | ||
} | ||
|
||
export async function generateStaticParams() { | ||
return source.generateParams(); | ||
} | ||
|
||
export function generateMetadata({ params }: { params: { slug?: string[] } }) { | ||
const page = source.getPage(params.slug); | ||
if (!page) notFound(); | ||
|
||
return { | ||
title: page.data.title, | ||
description: page.data.description, | ||
} satisfies Metadata; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { DocsLayout } from 'fumadocs-ui/layout'; | ||
import type { ReactNode } from 'react'; | ||
import { baseOptions } from '../layout.config'; | ||
import { source } from '@/app/source'; | ||
|
||
export default function Layout({ children }: { children: ReactNode }) { | ||
return ( | ||
<DocsLayout tree={source.pageTree} {...baseOptions}> | ||
{children} | ||
</DocsLayout> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { source } from '@/app/source'; | ||
import { createSearchAPI } from 'fumadocs-core/search/server'; | ||
|
||
export const { GET } = createSearchAPI('advanced', { | ||
indexes: source.getPages().map((page) => ({ | ||
title: page.data.title, | ||
description: page.data.description, | ||
structuredData: page.data.structuredData, | ||
id: page.url, | ||
url: page.url, | ||
})), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
:root { | ||
--fd-sidebar-width: 375px; | ||
--primary: 221.2 83.2% 53.3%; | ||
} | ||
|
||
.dark { | ||
--primary: 213.1 93.9% 67.8%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { type HomeLayoutProps } from "fumadocs-ui/home-layout"; | ||
|
||
/** | ||
* Shared layout configurations | ||
* | ||
* you can configure layouts individually from: | ||
* Home Layout: app/(home)/layout.tsx | ||
* Docs Layout: app/docs/layout.tsx | ||
*/ | ||
export const baseOptions: HomeLayoutProps = { | ||
nav: { | ||
title: <span className="text-lg md:ml-2">ClassCharts API Docs</span>, | ||
transparentMode: "top", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"use client"; | ||
|
||
import { useServiceWorker } from "@/hooks/use-service-worker"; | ||
import "./global.css"; | ||
import { RootProvider } from "fumadocs-ui/provider"; | ||
import { Inter } from "next/font/google"; | ||
import type { ReactNode } from "react"; | ||
|
||
const inter = Inter({ | ||
subsets: ["latin"], | ||
}); | ||
|
||
export default function Layout({ children }: { children: ReactNode }) { | ||
useServiceWorker(); | ||
|
||
return ( | ||
<html lang="en" className={inter.className} suppressHydrationWarning> | ||
<body> | ||
<RootProvider>{children}</RootProvider> | ||
</body> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { docs, meta } from "@/.source"; | ||
import { createMDXSource } from "fumadocs-mdx"; | ||
import { loader } from "fumadocs-core/source"; | ||
import { createOpenAPI, attachFile } from "fumadocs-openapi/server"; | ||
import { icons } from "lucide-react"; | ||
import { createElement } from "react"; | ||
import { IconContainer } from "@/components/ui/icon"; | ||
|
||
export const source = loader({ | ||
baseUrl: "/", | ||
source: createMDXSource(docs, meta), | ||
pageTree: { | ||
attachFile, | ||
}, | ||
icon(icon) { | ||
if (!icon) { | ||
return; | ||
} | ||
|
||
if (icon in icons) | ||
return createElement(IconContainer, { | ||
icon: icons[icon as keyof typeof icons], | ||
}); | ||
}, | ||
}); | ||
|
||
export const openapi = createOpenAPI({}); |
Oops, something went wrong.