@windrun-huaiin/diaomao 26.0.0 → 29.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/.env.local.txt +14 -5
  2. package/.gitignore +70 -28
  3. package/dev-scripts.config.json +13 -5
  4. package/next.config.ts +37 -5
  5. package/package.json +24 -54
  6. package/src/app/[locale]/(clerk)/layout.tsx +3 -3
  7. package/src/app/[locale]/(content)/blog/[[...slug]]/page.tsx +5 -7
  8. package/src/app/[locale]/(content)/blog/layout.tsx +62 -7
  9. package/src/app/[locale]/{(home) → (content)}/legal/[[...slug]]/page.tsx +4 -5
  10. package/src/app/[locale]/(content)/legal/layout.tsx +70 -0
  11. package/src/app/[locale]/(home)/layout.heavy.tsx +27 -0
  12. package/src/app/[locale]/(home)/layout.tsx +12 -10
  13. package/src/app/[locale]/(home)/page.tsx +9 -9
  14. package/src/app/[locale]/(home)/pricing/page.tsx +30 -17
  15. package/src/app/[locale]/(home)/pricing/pricing-client.tsx +87 -0
  16. package/src/app/[locale]/layout.config.tsx +5 -114
  17. package/src/app/[locale]/layout.nav.tsx +129 -0
  18. package/src/app/[locale]/layout.tsx +5 -6
  19. package/src/app/[locale]/loading.tsx +1 -1
  20. package/src/app/api/blog/llm-content/route.ts +3 -3
  21. package/src/app/api/legal/llm-content/route.ts +3 -3
  22. package/src/app/api/stripe/checkout/route.ts +1 -0
  23. package/src/app/api/stripe/customer-portal/route.ts +1 -0
  24. package/src/app/api/user/anonymous/init/route.ts +1 -0
  25. package/src/app/api/user/credit-overview/route.ts +32 -0
  26. package/src/app/api/user/pricing-context/route.ts +4 -0
  27. package/src/app/api/webhook/clerk/user/route.ts +1 -0
  28. package/src/app/api/webhook/stripe/route.ts +1 -0
  29. package/src/app/robots.ts +2 -2
  30. package/src/app/sitemap.ts +2 -2
  31. package/src/components/credit-popover-client.tsx +72 -0
  32. package/src/components/credit-popover.tsx +12 -8
  33. package/src/components/hero.tsx +2 -2
  34. package/src/i18n.ts +1 -8
  35. package/src/lib/appConfig.ts +1 -1
  36. package/src/lib/i18n-base.ts +8 -0
  37. package/src/lib/site-config.ts +1 -1
  38. package/src/lib/site-docs-base.ts +106 -0
  39. package/src/lib/site-docs.ts +12 -0
  40. package/src/mdx/blog/cheatsheet.mdx +266 -0
  41. package/src/mdx/blog/index.mdx +5 -2
  42. package/src/mdx/blog/ioc.mdx +4 -3
  43. package/src/mdx/blog/readme.mdx +13 -4
  44. package/src/proxy.ts +11 -15
  45. package/src/server/prisma.ts +71 -0
  46. package/tsconfig.json +3 -0
  47. package/src/app/[locale]/(content)/layout.tsx +0 -60
  48. package/src/app/[locale]/(home)/legal/layout.tsx +0 -20
  49. package/src/components/mdx-components.tsx +0 -34
  50. package/src/lib/content-source.ts +0 -42
package/.env.local.txt CHANGED
@@ -98,11 +98,14 @@ STRIPE_ONE_TIME_MORE_CREDITS=20
98
98
  ## Public Switch Control
99
99
  NEXT_PUBLIC_STYLE_SHOW_BANNER=true
100
100
  NEXT_PUBLIC_STYLE_CLERK_PAGE_BANNER=true
101
- NEXT_PUBLIC_STYLE_CLERK_AUTH_IN_MODAL=false
101
+ NEXT_PUBLIC_STYLE_CLERK_AUTH_IN_MODAL=true
102
102
  NEXT_PUBLIC_STYLE_WATERMARK_ENABLED=true
103
- NEXT_PUBLIC_DELAYED_IMG_ENABLED=true
103
+ NEXT_PUBLIC_DELAYED_IMG_ENABLED=false
104
104
  CLERK_DEBUG=false
