@@ -76,6 +76,14 @@ class LayerCatalogue extends EventTarget {
7676 return ;
7777 }
7878
79+ const tplTags = ( tagsConfig ) => {
80+ let result = "" ;
81+ tagsConfig . forEach ( ( tag ) => {
82+ result += `<div class="tagSmall" style="background-color:${ tag . tagColor } ;background-image:url(${ tag . tagIcon } );"></div>` ;
83+ } ) ;
84+ return result ;
85+ } ;
86+
7987 const tplLayer = ( opts ) => {
8088 const defaultOpacity = opts . defaultOpacity || 100 ;
8189 return `
@@ -84,8 +92,9 @@ class LayerCatalogue extends EventTarget {
8492 <img src="${ opts . layerQuickLook } " alt="${ opts . layerTitle } " onerror="this.onerror=null;this.src='${ ImageNotFound } '" />
8593 <div class="layer-badge"></div>
8694 <div class="layer-interactive-badge-${ opts . interactive } " ></div>
95+ <div class="layer-new-badge-${ opts . isNew } " >NOUVEAU</div>
8796 </div>
88- <div class="layer-title-thematic">${ opts . layerThematic } </div>
97+ <div class="layer-tags"> ${ tplTags ( opts . tagsConfig ) } <div class="layer- title-thematic">${ opts . layerThematic } </div> </div>
8998 <div id="${ opts . layerName } " class="layer-title">${ opts . layerTitle } </div>
9099 </div>
91100 ` ;
@@ -105,12 +114,16 @@ class LayerCatalogue extends EventTarget {
105114 layerThematic : "" ,
106115 interactive : props . interactive ,
107116 defaultOpacity : props . defaultOpacity || 100 ,
117+ isNew : props . isNew ,
118+ tagsConfig : props . tagConfigs ,
108119 } ) ;
109120 }
110121
111122 var strThematicButtons = "" ;
112123 var strThematicLayers = "" ;
113124 var thematicButtons = LayersConfig . getThematics ( ) ;
125+ thematicButtons = thematicButtons . filter ( item => item !== "Tous" ) ;
126+ thematicButtons . unshift ( "Tous" ) ;
114127 var tempLayers = LayersConfig . getTempLayers ( ) ;
115128 if ( tempLayers . length > 0 ) {
116129 for ( let k = 0 ; k < tempLayers . length ; k ++ ) {
@@ -124,14 +137,25 @@ class LayerCatalogue extends EventTarget {
124137 layerThematic : "Évènements" ,
125138 interactive : true ,
126139 defaultOpacity : tempLayer . defaultOpacity || 100 ,
140+ isNew : props . isNew ,
141+ tagsConfig : props . tagConfigs ,
127142 } ) ;
128143 }
129144 }
130145
131146 for ( let l = 0 ; l < thematicButtons . length ; l ++ ) {
132147 const name = thematicButtons [ l ] ;
148+ let additionalStyle = "" ;
149+ let additionalClass = "" ;
150+ for ( const tag in config . layerTags ) {
151+ if ( config . layerTags [ tag ] . name === name ) {
152+ additionalStyle = `style="color=${ config . layerTags [ tag ] . textColor } ;background-color:${ config . layerTags [ tag ] . tagColor } ;background-image:url(${ config . layerTags [ tag ] . tagIcon } );"` ;
153+ additionalClass = "seasonalTag" ;
154+ break ;
155+ }
156+ }
133157 strThematicButtons += `
134- <button class="thematicButton" data-name="${ name } ">
158+ <button class="thematicButton ${ additionalClass } " ${ additionalStyle } data-name="${ name } ">
135159 ${ name }
136160 </button>
137161 ` ;
@@ -150,6 +174,8 @@ class LayerCatalogue extends EventTarget {
150174 layerThematic : thematic ,
151175 interactive : props . interactive ,
152176 defaultOpacity : props . defaultOpacity || 100 ,
177+ isNew : props . isNew ,
178+ tagsConfig : props . tagConfigs ,
153179 } ) ;
154180 }
155181
0 commit comments