<commit_before>import { createWidget } from 'discourse/widgets/widget';
import { h } from 'virtual-dom';
import { number } from 'discourse/lib/formatter';

createWidget('hamburger-category', {
  tagName: 'li.category-link',

  html(c) {
    const results = [ this.attach('category-link', { category: c, allowUncategorized: true }) ];

    const unreadTotal = parseInt(c.get('unreadTopics'), 10) + parseInt(c.get('newTopics'), 10);
    if (unreadTotal) {
      results.push(h('a.badge.badge-notification', {
        attributes: { href: c.get('url') }
      }, number(unreadTotal)));
    }

    if (!this.currentUser) {
      results.push(h('b.topics-count', c.get('topic_count').toString()));
    }

    return results;
  }
});

export default createWidget('hamburger-categories', {
  tagName: 'ul.category-links.clearfix',

  html(attrs) {
    const href = Discourse.getURL('/categories');
    const result = [h('li.heading',<commit_msg>FIX: Display anonymous counts nicely on badges<commit_after>import { createWidget } from 'discourse/widgets/widget';
import { h } from 'virtual-dom';
import { number } from 'discourse/lib/formatter';

createWidget('hamburger-category', {
  tagName: 'li.category-link',

  html(c) {
    const results = [ this.attach('category-link', { category: c, allowUncategorized: true }) ];

    const unreadTotal = parseInt(c.get('unreadTopics'), 10) + parseInt(c.get('newTopics'), 10);
    if (unreadTotal) {
      results.push(h('a.badge.badge-notification', {
        attributes: { href: c.get('url') }
      }, number(unreadTotal)));
    }

    if (!this.currentUser) {
      results.push(h('b.topics-count', number(c.get('topic_count'))));
    }

    return results;
  }
});

export default createWidget('hamburger-categories', {
  tagName: 'ul.category-links.clearfix',

  html(attrs) {
    const href = Discourse.getURL('/categories');
    const result = [h('li.heading',
{'fraction_non_alphanumeric': 0.1722689075630252, 'fraction_numerical': 0.004201680672268907, 'mean_word_length': 3.9097938144329896, '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': '6036126', 'n_tokens_mistral': 640, 'n_tokens_neox': 619, 'n_words': 113}