From 474bc266c789f010ef0a4d6fbce1bd298d3079d1 Mon Sep 17 00:00:00 2001 From: Wildan Nursahidan Date: Sat, 3 May 2025 21:10:51 +0700 Subject: [PATCH] initial commit. --- .DS_Store | Bin 0 -> 8196 bytes CHANGELOG.md | 329 + README.md | 39 + app/.DS_Store | Bin 0 -> 6148 bytes app/blog/.DS_Store | Bin 0 -> 6148 bytes app/blog/[slug]/page.tsx | 92 + app/blog/layout.tsx | 9 + app/blog/page.tsx | 98 + app/changelog/layout.tsx | 11 + app/changelog/page.tsx | 63 + app/docs/.DS_Store | Bin 0 -> 6148 bytes app/docs/[[...slug]]/page.tsx | 105 + app/docs/layout.tsx | 14 + app/error.tsx | 44 + app/layout.tsx | 96 + app/not-found.tsx | 19 + app/page.tsx | 95 + app/playground/layout.tsx | 16 + app/playground/page.tsx | 394 + components.json | 17 + components/.DS_Store | Bin 0 -> 6148 bytes components/anchor.tsx | 43 + components/changelog/change-group.tsx | 45 + components/changelog/floating-version.tsx | 86 + components/changelog/version-entry.tsx | 113 + components/changelog/version-tag.tsx | 14 + components/changelog/version-toc.tsx | 90 + components/contexts/theme-provider.tsx | 9 + components/docs-breadcrumb.tsx | 47 + components/docs-menu.tsx | 24 + components/edit-on-github.tsx | 35 + components/footer.tsx | 65 + components/leftbar.tsx | 59 + components/markdown/accordion.tsx | 47 + components/markdown/button.tsx | 52 + components/markdown/card.tsx | 41 + components/markdown/cardgroup.tsx | 28 + components/markdown/copy.tsx | 33 + components/markdown/image.tsx | 25 + components/markdown/link.tsx | 14 + components/markdown/note.tsx | 52 + components/markdown/outlet.tsx | 29 + components/markdown/pre.tsx | 19 + components/markdown/stepper.tsx | 41 + components/markdown/tooltips.tsx | 28 + components/markdown/youtube.tsx | 22 + components/mob-toc.tsx | 38 + components/navbar.tsx | 78 + components/pagination.tsx | 49 + components/playground/MarkComponent.tsx | 252 + components/scroll-to-top.tsx | 52 + components/search.tsx | 193 + components/sublink.tsx | 85 + components/theme-toggle.tsx | 71 + components/toc-observer.tsx | 69 + components/toc.tsx | 21 + components/typography.tsx | 9 + components/ui/accordion.tsx | 58 + components/ui/animated-shiny-text.tsx | 40 + components/ui/aurora.tsx | 45 + components/ui/avatar.tsx | 50 + components/ui/badge.tsx | 37 + components/ui/breadcrumb.tsx | 115 + components/ui/button.tsx | 57 + components/ui/card.tsx | 76 + components/ui/collapsible.tsx | 11 + components/ui/command.tsx | 153 + components/ui/dialog.tsx | 124 + components/ui/dropdown-menu.tsx | 200 + components/ui/icon-cloud.tsx | 324 + components/ui/input.tsx | 25 + components/ui/interactive-hover-button.tsx | 35 + components/ui/popover.tsx | 33 + components/ui/scroll-area.tsx | 48 + components/ui/separator.tsx | 30 + components/ui/sheet.tsx | 140 + components/ui/shine-border.tsx | 64 + components/ui/skeleton.tsx | 15 + components/ui/sonner.tsx | 31 + components/ui/table.tsx | 117 + components/ui/tabs.tsx | 55 + components/ui/toggle-group.tsx | 61 + components/ui/toggle.tsx | 46 + contents/.DS_Store | Bin 0 -> 6148 bytes contents/blogs/components.mdx | 133 + contents/blogs/nested-docs.mdx | 98 + contents/blogs/next-react.mdx | 121 + .../components/accordion/index.mdx | 72 + .../components/button/index.mdx | 42 + .../components/card-group/index.mdx | 49 + .../getting-started/components/card/index.mdx | 70 + .../components/code-block/index.mdx | 41 + .../components/custom/index.mdx | 38 + .../components/image/index.mdx | 37 + .../docs/getting-started/components/index.mdx | 9 + .../getting-started/components/link/index.mdx | 34 + .../getting-started/components/note/index.mdx | 46 + .../components/release-note/index.mdx | 61 + .../components/stepper/index.mdx | 47 + .../getting-started/components/tabs/index.mdx | 70 + .../components/tooltips/index.mdx | 22 + .../components/youtube/index.mdx | 21 + .../docs/getting-started/customize/index.mdx | 94 + .../getting-started/installation/index.mdx | 84 + .../getting-started/introduction/index.mdx | 51 + .../project-structure/index.mdx | 95 + .../quick-start-guide/index.mdx | 157 + docu.json | 89 + lib/changelog.ts | 76 + lib/markdown.ts | 229 + lib/routes-config.ts | 28 + lib/utils.ts | 80 + next-env.d.ts | 5 + next.config.mjs | 14 + package-lock.json | 9773 +++++++++++++++++ package.json | 59 + pnpm-lock.yaml | 6544 +++++++++++ postcss.config.js | 6 + public/.DS_Store | Bin 0 -> 6148 bytes public/favicon.ico | Bin 0 -> 12498 bytes public/images/.DS_Store | Bin 0 -> 6148 bytes public/images/docu.svg | 6 + public/images/example-img.png | Bin 0 -> 30626 bytes public/images/img-playground.png | Bin 0 -> 30192 bytes public/images/new-editor.png | Bin 0 -> 32138 bytes public/images/og-image.png | Bin 0 -> 79780 bytes public/images/release-note.png | Bin 0 -> 61454 bytes public/images/snippet.png | Bin 0 -> 87795 bytes styles/editor.css | 57 + styles/globals.css | 140 + styles/syntax.css | 115 + tailwind.config.ts | 111 + tsconfig.json | 26 + 133 files changed, 24259 insertions(+) create mode 100644 .DS_Store create mode 100644 CHANGELOG.md create mode 100644 README.md create mode 100644 app/.DS_Store create mode 100644 app/blog/.DS_Store create mode 100644 app/blog/[slug]/page.tsx create mode 100644 app/blog/layout.tsx create mode 100644 app/blog/page.tsx create mode 100644 app/changelog/layout.tsx create mode 100644 app/changelog/page.tsx create mode 100644 app/docs/.DS_Store create mode 100644 app/docs/[[...slug]]/page.tsx create mode 100644 app/docs/layout.tsx create mode 100644 app/error.tsx create mode 100644 app/layout.tsx create mode 100644 app/not-found.tsx create mode 100644 app/page.tsx create mode 100644 app/playground/layout.tsx create mode 100644 app/playground/page.tsx create mode 100644 components.json create mode 100644 components/.DS_Store create mode 100644 components/anchor.tsx create mode 100644 components/changelog/change-group.tsx create mode 100644 components/changelog/floating-version.tsx create mode 100644 components/changelog/version-entry.tsx create mode 100644 components/changelog/version-tag.tsx create mode 100644 components/changelog/version-toc.tsx create mode 100644 components/contexts/theme-provider.tsx create mode 100644 components/docs-breadcrumb.tsx create mode 100644 components/docs-menu.tsx create mode 100644 components/edit-on-github.tsx create mode 100644 components/footer.tsx create mode 100644 components/leftbar.tsx create mode 100644 components/markdown/accordion.tsx create mode 100644 components/markdown/button.tsx create mode 100644 components/markdown/card.tsx create mode 100644 components/markdown/cardgroup.tsx create mode 100644 components/markdown/copy.tsx create mode 100644 components/markdown/image.tsx create mode 100644 components/markdown/link.tsx create mode 100644 components/markdown/note.tsx create mode 100644 components/markdown/outlet.tsx create mode 100644 components/markdown/pre.tsx create mode 100644 components/markdown/stepper.tsx create mode 100644 components/markdown/tooltips.tsx create mode 100644 components/markdown/youtube.tsx create mode 100644 components/mob-toc.tsx create mode 100644 components/navbar.tsx create mode 100644 components/pagination.tsx create mode 100644 components/playground/MarkComponent.tsx create mode 100644 components/scroll-to-top.tsx create mode 100644 components/search.tsx create mode 100644 components/sublink.tsx create mode 100644 components/theme-toggle.tsx create mode 100644 components/toc-observer.tsx create mode 100644 components/toc.tsx create mode 100644 components/typography.tsx create mode 100644 components/ui/accordion.tsx create mode 100644 components/ui/animated-shiny-text.tsx create mode 100644 components/ui/aurora.tsx create mode 100644 components/ui/avatar.tsx create mode 100644 components/ui/badge.tsx create mode 100644 components/ui/breadcrumb.tsx create mode 100644 components/ui/button.tsx create mode 100644 components/ui/card.tsx create mode 100644 components/ui/collapsible.tsx create mode 100644 components/ui/command.tsx create mode 100644 components/ui/dialog.tsx create mode 100644 components/ui/dropdown-menu.tsx create mode 100644 components/ui/icon-cloud.tsx create mode 100644 components/ui/input.tsx create mode 100644 components/ui/interactive-hover-button.tsx create mode 100644 components/ui/popover.tsx create mode 100644 components/ui/scroll-area.tsx create mode 100644 components/ui/separator.tsx create mode 100644 components/ui/sheet.tsx create mode 100644 components/ui/shine-border.tsx create mode 100644 components/ui/skeleton.tsx create mode 100644 components/ui/sonner.tsx create mode 100644 components/ui/table.tsx create mode 100644 components/ui/tabs.tsx create mode 100644 components/ui/toggle-group.tsx create mode 100644 components/ui/toggle.tsx create mode 100644 contents/.DS_Store create mode 100644 contents/blogs/components.mdx create mode 100644 contents/blogs/nested-docs.mdx create mode 100644 contents/blogs/next-react.mdx create mode 100644 contents/docs/getting-started/components/accordion/index.mdx create mode 100644 contents/docs/getting-started/components/button/index.mdx create mode 100644 contents/docs/getting-started/components/card-group/index.mdx create mode 100644 contents/docs/getting-started/components/card/index.mdx create mode 100644 contents/docs/getting-started/components/code-block/index.mdx create mode 100644 contents/docs/getting-started/components/custom/index.mdx create mode 100644 contents/docs/getting-started/components/image/index.mdx create mode 100644 contents/docs/getting-started/components/index.mdx create mode 100644 contents/docs/getting-started/components/link/index.mdx create mode 100644 contents/docs/getting-started/components/note/index.mdx create mode 100644 contents/docs/getting-started/components/release-note/index.mdx create mode 100644 contents/docs/getting-started/components/stepper/index.mdx create mode 100644 contents/docs/getting-started/components/tabs/index.mdx create mode 100644 contents/docs/getting-started/components/tooltips/index.mdx create mode 100644 contents/docs/getting-started/components/youtube/index.mdx create mode 100644 contents/docs/getting-started/customize/index.mdx create mode 100644 contents/docs/getting-started/installation/index.mdx create mode 100644 contents/docs/getting-started/introduction/index.mdx create mode 100644 contents/docs/getting-started/project-structure/index.mdx create mode 100644 contents/docs/getting-started/quick-start-guide/index.mdx create mode 100644 docu.json create mode 100644 lib/changelog.ts create mode 100644 lib/markdown.ts create mode 100644 lib/routes-config.ts create mode 100644 lib/utils.ts create mode 100644 next-env.d.ts create mode 100644 next.config.mjs create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 pnpm-lock.yaml create mode 100644 postcss.config.js create mode 100644 public/.DS_Store create mode 100644 public/favicon.ico create mode 100644 public/images/.DS_Store create mode 100644 public/images/docu.svg create mode 100644 public/images/example-img.png create mode 100644 public/images/img-playground.png create mode 100644 public/images/new-editor.png create mode 100644 public/images/og-image.png create mode 100644 public/images/release-note.png create mode 100644 public/images/snippet.png create mode 100644 styles/editor.css create mode 100644 styles/globals.css create mode 100644 styles/syntax.css create mode 100644 tailwind.config.ts create mode 100644 tsconfig.json diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..cb22b121685979c56dff2aa17d888bdca3ecbd8a GIT binary patch literal 8196 zcmeHM&x_MQ6n?X9chjw656Uho81!htc9mVkOSV?LE*sH5pB!h>J5Y^G)WxH}A`rX_83+fK)qn z1z;WkG^`AZ1#HF?W@mMzOv#ZGhy>$drQ8XlHXapVdBj@{C(bAV7z-5PK;-6w$jn6UPzcYC^XuFlh#^q5N&%(7r~+*7o`D7g5L{hN z?cZ?(JaAzhtq~#xf8c9%!@%;Wg(J_cz;nZ>T>eC+GTGepj5ebcwA*HrcFm{}b;4?+ zeUlwsqtvr@`VH&4>vZeIqnD{4HC*3m^8nX&(B;+**SBf6N;|$C@>o+Cw7izD7w3At zh00P%UtH>!^xnmVa!J2%ezD)rYsb!)S6r^W3R9k_;yKqzNHJ9kC Now looks more modern and clean which is a big change in layout and design + +### Added + +- Social footer +- Toggle group +- Site description {meta.description} in footer +- Site title {meta.title} in footer + +### Improved + +- Header design changes +- Footer design changes +- New functions in theme provider +- Object changes in docu.json + +### Fixed + +- Updates to path structure components +- Groups to organize components + +## [1.7.0] - 2025-02-23 + +> Remove the old function in the search dialog and replace it with a new and more optimal feature + +### Added + +- Up and down navigation : search dialog.tsx +- Enter (return) to select : search dialog.tsx +- Escape to close the dialog : search dialog.tsx + +### Improved + +- Maintenance for anchor components +- Anchor.tsx adjustments for all elements that use it + +### Removed + +- Remove suboptimal search features + +## [1.6.0] - 2025-02-21 + +> New Feature Card Groups with arrays for more Flexible Content + +### Added + +- Card Groups Components +- Props : href to url link +- Props : horizontal boolean + +### Improved + +- Card props styling +- Compability for Cards components +- {children} support for card content + +### Removed + +- remove unused props cards components + +## [1.5.0] - 2025-02-18 + +> Minor Update - improved features and responsiveness on all devices + +### Added + +- New dialog footer on searchbox above @media 768px +- Icon X for close dialog on searcbox as esc on medium screen + +### Improved + +- Responsive Leftbar components on large screen +- Menu Trigger on medium screen +- Responsive Navbar components on medium screen +- Better UX for searchbox dialog +- tooltips components can be written together with regular paragraphs + +### Fixed + +- Responsive issue +- Compatibility for Bun +- Changes postcss.config.js to .cjs for Bun +- all CLI installer and updater not working +- adjustments for package managers npm, pnpm, bun, yarn + +## [1.4.2] - 2025-02-16 + +> Complex Content for Accordion Component props {children} + +### Added + +- New Props with {children} in accordion +- Compatibility for markdown in accordion +- Nested components inside an accordion +- New icon on note components +- add CLI npx @docubook/create@latest +- add CLI npx @docubook/update@latest + +### Improved + +- Better UI design for accordion +- Styling Note components on markdown +- Change accordion output on playground +- Change accordion output on snippet + +### Removed + +- Remove depcreated props on accordion +- Remove CLI npx update_docu +- Remove CLI npx create_docu + +## [1.4.0] - 2025-02-11 + +> Floating Button Version with Dynamic Tag {version} on Changelog page + +### Added + +- New components / changelog floating-version.tsx +- Button popover to open version-toc below @media 1024px +- Dynamic tag by section ID #version +- Dynamic url tag #version +- Dynamic version indicator on floating version when scrolling section by ID + +### Improved + +- change icon version history +- responsive version-toc +- improvement components to changelog page + +## [1.3.8] - 2025-02-08 + +> Responsive Table of Content + +### Added + +- Components terminal MagicUI +- Components card Shadcn +- New mob-toc for a better experience on mobile devices +- New Components scroll to top button +- Scroll to top :blog-post +- Scroll to top :docs-post + +### Improved + +- lib/markdown for generated dynamic toc on markdown +- Responsive Table of Content below @media 1024px +- Improve docs page + +## [1.3.6] - 2025-02-01 + +> Appears more modern editor for Docu Play + +![version 1.3.6 - Playground](https://docubook.pro/images/new-editor.png) + +### Added + +- Line Number for editor +- editor.css + +### Improved + +- Better Design for Editor +- Similar to Github Editor +- Moved Handler Element (copy, download, reset and fullscreen) on Header + +## [1.3.5] - 2025-01-30 + +> it's Easy to Write Markdown with Playground + +![version 1.3.5 - Playground](https://docubook.pro/images/img-playground.png) + +### Added + +- New Playground Page +- New Playground Layout +- Toolbar for Markdown Components +- Fullscreen Mode to Focus Editing Your Content +- Copy to Clipboard Your Content +- Download Your Content as index.mdx +- Reset Your Content without refresh the Browser +- Only Large Screen for Better Experience + +## [1.3.1] - 2025-01-20 + +> Snippet Feature to Easily Write Markdown and Call DocuBook Components + +![version 1.3.1 - Snippet Features](https://docubook.pro/images/snippet.png) + +### Added + +- New Feature Snippet for Markdown Components +- Support Snippet for Visual Studio Code + +### Removed + +- remove props icon and props description for accordion components + +## [1.3.0] - 2024-12-31 + +> Release Note Feature to Make it Easier to Write Changelogs + +### Added + +- New Release Note Feature +- New Layout for Changelog page +- New Changelog page +- Add Release Note Component +- Easily write release notes directly from the CHANGELOG.md file +- TOC for versioning +- Write with the markdown tag +- Add lib / changelog.ts + +### Improved + +- Improvement Responsive feature image for Version Entry +- Improvement Layout for changelog page +- Improvement Padding on mobile devices +- Only use containers of md size +- Improvement syntax.css for ul>li classes + +### Fixed + +- Fix og:image not showing on Page.tsx +- Fix text-indent on class li + +### Removed + +- Remove excessive padding +- Remove Logo on Footer + +## [1.2.0] - 2024-12-22 + +> New Accordion Component : Support content plain text, html and all markdown component + +### Added + +- add New Accordion + +### Improved + +- Props Improvement +- Support Dynamic Content for Accordion + +## [1.1.0] - 2024-12-15 + +> Minor Update : Easily manage set up with docu.json + +### Added + +- add docu.json file +- add openGraph (title, description, image) +- add Dynamic metadata +- Generate metadata as openGraph +- openGraph support for .mdx + +### Improved + +- routes-config from json +- Frontmatter improvement +- Edit the content of footer.tsx simply via the docu.json file +- Edit the content of navbar.tsx simply via the docu.json file + +## [1.0.7] - 2024-12-14 + +> Easily updates your DocuBook Version with CLI npx update_docu + +### Added + +- CLI npx update_docu (update features into docubook existing directory) +- Playground (easily to written content) +- New Button component +- Navbar external link conditions +- CLI npx create_docu + +### Improved + +- Searchbar Improvement +- Navigation Improvement +- Edit on Github Improvement + +### Removed +- Remove CLI npx create-docu (on this version not usage dash `-`) + +## [1.0.6] - 2024-11-24 + +> New Components, Fix and Improvement + +### Added + +- New Card component +- New Tooltips component + +### Fixed + +- change root folder + +### Improved + +- logo on navbar & footer +- easily change logo + +## [1.0.5] - 2024-11-16 + +> Add New Features and Improvement for this version + +### Added + +- New Youtube component +- edit this page - easily manage directory content via the github repo +- support installation via cli commant npx create-docu + +### Improved + +- keyboard shortcut command + k or ctrl + k to open search dialog + +## [1.0.0] - 2024-11-10 + +> Initial release of DocuBook to create interactive nested docs with MDX + +### Added + +- Initial release of DocuBook +- Basic documentation structure +- Markdown support with MDX +- Responsive design +- Search functionality +- Dark mode support diff --git a/README.md b/README.md new file mode 100644 index 0000000..3195f30 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +# DocuBook + +**DocuBook** is a documentation web project designed to provide a simple and user-friendly interface for accessing various types of documentation. This site is crafted for developers and teams who need quick access to references, guides, and essential documents. + +> **Note**: This application is a fork of [AriaDocs](https://github.com/nisabmohd/Aria-Docs), created by [Nisab Mohd](https://github.com/nisabmohd). DocuBook provides an alternative to the documentation solution found on [Mintlify](https://mintlify.com/), utilizing `.mdx` (Markdown + JSX) for content creation and management. + +[![Deploy with +Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/gitfromwildan/docubook) + +## Features + +- **Easy Navigation**: Simple layout for quick navigation between pages. +- **Quick Search**: Easily find documentation using a search function. +- **Responsive Theme**: Responsive design optimized for devices ranging from desktops to mobile. +- **Markdown Content**: Support for markdown-based documents. +- **SEO Friendly**: Optimized structure for search visibility, enhancing accessibility on search engines. + +## Installation + +```bash +npx @docubook/create@latest +``` + +#### command output + +```bash +? Enter a name for your project directory: (docubook) + +Creating a new Docubook project in /path/your/docubook from the main branch... +✔ Docubook project successfully created in /path/your/docubook! + +Next steps: +1. Navigate to your project directory: + cd docubook +2. Install dependencies: + npm install +3. Start the development server: + npm run dev +``` diff --git a/app/.DS_Store b/app/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a2b816daae95203d96faa409225261200a190952 GIT binary patch literal 6148 zcmeHKu};G<5IsYNwk#DBqX!l?I>LZL39KOX2WXqB9a>U>I1AGNv zz{)%O09#GVh5+43_H%r9_VbHk$3$e>v%E#rB%&G$W70rXVeIEJXDiaf$%e-m4_lpn zF`3RqYKJPI3j9U|+=ov+8dE{T`1{?y1L5SuHz~5LH!gbUs~xRx?cU!$@5lapsed{O z_l6VJqE3ApQJ2nWNP{W{_1EgCkP9N79&Q|$it#4J7pvuwF+Yo7tUZS+eY%Ks*}M*Y zA(w;WKo`jk8C3b>c~hRZK~t#FrAz2?4hAzQl*b%)-WJ7$d|ujnSA$2VP34#&x9?(O zp6>lISGB*Z0M2Z-+L}kLRRL8%75G$u_Xmr@m*dzx}BlTzZ9Hf1yjM& zBRnwUQ-MC!$Q8r*bo5(^O9e}hKAntQK8(z4=@s=a5AY!tyKY4AXZ@2KQ{UN zKU{qOkCXIC6;K8Kl>#QoI$0Y_lCyPgaeUTVlv5Nojw?O76jX8?y9OV{8z|1;v)llt Uf~80F!1PDJ$)J@g@S_U619#es?EnA( literal 0 HcmV?d00001 diff --git a/app/blog/.DS_Store b/app/blog/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..1e0c66dd833a3b7e00e72b6bfea5ab664822b096 GIT binary patch literal 6148 zcmeH~!Ab)$5Qb;8NTHV=J?0hq25VWLpx#7~TBwIDTPVHffqVjQUVJY9e`XZxE_f>< zGm!krWRl(eU^9t`=<>K(h|EP~ib7R3MvU&!p^FHfK-JdR%0stZte*Paeq^D)=;FIy z$-Nw;lcNmYe|GnCeAl<_y6e~Q6Uy7`%lpkRX7g*z{`os6@=r?wNgxR%fh2Gi0?664 z>C83jB#;D>z!w4T4+VwVgjQGEI#Aga0Lo*u8QON1g%&!XO=xw62c|w1>QgnY80ypE zFA>*-R#%@cYEQ;G@#N3Ti^fS>i-n6eu30C6BydXL(z|o!|6BY@qnG^CDcMT`N#LIm z&`G;$m-wj2t%J{Ft}Q5!C^W`ZHehI5Du!ArMu+>zwGH}sVH@L3Xm#Z(^xJf39s~?X KR!QIt1U>){2P+r= literal 0 HcmV?d00001 diff --git a/app/blog/[slug]/page.tsx b/app/blog/[slug]/page.tsx new file mode 100644 index 0000000..42951bc --- /dev/null +++ b/app/blog/[slug]/page.tsx @@ -0,0 +1,92 @@ +import { Typography } from "@/components/typography"; +import { buttonVariants } from "@/components/ui/button"; +import { Author, getAllBlogStaticPaths, getBlogForSlug } from "@/lib/markdown"; +import { ArrowLeftIcon } from "lucide-react"; +import Link from "next/link"; +import { notFound } from "next/navigation"; +import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; +import { formatDate } from "@/lib/utils"; +import { ScrollToTop } from "@/components/scroll-to-top"; + +type PageProps = { + params: { slug: string }; +}; + +export async function generateMetadata({ params: { slug } }: PageProps) { + const res = await getBlogForSlug(slug); + if (!res) return null; + const { frontmatter } = res; + return { + title: frontmatter.title, + description: frontmatter.description, + }; +} + +export async function generateStaticParams() { + const val = await getAllBlogStaticPaths(); + if (!val) return []; + return val.map((it) => ({ slug: it })); +} + +export default async function BlogPage({ params: { slug } }: PageProps) { + const res = await getBlogForSlug(slug); + if (!res) notFound(); + return ( +
+ + Back to blog + +
+