105
- LOCAL_MD_CACHE_DISABLE=true
105
+ LOCAL_MD_CACHE_DISABLE=false
106
+ LOCAL_MD_DEBUG=false
107
+ LOCAL_MD_CACHE_EMPTY=false
108
+ LOCAL_MD_DEV_RUNTIME=false
106
109
 
107
110
 
108
111
  ##================================##
@@ -126,12 +129,17 @@ CREDITS_INIT_FREE_REGISTER_AMOUNT=2
126
129
  CREDITS_INIT_FREE_EXPIRED_DAYS=7
127
130
  CREDITS_ONE_TIME_EXPIRED_DAYS=30
128
131
 
132
+
133
+ ######### ---------------------------------- #########
134
+ ######### Key, Token, Secret, Pem. #######
135
+
129
136
  ## Supabase RLS Security Isolation Description
130
137
  ## The project adopts: Frontend -> Backend Authentication -> Prisma Transaction Direct Connection (Account Permission Isolation) -> PostgresDB Dedicated Schema Access
131
138
  ## No frontend role access is opened. Therefore, pay close attention to the creation SQL in init-schema, which contains sufficient permission isolation and security control
132
139
 
133
140
  ## Project->Database->Settings->ResetPassword
134
141
  #### Transaction Mode, IPv4 supported, great concurrency performance, Prisma prepared statements not supported
142
+ ## ⚠️⚠️DO NOT use sslmode=require/no-verify, but config SSL cert env: SUPABASE_DB_CA_CERT
135
143
  ## DATABASE_URL="postgresql://YOURS_app.PROJECT_ID:PASSWORD@SERVER_HOST.pooler.supabase.com:6543/postgres?sslmode=require&schema=YOURS&pgbouncer=true"
136
144
  #### Session Mode, IPv4 supported, consumes connections with slightly poorer concurrency performance, but supports Prisma prepared statements
137
145
  ## DATABASE_URL="postgresql://YOURS_app.PROJECT_ID:PASSWORD@SERVER_HOST.pooler.supabase.com:5432/postgres?sslmode=require&schema=YOURS"
@@ -139,9 +147,9 @@ CREDITS_ONE_TIME_EXPIRED_DAYS=30
139
147
  # DB Config, Local Supabase Docker Image
140
148
  ## 🚨⚠️Superuser Account Access🚨⚠️, extremely high risk, will completely invalidate multi-schema permission isolation for one database
141
149
  ## DATABASE_URL="postgresql://postgres:YOURS_PASSWORD@localhost:5432/postgres?schema=YOURS"
142
- ## Project dedicated account access, recommended
150
+ ## Project dedicated account access, recommended, ⚠️⚠️ windrun-huaiin/backend-core has limited safety, so in local env you should siable ssl
143
151
  # DB Config, replace YOUR port、db name、schema
144
- DATABASE_URL="postgresql://YOURS_app:YOURS_PASSWORD@localhost:5432/postgres?schema=YOURS"
152
+ DATABASE_URL="postgresql://YOURS_app:YOURS_PASSWORD@localhost:5432/postgres?sslmode=disable&schema=YOURS"
145
153
 
146
154
  ## Clerk Front/Backend config
147
155
  NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=YOURS-
@@ -195,3 +203,4 @@ OPENROUTER_ENABLE_MOCK=true
195
203
  NEXT_PUBLIC_OPENROUTER_DEBUG=true
196
204
  ENABLE_STRIPE_SUBSCRIPTION_UPGRADE=true
197
205
  MONEY_PRICE_MOCK_USER_ENABLED=false
206
+ PRISMA_DEBUG=false
package/.gitignore CHANGED
@@ -1,7 +1,11 @@
1
- .zshrc*
2
- .zsh_history
1
+ .zsh*
3
2
  .zprofile
4
- next-env.d.ts
3
+ .gemini*
4
+ .claude*
5
+ .codex*
6
+ .cursor*
7
+ .gitNexus*
8
+
5
9
  # Logs
6
10
  logs
7
11
  *.log
@@ -10,9 +14,8 @@ yarn-debug.log*
10
14
  yarn-error.log*
11
15
  lerna-debug.log*
12
16
  .pnpm-debug.log*
13
- .claude*
14
- .codex*
15
- .gemini*
17
+
18
+ clerk-dns-domain.txt
16
19
 
17
20
  .changeset/d8-template.md
18
21
 
@@ -81,24 +84,30 @@ web_modules/
81
84
  # Yarn Integrity file
