@@ -14,11 +14,13 @@ import LoadingPage from './LoadingPage';
14
14
15
15
import { Box , Button , IconButton , Tooltip , Typography } from '@mui/material' ;
16
16
import SearchBar from '../components/SearchBar' ;
17
+ import { useStats } from '../data-providers/StatsDataProvider' ;
17
18
import styles from './../style/pages/Home.module.css' ;
18
19
19
20
20
21
export default function Home ( ) : JSX . Element {
21
22
const { loadingFailed } = useProjects ( )
23
+ const { stats, loadingFailed : statsLoadingFailed } = useStats ( )
22
24
const { filteredProjects : projects , query, setQuery } = useSearch ( )
23
25
const [ showAll , setShowAll ] = useState ( false ) ;
24
26
const [ favoriteProjects , setFavoriteProjects ] = useState < Project [ ] > ( [ ] )
@@ -54,7 +56,7 @@ export default function Home(): JSX.Element {
54
56
updateFavorites ( )
55
57
} , [ projects ] )
56
58
57
- if ( loadingFailed ) {
59
+ if ( loadingFailed || statsLoadingFailed ) {
58
60
return (
59
61
< div className = { styles . home } >
60
62
< Header />
@@ -67,7 +69,7 @@ export default function Home(): JSX.Element {
67
69
)
68
70
}
69
71
70
- if ( projects == null ) {
72
+ if ( projects == null || stats == null ) {
71
73
return < LoadingPage />
72
74
}
73
75
@@ -76,6 +78,9 @@ export default function Home(): JSX.Element {
76
78
< Header />
77
79
78
80
< div className = { styles [ 'project-overview' ] } >
81
+ < Box sx = { { width : '80%' , maxWidth : '800px' } } >
82
+
83
+
79
84
< Box sx = { {
80
85
display : 'flex' ,
81
86
marginTop : '24px' ,
@@ -148,7 +153,7 @@ export default function Home(): JSX.Element {
148
153
/>
149
154
:
150
155
< >
151
- < Typography sx = { { marginLeft : '24px' , marginBottom : 1.5 } } fontWeight = { 200 } fontSize = { 20 } > FAVOURITES</ Typography >
156
+ < Typography sx = { { marginLeft : '24px' , marginBottom : 1.5 } } fontWeight = { 300 } fontSize = { 20 } > FAVOURITES</ Typography >
152
157
{ ( favoriteProjects . length === 0 ) ?
153
158
< Box sx = { { marginLeft : '24px' } } >
154
159
No docs favourited at the moment, search for docs or
@@ -168,7 +173,28 @@ export default function Home(): JSX.Element {
168
173
}
169
174
</ >
170
175
}
171
-
176
+ </ Box >
177
+ < Box sx = { {
178
+ display : {
179
+ sm : 'block' ,
180
+ xs : 'none'
181
+ } , borderLeft : '1px solid #efefef' , paddingLeft : 2 , marginTop : 15 , width : '400px' } } >
182
+ < Typography sx = { { display : 'inline-block' } } fontWeight = { 300 } fontSize = { '1.1em' } component = { 'span' } > INSTANCE STATS</ Typography >
183
+ < Box />
184
+
185
+ < Typography fontSize = { '1em' } fontWeight = { 200 } sx = { { opacity : 0.8 } } component = { 'span' } > # </ Typography >
186
+ < Typography sx = { { width : 100 , display : 'inline-block' , marginTop : 1 } } fontWeight = { 300 } fontSize = { '1em' } component = { 'span' } > DOCS </ Typography >
187
+ < Typography fontSize = { '1em' } fontWeight = { 200 } sx = { { opacity : 0.8 } } component = { 'span' } > { stats . n_projects } </ Typography >
188
+
189
+ < Box />
190
+ < Typography fontSize = { '1em' } fontWeight = { 200 } sx = { { opacity : 0.8 } } component = { 'span' } > # </ Typography >
191
+ < Typography sx = { { width : 100 , display : 'inline-block' , marginTop : 0.4 } } fontWeight = { 300 } fontSize = { '1em' } component = { 'span' } > VERSIONS </ Typography >
192
+ < Typography fontSize = { '1em' } fontWeight = { 200 } sx = { { opacity : 0.8 } } component = { 'span' } > { stats . n_versions } </ Typography >
193
+
194
+ < Box />
195
+ < Typography sx = { { width : 115 , display : 'inline-block' , marginTop : 0.4 } } fontWeight = { 300 } fontSize = { '1em' } component = { 'span' } > STORAGE </ Typography >
196
+ < Typography fontSize = { '1em' } fontWeight = { 200 } sx = { { opacity : 0.8 } } component = { 'span' } > { stats . storage } </ Typography >
197
+ </ Box >
172
198
</ div >
173
199
< Footer />
174
200
</ div >
0 commit comments