1- import React , { useEffect , useState } from 'react' ;
1+ import React from 'react' ;
22import Layout from '@theme/Layout' ;
33import Link from '@docusaurus/Link' ;
44import useDocusaurusContext from '@docusaurus/useDocusaurusContext' ;
55import Translate , { translate } from '@docusaurus/Translate' ;
6- import axios from 'axios ' ;
6+ import commitInfo from '../../../src/data/commitInfo.json ' ;
77
88export default function Home ( ) : JSX . Element {
99 const { siteConfig } = useDocusaurusContext ( ) ;
1010
11- const [ commits , setCommits ] = useState < {
12- [ key : string ] : string ;
13- } > ( { } ) ;
14-
15- useEffect ( ( ) => {
16- const repos = {
17- XRobot : 'xrobot-org/XRobot' ,
18- LibXR : 'Jiu-xiao/libxr' ,
19- CodeGen : 'Jiu-xiao/LibXR_CppCodeGenerator' ,
20- } ;
21-
22- const fetchCommits = async ( ) => {
23- const newCommits : { [ key : string ] : string } = { } ;
24- await Promise . all (
25- Object . entries ( repos ) . map ( async ( [ name , repo ] ) => {
26- try {
27- const res = await axios . get (
28- `https://api.github.com/repos/${ repo } /commits/master`
29- ) ;
30- newCommits [ name ] = res . data . sha . substring ( 0 , 7 ) ;
31- } catch ( err ) {
32- newCommits [ name ] = 'Error' ;
33- }
34- } )
35- ) ;
36- setCommits ( newCommits ) ;
37- } ;
38-
39- fetchCommits ( ) ;
40- } , [ ] ) ;
41-
4211 return (
4312 < Layout
4413 title = { translate ( { message : 'Home' , id : 'homepage.title' } ) }
4514 description = { translate ( {
46- message : 'The documentation homepage for the XRobot project' ,
15+ message : 'Documentation homepage for the XRobot project' ,
4716 id : 'homepage.description' ,
4817 } ) }
4918 >
@@ -59,75 +28,57 @@ export default function Home(): JSX.Element {
5928 </ Translate >
6029 </ p >
6130 < div className = "buttons" >
62- < Link
63- className = "button button--secondary button--lg"
64- to = "/docs/intro"
65- >
31+ < Link className = "button button--secondary button--lg" to = "/docs/intro" >
6632 < Translate id = "homepage.getStarted" > Get Started</ Translate >
6733 </ Link >
6834 </ div >
6935 </ div >
7036 </ section >
37+
7138 < section className = "features" >
7239 < div className = "container" >
7340 < div className = "row" >
7441 < div className = "col col--3" >
75- < h3 >
76- < Translate id = "homepage.feature1.title" > Documentation Support</ Translate >
77- </ h3 >
78- < p >
79- < Translate id = "homepage.feature1.content" >
80- Project content is organized modularly—from environment setup to advanced usage—for easy maintenance and reference.
81- </ Translate >
82- </ p >
42+ < h3 > < Translate id = "homepage.feature1.title" > Documentation Support</ Translate > </ h3 >
43+ < p > < Translate id = "homepage.feature1.content" >
44+ Content is organized in modular blocks, covering setup, tutorials, and advanced usage for easy reference and maintenance.
45+ </ Translate > </ p >
8346 </ div >
8447 < div className = "col col--3" >
85- < h3 >
86- < Translate id = "homepage.feature2.title" > Complete Ecosystem</ Translate >
87- </ h3 >
88- < p >
89- < Translate id = "homepage.feature2.content" >
90- Development environments support Windows/Linux, and Docker images are provided to support modular design and automation.
91- </ Translate >
92- </ p >
48+ < h3 > < Translate id = "homepage.feature2.title" > Complete Ecosystem</ Translate > </ h3 >
49+ < p > < Translate id = "homepage.feature2.content" >
50+ Supports Windows/Linux, and provides Docker images for modular design and automation workflows.
51+ </ Translate > </ p >
9352 </ div >
9453 < div className = "col col--3" >
95- < h3 >
96- < Translate id = "homepage.feature3.title" > Powerful Features</ Translate >
97- </ h3 >
98- < p >
99- < Translate id = "homepage.feature3.content" >
100- From supporting various peripherals and RTOSs to coordinate transforms and kinematics, XRobot is like a Swiss army knife for development.
101- </ Translate >
102- </ p >
54+ < h3 > < Translate id = "homepage.feature3.title" > Powerful Features</ Translate > </ h3 >
55+ < p > < Translate id = "homepage.feature3.content" >
56+ From peripheral and RTOS support to coordinate transforms and kinematics algorithms, XRobot is your Swiss army knife for development.
57+ </ Translate > </ p >
10358 </ div >
10459 < div className = "col col--3" >
105- < h3 >
106- < Translate id = "homepage.feature4.title" > Open Collaboration</ Translate >
107- </ h3 >
108- < p >
109- < Translate id = "homepage.feature4.content" >
110- Contributors are welcome to help improve and expand the content—let’s build a better XRobot together.
111- </ Translate >
112- </ p >
60+ < h3 > < Translate id = "homepage.feature4.title" > Open Collaboration</ Translate > </ h3 >
61+ < p > < Translate id = "homepage.feature4.content" >
62+ Contributions are welcome. Help improve the content and build a better XRobot together.
63+ </ Translate > </ p >
11364 </ div >
11465 </ div >
11566 </ div >
11667 </ section >
11768
11869 < section className = "container margin-top--lg" >
119- < h2 >
120- < Translate id = "homepage.versionTitle" > Repository Versions</ Translate >
121- </ h2 >
70+ < h2 > < Translate id = "homepage.versionTitle" > Repository Versions</ Translate > </ h2 >
12271 < ul >
123- XRobot: < code > { commits . XRobot || 'Loading...' } </ code > libxr: < code > { commits . LibXR || 'Loading...' } </ code > LibXR_CppCodeGenerator: < code > { commits . CodeGen || 'Loading...' } </ code >
72+ XRobot: < code > { commitInfo . XRobot || 'N/A' } </ code > { ' ' }
73+ libxr: < code > { commitInfo . LibXR || 'N/A' } </ code > { ' ' }
74+ LibXR_CppCodeGenerator: < code > { commitInfo . CodeGen || 'N/A' } </ code >
12475 </ ul >
12576 </ section >
12677
12778 < section className = "container margin-top--lg" >
12879 < ul >
12980 This documentation includes usage and coding tutorials only.
130- For API and CLI references, see the Documents section in the footer.
81+ For API and CLI documentation, please refer to the Documents section in the footer.
13182 </ ul >
13283 </ section >
13384 </ main >
0 commit comments