82
85
  .yarn-integrity
83
86
 
84
- # dotenv environment variable files
85
- .env
86
- .env.development.local
87
- .env.test.local
88
- .env.production.local
89
- .env.local
87
+ # dotenv environment variable files (anywhere)
88
+ **/.env
89
+ **/.env.*
90
+ !**/.env.example
91
+ !**/.env.local.txt
90
92
 
91
93
  # parcel-bundler cache (https://parceljs.org/)
92
94
  .cache
93
95
  .parcel-cache
94
96
 
95
- # Next.js build output
96
- .next
97
- out
98
-
99
- # Nuxt.js build / generate output
100
- .nuxt
101
- dist
97
+ # Build outputs (anywhere in project)
98
+ **/next-env.d.ts
99
+ **/.next/
100
+ **/out/
101
+ **/dist/
102
+ **/build/
103
+ **/esm/
104
+ **/cjs/
105
+
106
+ # Framework specific outputs
107
+ **/.nuxt/
108
+ **/.docusaurus/
109
+ **/.vuepress/dist/
110
+ **/storybook-static/
102
111
 
103
112
  # Gatsby files
104
113
  .cache/
@@ -106,16 +115,10 @@ dist
106
115
  # https://nextjs.org/blog/next-9-1#public-directory-support
107
116
  # public
108
117
 
109
- # vuepress build output
110
- .vuepress/dist
111
-
112
118
  # vuepress v2.x temp and cache directory
113
119
  .temp
114
120
  .cache
115
121
 
116
- # Docusaurus cache and generated files
117
- .docusaurus
118
-
119
122
  # Serverless directories
120
123
  .serverless/
121
124
 
@@ -137,12 +140,51 @@ dist
137
140
  .yarn/build-state.yml
138
141
  .yarn/install-state.gz
139
142
  .pnp.*
143
+
144
+ # pnpm workspace
145
+ .pnpm-store/
146
+ .pnpm/
147
+ **/pnpm-debug.log
148
+
149
+ # Test coverage (anywhere)
150
+ **/coverage/
151
+
152
+ # Temporary files
153
+ tmp/
154
+ temp/
155
+ .tmp/
156
+ .temp/
157
+
158
+ # IDE and editor files
159
+ .vscode/
160
+ .idea/
161
+ *.swp
162
+ *.swo
163
+ *~
164
+
165
+ # OS generated files
140
166
  .DS_Store
141
- .source/index.ts
142
- .source/source.config.mjs
167
+ .DS_Store?
168
+ ._*
169
+ .Spotlight-V100
170
+ .Trashes
171
+ ehthumbs.db
172
+ Thumbs.db
173
+
174
+ # Generated local-md source artifacts
175
+ .source/
176
+
177
+ # App Prisma clients are generated during dev/build
178
+ src/generated/prisma/
179
+
180
+ # Backup files
181
+ *.bak
182
+ *.backup
143
183
 
184
+ # Turbo cache
185
+ **/.turbo
144
186
 
145
- /generated/prisma
146
187
  .gitnexus
147
188
  AGENTS.md
148
189
  CLAUDE.md
190
+ .vercel
@@ -2,11 +2,15 @@
2
2
  "i18n": {
3
3
  "locales": ["en"],
4
4
  "defaultLocale": "en",
5
- "messageRoot": "messages"
5
+ "messageRoot": "messages",
6
+ "messageGlobs": [
7
+ "messages/{locale}.json",
8
+ "messages/biz/*.{locale}.json"
9
+ ]
6
10
  },
