@@ -24,47 +24,16 @@ export default function CategoryFilter() {
2424 }
2525 }
2626
27- const setCategoryOnly = ( category : string ) => {
28- setCurrentCustomCategories ( [ category ] )
29- }
30-
31- const selectAll = ( ) => {
32- setCurrentCustomCategories (
33- [ 'preset_uncategorized' ] . concat ( customCategories . listCategories ( ) )
34- )
35- }
36-
37- const toggleWithOnly = (
38- toggle : JSX . Element ,
39- onOnlyClicked : ( ) => void ,
40- category : string
41- ) => {
42- return (
43- < div className = "toggleWithOnly" key = { category } >
44- { toggle }
45- < button className = "only" onClick = { ( ) => onOnlyClicked ( ) } >
46- { t ( 'header.only' , 'only' ) }
47- </ button >
48- </ div >
49- )
50- }
51-
52- const categoryToggle = ( categoryName : string , categoryValue ?: string ) => {
53- const toggle = (
54- < ToggleSwitch
55- htmlId = { categoryValue || categoryName }
56- handleChange = { ( ) => toggleCategory ( categoryValue || categoryName ) }
57- value = { currentCustomCategories . includes ( categoryValue || categoryName ) }
58- title = { categoryName }
59- />
60- )
61-
62- const onOnlyClick = ( ) => {
63- setCategoryOnly ( categoryValue || categoryName )
64- }
27+ const resetCategories = ( ) => setCurrentCustomCategories ( [ ] )
6528
66- return toggleWithOnly ( toggle , onOnlyClick , categoryValue || categoryName )
67- }
29+ const categoryToggle = ( categoryName : string , categoryValue ?: string ) => (
30+ < ToggleSwitch
31+ htmlId = { categoryValue || categoryName }
32+ handleChange = { ( ) => toggleCategory ( categoryValue || categoryName ) }
33+ value = { currentCustomCategories . includes ( categoryValue || categoryName ) }
34+ title = { categoryName }
35+ />
36+ )
6837
6938 const categoriesList = customCategories . listCategories ( )
7039
@@ -94,9 +63,9 @@ export default function CategoryFilter() {
9463 < button
9564 type = "reset"
9665 className = "button is-primary"
97- onClick = { ( ) => selectAll ( ) }
66+ onClick = { ( ) => resetCategories ( ) }
9867 >
99- { t ( 'header.select_all ' , 'Select All ' ) }
68+ { t ( 'header.reset ' , 'Reset ' ) }
10069 </ button >
10170 < button
10271 className = "button is-secondary is-small"
0 commit comments