@@ -50,7 +50,12 @@ function ColumnMapContainer(props) {
5050 ) ;
5151}
5252
53- type ColumnFilterKey = "liths" | "stratNames" | "intervals" ;
53+ type ColumnFilterKey =
54+ | "liths"
55+ | "stratNames"
56+ | "intervals"
57+ | "concepts"
58+ | "environments" ;
5459
5560type ColumnFilterDef = {
5661 type : ColumnFilterKey ;
@@ -366,9 +371,18 @@ function ColumnGroup({ data, linkPrefix }) {
366371}
367372
368373function ColumnItem ( { data, linkPrefix = "/" } ) {
369- const { col_id, col_name, units } = data ;
374+ const { col_id, col_name, t_units , t_sections } = data ;
370375
371- const unitsText = units ?. length > 0 ? `${ units ?. length } units` : "empty" ;
376+ const unitsText = t_units > 0 ? `${ t_units } units` : "no units" ;
377+
378+ let gbpTag = null ;
379+ if ( t_sections > 0 ) {
380+ gbpTag = h (
381+ Tag ,
382+ { minimal : true , color : "goldenrod" , size : "small" } ,
383+ `${ t_sections } packages`
384+ ) ;
385+ }
372386
373387 const href = linkPrefix + `columns/${ col_id } ` ;
374388 return h (
@@ -388,13 +402,13 @@ function ColumnItem({ data, linkPrefix = "/" }) {
388402 { minimal : true , color : "lightgreen" , size : "small" } ,
389403 "in process"
390404 ) ,
391- " " ,
405+ gbpTag ,
392406 h (
393407 Tag ,
394408 {
395409 minimal : true ,
396410 size : "small" ,
397- color : units ?. length = == 0 ? "orange" : "dodgerblue" ,
411+ color : t_units == 0 ? "orange" : "dodgerblue" ,
398412 } ,
399413 unitsText
400414 ) ,
@@ -432,7 +446,7 @@ function LexFilters() {
432446async function _fetchFilterItems ( inputText : string ) {
433447 // Fetch filter items from the API based on input text, using the PostgREST client API
434448 const res = postgrest
435- . from ( "col_filter " )
449+ . from ( "col_filters " )
436450 . select ( "*" )
437451 . ilike ( "name" , `%${ inputText } %` )
438452 . limit ( 5 ) ;
@@ -473,6 +487,10 @@ function routeForFilterKey(key: ColumnFilterKey): string {
473487 return "strat-names" ;
474488 case "intervals" :
475489 return "intervals" ;
490+ case "concepts" :
491+ return "concepts" ;
492+ case "environments" :
493+ return "environments" ;
476494 }
477495}
478496
@@ -484,33 +502,42 @@ function filterKeyFromType(type: string): ColumnFilterKey | null {
484502 return "stratNames" ;
485503 case "interval" :
486504 return "intervals" ;
505+ case "concept" :
506+ return "concepts" ;
507+ case "environment" :
508+ return "environments" ;
487509 default :
488510 return null ;
489511 }
490512}
491513
492- function paramNameForFilterKey ( key : ColumnFilterKey ) : string {
514+ function paramNameForFilterKey (
515+ key : ColumnFilterKey
516+ ) : keyof ColumnFilterOptions {
493517 switch ( key ) {
494518 case "liths" :
495519 return "liths" ;
496520 case "stratNames" :
497521 return "strat_names" ;
498522 case "intervals" :
499523 return "intervals" ;
524+ case "concepts" :
525+ return "strat_name_concepts" ;
526+ case "environments" :
527+ return "environments" ;
500528 }
501529}
502530
503531function buildParamsFromFilters (
504- filters : ColumnFilterDef [ ] ,
505- // Allow multiple filters per category (not supported in API v2)
506- allowMultiple = false
532+ filters : ColumnFilterDef [ ]
507533) : Partial < ColumnFilterOptions > {
508534 const params : Record < string , string > = { } ;
509535 if ( filters == null ) return params ;
510536 let filterData : Partial < ColumnFilterOptions > = { } ;
511537 for ( const filter of filters ) {
512538 const key = paramNameForFilterKey ( filter . type ) ;
513- if ( allowMultiple ) {
539+ if ( key == "strat_names" || key == "strat_name_concepts" ) {
540+ // We can add multiple parameters of each type
514541 filterData [ key ] ??= [ ] ;
515542 } else {
516543 filterData [ key ] = [ ] ;
0 commit comments