@@ -130,6 +130,55 @@ export default class ReleaseNotesItem extends LitElement {
130130 padding: 0 10px;
131131 }
132132 }
133+
134+ :host .dropdown-menu {
135+ position: absolute;
136+ top: 100%;
137+ left: 0;
138+ z-index: 100;
139+ background: #1f2430;
140+ border: 1px solid #383d4c;
141+ border-radius: 4px;
142+ box-shadow: 0 2px 8px rgba(0,0,0,0.5);
143+ min-width: 180px;
144+ margin-top: 5px;
145+ padding: 8px 0;
146+ color: #c6d0e0;
147+ }
148+
149+ :host .dropdown-header {
150+ padding: 5px 15px;
151+ font-size: 12px;
152+ color: #8992a4;
153+ border-bottom: 1px solid #383d4c;
154+ }
155+
156+ :host .dropdown-item {
157+ padding: 8px 15px;
158+ cursor: pointer;
159+ display: flex;
160+ align-items: center;
161+ }
162+
163+ :host .dropdown-item input {
164+ margin-right: 8px;
165+ }
166+
167+ :host .dropdown-item:hover, :host .dropdown-item.selected {
168+ background: #2c3241;
169+ }
170+
171+ :host .dropdown-clear {
172+ padding: 8px 15px;
173+ cursor: pointer;
174+ border-top: 1px solid #383d4c;
175+ color: #3f8cff;
176+ }
177+
178+ :host .item-changes-filter {
179+ position: relative;
180+ display: inline-block;
181+ }
133182 ` ;
134183 }
135184
@@ -148,7 +197,11 @@ export default class ReleaseNotesItem extends LitElement {
148197 this . _copiableUnifiedText = "" ;
149198 this . _copiableGroupedText = "" ;
150199 this . _copyStatus = "idle" ;
151- this . _hideBugs = false ;
200+
201+ // Available label filters
202+ this . _availableLabels = [ 'bug' , 'regression' , 'enhancement' , 'documentation' ] ;
203+ this . _selectedLabels = [ ] ;
204+ this . _dropdownOpen = false ;
152205 }
153206
154207 _onViewModeClicked ( type ) {
@@ -188,8 +241,24 @@ export default class ReleaseNotesItem extends LitElement {
188241 } ) ;
189242 }
190243
191- _onBugChange ( e ) {
192- this . _hideBugs = e . target . checked ;
244+ _toggleDropdown ( ) {
245+ this . _dropdownOpen = ! this . _dropdownOpen ;
246+ this . requestUpdate ( ) ;
247+ }
248+
249+ _toggleLabel ( labelName ) {
250+ if ( this . _selectedLabels . includes ( labelName ) ) {
251+ this . _selectedLabels = this . _selectedLabels . filter ( label => label !== labelName ) ;
252+ } else {
253+ this . _selectedLabels = [ ...this . _selectedLabels , labelName ] ;
254+ }
255+
256+ this . _updateNotes ( ) ;
257+ this . requestUpdate ( ) ;
258+ }
259+
260+ _clearLabelFilters ( ) {
261+ this . _selectedLabels = [ ] ;
193262 this . _updateNotes ( ) ;
194263 this . requestUpdate ( ) ;
195264 }
@@ -200,11 +269,16 @@ export default class ReleaseNotesItem extends LitElement {
200269 this . _copiableUnifiedText = "" ;
201270 this . _copiableGroupedText = "" ;
202271
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- } ) ;
272+ // Filter pulls based on selected labels (if any)
273+ const filteredPulls = this . _selectedLabels . length === 0
274+ ? this . pulls
275+ : this . pulls . filter ( ( pull ) => {
276+ if ( ! pull . labels ) return false ;
277+
278+ return pull . labels . some ( label =>
279+ this . _selectedLabels . includes ( label . name )
280+ ) ;
281+ } ) ;
208282
209283 let groupedNotes = { } ;
210284 filteredPulls . forEach ( ( pull ) => {
@@ -319,21 +393,35 @@ export default class ReleaseNotesItem extends LitElement {
319393 < div class ="item-container ">
320394 < div class ="item-changes ">
321395 < 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 } "
396+ < div class ="item-changes-filter ">
397+ < span
398+ class ="item-changes-type "
399+ @click ="${ this . _toggleDropdown } "
400+ style ="cursor: pointer; "
334401 >
335- Hide Bug Fixes
336- </ span >
402+ ${ this . _selectedLabels . length ?
403+ `Filtered (${ this . _selectedLabels . length } )` :
404+ 'Filter Labels' } ▼
405+ </ span >
406+ ${ this . _dropdownOpen ? html `
407+ < div class ="dropdown-menu ">
408+ < div class ="dropdown-header ">
409+ Select labels to show:
410+ </ div >
411+ ${ this . _availableLabels . map ( label => html `
412+ < div class ="dropdown-item ${ this . _selectedLabels . includes ( label ) ? 'selected' : '' } " @click ="${ ( e ) => this . _toggleLabel ( label , e ) } ">
413+ < input type ="checkbox " .checked ="${ this . _selectedLabels . includes ( label ) } ">
414+ ${ label }
415+ </ div >
416+ ` ) }
417+ ${ this . _selectedLabels . length ? html `
418+ < div class ="dropdown-clear " @click ="${ this . _clearLabelFilters } ">
419+ Clear all filters
420+ </ div >
421+ ` : '' }
422+ </ div >
423+ ` : '' }
424+ </ div >
337425 |
338426 < span
339427 class ="item-changes-type ${ ( this . _viewMode === "pretty" ? "item-changes--active" : "" ) } "
0 commit comments