Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions packages/docs/app/docs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import browserCollections from 'fumadocs-mdx:collections/browser';

export async function loader({ params }: Route.LoaderArgs) {
// 从路由参数获取语言,如果没有则使用默认语言
// URL 格式: /docs/getting-started (默认语言 zh)
// URL 格式: /en/docs/getting-started (英语)
// URL 格式: /docs/manual/getting-started (默认语言 zh)
// URL 格式: /en/docs/manual/getting-started (英语)
const lang = (params.lang && i18n.languages.includes(params.lang as any))
? (params.lang as 'zh' | 'en')
: (i18n.defaultLanguage as 'zh' | 'en');
Expand All @@ -37,10 +37,22 @@ const clientLoader = browserCollections.docs.createClientLoader({
component({ toc, frontmatter, default: Mdx }) {
return (
<DocsPage toc={toc}>
<DocsTitle>{frontmatter.title}</DocsTitle>
<DocsDescription>{frontmatter.description}</DocsDescription>
{/* 老王说不要这个 */}
{/* <DocsTitle>{frontmatter.title}</DocsTitle>
<DocsDescription>{frontmatter.description}</DocsDescription> */}
<DocsBody>
<Mdx components={{ ...defaultMdxComponents, Card, Cards }} />
<Mdx
components={{
...defaultMdxComponents,
Card: (props: any) => (
<Card
{...props}
className={`border-blue-600/20 hover:border-blue-600/50 transition-colors ${props.className || ''}`}
/>
),
Cards
}}
/>
</DocsBody>
</DocsPage>
);
Expand Down
9 changes: 7 additions & 2 deletions packages/docs/app/lib/layout.shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ export function baseOptions(locale: string): BaseLayoutProps {
links: [
{
type: 'main',
text: locale === 'zh' ? '文档' : 'Documentation',
url: `${localePrefix}/docs`,
text: locale === 'zh' ? '使用文档' : 'Manual',
url: `${localePrefix}/docs/manual`,
},
{
type: 'main',
text: locale === 'zh' ? '开发文档' : 'Development',
url: `${localePrefix}/docs/development`,
},
],
};
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/app/lib/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ export const source = loader({
baseUrl: '/docs',
i18n,
// hideLocale: 'default-locale' 会自动生成正确的 URL:
// - 默认语言 (zh): /docs/getting-started
// - 其他语言 (en): /en/docs/getting-started
// - 默认语言 (zh): /docs/manual/getting-started
// - 其他语言 (en): /en/docs/manual/getting-started
});
8 changes: 4 additions & 4 deletions packages/docs/app/routes/docs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { i18n } from '@/lib/i18n';
export function loader({ params }: Route.LoaderArgs) {
const lang = params.lang as string | undefined;

// 如果没有语言参数或是默认语言,重定向到 /docs/getting-started
// 如果没有语言参数或是默认语言,重定向到 /docs/manual/getting-started
if (!lang || lang === i18n.defaultLanguage) {
return redirect('/docs/getting-started');
return redirect('/docs/manual/getting-started');
}

// 其他语言重定向到 /:lang/docs/getting-started
return redirect(`/${lang}/docs/getting-started`);
// 其他语言重定向到 /:lang/docs/manual/getting-started
return redirect(`/${lang}/docs/manual/getting-started`);
}
14 changes: 7 additions & 7 deletions packages/docs/app/routes/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const texts = {
subtitle: 'Modern. Reproducible. Developer-Grade.',
description: 'Built with Tauri v2 and Rust for native performance and minimal resource usage',
start: 'Get Started',
features: 'Features',
development: 'Development',
},
features: {
items: [
Expand Down Expand Up @@ -42,7 +42,7 @@ const texts = {
subtitle: '现代、可复现、开发者级',
description: '基于 Tauri v2 和 Rust 构建,拥有原生性能和极低的资源占用',
start: '开始使用',
features: '功能特性',
development: '参与开发',
},
features: {
items: [
Expand Down Expand Up @@ -107,10 +107,10 @@ export default function Home({ params }: Route.ComponentProps) {
{t.hero.start}
</a>
<a
className="bg-fd-secondary hover:bg-fd-secondary/80 text-fd-secondary-foreground font-semibold rounded-lg px-6 py-3 transition-colors cursor-pointer"
href={`${localePrefix}/docs/features`}
className="bg-fd-secondary hover:bg-fd-secondary/80 text-fd-secondary-foreground font-semibold rounded-lg px-6 py-3 transition-colors cursor-pointer border border-blue-600/50"
href={`${localePrefix}/docs/development`}
>
{t.hero.features}
{t.hero.development}
</a>
</div>
</div>
Expand All @@ -129,7 +129,7 @@ export default function Home({ params }: Route.ComponentProps) {
{/* Features Grid */}
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-6 mb-16">
{t.features.items.map((item, i) => (
<div key={i} className="p-6 rounded-lg border border-fd-border bg-fd-card">
<div key={i} className="p-6 rounded-lg border border-blue-600/20 bg-fd-card hover:border-blue-600/50 transition-colors">
<h3 className="font-semibold text-lg mb-2">{item.title}</h3>
<p className="text-sm text-fd-muted-foreground">
{item.desc}
Expand Down Expand Up @@ -162,7 +162,7 @@ export default function Home({ params }: Route.ComponentProps) {
</p>
<a
className="inline-block bg-blue-600 hover:bg-blue-700 text-white font-semibold rounded-lg px-8 py-3 transition-colors"
href={`${localePrefix}/docs/getting-started`}
href={`${localePrefix}/docs/manual/getting-started`}
>
{t.cta.button}
</a>
Expand Down
Loading