7
11
  "scan": {
8
12
  "include": ["src/**/*.{tsx,ts,jsx,js}"],
9
- "exclude": ["src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.d.ts", "node_modules/**", ".claude/**", ".gemini/**", ".codex/**", ".vscode/**", ".clerk/**"],
13
+ "exclude": ["src/**/*.d.ts", "src/**/*.test.ts", "src/**/*.test.tsx", "node_modules/**"],
10
14
  "includeWindrunPackages": false,
11
15
  "whitelist": ["footer.title", "home.email", "home.banner"],
12
16
  "namespaceWhitelist": [
@@ -47,6 +51,7 @@
47
51
  "@clerk/themes",
48
52
  "@fingerprintjs/fingerprintjs",
49
53
  "@hookform/resolvers",
54
+ "@prisma/adapter-pg",
50
55
  "@prisma/client",
51
56
  "@radix-ui/react-alert-dialog",
52
57
  "@radix-ui/react-dropdown-menu",
@@ -63,12 +68,12 @@
63
68
  "@types/react-dom",
64
69
  "@typescript-eslint/parser",
65
70
  "@windrun-huaiin/contracts",
66
- "@windrun-huaiin/base-ui",
67
- "@windrun-huaiin/dev-scripts",
68
71
  "@windrun-huaiin/lib",
72
+ "@windrun-huaiin/base-ui",
69
73
  "@windrun-huaiin/third-ui",
70
74
  "@windrun-huaiin/backend-core",
71
75
  "@windrun-huaiin/fumadocs-local-md",
76
+ "@windrun-huaiin/dev-scripts",
72
77
  "autoprefixer",
73
78
  "baseline-browser-mapping",
74
79
  "class-variance-authority",
@@ -114,7 +119,10 @@
114
119
  ],
115
120
  "compactLog": true
116
121
  },
122
+ "architectureExclude": [
123
+ "coverage"
124
+ ],
117
125
  "architectureConfig": {
118
- ".": "Diaomao Project"
126
+ ".": "Diaomao项目"
119
127
  }
120
128
  }
package/next.config.ts CHANGED
@@ -33,11 +33,43 @@ const nextConfig: NextConfig = {
33
33
  outputFileTracingIncludes: {
34
34
  // Ensure MDX files for the llm-content API route are included in the serverless function
35
35
  // Adjust the key if your API route path is different in the output structure
36
- '/api/blog/llm-content': ['./src/mdx/blog/**/*'],
37
- '/api/legal/llm-content': ['./src/mdx/legal/**/*'],
38
- '/[locale]/blog/[[...slug]]': ['./src/mdx/blog/**/*'],
39
- '/[locale]/legal/[[...slug]]': ['./src/mdx/legal/**/*'],
36
+ '/api/blog/llm-content': ['./src/mdx/blog/**/*', './.source/**/*'],
37
+ '/api/legal/llm-content': ['./src/mdx/legal/**/*', './.source/**/*'],
38
+ '/blog': ['./.source/**/*'],
39
+ '/blog/[[...slug]]': ['./.source/**/*'],
40
+ '/[locale]/blog': ['./.source/**/*'],
41
+ '/[locale]/blog/[[...slug]]': ['./.source/**/*'],
42
+ '/legal': ['./.source/**/*'],
43
+ '/legal/[[...slug]]': ['./.source/**/*'],
44
+ '/[locale]/legal': ['./.source/**/*'],
45
+ '/[locale]/legal/[[...slug]]': ['./.source/**/*'],
46
+ },
47
+
48
+ outputFileTracingExcludes: {
49
+ '*': [
50
+ './tsconfig.tsbuildinfo',
51
+ './tsconfig.json',
52
+ './tsconfig.node.json',
53
+ './dev-scripts.config.json',
54
+ './components.json',
55
+ './eslint.config.js',
56
+ './postcss.config.mjs',
57
+ './next.config.ts',
58
+ './CHANGELOG.md',
59
+ './LICENSE',
60
+ './logs/**/*',
61
+ './github/**/*',
62
+ './changeset/**/*',
63
+ './database/**/*',
64
+ './docs/**/*',
65
+ './node_modules/.pnpm/@prisma+client*/node_modules/@prisma/client/runtime/query_compiler_bg.cockroachdb.*',
66
+ './node_modules/.pnpm/@prisma+client*/node_modules/@prisma/client/runtime/query_compiler_bg.mysql.*',
67
+ './node_modules/.pnpm/@prisma+client*/node_modules/@prisma/client/runtime/query_compiler_bg.sqlite.*',
68
+ './node_modules/.pnpm/@prisma+client*/node_modules/@prisma/client/runtime/query_compiler_bg.sqlserver.*',
69
+ './node_modules/.pnpm/@prisma+client*/node_modules/@prisma/client/runtime/query_compiler_bg.postgresql.js',
70
+ './node_modules/.pnpm/@prisma+client*/node_modules/@prisma/client/runtime/query_compiler_bg.postgresql.wasm-base64.js',
71
+ ],
40
72
  }
41
73
  };
42
74
 
43
- export default withNextIntl(nextConfig);
75
+ export default withNextIntl(nextConfig);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windrun-huaiin/diaomao",
3
- "version": "26.0.0",
3
+ "version": "29.0.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -15,58 +15,28 @@
15
15
  "react"