+ {formatDate(res.frontmatter.date)} +

+

+ {res.frontmatter.title} +

+
+

Posted by

+ +
+
+
+ {res.content} +
+ +
+ ); +} + +function Authors({ authors }: { authors: Author[] }) { + return ( +
+ {authors.map((author) => { + return ( + + + + + {author.username.slice(0, 2).toUpperCase()} + + +
+

{author.username}

+

+ @{author.handle} +

+
+ + ); + })} +
+ ); +} diff --git a/app/blog/layout.tsx b/app/blog/layout.tsx new file mode 100644 index 0000000..6211155 --- /dev/null +++ b/app/blog/layout.tsx @@ -0,0 +1,9 @@ +import { PropsWithChildren } from "react"; + +export default function BlogLayout({ children }: PropsWithChildren) { + return ( +
+ {children} +
+ ); +} diff --git a/app/blog/page.tsx b/app/blog/page.tsx new file mode 100644 index 0000000..780cd39 --- /dev/null +++ b/app/blog/page.tsx @@ -0,0 +1,98 @@ +import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; +import { Author, BlogMdxFrontmatter, getAllBlogs } from "@/lib/markdown"; +import { formatDate2, stringToDate } from "@/lib/utils"; +import { getMetadata } from "@/app/layout"; +import Image from "next/image"; +import Link from "next/link"; +import docuConfig from "@/docu.json"; + +export const metadata = getMetadata({ + title: "Blog", + description: "Discover the latest updates, tutorials, and insights on DocuBook.", +}); +const { meta } = docuConfig; +export default async function BlogIndexPage() { + const blogs = (await getAllBlogs()).sort( + (a, b) => stringToDate(b.date).getTime() - stringToDate(a.date).getTime() + ); + return ( +
+
+

+ Blog Posts +

+

+ Discover the latest updates, tutorials, and insights on {meta.title}. +

+
+
+ {blogs.map((blog) => ( + + ))} +
+
+ ); +} + +function BlogCard({ + date, + title, + description, + slug, + cover, + authors, +}: BlogMdxFrontmatter & { slug: string }) { + return ( + +

{title}

+
+ {title} +
+

{description}

+
+

+ Published on {formatDate2(date)} +

+ +
+ + ); +} + +function AvatarGroup({ users, max = 4 }: { users: Author[]; max?: number }) { + const displayUsers = users.slice(0, max); + const remainingUsers = Math.max(users.length - max, 0); + + return ( +
+ {displayUsers.map((user, index) => ( + + + + {user.username.slice(0, 2).toUpperCase()} + + + ))} + {remainingUsers > 0 && ( + + +{remainingUsers} + + )} +
+ ); +} diff --git a/app/changelog/layout.tsx b/app/changelog/layout.tsx new file mode 100644 index 0000000..b77f34a --- /dev/null +++ b/app/changelog/layout.tsx @@ -0,0 +1,11 @@ +export default function ChangelogLayout({ + children, +}: { + children: React.ReactNode; +}) { + return ( +
+ {children} +
+ ); +} \ No newline at end of file diff --git a/app/changelog/page.tsx b/app/changelog/page.tsx new file mode 100644 index 0000000..397a039 --- /dev/null +++ b/app/changelog/page.tsx @@ -0,0 +1,63 @@ +import { Suspense } from "react"; +import { getChangelogEntries } from "@/lib/changelog"; +import { VersionEntry } from "@/components/changelog/version-entry"; +import { VersionToc } from "@/components/changelog/version-toc"; +import { getMetadata } from "@/app/layout"; +import docuConfig from "@/docu.json"; +import { FloatingVersionToc } from "@/components/changelog/floating-version"; + +export const metadata = getMetadata({ + title: "Changelog", + description: "Latest updates and improvements to DocuBook", + image: "release-note.png", +}); + +export default async function ChangelogPage() { + const entries = await getChangelogEntries(); + const { meta } = docuConfig; + return ( +
+
+
+

Changelog

+

+ Latest updates and improvements to {meta.title} +

+
+
+ +
+
+ }> + ({ version, date }))} + /> + + +
+
+
+
+ {entries.map((entry, index) => ( +
+ +
+ ))} +
+
+
+
+
+ {/* Floating TOC for smaller screens */} + {entries.length > 0 && ( + ({ version, date }))} + /> + )} +
+ ); +} diff --git a/app/docs/.DS_Store b/app/docs/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..6ed269c595f70d61f496f7e26230120db560a40d GIT binary patch literal 6148 zcmeHK%}N6?5T4N<3VZ3%W1gVUH;83@f?fnENG;UEmMuu{c_5#_TQ7Yszi%e~6jwn6 z5t#|eH<`?2v){6rL_~DHU(ZA)A~HrLDwP4Dd2r~gI*)*Ab4=wyI@!xcmID+0MHAQF z$PLQW%G>&v-DbA9>$f{!c60r?=eBR#RoAcJL81;%kH^ceyw~6G-rc`n1;0~BFc1s` z1HnKr@FND0vnk`oG1_1t7zhSl8Q}hqP>H!>akQ-ija>nNJVu*9w=*g*(E!X9iz6%$ z^-!RPYQ18phr^z#U#?gjJzUhDjCtylUoJ0NPsp0gT{JsJ8w>;krwp8Xcf$OCg +
+ +
+ +
+ +

{title}

+

{description}

+
{res.content}
+
+ {date && ( +

+ Published on {formatDate2(date)} +

+ )} + +
+ +
+ +
+ + + ); +} diff --git a/app/docs/layout.tsx b/app/docs/layout.tsx new file mode 100644 index 0000000..ef73ca4 --- /dev/null +++ b/app/docs/layout.tsx @@ -0,0 +1,14 @@ +import { Leftbar } from "@/components/leftbar"; + +export default function DocsLayout({ + children, +}: Readonly<{ + children: React.ReactNode; +}>) { + return ( +
+ +
{children}
+
+ ); +} diff --git a/app/error.tsx b/app/error.tsx new file mode 100644 index 0000000..8a8ae0b --- /dev/null +++ b/app/error.tsx @@ -0,0 +1,44 @@ +"use client"; // Error components must be Client Components + +import { Button, buttonVariants } from "@/components/ui/button"; +import Link from "next/link"; +import { useEffect } from "react"; + +export default function Error({ + error, + reset, +}: { + error: Error & { digest?: string }; + reset: () => void; +}) { + useEffect(() => { + console.error(error); + }, [error]); + + return ( +
+
+

