<commit_before>import { h } from 'snabbdom'
import { Ctrl, Tab } from './interfaces'
import discussionView from './discussion'
import { noteView } from './note'
import { moderationView } from './moderation'
import { bind } from './util'

export default function(ctrl: Ctrl) {

  return h('div#chat.side_box.mchat', {
    class: {
      mod: ctrl.opts.permissions.timeout
    }
  }, moderationView(ctrl.moderation) || normalView(ctrl))
}

function normalView(ctrl: Ctrl) {
  const active = ctrl.vm.tab;
  const tabs: Array<Tab> = ['discussion'];
  if (ctrl.note) tabs.push('note');
  return [
    h('div.chat_tabs', {
      class: {
        ['nb_' + tabs.length]: true
      }
    }, tabs.map(t => renderTab(ctrl, t, active))),
    h('div.content.' + active, (active === 'note' && ctrl.note) ? [noteView(ctrl.note)] : discussionView(ctrl))<commit_msg>fix ui/chat2 compilation<commit_after>import { h } from 'snabbdom'
import { Ctrl, Tab } from './interfaces'
import discussionView from './discussion'
import { noteView } from './note'
import { moderationView } from './moderation'
import { bind } from './util'

export default function(ctrl: Ctrl) {

  return h('div#chat.side_box.mchat', {
    class: {
      mod: !!ctrl.opts.permissions.timeout
    }
  }, moderationView(ctrl.moderation) || normalView(ctrl))
}

function normalView(ctrl: Ctrl) {
  const active = ctrl.vm.tab;
  const tabs: Array<Tab> = ['discussion'];
  if (ctrl.note) tabs.push('note');
  return [
    h('div.chat_tabs', {
      class: {
        ['nb_' + tabs.length]: true
      }
    }, tabs.map(t => renderTab(ctrl, t, active))),
    h('div.content.' + active, (active === 'note' && ctrl.note) ? [noteView(ctrl.note)] : discussionView(ctrl))
{'fraction_non_alphanumeric': 0.17571511967308814, 'fraction_numerical': 0.0005837711617046118, 'mean_word_length': 3.5828877005347595, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4893258', 'n_tokens_mistral': 585, 'n_tokens_neox': 556, 'n_words': 133}