|
1 | | -import { Database, Monitor, HardDrive, ShieldCheck, Puzzle, Code2, Rocket, Users, Blocks, LucideIcon } from 'lucide-react'; |
2 | | -import { HomeLayout } from 'fumadocs-ui/layouts/home'; |
3 | | -import { baseOptions } from '@/lib/layout.shared'; |
4 | | -import { getHomepageTranslations } from '@/lib/homepage-i18n'; |
5 | | -import { HeroSection } from '@/components/hero-section'; |
6 | | -import { CodePreview } from '@/components/code-preview'; |
7 | | -import { FeatureCard } from '@/components/feature-card'; |
8 | | -import { PersonaCard } from '@/components/persona-card'; |
| 1 | +import { redirect } from 'next/navigation'; |
| 2 | +import { i18n } from '@/lib/i18n'; |
9 | 3 |
|
10 | 4 | export default async function HomePage({ |
11 | 5 | params, |
12 | 6 | }: { |
13 | 7 | params: Promise<{ lang: string }>; |
14 | 8 | }) { |
15 | 9 | const { lang } = await params; |
16 | | - const t = getHomepageTranslations(lang); |
17 | 10 |
|
18 | | - const features = [ |
19 | | - { |
20 | | - key: 'restApi', |
21 | | - icon: Rocket, |
22 | | - href: '/docs/getting-started/quick-start', |
23 | | - title: t.features.restApi.title, |
24 | | - description: t.features.restApi.description, |
25 | | - }, |
26 | | - { |
27 | | - key: 'studio', |
28 | | - icon: Monitor, |
29 | | - href: '/docs/getting-started/cli', |
30 | | - title: t.features.studio.title, |
31 | | - description: t.features.studio.description, |
32 | | - }, |
33 | | - { |
34 | | - key: 'multiDb', |
35 | | - icon: HardDrive, |
36 | | - href: '/docs/guides/driver-configuration', |
37 | | - title: t.features.multiDb.title, |
38 | | - description: t.features.multiDb.description, |
39 | | - }, |
40 | | - { |
41 | | - key: 'typeSafety', |
42 | | - icon: ShieldCheck, |
43 | | - href: '/docs/references/data', |
44 | | - title: t.features.typeSafety.title, |
45 | | - description: t.features.typeSafety.description, |
46 | | - }, |
47 | | - { |
48 | | - key: 'namespace', |
49 | | - icon: Blocks, |
50 | | - href: '/docs/concepts/core', |
51 | | - title: t.features.namespace.title, |
52 | | - description: t.features.namespace.description, |
53 | | - }, |
54 | | - { |
55 | | - key: 'plugins', |
56 | | - icon: Puzzle, |
57 | | - href: '/docs/getting-started/examples', |
58 | | - title: t.features.plugins.title, |
59 | | - description: t.features.plugins.description, |
60 | | - }, |
61 | | - ]; |
62 | | - |
63 | | - const personas = [ |
64 | | - { |
65 | | - key: 'fullStack', |
66 | | - icon: Code2, |
67 | | - color: 'text-blue-500', |
68 | | - href: '/docs/getting-started/quick-start', |
69 | | - title: t.personas.fullStack.title, |
70 | | - description: t.personas.fullStack.description, |
71 | | - action: t.personas.fullStack.action, |
72 | | - }, |
73 | | - { |
74 | | - key: 'platformTeam', |
75 | | - icon: Users, |
76 | | - color: 'text-purple-500', |
77 | | - href: '/docs/concepts', |
78 | | - title: t.personas.platformTeam.title, |
79 | | - description: t.personas.platformTeam.description, |
80 | | - action: t.personas.platformTeam.action, |
81 | | - }, |
82 | | - { |
83 | | - key: 'lowCode', |
84 | | - icon: Blocks, |
85 | | - color: 'text-green-500', |
86 | | - href: '/docs/getting-started/examples', |
87 | | - title: t.personas.lowCode.title, |
88 | | - description: t.personas.lowCode.description, |
89 | | - action: t.personas.lowCode.action, |
90 | | - }, |
91 | | - ]; |
92 | | - |
93 | | - return ( |
94 | | - <HomeLayout {...baseOptions()} i18n> |
95 | | - <main className="flex min-h-screen flex-col items-center justify-center text-center px-4 py-16 sm:py-24 md:py-32 overflow-hidden bg-background text-foreground selection:bg-primary/20"> |
96 | | - |
97 | | - {/* Hero Section */} |
98 | | - <HeroSection |
99 | | - badge={t.badge} |
100 | | - title={t.hero.title} |
101 | | - subtitle={t.hero.subtitle} |
102 | | - cta={t.hero.cta} |
103 | | - quickStart={t.hero.quickStart} |
104 | | - /> |
105 | | - |
106 | | - {/* Code Preview */} |
107 | | - <CodePreview /> |
108 | | - |
109 | | - {/* Grid Pattern Background */} |
110 | | - <div className="absolute inset-0 -z-10 h-full w-full bg-[linear-gradient(to_right,#8080800a_1px,transparent_1px),linear-gradient(to_bottom,#8080800a_1px,transparent_1px)] bg-[size:4rem_4rem] [mask-image:radial-gradient(ellipse_60%_50%_at_50%_50%,#000_70%,transparent_100%)] pointer-events-none" /> |
111 | | - |
112 | | - {/* Feature Grid */} |
113 | | - <div className="mt-24 grid grid-cols-1 gap-6 text-left sm:grid-cols-2 lg:grid-cols-3 max-w-6xl w-full"> |
114 | | - {features.map((feature) => ( |
115 | | - <FeatureCard |
116 | | - key={feature.key} |
117 | | - icon={<feature.icon className="h-6 w-6" />} |
118 | | - title={feature.title} |
119 | | - href={feature.href} |
120 | | - description={feature.description} |
121 | | - /> |
122 | | - ))} |
123 | | - </div> |
124 | | - |
125 | | - {/* Personas Section */} |
126 | | - <div className="mt-32 mb-16 w-full max-w-5xl px-4"> |
127 | | - <h2 className="text-3xl sm:text-4xl font-bold tracking-tight mb-12 bg-gradient-to-r from-foreground to-foreground/70 bg-clip-text text-transparent"> |
128 | | - {t.personas.heading} |
129 | | - </h2> |
130 | | - <div className="grid grid-cols-1 md:grid-cols-3 gap-6"> |
131 | | - {personas.map((persona) => ( |
132 | | - <PersonaCard |
133 | | - key={persona.key} |
134 | | - icon={<persona.icon className={`w-8 h-8 ${persona.color}`} />} |
135 | | - title={persona.title} |
136 | | - description={persona.description} |
137 | | - href={persona.href} |
138 | | - action={persona.action} |
139 | | - /> |
140 | | - ))} |
141 | | - </div> |
142 | | - </div> |
143 | | - |
144 | | - </main> |
145 | | - </HomeLayout> |
146 | | - ); |
| 11 | + redirect(lang === i18n.defaultLanguage ? '/docs' : `/${lang}/docs`); |
147 | 12 | } |
148 | | - |
0 commit comments