Oops!

+

+ Something went wrong {":`("} +

+

+ We're sorry, but an error occurred while processing your request. +

+
+
+ + + Back to homepage + +
+
+ ); +} diff --git a/app/layout.tsx b/app/layout.tsx new file mode 100644 index 0000000..2eb4c75 --- /dev/null +++ b/app/layout.tsx @@ -0,0 +1,96 @@ +import type { Metadata } from "next"; +import { ThemeProvider } from "@/components/contexts/theme-provider"; +import { Navbar } from "@/components/navbar"; +import { GeistSans } from "geist/font/sans"; +import { GeistMono } from "geist/font/mono"; +import { Footer } from "@/components/footer"; +import docuConfig from "@/docu.json"; +import { Toaster } from "@/components/ui/sonner"; +import "@/styles/globals.css"; + +const { meta } = docuConfig; + +// Default Metadata +const defaultMetadata: Metadata = { + metadataBase: new URL(meta.baseURL), + description: meta.description, + title: meta.title, + icons: { + icon: meta.favicon, + }, + openGraph: { + title: meta.title, + description: meta.description, + images: [ + { + url: new URL("/images/og-image.png", meta.baseURL).toString(), + width: 1200, + height: 630, + alt: String(meta.title), + }, + ], + locale: "en_US", + type: "website", + }, +}; + +// Dynamic Metadata Getter +export function getMetadata({ + title, + description, + image, +}: { + title?: string; + description?: string; + image?: string; +}): Metadata { + const ogImage = image ? new URL(`/images/${image}`, meta.baseURL).toString() : undefined; + + return { + ...defaultMetadata, + title: title ? `${title}` : defaultMetadata.title, + description: description || defaultMetadata.description, + openGraph: { + ...defaultMetadata.openGraph, + title: title || defaultMetadata.openGraph?.title, + description: description || defaultMetadata.openGraph?.description, + images: ogImage ? [ + { + url: ogImage, + width: 1200, + height: 630, + alt: String(title || defaultMetadata.openGraph?.title), + }, + ] : defaultMetadata.openGraph?.images, + }, + }; +} + +export default function RootLayout({ + children, +}: Readonly<{ + children: React.ReactNode; +}>) { + return ( + + + + +
+ {children} +
+