@@ -24,10 +24,20 @@ export enum Chapters {
2424 xrobot_api = "/xrobot/api/" ,
2525 xrobot_api_server = "/xrobot/api/server/" ,
2626 xrobot_api_client = "/xrobot/api/client/" ,
27+ // platform
28+ xrobot_platform = "/xrobot/platform" ,
29+ xrobot_platform_esp32 = "/xrobot/platform/esp32" ,
2730 // faq
2831 xrobot_faq = "/xrobot/faq/" ,
2932}
3033
34+ // 判断一个link 字符串是否是章节link
35+ export function isChapter < T extends Record < string , string > > (
36+ link : string
37+ ) : link is T [ keyof T ] {
38+ return Object . values ( Chapters ) . includes ( link as Chapters ) ;
39+ }
40+
3141// // 给 ChapterItem 的 link 字段追加当前章节的 link 前缀
3242// // 通过是否包含子items来判断
3343// export function apply_prefix2(item: ChapterItem, prefix: Chapters) {
@@ -59,7 +69,7 @@ export function apply_prefix(item: ChapterItem, prefix: Chapters) {
5969export const items_xrobot_api_server = [
6070 {
6171 text : "服务端API参考" ,
62- collapsed : false ,
72+ collapsed : true ,
6373 link : Chapters . xrobot_api_server ,
6474 items : [
6575 { text : "用户API" , link : "user" } ,
@@ -73,7 +83,7 @@ export const items_xrobot_api_server = [
7383export const items_xrobot_api_client = [
7484 {
7585 text : "客户端API参考" ,
76- collapsed : false ,
86+ collapsed : true ,
7787 link : Chapters . xrobot_api_client ,
7888 items : [ ] . map ( ( item ) => apply_prefix ( item , Chapters . xrobot_api_client ) ) ,
7989 } ,
@@ -125,12 +135,26 @@ export const items_xrobot_guide = [
125135 } ,
126136] ;
127137
128- // 判断一个link 字符串是否是章节link
129- export function isChapter < T extends Record < string , string > > (
130- link : string
131- ) : link is T [ keyof T ] {
132- return Object . values ( Chapters ) . includes ( link as Chapters ) ;
133- }
138+ const items_xrobot_platform_esp32 = [
139+ {
140+ text : "ESP32" ,
141+ link : Chapters . xrobot_platform_esp32 ,
142+ collapsed : true ,
143+ items : [
144+ { text : "esp32-s3" , link : "S3" } ,
145+ { text : "esp32-c3" , link : "C3" } ,
146+ ] . map ( ( item ) => apply_prefix ( item , Chapters . xrobot_platform_esp32 ) ) ,
147+ } ,
148+ ] ;
149+
150+ const items_xrobot_platform = [
151+ {
152+ text : "设备平台" ,
153+ link : Chapters . xrobot_platform ,
154+ collapsed : false ,
155+ items : [ ...items_xrobot_platform_esp32 ] ,
156+ } ,
157+ ] ;
134158
135159const items_xrobot_faq = [
136160 {
@@ -148,8 +172,13 @@ const items_xrobot = [
148172 {
149173 text : "" ,
150174 link : Chapters . xrobot ,
151- items : [ ...items_xrobot_guide , ...items_xrobot_api , ...items_xrobot_faq ] ,
152175 // collapsed: false,
176+ items : [
177+ ...items_xrobot_guide ,
178+ ...items_xrobot_api ,
179+ ...items_xrobot_platform ,
180+ ...items_xrobot_faq ,
181+ ] ,
153182 } ,
154183] ;
155184
@@ -184,6 +213,15 @@ export const ChapterItems: Record<Chapters, ChapterItem[]> = {
184213 gobackItem ( Chapters . xrobot_guide ) ,
185214 ...items_xrobot_guide_device ,
186215 ] ,
216+ // platform
217+ [ Chapters . xrobot_platform ] : [
218+ gobackItem ( Chapters . xrobot ) ,
219+ ...items_xrobot_platform ,
220+ ] ,
221+ [ Chapters . xrobot_platform_esp32 ] : [
222+ gobackItem ( Chapters . xrobot_platform ) ,
223+ ...items_xrobot_platform_esp32 ,
224+ ] ,
187225 // faq
188226 [ Chapters . xrobot_faq ] : [ gobackItem ( Chapters . xrobot ) , ...items_xrobot_faq ] ,
189227} ;
0 commit comments