@@ -148,7 +148,11 @@ export default class ReleaseNotesItem extends LitElement {
148148 this . _copiableUnifiedText = "" ;
149149 this . _copiableGroupedText = "" ;
150150 this . _copyStatus = "idle" ;
151- this . _hideBugs = false ;
151+
152+ // Available label filters
153+ this . _availableLabels = [ 'bug' , 'enhancement' , 'documentation' ] ;
154+ this . _selectedLabels = [ ] ;
155+ this . _dropdownOpen = false ;
152156 }
153157
154158 _onViewModeClicked ( type ) {
@@ -188,8 +192,24 @@ export default class ReleaseNotesItem extends LitElement {
188192 } ) ;
189193 }
190194
191- _onBugChange ( e ) {
192- this . _hideBugs = e . target . checked ;
195+ _toggleDropdown ( ) {
196+ this . _dropdownOpen = ! this . _dropdownOpen ;
197+ this . requestUpdate ( ) ;
198+ }
199+
200+ _toggleLabel ( labelName ) {
201+ if ( this . _selectedLabels . includes ( labelName ) ) {
202+ this . _selectedLabels = this . _selectedLabels . filter ( label => label !== labelName ) ;
203+ } else {
204+ this . _selectedLabels = [ ...this . _selectedLabels , labelName ] ;
205+ }
206+
207+ this . _updateNotes ( ) ;
208+ this . requestUpdate ( ) ;
209+ }
210+
211+ _clearLabelFilters ( ) {
212+ this . _selectedLabels = [ ] ;
193213 this . _updateNotes ( ) ;
194214 this . requestUpdate ( ) ;
195215 }
@@ -200,11 +220,16 @@ export default class ReleaseNotesItem extends LitElement {
200220 this . _copiableUnifiedText = "" ;
201221 this . _copiableGroupedText = "" ;
202222
203- // Filter pulls based on bug label and hide bugs checkbox
204- const filteredPulls = this . pulls . filter ( ( pull ) => {
205- const hasBugLabel = pull . labels && pull . labels . some ( label => label . name === 'bug' ) ;
206- return this . _hideBugs ? ! hasBugLabel : true ;
207- } ) ;
223+ // Filter pulls based on selected labels (if any)
224+ const filteredPulls = this . _selectedLabels . length === 0
225+ ? this . pulls
226+ : this . pulls . filter ( ( pull ) => {
227+ if ( ! pull . labels ) return false ;
228+
229+ return pull . labels . some ( label =>
230+ this . _selectedLabels . includes ( label . name )
231+ ) ;
232+ } ) ;
208233
209234 let groupedNotes = { } ;
210235 filteredPulls . forEach ( ( pull ) => {
@@ -319,21 +344,43 @@ export default class ReleaseNotesItem extends LitElement {
319344 < div class ="item-container ">
320345 < div class ="item-changes ">
321346 < div class ="item-changes-types ">
322- < span
323- class ="item-changes-type "
324- @click ="${ ( ) => {
325- this . _hideBugs = ! this . _hideBugs ;
326- this . _updateNotes ( ) ;
327- this . requestUpdate ( ) ;
328- } } "
329- >
330- < input
331- type ="checkbox "
332- .checked ="${ this . _hideBugs } "
333- @change ="${ this . _onBugChange } "
347+ < div class ="item-changes-filter " style ="position: relative; display: inline-block; ">
348+ < span
349+ class ="item-changes-type "
350+ @click ="${ this . _toggleDropdown } "
351+ style ="cursor: pointer; "
334352 >
335- Hide Bug Fixes
336- </ span >
353+ ${ this . _selectedLabels . length ?
354+ `Filtered (${ this . _selectedLabels . length } )` :
355+ 'Filter Labels' } ▼
356+ </ span >
357+ ${ this . _dropdownOpen ? html `
358+ < div class ="dropdown-menu " style ="position: absolute; top: 100%; left: 0;
359+ z-index: 100; background: #1f2430; border: 1px solid #383d4c;
360+ border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.5);
361+ min-width: 180px; margin-top: 5px; padding: 8px 0; color: #c6d0e0; ">
362+ < div style ="padding: 5px 15px; font-size: 12px; color: #8992a4; border-bottom: 1px solid #383d4c; ">
363+ Select labels to show:
364+ </ div >
365+ ${ this . _availableLabels . map ( label => html `
366+ < div style ="padding: 8px 15px; cursor: pointer; display: flex; align-items: center;
367+ ${ this . _selectedLabels . includes ( label ) ? 'background: #2c3241;' : '' }
368+ &:hover { background: #2c3241; } "
369+ @click ="${ ( e ) => this . _toggleLabel ( label , e ) } ">
370+ < input type ="checkbox " .checked ="${ this . _selectedLabels . includes ( label ) } "
371+ style ="margin-right: 8px; ">
372+ ${ label }
373+ </ div >
374+ ` ) }
375+ ${ this . _selectedLabels . length ? html `
376+ < div style ="padding: 8px 15px; cursor: pointer; border-top: 1px solid #383d4c; color: #3f8cff; "
377+ @click ="${ this . _clearLabelFilters } ">
378+ Clear all filters
379+ </ div >
380+ ` : '' }
381+ </ div >
382+ ` : '' }
383+ </ div >
337384 |
338385 < span
339386 class ="item-changes-type ${ ( this . _viewMode === "pretty" ? "item-changes--active" : "" ) } "
0 commit comments