<commit_before>import classNames from 'classnames'
import { div, span, button, li, ul, h2, section, table, th, tr, td, label } from '@cycle/dom'
import {propEq, find} from 'ramda'

import {videoIconSvg, playIconSvg, pauseIconSvg} from './widgets/icons'
import icon from './widgets/icon'

export default function drawPrintersList (state) {
  const printers = table('.printersList', state.printing.printers
    .map(function (printer) {
      const isSelected = state.printing.activePrinterId === printer.id
      const isClaimed = printer.claimed
      const isPaused = true
      const activePrinter = find(propEq('id', state.printing.activePrinterId))(state.printing.printers)

      const printerName = printer.friendlyName ? printer.friendlyName : printer.name
      const printerText = isSelected ? `${printerName} ${state.printing.printerStatus.message}` : printerName

      const classes = classNames({'.selected': isSelected, '.printerL': true})

      /*const claimButtons = isClaimed // buttons to claim / unclaim printer
        ? button('.unClaim .claimed', {attrs: {'data-id': printer.id}}, 'unClaim')
        : button('.claim', {attrs: {'data-id': printer.id}}, 'claim')*/
      const claimToggler = isClaimed // buttons to claim / unclaim printer
        ? td('.unClaim .claimed', {attrs: {'data-id': printer.id}}, 'unClaim')
        : td('.claim', {attrs: {'data-id': printer.id}}, 'claim')

      const pauseResumeButton = isClaimed ? (isPaused ? icon(playIconSvg) : icon(pauseIconSvg)) : ''
      const videoFramesButton = isClaimed ? icon(videoIconSvg) : ''

      return tr(classes, {attrs: {'data-id': printer.id}}, [
        td([printerText]),
        td(['connected']),
        td([pauseResumeButton]),

        td([videoFramesButton]),

        td(['190°C']),
        td(['205°C']),
        td(['65°C']),

        td([
          span('.gnok', 'foobar')
        ]),
        claimToggler
      ])
    })
  )
  const noPrinters = table('.printersList', [
    tr([td('please wait fetching printers')])
  ])
  const printerSetup = section('', [
    state.printing.printers.length > 0 ? printers : noPrinters
  ])

  // console.log(activePrinter, state.activePrinter)
  const newPrintDisabled = state.buildplate.entities.length === 0 || state.printing.printerStatus.busy === true
  return printerSetup
}
<commit_msg>feat(printersList): stripped down printerslist to something more minimal<commit_after>import classNames from 'classnames'
import { div, span, button, li, ul, h2, section, table, th, tr, td, label } from '@cycle/dom'
import {propEq, find} from 'ramda'

import {videoIconSvg, playIconSvg, pauseIconSvg} from './widgets/icons'
import icon from './widgets/icon'

export default function drawPrintersList (state) {
  const printers = table('.printersList', state.printing.printers
    .map(function (printer) {
      const isSelected = state.printing.activePrinterId === printer.id
      const isClaimed = printer.claimed
      const isConnected = printer.claimed // FIXME: for now reusing claimed state
      const isPaused = true
      const activePrinter = find(propEq('id', state.printing.activePrinterId))(state.printing.printers)

      const printerName = printer.friendlyName ? printer.friendlyName : printer.name
      const printerText = isSelected ? `${printerName} ${state.printing.printerStatus.message}` : printerName

      const t0Temp = isConnected ? '190°C' : ''
      const t1Temp = isConnected ? '205°C' : ''
      const bedTemp = isConnected ? '65°C' : ''

      const classes = classNames({'.selected': isSelected, '.printerL': true})

      const claimToggler = isClaimed // buttons to claim / unclaim printer
        ? td('.claimer .unClaim .claimed', {attrs: {'data-id': printer.id}}, 'unClaim')
        : td('.claimer .claim', {attrs: {'data-id': printer.id}}, 'claim')

      const pauseResumeButton = isClaimed ? (isPaused ? icon(playIconSvg) : icon(pauseIconSvg)) : ''
      const videoFramesButton = isClaimed ? icon(videoIconSvg) : ''

      return tr(classes, {attrs: {'data-id': printer.id}}, [
        td(printerText),
        /*td(isConnected ? 'connected' : 'not connected'),
        td([pauseResumeButton]),

        td([videoFramesButton]),

        td(t0Temp),
        td(t1Temp),
        td(bedTemp),*/

        /*td([
          span('.gnok', 'foobar')
        ]),*/
        claimToggler
      ])
    })
  )
  const noPrinters = table('.printersList', [
    tr([td('please wait fetching printers')])
  ])
  const printerSetup = section('', [
    state.printing.printers.length > 0 ? printers : noPrinters
  ])

  // console.log(activePrinter, state.activePrinter)
  const newPrintDisabled = state.buildplate.entities.length === 0 || state.printing.printerStatus.busy === true
  return printerSetup
}

{'fraction_non_alphanumeric': 0.14678129586915495, 'fraction_numerical': 0.00545187670371147, 'mean_word_length': 3.376146788990826, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '91188', 'n_tokens_mistral': 1484, 'n_tokens_neox': 1430, 'n_words': 342}