From 63707fa434c37b61da7c8c0265553d1563d1e66b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 21 Jan 2026 17:22:58 +0000 Subject: docs: redesign home page with launcher showcase and fix routing Co-authored-by: HsiangNianian <44714368+HsiangNianian@users.noreply.github.com> --- packages/docs/app/routes/docs.tsx | 6 ++ packages/docs/app/routes/home.tsx | 141 ++++++++++++++++++++++++++++++++++---- 2 files changed, 134 insertions(+), 13 deletions(-) create mode 100644 packages/docs/app/routes/docs.tsx (limited to 'packages/docs/app/routes') diff --git a/packages/docs/app/routes/docs.tsx b/packages/docs/app/routes/docs.tsx new file mode 100644 index 0000000..a1c1707 --- /dev/null +++ b/packages/docs/app/routes/docs.tsx @@ -0,0 +1,6 @@ +import type { Route } from './+types/docs'; +import { redirect } from 'react-router'; + +export function loader({}: Route.LoaderArgs) { + return redirect('/docs/en'); +} diff --git a/packages/docs/app/routes/home.tsx b/packages/docs/app/routes/home.tsx index 7f03ba9..b1f8516 100644 --- a/packages/docs/app/routes/home.tsx +++ b/packages/docs/app/routes/home.tsx @@ -5,25 +5,140 @@ import { baseOptions } from '@/lib/layout.shared'; export function meta({}: Route.MetaArgs) { return [ - { title: 'New React Router App' }, - { name: 'description', content: 'Welcome to React Router!' }, + { title: 'DropOut - Modern Minecraft Launcher' }, + { name: 'description', content: 'A modern, reproducible, and developer-grade Minecraft launcher built with Tauri v2 and Rust.' }, ]; } export default function Home() { return ( -
-

Fumadocs on React Router.

-

- The truly flexible docs framework on React.js. -

- - Open Docs - +
+ {/* Hero Section */} +
+

+ DropOut Minecraft Launcher +

+

+ Modern. Reproducible. Developer-Grade. +

+

+ Built with Tauri v2 and Rust for native performance and minimal resource usage +

+
+ + Get Started + + + Features + +
+
+ + {/* Launcher Showcase */} +
+
+ DropOut Launcher Interface +
+
+ + {/* Features Grid */} +
+
+
🚀
+

High Performance

+

+ Built with Rust and Tauri for minimal resource usage and fast startup times +

+
+
+
🎨
+

Modern UI

+

+ Clean, distraction-free interface with Svelte 5 and Tailwind CSS 4 +

+
+
+
🔐
+

Secure Auth

+

+ Microsoft OAuth 2.0 with device code flow and offline mode support +

+
+
+
🔧
+

Mod Loaders

+

+ Built-in support for Fabric and Forge with automatic version management +

+
+
+
+

Java Management

+

+ Auto-detection and integrated downloader for Adoptium JDK/JRE +

+
+
+
📦
+

Instance System

+

+ Isolated game environments with independent configs and mods +

+
+
+ + {/* Why DropOut Section */} +
+

Why DropOut?

+
+
+

+ Your instance worked yesterday but broke today? +
+ → DropOut makes it traceable. +

+
+
+

+ Sharing a modpack means zipping gigabytes? +
+ → DropOut shares exact dependency manifests. +

+
+
+

+ Java, loader, mods, configs drift out of sync? +
+ → DropOut locks them together. +

+
+
+
+ + {/* CTA Section */} +
+

Ready to get started?

+

+ Check out the documentation to learn more about DropOut +

+ + Read the Docs + +
); -- cgit v1.2.3-70-g09d2 From c309904c5ab5394938e92bb139fc0c40d87de055 Mon Sep 17 00:00:00 2001 From: NtskwK Date: Thu, 29 Jan 2026 10:15:55 +0800 Subject: feat(docs): enhance error boundary UI and add 404 page --- packages/docs/app/root.tsx | 27 +++++++++++++++++++++------ packages/docs/app/routes.ts | 1 + packages/docs/app/routes/not-found.tsx | 7 +++++++ 3 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 packages/docs/app/routes/not-found.tsx (limited to 'packages/docs/app/routes') diff --git a/packages/docs/app/root.tsx b/packages/docs/app/root.tsx index 08b8aa8..a6c807e 100644 --- a/packages/docs/app/root.tsx +++ b/packages/docs/app/root.tsx @@ -1,5 +1,6 @@ import { isRouteErrorResponse, + Link, Links, Meta, Outlet, @@ -60,13 +61,27 @@ export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) { } return ( -
-

{message}

-

{details}

+
+

+ {message} +

+

{details}

+

+ Sorry, we couldn't find the page you're looking for. It might have been moved or deleted. +

+ + Return Home / 返回首页 + {stack && ( -
-          {stack}
-        
+
+

Error Stack

+
+            {stack}
+          
+
)}
); diff --git a/packages/docs/app/routes.ts b/packages/docs/app/routes.ts index 677030a..9acc429 100644 --- a/packages/docs/app/routes.ts +++ b/packages/docs/app/routes.ts @@ -5,4 +5,5 @@ export default [ route('docs', 'routes/docs.tsx'), route('docs/*', 'docs/page.tsx'), route('api/search', 'docs/search.ts'), + route('*', 'routes/not-found.tsx'), ] satisfies RouteConfig; diff --git a/packages/docs/app/routes/not-found.tsx b/packages/docs/app/routes/not-found.tsx new file mode 100644 index 0000000..1d9e041 --- /dev/null +++ b/packages/docs/app/routes/not-found.tsx @@ -0,0 +1,7 @@ +export function loader() { + throw new Response('Not Found', { status: 404 }); +} + +export default function NotFound() { + return null; +} -- cgit v1.2.3-70-g09d2 From 9627912c1f7910f786c555a3a9485f0a8c4211bf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 15:07:12 +0000 Subject: docs: remove emojis from documentation and home page Co-authored-by: HsiangNianian <44714368+HsiangNianian@users.noreply.github.com> --- packages/docs/app/routes/home.tsx | 6 ---- packages/docs/content/docs/en/features/index.mdx | 40 ++++++++++++------------ packages/docs/content/docs/en/index.mdx | 16 +++++----- packages/docs/content/docs/zh/features/index.mdx | 40 ++++++++++++------------ packages/docs/content/docs/zh/index.mdx | 16 +++++----- 5 files changed, 56 insertions(+), 62 deletions(-) (limited to 'packages/docs/app/routes') diff --git a/packages/docs/app/routes/home.tsx b/packages/docs/app/routes/home.tsx index b1f8516..1bd2235 100644 --- a/packages/docs/app/routes/home.tsx +++ b/packages/docs/app/routes/home.tsx @@ -55,42 +55,36 @@ export default function Home() { {/* Features Grid */}
-
🚀

High Performance

Built with Rust and Tauri for minimal resource usage and fast startup times

-
🎨

Modern UI

Clean, distraction-free interface with Svelte 5 and Tailwind CSS 4

-
🔐

Secure Auth

Microsoft OAuth 2.0 with device code flow and offline mode support

-
🔧

Mod Loaders

Built-in support for Fabric and Forge with automatic version management

-

Java Management

Auto-detection and integrated downloader for Adoptium JDK/JRE

-
📦

Instance System

Isolated game environments with independent configs and mods diff --git a/packages/docs/content/docs/en/features/index.mdx b/packages/docs/content/docs/en/features/index.mdx index 19a6973..3a463d0 100644 --- a/packages/docs/content/docs/en/features/index.mdx +++ b/packages/docs/content/docs/en/features/index.mdx @@ -46,26 +46,26 @@ DropOut is packed with features designed for both casual players and power users | Feature | Status | Description | |---------|--------|-------------| -| Microsoft Authentication | ✅ Complete | OAuth 2.0 with device code flow | -| Offline Authentication | ✅ Complete | Local accounts for offline play | -| Token Auto-refresh | ✅ Complete | Automatic refresh of expired tokens | -| Java Auto-detection | ✅ Complete | Scans system for Java installations | -| Java Download | ✅ Complete | Download Adoptium JDK/JRE versions | -| Fabric Support | ✅ Complete | Install and launch Fabric loader | -| Forge Support | ✅ Complete | Install and launch Forge loader | -| Instance System | ✅ Complete | Isolated game environments | -| GitHub Integration | ✅ Complete | View releases and changelogs | -| Concurrent Downloads | ✅ Complete | Multi-threaded asset downloads | -| Resume Downloads | ✅ Complete | Resume interrupted downloads | -| AI Assistant | ✅ Complete | Built-in troubleshooting helper | -| Config Editor | ✅ Complete | JSON/TOML configuration editor | -| Custom Resolution | ✅ Complete | Set game window dimensions | -| Memory Allocation | ✅ Complete | Customize JVM memory settings | -| Multi-account | 🚧 In Progress | Switch between multiple accounts | -| Mods Manager | 🚧 Planned | Enable/disable mods in launcher | -| Launcher Auto-update | 🚧 Planned | Self-updating mechanism | -| Custom Game Directory | 🚧 Planned | Choose game files location | -| Import Profiles | 🚧 Planned | Import from MultiMC/Prism | +| Microsoft Authentication | Complete | OAuth 2.0 with device code flow | +| Offline Authentication | Complete | Local accounts for offline play | +| Token Auto-refresh | Complete | Automatic refresh of expired tokens | +| Java Auto-detection | Complete | Scans system for Java installations | +| Java Download | Complete | Download Adoptium JDK/JRE versions | +| Fabric Support | Complete | Install and launch Fabric loader | +| Forge Support | Complete | Install and launch Forge loader | +| Instance System | Complete | Isolated game environments | +| GitHub Integration | Complete | View releases and changelogs | +| Concurrent Downloads | Complete | Multi-threaded asset downloads | +| Resume Downloads | Complete | Resume interrupted downloads | +| AI Assistant | Complete | Built-in troubleshooting helper | +| Config Editor | Complete | JSON/TOML configuration editor | +| Custom Resolution | Complete | Set game window dimensions | +| Memory Allocation | Complete | Customize JVM memory settings | +| Multi-account | In Progress | Switch between multiple accounts | +| Mods Manager | Planned | Enable/disable mods in launcher | +| Launcher Auto-update | Planned | Self-updating mechanism | +| Custom Game Directory | Planned | Choose game files location | +| Import Profiles | Planned | Import from MultiMC/Prism | ## Performance Features diff --git a/packages/docs/content/docs/en/index.mdx b/packages/docs/content/docs/en/index.mdx index d9846ab..9dee19f 100644 --- a/packages/docs/content/docs/en/index.mdx +++ b/packages/docs/content/docs/en/index.mdx @@ -48,28 +48,28 @@ This launcher is built for players who value control, transparency, and long-ter ## Key Features -### 🚀 High Performance +### High Performance Built with Rust and Tauri for minimal resource usage and fast startup times. -### 🎨 Modern UI +### Modern UI Clean, distraction-free interface with Svelte 5, Tailwind CSS 4, and particle effects. -### 🔐 Secure Authentication +### Secure Authentication Microsoft OAuth 2.0 with device code flow and offline authentication support. -### 🔧 Mod Loader Support +### Mod Loader Support Built-in installation for Fabric and Forge with automatic version management. -### ☕ Java Management +### Java Management Automatic detection of installed Java versions and integrated downloader for Adoptium JDK/JRE. -### 📦 Instance System +### Instance System Isolated game environments with independent configurations, mods, and saves. -### 🤖 AI Assistant +### AI Assistant Built-in AI helper for troubleshooting, configuration, and guidance. -### ⚡ Fast Downloads +### Fast Downloads Concurrent asset and library downloads with resume support and progress tracking. ## Technology Stack diff --git a/packages/docs/content/docs/zh/features/index.mdx b/packages/docs/content/docs/zh/features/index.mdx index 3e03e83..bb53ce2 100644 --- a/packages/docs/content/docs/zh/features/index.mdx +++ b/packages/docs/content/docs/zh/features/index.mdx @@ -46,26 +46,26 @@ DropOut 功能丰富,既适合休闲玩家也适合高级用户。本指南涵 | 功能 | 状态 | 描述 | |---------|--------|-------------| -| Microsoft 身份验证 | ✅ 完成 | 使用设备代码流的 OAuth 2.0 | -| 离线身份验证 | ✅ 完成 | 用于离线游玩的本地账户 | -| 令牌自动刷新 | ✅ 完成 | 自动刷新过期的令牌 | -| Java 自动检测 | ✅ 完成 | 扫描系统中的 Java 安装 | -| Java 下载 | ✅ 完成 | 下载 Adoptium JDK/JRE 版本 | -| Fabric 支持 | ✅ 完成 | 安装和启动 Fabric 加载器 | -| Forge 支持 | ✅ 完成 | 安装和启动 Forge 加载器 | -| 实例系统 | ✅ 完成 | 隔离的游戏环境 | -| GitHub 集成 | ✅ 完成 | 查看发布和更新日志 | -| 并发下载 | ✅ 完成 | 多线程资源下载 | -| 断点续传 | ✅ 完成 | 恢复中断的下载 | -| AI 助手 | ✅ 完成 | 内置故障排除助手 | -| 配置编辑器 | ✅ 完成 | JSON/TOML 配置编辑器 | -| 自定义分辨率 | ✅ 完成 | 设置游戏窗口尺寸 | -| 内存分配 | ✅ 完成 | 自定义 JVM 内存设置 | -| 多账户 | 🚧 进行中 | 在多个账户之间切换 | -| 模组管理器 | 🚧 计划中 | 在启动器中启用/禁用模组 | -| 启动器自动更新 | 🚧 计划中 | 自我更新机制 | -| 自定义游戏目录 | 🚧 计划中 | 选择游戏文件位置 | -| 导入配置文件 | 🚧 计划中 | 从 MultiMC/Prism 导入 | +| Microsoft 身份验证 | 完成 | 使用设备代码流的 OAuth 2.0 | +| 离线身份验证 | 完成 | 用于离线游玩的本地账户 | +| 令牌自动刷新 | 完成 | 自动刷新过期的令牌 | +| Java 自动检测 | 完成 | 扫描系统中的 Java 安装 | +| Java 下载 | 完成 | 下载 Adoptium JDK/JRE 版本 | +| Fabric 支持 | 完成 | 安装和启动 Fabric 加载器 | +| Forge 支持 | 完成 | 安装和启动 Forge 加载器 | +| 实例系统 | 完成 | 隔离的游戏环境 | +| GitHub 集成 | 完成 | 查看发布和更新日志 | +| 并发下载 | 完成 | 多线程资源下载 | +| 断点续传 | 完成 | 恢复中断的下载 | +| AI 助手 | 完成 | 内置故障排除助手 | +| 配置编辑器 | 完成 | JSON/TOML 配置编辑器 | +| 自定义分辨率 | 完成 | 设置游戏窗口尺寸 | +| 内存分配 | 完成 | 自定义 JVM 内存设置 | +| 多账户 | 进行中 | 在多个账户之间切换 | +| 模组管理器 | 计划中 | 在启动器中启用/禁用模组 | +| 启动器自动更新 | 计划中 | 自我更新机制 | +| 自定义游戏目录 | 计划中 | 选择游戏文件位置 | +| 导入配置文件 | 计划中 | 从 MultiMC/Prism 导入 | ## 性能功能 diff --git a/packages/docs/content/docs/zh/index.mdx b/packages/docs/content/docs/zh/index.mdx index 27487cb..b554cca 100644 --- a/packages/docs/content/docs/zh/index.mdx +++ b/packages/docs/content/docs/zh/index.mdx @@ -48,28 +48,28 @@ DropOut 是一个使用 Tauri v2 和 Rust 构建的现代 Minecraft 启动器, ## 核心特性 -### 🚀 高性能 +### 高性能 使用 Rust 和 Tauri 构建,资源占用最小,启动速度极快。 -### 🎨 现代化界面 +### 现代化界面 简洁、无干扰的界面,使用 Svelte 5、Tailwind CSS 4 和粒子效果。 -### 🔐 安全认证 +### 安全认证 微软 OAuth 2.0 设备代码流和离线认证支持。 -### 🔧 模组加载器支持 +### 模组加载器支持 内置 Fabric 和 Forge 安装,自动版本管理。 -### ☕ Java 管理 +### Java 管理 自动检测已安装的 Java 版本,集成 Adoptium JDK/JRE 下载器。 -### 📦 实例系统 +### 实例系统 独立的游戏环境,具有独立的配置、模组和存档。 -### 🤖 AI 助手 +### AI 助手 内置 AI 帮助,用于故障排除、配置和指导。 -### ⚡ 快速下载 +### 快速下载 并发资源和库下载,支持断点续传和进度跟踪。 ## 技术栈 -- cgit v1.2.3-70-g09d2 From b27777b625fb348f35e435276842668e16456967 Mon Sep 17 00:00:00 2001 From: NtskwK Date: Tue, 3 Feb 2026 11:19:09 +0800 Subject: feat(i18n): add multi-language support for docs --- packages/docs/app/docs/page.tsx | 51 +++++---- packages/docs/app/docs/search.ts | 7 +- packages/docs/app/lib/i18n.ts | 8 ++ packages/docs/app/lib/layout.shared.tsx | 17 ++- packages/docs/app/lib/source.ts | 5 + packages/docs/app/root.tsx | 20 +++- packages/docs/app/routes.ts | 19 +++- packages/docs/app/routes/docs.tsx | 14 ++- packages/docs/app/routes/home.tsx | 196 +++++++++++++++++++------------- packages/docs/source.config.ts | 3 +- 10 files changed, 222 insertions(+), 118 deletions(-) create mode 100644 packages/docs/app/lib/i18n.ts (limited to 'packages/docs/app/routes') diff --git a/packages/docs/app/docs/page.tsx b/packages/docs/app/docs/page.tsx index 2618989..a9e3433 100644 --- a/packages/docs/app/docs/page.tsx +++ b/packages/docs/app/docs/page.tsx @@ -1,51 +1,58 @@ import type { Route } from './+types/page'; +import defaultMdxComponents from 'fumadocs-ui/mdx'; import { DocsLayout } from 'fumadocs-ui/layouts/docs'; -import { DocsBody, DocsDescription, DocsPage, DocsTitle } from 'fumadocs-ui/layouts/docs/page'; +import { DocsPage, DocsBody, DocsDescription, DocsTitle } from 'fumadocs-ui/page'; +import { Card, Cards } from 'fumadocs-ui/components/card'; import { source } from '@/lib/source'; -import defaultMdxComponents from 'fumadocs-ui/mdx'; -import browserCollections from 'fumadocs-mdx:collections/browser'; +import { i18n } from '@/lib/i18n'; import { baseOptions } from '@/lib/layout.shared'; import { useFumadocsLoader } from 'fumadocs-core/source/client'; +import browserCollections from 'fumadocs-mdx:collections/browser'; export async function loader({ params }: Route.LoaderArgs) { - const slugs = params['*'].split('/').filter((v) => v.length > 0); - const page = source.getPage(slugs); - if (!page) throw new Response('Not found', { status: 404 }); + // 从路由参数获取语言,如果没有则使用默认语言 + // URL 格式: /docs/getting-started (默认语言 zh) + // URL 格式: /en/docs/getting-started (英语) + const lang = (params.lang && i18n.languages.includes(params.lang as any)) + ? (params.lang as 'zh' | 'en') + : (i18n.defaultLanguage as 'zh' | 'en'); + + // 获取文档路径 slugs + const slugs = params['*']?.split('/').filter((v) => v.length > 0) || []; + + const page = source.getPage(slugs, lang); + + if (!page) { + throw new Response('Not found', { status: 404 }); + } return { path: page.path, - pageTree: await source.serializePageTree(source.getPageTree()), + pageTree: await source.serializePageTree(source.getPageTree(lang)), + lang, }; } const clientLoader = browserCollections.docs.createClientLoader({ - component( - { toc, frontmatter, default: Mdx }, - // you can define props for the `` component - props?: { - className?: string; - }, - ) { + component({ toc, frontmatter, default: Mdx }) { return ( - - {frontmatter.title} - + {frontmatter.title} {frontmatter.description} - + ); }, }); -export default function Page({ loaderData }: Route.ComponentProps) { - const { path, pageTree } = useFumadocsLoader(loaderData); +export default function Page({ loaderData, params }: Route.ComponentProps) { + const { pageTree, lang } = useFumadocsLoader(loaderData); return ( - - {clientLoader.useContent(path)} + + {clientLoader.useContent(loaderData.path)} ); } diff --git a/packages/docs/app/docs/search.ts b/packages/docs/app/docs/search.ts index 9603c72..a98edd5 100644 --- a/packages/docs/app/docs/search.ts +++ b/packages/docs/app/docs/search.ts @@ -3,8 +3,11 @@ import { createFromSource } from 'fumadocs-core/search/server'; import { source } from '@/lib/source'; const server = createFromSource(source, { - // https://docs.orama.com/docs/orama-js/supported-languages - language: 'english', + localeMap: { + zh: { + language: 'english', + }, + }, }); export async function loader({ request }: Route.LoaderArgs) { diff --git a/packages/docs/app/lib/i18n.ts b/packages/docs/app/lib/i18n.ts new file mode 100644 index 0000000..a9f18b1 --- /dev/null +++ b/packages/docs/app/lib/i18n.ts @@ -0,0 +1,8 @@ +import { defineI18n } from 'fumadocs-core/i18n'; + +export const i18n = defineI18n({ + defaultLanguage: 'zh', + languages: ['zh', 'en'], + hideLocale: 'default-locale', + parser: 'dir', // 使用目录结构 (content/zh/*, content/en/*) +}); diff --git a/packages/docs/app/lib/layout.shared.tsx b/packages/docs/app/lib/layout.shared.tsx index 6c7a35d..6e90ba0 100644 --- a/packages/docs/app/lib/layout.shared.tsx +++ b/packages/docs/app/lib/layout.shared.tsx @@ -1,9 +1,24 @@ import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared'; +import { i18n } from './i18n'; -export function baseOptions(): BaseLayoutProps { +export function baseOptions(locale: string): BaseLayoutProps { + // 默认语言(zh)不显示前缀,其他语言显示前缀 + const isDefaultLocale = locale === i18n.defaultLanguage; + const localePrefix = isDefaultLocale ? '' : `/${locale}`; + return { + i18n, nav: { title: 'DropOut', + url: localePrefix || '/', }, + githubUrl: 'https://github.com/HydroRoll-Team/DropOut', + links: [ + { + type: 'main', + text: locale === 'zh' ? '文档' : 'Documentation', + url: `${localePrefix}/docs`, + }, + ], }; } diff --git a/packages/docs/app/lib/source.ts b/packages/docs/app/lib/source.ts index 97cf767..bce9bf9 100644 --- a/packages/docs/app/lib/source.ts +++ b/packages/docs/app/lib/source.ts @@ -1,7 +1,12 @@ import { loader } from 'fumadocs-core/source'; import { docs } from 'fumadocs-mdx:collections/server'; +import { i18n } from './i18n'; export const source = loader({ source: docs.toFumadocsSource(), baseUrl: '/docs', + i18n, + // hideLocale: 'default-locale' 会自动生成正确的 URL: + // - 默认语言 (zh): /docs/getting-started + // - 其他语言 (en): /en/docs/getting-started }); diff --git a/packages/docs/app/root.tsx b/packages/docs/app/root.tsx index a6c807e..9032c80 100644 --- a/packages/docs/app/root.tsx +++ b/packages/docs/app/root.tsx @@ -6,11 +6,25 @@ import { Outlet, Scripts, ScrollRestoration, + useParams, } from 'react-router'; import { RootProvider } from 'fumadocs-ui/provider/react-router'; import type { Route } from './+types/root'; import './app.css'; +import { defineI18nUI } from 'fumadocs-ui/i18n'; +import { i18n } from './lib/i18n'; +const { provider } = defineI18nUI(i18n, { + translations: { + en: { + displayName: 'English', + }, + zh: { + displayName: '中文', + search: '查找文档', + }, + }, +}); export const links: Route.LinksFunction = () => [ { rel: 'preconnect', href: 'https://fonts.googleapis.com' }, { @@ -25,8 +39,10 @@ export const links: Route.LinksFunction = () => [ ]; export function Layout({ children }: { children: React.ReactNode }) { + const { lang = i18n.defaultLanguage } = useParams(); + return ( - + @@ -34,7 +50,7 @@ export function Layout({ children }: { children: React.ReactNode }) { - {children} + {children} diff --git a/packages/docs/app/routes.ts b/packages/docs/app/routes.ts index 9acc429..2997ecf 100644 --- a/packages/docs/app/routes.ts +++ b/packages/docs/app/routes.ts @@ -1,9 +1,16 @@ -import { index, route, type RouteConfig } from '@react-router/dev/routes'; +import { route, type RouteConfig } from '@react-router/dev/routes'; export default [ - index('routes/home.tsx'), - route('docs', 'routes/docs.tsx'), - route('docs/*', 'docs/page.tsx'), - route('api/search', 'docs/search.ts'), - route('*', 'routes/not-found.tsx'), + // Home routes: / and /:lang + route(':lang?', 'routes/home.tsx', { id: 'home' }), + + // Docs routes: /docs/* and /:lang/docs/* + route(':lang?/docs', 'routes/docs.tsx', { id: 'docs' }), + route(':lang?/docs/*', 'docs/page.tsx', { id: 'docs-page' }), + + // API routes + route('api/search', 'docs/search.ts', { id: 'api-search' }), + + // Catch-all 404 + route('*', 'routes/not-found.tsx', { id: 'not-found' }), ] satisfies RouteConfig; diff --git a/packages/docs/app/routes/docs.tsx b/packages/docs/app/routes/docs.tsx index a1c1707..5154d27 100644 --- a/packages/docs/app/routes/docs.tsx +++ b/packages/docs/app/routes/docs.tsx @@ -1,6 +1,16 @@ import type { Route } from './+types/docs'; import { redirect } from 'react-router'; -export function loader({}: Route.LoaderArgs) { - return redirect('/docs/en'); +import { i18n } from '@/lib/i18n'; + +export function loader({ params }: Route.LoaderArgs) { + const lang = params.lang as string | undefined; + + // 如果没有语言参数或是默认语言,重定向到 /docs/getting-started + if (!lang || lang === i18n.defaultLanguage) { + return redirect('/docs/getting-started'); + } + + // 其他语言重定向到 /:lang/docs/getting-started + return redirect(`/${lang}/docs/getting-started`); } diff --git a/packages/docs/app/routes/home.tsx b/packages/docs/app/routes/home.tsx index 1bd2235..66b5333 100644 --- a/packages/docs/app/routes/home.tsx +++ b/packages/docs/app/routes/home.tsx @@ -1,43 +1,117 @@ import type { Route } from './+types/home'; import { HomeLayout } from 'fumadocs-ui/layouts/home'; -import { Link } from 'react-router'; import { baseOptions } from '@/lib/layout.shared'; +import { i18n } from '@/lib/i18n'; -export function meta({}: Route.MetaArgs) { +const texts = { + en: { + hero: { + title: 'DropOut Minecraft Launcher', + subtitle: 'Modern. Reproducible. Developer-Grade.', + description: 'Built with Tauri v2 and Rust for native performance and minimal resource usage', + start: 'Get Started', + features: 'Features', + }, + features: { + items: [ + { title: 'High Performance', desc: 'Built with Rust and Tauri for minimal resource usage and fast startup times' }, + { title: 'Modern UI', desc: 'Clean, distraction-free interface with Svelte 5 and Tailwind CSS 4' }, + { title: 'Secure Auth', desc: 'Microsoft OAuth 2.0 with device code flow and offline mode support' }, + { title: 'Mod Loaders', desc: 'Built-in support for Fabric and Forge with automatic version management' }, + { title: 'Java Management', desc: 'Auto-detection and integrated downloader for Adoptium JDK/JRE' }, + { title: 'Instance System', desc: 'Isolated game environments with independent configs and mods' }, + ] + }, + why: { + title: 'Why DropOut?', + items: [ + { q: 'Your instance worked yesterday but broke today?', a: '→ DropOut makes it traceable.' }, + { q: 'Sharing a modpack means zipping gigabytes?', a: '→ DropOut shares exact dependency manifests.' }, + { q: 'Java, loader, mods, configs drift out of sync?', a: '→ DropOut locks them together.' }, + ] + }, + cta: { + title: 'Ready to get started?', + desc: 'Check out the documentation to learn more about DropOut', + button: 'Read the Docs', + } + }, + zh: { + hero: { + title: 'DropOut Minecraft 启动器', + subtitle: '现代、可复现、开发者级', + description: '基于 Tauri v2 和 Rust 构建,拥有原生性能和极低的资源占用', + start: '开始使用', + features: '功能特性', + }, + features: { + items: [ + { title: '高性能', desc: '使用 Rust 和 Tauri 构建,资源占用最小,启动速度极快' }, + { title: '现代化界面', desc: '简洁、无干扰的界面,使用 Svelte 5 和 Tailwind CSS 4' }, + { title: '安全认证', desc: '支持微软 OAuth 2.0 设备代码流和离线模式' }, + { title: '模组支持', desc: '内置 Fabric 和 Forge 支持,自动管理版本' }, + { title: 'Java 管理', desc: '自动检测并集成 Adoptium JDK/JRE 下载器' }, + { title: '实例系统', desc: '独立的游戏环境,独立的配置和模组' }, + ] + }, + why: { + title: '为什么选择 DropOut?', + items: [ + { q: '你的实例昨天还能用,今天就坏了?', a: '→ DropOut 让它可追溯。' }, + { q: '分享模组包意味着打包数GB的文件?', a: '→ DropOut 分享精确的依赖清单。' }, + { q: 'Java、加载器、模组、配置不同步?', a: '→ DropOut 将它们锁定在一起。' }, + ] + }, + cta: { + title: '准备好开始了?', + desc: '查看文档以了解更多关于 DropOut 的信息', + button: '阅读文档', + } + } +}; + +export function meta({ params }: Route.MetaArgs) { return [ { title: 'DropOut - Modern Minecraft Launcher' }, { name: 'description', content: 'A modern, reproducible, and developer-grade Minecraft launcher built with Tauri v2 and Rust.' }, ]; } -export default function Home() { +export default function Home({ params }: Route.ComponentProps) { + const lang = (params.lang as 'en' | 'zh') || i18n.defaultLanguage; + const t = texts[lang]; + + // 默认语言(zh)不显示前缀,其他语言显示前缀 + const isDefaultLocale = lang === i18n.defaultLanguage; + const localePrefix = isDefaultLocale ? '' : `/${lang}`; + return ( - +

{/* Hero Section */}

- DropOut Minecraft Launcher + {t.hero.title}

- Modern. Reproducible. Developer-Grade. + {t.hero.subtitle}

- Built with Tauri v2 and Rust for native performance and minimal resource usage + {t.hero.description}

@@ -54,84 +128,44 @@ export default function Home() { {/* Features Grid */}
-
-

High Performance

-

- Built with Rust and Tauri for minimal resource usage and fast startup times -

-
-
-

Modern UI

-

- Clean, distraction-free interface with Svelte 5 and Tailwind CSS 4 -

-
-
-

Secure Auth

-

- Microsoft OAuth 2.0 with device code flow and offline mode support -

-
-
-

Mod Loaders

-

- Built-in support for Fabric and Forge with automatic version management -

-
-
-

Java Management

-

- Auto-detection and integrated downloader for Adoptium JDK/JRE -

-
-
-

Instance System

-

- Isolated game environments with independent configs and mods -

-
+ {t.features.items.map((item, i) => ( +
+

{item.title}

+

+ {item.desc} +

+
+ ))}
{/* Why DropOut Section */}
-

Why DropOut?

+

{t.why.title}

-
-

- Your instance worked yesterday but broke today? -
- → DropOut makes it traceable. -

-
-
-

- Sharing a modpack means zipping gigabytes? -
- → DropOut shares exact dependency manifests. -

-
-
-

- Java, loader, mods, configs drift out of sync? -
- → DropOut locks them together. -

-
+ {t.why.items.map((item, i) => ( +
+

+ {item.q} +
+ {item.a} +

+
+ ))}
{/* CTA Section */}
-

Ready to get started?

+

{t.cta.title}

- Check out the documentation to learn more about DropOut + {t.cta.desc}

- - Read the Docs - + {t.cta.button} +
diff --git a/packages/docs/source.config.ts b/packages/docs/source.config.ts index 1e8ac56..d67a91b 100644 --- a/packages/docs/source.config.ts +++ b/packages/docs/source.config.ts @@ -1,8 +1,7 @@ import { defineConfig, defineDocs } from 'fumadocs-mdx/config'; export const docs = defineDocs({ - dir: 'content/docs', - i18n: true, + dir: 'content', }); export default defineConfig(); -- cgit v1.2.3-70-g09d2