16
16
  ],
17
17
  "dependencies": {
18
- "@clerk/localizations": "^4.2.2",
19
18
  "@clerk/nextjs": "^7.0.5",
20
- "@clerk/shared": "^4.3.1",
21
- "@clerk/themes": "^2.4.57",
22
- "@fingerprintjs/fingerprintjs": "^5.1.0",
23
- "@hookform/resolvers": "^5.2.2",
24
- "@radix-ui/react-alert-dialog": "^1.1.15",
25
- "@radix-ui/react-dropdown-menu": "^2.1.16",
26
- "@radix-ui/react-label": "^2.1.8",
27
- "@radix-ui/react-slot": "^1.2.4",
28
- "@tailwindcss/typography": "^0.5.19",
29
19
  "@types/mdx": "^2.0.13",
30
- "@windrun-huaiin/backend-core": "26.0.2",
31
- "@windrun-huaiin/base-ui": "26.0.0",
32
- "@windrun-huaiin/contracts": "22.0.0",
33
- "@windrun-huaiin/fumadocs-local-md": "26.0.0",
34
- "@windrun-huaiin/lib": "26.0.0",
35
- "@windrun-huaiin/third-ui": "26.0.0",
36
- "autoprefixer": "^10.4.27",
37
- "class-variance-authority": "^0.7.1",
20
+ "@windrun-huaiin/backend-core": "29.0.1",
21
+ "@windrun-huaiin/base-ui": "29.0.0",
22
+ "@windrun-huaiin/contracts": "29.0.0",
23
+ "@windrun-huaiin/fumadocs-local-md": "29.0.0",
24
+ "@windrun-huaiin/lib": "29.0.0",
25
+ "@windrun-huaiin/third-ui": "29.0.2",
38
26
  "clsx": "^2.1.1",
39
- "date-fns": "^4.1.0",
40
- "fumadocs-core": "16.8.2",
41
- "fumadocs-ui": "16.8.2",
42
- "katex": "^0.16.33",
43
27
  "lucide-react": "^0.577.0",
44
- "mermaid": "11.12.1",
45
28
  "next": "16.1.6",
46
29
  "next-intl": "^4.8.3",
47
30
  "next-themes": "^0.4.6",
48
31
  "react": "19.2.4",
49
32
  "react-dom": "19.2.4",
50
- "react-medium-image-zoom": "^5.4.1",
51
- "rehype-katex": "^7.0.1",
52
- "remark": "^15.0.1",
53
- "remark-frontmatter": "^5.0.0",
54
- "remark-gfm": "^4.0.1",
55
- "remark-math": "^6.0.0",
56
- "remark-mdx": "^3.1.1",
57
- "shiki": "^4.0.0",
58
- "stripe": "22.0.2",
59
- "svix": "^1.86.0",
60
- "swiper": "^12.1.2",
61
33
  "tailwind-merge": "^3.5.0",
62
- "tailwindcss-animate": "^1.0.7",
63
- "uuid": "^13.0.0",
64
- "zod": "^4.3.6"
34
+ "turbo": "^2.9.6"
65
35
  },
66
36
  "devDependencies": {
67
37
  "@changesets/cli": "^2.29.8",
68
- "@prisma/client": "^6.19.0",
69
- "@tailwindcss/cli": "^4.2.1",
38
+ "@prisma/client": "^7.8.0",
39
+ "@prisma/adapter-pg": "^7.8.0",
70
40
  "@tailwindcss/postcss": "^4.2.1",
71
41
  "@types/hast": "^3.0.4",
72
42
  "@types/node": "^25.3.2",
@@ -74,20 +44,17 @@
74
44
  "@types/react": "^19.2.14",
75
45
  "@types/react-dom": "^19.2.3",
76
46
  "@typescript-eslint/parser": "^8.56.1",
77
- "@windrun-huaiin/dev-scripts": "^26.0.0",
47
+ "@windrun-huaiin/dev-scripts": "^29.0.1",
48
+ "dotenv": "^17.4.2",
78
49
  "baseline-browser-mapping": "^2.10.0",
79
50
  "eslint": "^9.39.1",
80
51
  "eslint-config-next": "^16.1.6",
81
52
  "eslint-plugin-unused-imports": "^4.4.1",
82
- "fast-glob": "^3.3.3",
83
53
  "nprogress": "^0.2.0",
84
54
  "postcss": "^8.5.6",
85
- "prisma": "^6.19.0",
55
+ "prisma": "^7.8.0",
86
56
  "tailwindcss": "^4.2.1",
87
- "ts-morph": "^27.0.2",
88
- "ts-node": "^10.9.2",
89
- "typescript": "^5.8.3",
90
- "unist-util-visit": "^5.1.0"
57
+ "typescript": "^5.8.3"
91
58
  },
