@@ -96,97 +96,121 @@ const Plugins = () => {
9696 : t ( 'plugins.topNTitle' as any , { count : rowsPerPage . toString ( ) } )
9797 }
9898 >
99- < Table aria-labelledby = "Plugins" sx = { { width : '100%' } } >
100- < TableHead >
101- < TableRow >
102- { PLUGINS_TABLE_HEADERS . map ( header => {
103- return (
99+ < Box sx = { { width : '100%' } } >
100+ < Table aria-labelledby = "Plugins" sx = { { width : '100%' } } >
101+ < TableHead >
102+ < TableRow >
103+ { PLUGINS_TABLE_HEADERS . map ( header => {
104+ return (
105+ < TableCell
106+ key = { header . id }
107+ align = "left"
108+ sx = { {
109+ borderBottom : theme =>
110+ `1px solid ${ theme . palette . grey [ 300 ] } ` ,
111+ } }
112+ >
113+ { t ( header . titleKey as any , { } ) }
114+ </ TableCell >
115+ ) ;
116+ } ) }
117+ </ TableRow >
118+ </ TableHead >
119+ < TableBody >
120+ { loading ? (
121+ < TableRow >
104122 < TableCell
105- key = { header . id }
106- align = "left"
123+ colSpan = { PLUGINS_TABLE_HEADERS . length }
124+ align = "center"
125+ >
126+ < CircularProgress />
127+ </ TableCell >
128+ </ TableRow >
129+ ) : (
130+ visiblePlugins ?. map ( plugin => (
131+ < TableRow
132+ key = { plugin . plugin_id }
107133 sx = { {
134+ '&:nth-of-type(odd)' : { backgroundColor : 'inherit' } ,
108135 borderBottom : theme =>
109136 `1px solid ${ theme . palette . grey [ 300 ] } ` ,
110137 } }
111138 >
112- { t ( header . titleKey as any , { } ) }
113- </ TableCell >
114- ) ;
115- } ) }
116- </ TableRow >
117- </ TableHead >
118- < TableBody >
119- { loading ? (
139+ < TableCell
140+ sx = { {
141+ width : '20%' ,
142+ } }
143+ >
144+ { plugin . plugin_id ?? '--' }
145+ </ TableCell >
146+ < TableCell sx = { { width : '40%' } } >
147+ { plugin . trend ?. length > 1 ? (
148+ < ResponsiveContainer width = "100%" height = { 50 } >
149+ < LineChart data = { plugin . trend } >
150+ < Line
151+ type = "monotone"
152+ dataKey = "count"
153+ stroke = "#9370DB"
154+ strokeWidth = { 2 }
155+ dot = { false }
156+ />
157+ </ LineChart >
158+ </ ResponsiveContainer >
159+ ) : (
160+ '--'
161+ ) }
162+ </ TableCell >
163+ < TableCell sx = { { width : '20%' } } >
164+ < Box
165+ sx = { {
166+ display : 'flex' ,
167+ alignItems : 'center' ,
168+ gap : 1 ,
169+ minWidth : 0 ,
170+ } }
171+ >
172+ { Math . round ( Number ( plugin . trend_percentage ) ) < 0 ? (
173+ < TrendingDownIcon
174+ sx = { { color : 'red' , flexShrink : 0 } }
175+ />
176+ ) : (
177+ < TrendingUpIcon
178+ sx = { { color : 'green' , flexShrink : 0 } }
179+ />
180+ ) }
181+ < Typography
182+ variant = "body2"
183+ sx = { { overflow : 'hidden' , textOverflow : 'ellipsis' } }
184+ >
185+ { Math . abs ( Math . round ( Number ( plugin . trend_percentage ) ) ) } %
186+ </ Typography >
187+ </ Box >
188+ </ TableCell >
189+ < TableCell sx = { { width : '20%' } } >
190+ { Number ( plugin . visit_count ) . toLocaleString ( 'en-US' ) ?? '--' }
191+ </ TableCell >
192+ </ TableRow >
193+ ) )
194+ ) }
195+ </ TableBody >
196+ < TableFooter >
120197 < TableRow >
121- < TableCell colSpan = { PLUGINS_TABLE_HEADERS . length } align = "center" >
122- < CircularProgress />
198+ < TableCell
199+ colSpan = { PLUGINS_TABLE_HEADERS . length }
200+ sx = { { padding : 0 } }
201+ >
202+ < TableFooterPagination
203+ count = { plugins . data ?. length }
204+ rowsPerPage = { rowsPerPage }
205+ page = { page }
206+ handleChangePage = { handleChangePage }
207+ handleChangeRowsPerPage = { handleChangeRowsPerPage }
208+ />
123209 </ TableCell >
124210 </ TableRow >
125- ) : (
126- visiblePlugins ?. map ( plugin => (
127- < TableRow
128- key = { plugin . plugin_id }
129- sx = { {
130- '&:nth-of-type(odd)' : { backgroundColor : 'inherit' } ,
131- borderBottom : theme => `1px solid ${ theme . palette . grey [ 300 ] } ` ,
132- } }
133- >
134- < TableCell sx = { { width : '20%' } } >
135- { plugin . plugin_id ?? '--' }
136- </ TableCell >
137- < TableCell sx = { { width : '40%' } } >
138- { plugin . trend ?. length > 1 ? (
139- < ResponsiveContainer width = { 250 } height = { 50 } >
140- < LineChart data = { plugin . trend } >
141- < Line
142- type = "monotone"
143- dataKey = "count"
144- stroke = "#9370DB"
145- strokeWidth = { 2 }
146- dot = { false }
147- />
148- </ LineChart >
149- </ ResponsiveContainer >
150- ) : (
151- '--'
152- ) }
153- </ TableCell >
154- < TableCell sx = { { width : '20%' } } >
155- < Box sx = { { display : 'flex' , alignItems : 'center' , gap : 1 } } >
156- { Math . round ( Number ( plugin . trend_percentage ) ) < 0 ? (
157- < TrendingDownIcon sx = { { color : 'red' } } />
158- ) : (
159- < TrendingUpIcon sx = { { color : 'green' } } />
160- ) }
161- < Typography variant = "body2" >
162- { Math . abs ( Math . round ( Number ( plugin . trend_percentage ) ) ) } %
163- </ Typography >
164- </ Box >
165- </ TableCell >
166- < TableCell sx = { { width : '20%' } } >
167- { Number ( plugin . visit_count ) . toLocaleString ( 'en-US' ) ?? '--' }
168- </ TableCell >
169- </ TableRow >
170- ) )
171- ) }
172- </ TableBody >
173- < TableFooter >
174- < TableRow >
175- < TableCell
176- colSpan = { PLUGINS_TABLE_HEADERS . length }
177- sx = { { padding : 0 } }
178- >
179- < TableFooterPagination
180- count = { plugins . data ?. length }
181- rowsPerPage = { rowsPerPage }
182- page = { page }
183- handleChangePage = { handleChangePage }
184- handleChangeRowsPerPage = { handleChangeRowsPerPage }
185- />
186- </ TableCell >
187- </ TableRow >
188- </ TableFooter >
189- </ Table >
211+ </ TableFooter >
212+ </ Table >
213+ </ Box >
190214 </ CardWrapper >
191215 ) ;
192216} ;
0 commit comments