File tree Expand file tree Collapse file tree 3 files changed +25
-24
lines changed Expand file tree Collapse file tree 3 files changed +25
-24
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,18 @@ class AppDetails extends Component {
207
207
</ div >
208
208
) : null ;
209
209
210
+ const isWithinOneWeek = timestamp => {
211
+ // check if the given timestamp is within the last 7 days
212
+ const twoDaysInMilliseconds = 7 * 24 * 60 * 60 * 1000 ;
213
+ const currentTime = new Date ( ) . getTime ( ) ;
214
+ const appUpdateTime = new Date ( timestamp ) . getTime ( ) ;
215
+ return ( currentTime - appUpdateTime ) < twoDaysInMilliseconds ;
216
+ } ;
217
+
218
+ const formatWithCommas = number => {
219
+ return number . toString ( ) . replace ( / \B (? = ( \d { 3 } ) + (? ! \d ) ) / g, "," ) ;
220
+ }
221
+
210
222
return (
211
223
< div className = "AppDetails" >
212
224
< Mobile />
@@ -234,7 +246,7 @@ class AppDetails extends Component {
234
246
< div > < span > { t ( "updated" ) } </ span > { formattedUpdate } </ div >
235
247
< br />
236
248
< div className = "sideHeader" > { t ( "downloadStats" ) } </ div >
237
- < div > < span > { t ( "count" ) } </ span > { app_dls } </ div >
249
+ < div > < span > { t ( "count" ) } </ span > { app_dls === 0 && isWithinOneWeek ( updated ) ? "n/a" : formatWithCommas ( app_dls ) } </ div >
238
250
< div > < span > md5</ span > < input className = "md5text" defaultValue = { md5 } type = "text" readonly > </ input > </ div >
239
251
{ shaBlock }
240
252
</ div >
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ class AppList extends Component {
73
73
doesSearchMatch ( query = "" , pkg = { } ) {
74
74
const { title, description, author } = pkg ;
75
75
const { showLegacy } = this . state ;
76
- // skip if package category is legacy and they're disabled
76
+ // skip if package category is legacy and legacy is disabled
77
77
if ( ! showLegacy && pkg . category === "legacy" ) return false ;
78
78
const searchUs = [ title , description , author ] ;
79
79
return searchUs . filter ( a => a && a . toLowerCase ( ) . indexOf ( query . toLowerCase ( ) ) >= 0 ) . length > 0 ;
@@ -106,7 +106,10 @@ class AppList extends Component {
106
106
( me . query ) ;
107
107
} ) ;
108
108
109
- packages = packages . filter ( pkg => me . doesSearchMatch ( me . query , pkg ) ) ;
109
+ // filter packages if we have a search query only
110
+ if ( me . query ) {
111
+ packages = packages . filter ( pkg => me . doesSearchMatch ( me . query , pkg ) ) ;
112
+ }
110
113
111
114
me . setState ( { packages, query : me . query } ) ;
112
115
}
Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ const AppStatsChart = () => {
197
197
// actual chart
198
198
const chartInfo = ( < div
199
199
style = { {
200
- width : '100%' ,
200
+ width : '100%'
201
201
} } >
202
202
< LineChart
203
203
width = { 800 }
@@ -219,9 +219,11 @@ const AppStatsChart = () => {
219
219
type = 'number'
220
220
/>
221
221
< YAxis />
222
- < Tooltip
222
+ < Tooltip
223
223
labelFormatter = { ( unixTime ) => {
224
- return moment . unix ( unixTime / 1000 ) . format ( 'MMM DD YYYY' ) ;
224
+ return < span style = { { color : "black" } } >
225
+ { moment . unix ( unixTime / 1000 ) . format ( 'MMM DD YYYY' ) }
226
+ </ span >
225
227
} }
226
228
/>
227
229
< Legend />
@@ -252,31 +254,15 @@ const AppStatsChart = () => {
252
254
}
253
255
}
254
256
255
- const darkStyles = {
256
- control : ( provided , state ) => ( {
257
- ...provided ,
258
- backgroundColor : "black" ,
259
- color : "#000000" ,
260
-
261
- } ) ,
262
- option : ( provided , state ) => ( {
263
- ...provided ,
264
- backgroundColor : 'black' ,
265
- } )
266
- } ;
267
-
268
- const isDarkMode = window . matchMedia && window . matchMedia ( '(prefers-color-scheme: dark)' ) && window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches ;
269
-
270
257
const customStyle = {
271
258
multiValue : ( base , state ) => ( {
272
259
...base ,
273
260
backgroundColor : state . data . color ,
274
- } ) ,
275
- ...( isDarkMode ? darkStyles : { } )
261
+ } )
276
262
} ;
277
263
278
264
const maxOptions = 8 ; // gets a bit laggy after this, also we only have 8 colors
279
- const pkgSelector = < div style = { { width : 450 } } >
265
+ const pkgSelector = < div style = { { width : 450 , color : "black" } } >
280
266
< Select
281
267
styles = { customStyle }
282
268
isMulti = { true }
You can’t perform that action at this time.
0 commit comments