<commit_before>'use strict'

import m from 'mithril'
import _ from 'lodash'

//helpers
import fltr from '../helpers/filter.js'

//style
import style from '../../css/desktop-filter.scss'

//polythene
import menu from 'polythene/menu/menu'
import list from 'polythene/list/list'
import listTile from 'polythene/list-tile/list-tile'
import btn from 'polythene/button/button'
import iconBtn from 'polythene/icon-button/icon-button'

import gIconBack from 'mmsvg/google/msvg/hardware/keyboard-backspace';

import FilterMenuComponent from './filter_menu_component.js'

//TODO
// have an overlay that will close this modal by seeting permanent to false
// upon being clicked

//this components sets up a window listener for esc and deregister specific one using named handler

//conditionally display conent of the menu

const handleMiniButtonClick = function(type) {
  const ctrl = this

  if (type === 'clear') {

    console.log('CLICKE CLEAR BUTTON')
    console.log(ctrl)
    ctrl.filter.reset()
    ctrl.open(!ctrl.open())
    ctrl.clickedFilterSection('')
    return
  }

  console.log(type)

  if (type === ctrl.clickedFilterSection()) {
    ctrl.clickedFilterSection('')
  } else {
    ctrl.clickedFilterSection(type)
  }
}


const filterMenu = function() {
  const ctrl = this
  return m.component(list, {
          tiles: [
            m.component(listTile, {
              title: 'Rating',
              ink: true,
              events: {
                onclick: handleMiniButtonClick.bind(ctrl, 'rating')
              }
            }),
            m.component(listTile, {
              title: 'Type',
              ink: true,
              events: {
                onclick: handleMiniButtonClick.bind(ctrl, 'type')
              }
            }),
            m.component(listTile, {
              title: 'Price',
              ink: true,
              events: {
                onclick: handleMiniButtonClick.bind(ctrl, 'price')
              }
            }),
            m.component(listTile, {
              title: 'Reset',
              ink: true,
              events: {
                onclick: handleMiniButtonClick.bind(ctrl, 'rating')
              }
            })
          ]
        })
}<commit_msg>feature: reset button in desktop filter menu working<commit_after>'use strict'

import m from 'mithril'
import _ from 'lodash'

//helpers
import fltr from '../helpers/filter.js'

//style
import style from '../../css/desktop-filter.scss'

//polythene
import menu from 'polythene/menu/menu'
import list from 'polythene/list/list'
import listTile from 'polythene/list-tile/list-tile'
import btn from 'polythene/button/button'
import iconBtn from 'polythene/icon-button/icon-button'

import gIconBack from 'mmsvg/google/msvg/hardware/keyboard-backspace';

import FilterMenuComponent from './filter_menu_component.js'

//TODO
// have an overlay that will close this modal by seeting permanent to false
// upon being clicked

//this components sets up a window listener for esc and deregister specific one using named handler

//conditionally display conent of the menu

const handleMiniButtonClick = function(type) {
  const ctrl = this

  if (type === 'clear') {

    console.log('CLICKE CLEAR BUTTON')
    console.log(ctrl)
    ctrl.filter.reset()
    ctrl.open(!ctrl.open())
    ctrl.clickedFilterSection('')
    return
  }

  console.log(type)

  if (type === ctrl.clickedFilterSection()) {
    ctrl.clickedFilterSection('')
  } else {
    ctrl.clickedFilterSection(type)
  }
}


const filterMenu = function() {
  const ctrl = this
  return m.component(list, {
          tiles: [
            m.component(listTile, {
              title: 'Rating',
              ink: true,
              events: {
                onclick: handleMiniButtonClick.bind(ctrl, 'rating')
              }
            }),
            m.component(listTile, {
              title: 'Type',
              ink: true,
              events: {
                onclick: handleMiniButtonClick.bind(ctrl, 'type')
              }
            }),
            m.component(listTile, {
              title: 'Price',
              ink: true,
              events: {
                onclick: handleMiniButtonClick.bind(ctrl, 'price')
              }
            }),
            m.component(listTile, {
              title: 'Reset',
              ink: true,
              events: {
                onclick: handleMiniButtonClick.bind(ctrl, 'clear')
              }
            })
          ]
        })
}
{'fraction_non_alphanumeric': 0.1109870477891916, 'fraction_numerical': 0.0, 'mean_word_length': 1.9939839572192513, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2485416', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1269, 'n_words': 319}