92
59
  "files": [
93
60
  ".changeset",
@@ -114,11 +81,16 @@
114
81
  "!**/*.log"
115
82
  ],
116
83
  "scripts": {
117
- "dev": "prisma generate && next dev",
118
- "build": "pnpm generate-blog-index && prisma generate && next build",
119
- "build:dev": "pnpm generate-blog-index && prisma generate && next build",
120
- "build:prod": "prisma generate && next build",
121
- "start": "next start",
84
+ "dev": "turbo run task:dev",
85
+ "md:build": "turbo run task:md:build",
86
+ "build": "turbo run task:build",
87
+ "build:dev": "turbo run task:build:dev",
88
+ "build:prod": "turbo run task:build:prod",
89
+ "task:dev": "prisma generate && next dev",
90
+ "task:md:build": "pnpm exec local-md build",
91
+ "task:build": "pnpm generate-blog-index && prisma generate && next build",
92
+ "task:build:dev": "pnpm generate-blog-index && prisma generate && next build",
93
+ "task:build:prod": "prisma generate && next build",
122
94
  "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
123
95
  "lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
124
96
  "deep-clean": "dev-scripts deep-clean",
@@ -133,8 +105,6 @@
133
105
  "i18n": "dev-scripts check-translations -v",
134
106
  "core-list-route": "dev-scripts backend-core routes:list",
135
107
  "core-sync-route": "dev-scripts backend-core routes:sync",
136
- "core-sync-schema": "dev-scripts backend-core prisma:sync",
137
- "core-sync-sql": "dev-scripts backend-core migrations:sync --schema diaomao --dest database",
138
108
  "whoareyou": "dev-scripts generate-nextjs-architecture -v"
139
109
  }
140
110
  }
@@ -1,10 +1,10 @@
1
1
  import { baseOptions } from '@/app/[locale]/layout.config';
2
- import { fingerprintConfig } from '@windrun-huaiin/backend-core/lib';
2
+ import { fingerprintConfig } from '@windrun-huaiin/backend-core/config/fingerprint';
3
3
  import { FingerprintProvider } from '@windrun-huaiin/third-ui/fingerprint';
4
- import { SiteHomeLayout, type SiteHomeLayoutConfig } from '@windrun-huaiin/third-ui/fuma/base';
4
+ import { SiteHomeLayout, type SiteHomeLayoutConfig } from '@windrun-huaiin/third-ui/fuma/base/site-home-layout';
5
5
  import { ReactNode } from 'react';
6
6
  import { clerkPageBanner, localePrefixAsNeeded, defaultLocale } from '@/lib/appConfig';
7
- import { i18n } from '@/i18n';
7
+ import { i18n } from '@/lib/i18n-base';
8
8
  import { appConfig } from '@/lib/appConfig';
9
9
 
