@@ -10,31 +10,22 @@ import { titleCase } from "../index";
1010
1111export function Page ( ) {
1212 const [ input , setInput ] = useState ( "" ) ;
13- const [ age , setAge ] = useState ( [ 0 , 4600 ] ) ;
13+ const [ age , setAge ] = useState ( [ 0 , 4000 ] ) ;
1414 const res = useAPIResult ( SETTINGS . apiV2Prefix + "/defs/timescales?all" ) ?. success . data ;
1515
1616 if ( res == null ) return h ( "div" , "Loading..." ) ;
1717
18- console . log ( res ) ;
19-
20- const min_age_arr = res . map ( ( d ) => d . min_age ) ;
21- const min_age = Math . min ( ...min_age_arr ) ;
22- const max_age_arr = res . map ( ( d ) => d . max_age ) ;
23- const max_age = Math . max ( ...max_age_arr ) ;
24-
2518 const handleChange = ( event ) => {
2619 setInput ( event . target . value . toLowerCase ( ) ) ;
2720 }
2821
2922 const filtered = res . filter ( ( d ) => {
3023 const name = d . timescale ?. toLowerCase ( ) || "" ;
31- const max_age = d . max_age ? parseInt ( d . max_age , 10 ) : 0 ;
32- const min_age = d . min_age ? parseInt ( d . min_age , 10 ) : 4600 ;
24+ const max_age = d . max_age ? parseInt ( d . max_age , 10 ) : 4000 ;
25+ const min_age = d . min_age ? parseInt ( d . min_age , 10 ) : 0 ;
3326
3427 const matchesName = name . includes ( input ) ;
35- const matchesAgeRange =
36- ( ! isNaN ( max_age ) && max_age <= age [ 1 ] ) &&
37- ( ! isNaN ( min_age ) && min_age >= age [ 0 ] ) ;
28+ const matchesAgeRange = max_age >= age [ 0 ] && min_age <= age [ 1 ] ;
3829
3930 return matchesName && matchesAgeRange ;
4031 } ) ;
@@ -59,8 +50,8 @@ export function Page() {
5950 h ( 'div.age-filter' , [
6051 h ( 'p' , "Filter by ages" ) ,
6152 h ( RangeSlider , {
62- min : min_age ,
63- max : max_age ,
53+ min : 0 ,
54+ max : 4000 ,
6455 stepSize : 10 ,
6556 labelStepSize : 1000 ,
6657 value : [ age [ 0 ] , age [ 1 ] ] ,
0 commit comments