@@ -538,22 +538,31 @@ function appendInstallationValue(
538538) {
539539 const installationText = String ( installation ?? "" ) . trim ( ) ;
540540 const installationHref = toExternalHref ( installationText ) ;
541+ const installationAlreadyFiltered =
542+ ! state . route . memberUsername && state . filters . installation === installationText ;
541543
542544 if ( installationText ) {
543- const filterLink = document . createElement ( "a" ) ;
544- filterLink . href = "#" ;
545- filterLink . className = "inline-filter-link" ;
546- filterLink . textContent = installationText ;
547- filterLink . addEventListener ( "click" , ( event ) => {
548- event . preventDefault ( ) ;
549- if ( state . route . memberUsername ) {
550- navigateHomeWithFilters ( { installation : installationText } ) ;
551- } else {
552- state . filters . installation = installationText ;
553- render ( ) ;
554- }
555- } ) ;
556- container . append ( filterLink ) ;
545+ if ( installationAlreadyFiltered ) {
546+ const filterLabel = document . createElement ( "span" ) ;
547+ filterLabel . className = "inline-filter-label" ;
548+ filterLabel . textContent = installationText ;
549+ container . append ( filterLabel ) ;
550+ } else {
551+ const filterLink = document . createElement ( "a" ) ;
552+ filterLink . href = "#" ;
553+ filterLink . className = "inline-filter-link" ;
554+ filterLink . textContent = installationText ;
555+ filterLink . addEventListener ( "click" , ( event ) => {
556+ event . preventDefault ( ) ;
557+ if ( state . route . memberUsername ) {
558+ navigateHomeWithFilters ( { installation : installationText } ) ;
559+ } else {
560+ state . filters . installation = installationText ;
561+ render ( ) ;
562+ }
563+ } ) ;
564+ container . append ( filterLink ) ;
565+ }
557566
558567 if ( installationHref ) {
559568 container . append ( document . createTextNode ( " " ) ) ;
@@ -626,20 +635,30 @@ function appendInstallationValue(
626635 }
627636
628637 container . append ( document . createElement ( "br" ) ) ;
629- const countryLink = document . createElement ( "a" ) ;
630- countryLink . href = "#" ;
631- countryLink . className = "inline-filter-link" ;
632- countryLink . textContent = `(${ country } )` ;
633- countryLink . addEventListener ( "click" , ( event ) => {
634- event . preventDefault ( ) ;
635- if ( state . route . memberUsername ) {
636- navigateHomeWithFilters ( { country } ) ;
637- } else {
638- state . filters . country = country ;
639- render ( ) ;
640- }
641- } ) ;
642- container . append ( countryLink ) ;
638+ const countryAlreadyFiltered =
639+ ! state . route . memberUsername && state . filters . country === country ;
640+
641+ if ( countryAlreadyFiltered ) {
642+ const countryLabel = document . createElement ( "span" ) ;
643+ countryLabel . className = "inline-filter-label" ;
644+ countryLabel . textContent = `(${ country } )` ;
645+ container . append ( countryLabel ) ;
646+ } else {
647+ const countryLink = document . createElement ( "a" ) ;
648+ countryLink . href = "#" ;
649+ countryLink . className = "inline-filter-link" ;
650+ countryLink . textContent = `(${ country } )` ;
651+ countryLink . addEventListener ( "click" , ( event ) => {
652+ event . preventDefault ( ) ;
653+ if ( state . route . memberUsername ) {
654+ navigateHomeWithFilters ( { country } ) ;
655+ } else {
656+ state . filters . country = country ;
657+ render ( ) ;
658+ }
659+ } ) ;
660+ container . append ( countryLink ) ;
661+ }
643662}
644663
645664function createInstallationDescriptionPreview ( description ) {
0 commit comments