10
10
  async function homeOptions(locale: string): Promise<SiteHomeLayoutConfig> {
@@ -1,22 +1,20 @@
1
- import { getMDXComponents } from '@/components/mdx-components';
2
1
  import { appConfig } from '@/lib/appConfig';
2
+ import { siteDocs } from '@/lib/site-docs';
3
3
  import { NotFoundPage } from '@windrun-huaiin/base-ui/components';
4
- import { getContentSource } from '@/lib/content-source';
5
- import { createFumaPage } from '@windrun-huaiin/third-ui/fuma/server';
4
+ import { createFumaPage } from '@windrun-huaiin/third-ui/fuma/server/page-generator';
6
5
  import { SiteIcon } from '@/lib/site-config';
7
6
  import { LLMCopyButton } from '@windrun-huaiin/third-ui/fuma/mdx';
8
7
 
9
8
  const sourceKey = 'blog';
10
9
  const { Page, generateStaticParams, generateMetadata } = createFumaPage({
11
10
  sourceKey: sourceKey,
12
- mdxContentSource: () => getContentSource('blog'),
13
- getMDXComponents,
11
+ mdxContentSource: () => siteDocs.getContentSource('blog'),
12
+ getMDXComponents: siteDocs.getMDXComponents,
14
13
  mdxSourceDir: appConfig.mdxSourceDir[sourceKey],
15
14
  githubBaseUrl: appConfig.githubBaseUrl,
16
15
  copyButtonComponent: <LLMCopyButton />,
17
16
  siteIcon: <SiteIcon />,
18
17
  FallbackPage: NotFoundPage,
19
- supportedLocales: appConfig.i18n.locales as string[],
20
18
  showBreadcrumb: false,
21
19
  showTableOfContent: true,
22
20
  showTableOfContentPopover: false,
@@ -24,4 +22,4 @@ const { Page, generateStaticParams, generateMetadata } = createFumaPage({
24
22
  });
25
23
 
26
24
  export default Page;
27
- export { generateStaticParams, generateMetadata };
25
+ export { generateMetadata, generateStaticParams };
@@ -1,6 +1,23 @@
1
1
  import type { ReactNode } from 'react';
2
- import { getContentSource } from '@/lib/content-source';
3
- import { DocsLayout } from 'fumadocs-ui/layouts/docs';
2
+ import { baseOptions } from '@/app/[locale]/layout.config';
3
+ import { levelNavLinks, primaryNavLinks } from '@/app/[locale]/layout.nav';
4
+ import { showBanner, localePrefixAsNeeded, defaultLocale } from '@/lib/appConfig';
5
+ import { siteDocs } from '@/lib/site-docs';
6
+ import { SiteDocsLayout } from '@windrun-huaiin/third-ui/fuma/base/site-docs-layout';
7
+ import { SiteHomeLayout, type SiteHomeLayoutConfig } from '@windrun-huaiin/third-ui/fuma/base/site-home-layout';
8
+ import { fingerprintConfig } from '@windrun-huaiin/backend-core/config/fingerprint';
9
+ import { FingerprintProvider } from '@windrun-huaiin/third-ui/fingerprint';
10
+ import { appConfig } from '@/lib/appConfig';
11
+
12
+ async function contentOptions(locale: string): Promise<SiteHomeLayoutConfig> {
13
+ return {
14
+ ...(await baseOptions(locale)),
15
+ links: [
16
+ ...(await primaryNavLinks(locale)),
17
+ ...(await levelNavLinks(locale)),
18
+ ],
19
+ };
20
+ }
4
21
 
5
22
  export default async function Layout({
6
23
  params,
@@ -10,10 +27,48 @@ export default async function Layout({
10
27
  children: ReactNode;
11
28
  }) {
12
29
  const { locale } = await params;
13
- const blogSource = await getContentSource('blog');
30
+ const blogSource = await siteDocs.getContentSource('blog');
31
+ const contentLayoutOptions = await contentOptions(locale);
32
+ const homeLayoutOptions: SiteHomeLayoutConfig = {
33
+ ...contentLayoutOptions,
34
+ githubUrl: appConfig.github,
35
+ searchToggle: {
36
+ enabled: false,
37
+ },
38
+ themeSwitch: {
39
+ enabled: true,
40
+ mode: 'light-dark-system',
41
+ },
42
+ };
43
+
14
44
  return (
15
- <DocsLayout sidebar={{enabled: false}} searchToggle={{enabled: false}} tree={blogSource.pageTree[locale]}>
16
- {children}
17
- </DocsLayout>
45
+ <FingerprintProvider config={fingerprintConfig}>
46
+ <SiteHomeLayout
47
+ locale={locale}
48
+ config={{
49
+ ...homeLayoutOptions,
50
+ localePrefixAsNeeded,
51
+ defaultLocale,
52
+ showBanner,
53
+ showFooter: false,
54
+ floatingNav: true,
55
+ actionOrders: {
56
+ desktop: ['search', 'theme', 'github', 'i18n', 'secondary'],
57
+ mobileBar: ['search', 'pinned', 'menu'],
58
+ mobileMenu: ['theme', 'i18n', 'separator', 'secondary', 'github'],
59
+ },
60
+ }}
61
+ >
62
+ <SiteDocsLayout
63
+ config={{
64
+ tree: blogSource.getPageTree(locale),
65
+ sidebar: { enabled: false },
66
+ searchToggle: { enabled: false },
67
+ }}
68
+ >
69
+ {children}
70
+ </SiteDocsLayout>
71
+ </SiteHomeLayout>
72
+ </FingerprintProvider>
18
73
  );
19
- }
74
+ }
@@ -1,15 +1,14 @@
1
- import { getMDXComponents } from '@/components/mdx-components';
2
1
  import { appConfig } from '@/lib/appConfig';
2
+ import { siteDocs } from '@/lib/site-docs';
3
3
  import { SiteIcon } from '@/lib/site-config';
4
- import { getContentSource } from '@/lib/content-source';
5
4
  import { NotFoundPage } from '@windrun-huaiin/base-ui/components';
6
- import { createFumaPage } from '@windrun-huaiin/third-ui/fuma/server';
5
+ import { createFumaPage } from '@windrun-huaiin/third-ui/fuma/server/page-generator';
7
6
 
8
7
  const sourceKey = 'legal';
9
8
  const { Page, generateStaticParams, generateMetadata } = createFumaPage({
10
9
  sourceKey: sourceKey,
11
- mdxContentSource: () => getContentSource('legal'),
12
- getMDXComponents,
10
+ mdxContentSource: () => siteDocs.getContentSource('legal'),
11
+ getMDXComponents: siteDocs.getMDXComponents,
13
12
  mdxSourceDir: appConfig.mdxSourceDir[sourceKey],
14
13
  githubBaseUrl: appConfig.githubBaseUrl,
15
14
  siteIcon: <SiteIcon />,
@@ -0,0 +1,70 @@
1
+ import type { ReactNode } from 'react';
2
+ import { baseOptions } from '@/app/[locale]/layout.config';
3
+ import { levelNavLinks, primaryNavLinks } from '@/app/[locale]/layout.nav';
4
+ import { showBanner, localePrefixAsNeeded, defaultLocale } from '@/lib/appConfig';
5
+ import { siteDocs } from '@/lib/site-docs';
6
+ import { SiteDocsLayout } from '@windrun-huaiin/third-ui/fuma/base/site-docs-layout';
7
+ import { SiteHomeLayout, type SiteHomeLayoutConfig } from '@windrun-huaiin/third-ui/fuma/base/site-home-layout';
8
+ import { appConfig } from '@/lib/appConfig';
9
+
10
+ async function contentOptions(locale: string): Promise<SiteHomeLayoutConfig> {
11
+ return {
12
+ ...(await baseOptions(locale)),
13
+ links: [
14
+ ...(await primaryNavLinks(locale)),
15
+ ...(await levelNavLinks(locale)),
16
+ ],
17
+ };
18
+ }
19
+
20
+ export default async function Layout({
21
+ params,
22
+ children,
23
+ }: {
24
+ params: Promise<{ locale: string }>;
25
+ children: ReactNode;
26
+ }) {
27
+ const { locale } = await params;
28
+ const legalSource = await siteDocs.getContentSource('legal');
29
+ const contentLayoutOptions = await contentOptions(locale);
30
+ const homeLayoutOptions: SiteHomeLayoutConfig = {
31
+ ...contentLayoutOptions,
32
+ githubUrl: appConfig.github,
33
+ searchToggle: {
34
+ enabled: false,
35
+ },
36
+ themeSwitch: {
37
+ enabled: true,
38
+ mode: 'light-dark-system',
39
+ },
40
+ };
41
+
42
+ return (
43
+ <SiteHomeLayout
44
+ locale={locale}
45
+ config={{
46
+ ...homeLayoutOptions,
47
+ localePrefixAsNeeded,
48
+ defaultLocale,
49
+ showBanner,
50
+ showFooter: false,
51
+ floatingNav: true,
52
+ actionOrders: {
53
+ desktop: ['search', 'theme', 'github', 'i18n', 'secondary'],
54
+ mobileBar: ['search', 'pinned', 'menu'],
55
+ mobileMenu: ['theme', 'i18n', 'separator', 'secondary', 'github'],
56
+ },
57
+ }}
58
+ >
59
+ <SiteDocsLayout
60
+ config={{
61
+ tree: legalSource.getPageTree(locale),
62
+ sidebar: { enabled: false },
63
+ searchToggle: { enabled: false },
64
+ }}
65
+ >
66
+ {children}
67
+ </SiteDocsLayout>
68
+ </SiteHomeLayout>
69
+ );
70
+ }