1313
1414import { h } from '/js/src/index.js' ;
1515import { iconX } from '/js/src/icons.js' ;
16+ import { switchInput } from '../../../common/form/switchInput.js' ;
1617
1718/**
1819 * Returns a text input field that can be used to filter logs by author
@@ -40,19 +41,15 @@ const resetAuthorFilterButton = (authorFilterModel) => h(
4041) ;
4142
4243/**
43- * Returns a button that can be used to exclude anonymous authors
44+ * Returns a toggle that can be used to exclude anonymous authors
4445 *
4546 * @param {AuthorFilterModel } authorFilterModel The author filter model object
4647 * @return {Component } A button component that can be used to exclude anonymous authors
4748 */
48- const excludeAnonymousButton = ( authorFilterModel ) => h (
49- 'input.btn.btn-primary' ,
50- {
51- type : 'button' ,
52- value : 'No Anonymous' ,
53- disabled : authorFilterModel . isAnonymousExcluded ( ) ,
54- onclick : ( ) => authorFilterModel . applyExcludeAnonymousFilter ( ) ,
55- } ,
49+ export const excludeAnonymousLogAuthorToggle = ( authorFilterModel ) => switchInput (
50+ authorFilterModel . isAnonymousExcluded ( ) ,
51+ ( ) => authorFilterModel . toggleAnonymousFilter ( ) ,
52+ { labelAfter : 'No Anonymous' } ,
5653) ;
5754
5855/**
@@ -64,5 +61,5 @@ const excludeAnonymousButton = (authorFilterModel) => h(
6461export const authorFilter = ( { authorFilter } ) => h ( '.flex-row.items-center.g3' , [
6562 authorFilterTextInput ( authorFilter ) ,
6663 resetAuthorFilterButton ( authorFilter ) ,
67- excludeAnonymousButton ( authorFilter ) ,
64+ excludeAnonymousLogAuthorToggle ( authorFilter ) ,
6865] ) ;
0 commit comments