<commit_before>import {TagRepository} from "../services/tagRepository";

export module TagsView {

    export function createTagElement(tag: TagRepository.Tag): HTMLElement {

        let tagElement = $('<span class="uk-badge uk-icon" uk-icon="icon: tag"></span>');
        tagElement.text(tag.name);

        return tagElement[0];
    }
}<commit_msg>Added dropdown for the tags<commit_after>import {TagRepository} from "../services/tagRepository";
import {DisplayHelpers} from "../helpers/displayHelpers";
import {Views} from "./common";

export module TagsView {

    export function createTagElement(tag: TagRepository.Tag): HTMLElement {

        let container = $('<div class="uk-display-inline-block"></div>');

        let tagElement = $('<span class="uk-badge uk-icon" uk-icon="icon: tag"></span>');
        container.append(tagElement);
        tagElement.text(tag.name);

        let dropdown = $(createTagDropdown(tag));
        container.append(dropdown);

        return container[0];
    }

    function createTagDropdown(tag: TagRepository.Tag): HTMLElement {

        let content = $('<div></div>');
        content.append($(('<li>\n' +
            '    <a href="UserThreads" class="align-left">\n' +
            '        <span>Threads</span>\n' +
            '    </a>\n' +
            '    <span class="uk-badge align-right">{nrOfThreads}</span>\n' +
            '    <div class="uk-clearfix"></div>\n' +
            '</li>').replace('{nrOfThreads}', DisplayHelpers.formatNumberForStatistics(tag.threadCount))));

        content.append($(('<li>\n' +
            '    <a href="UserMessages" class="align-left">\n' +
            '        <span>Messages</span>\n' +
            '    </a>\n' +
            '    <span class="uk-badge align-right">{nrOfMessages}</span>\n' +
            '    <div class="uk-clearfix"></div>\n' +
            '</li>').replace('{nrOfMessages}', DisplayHelpers.formatNumberForStatistics(tag.messageCount))));

        return Views.createDropdown(tag.name, content, {
            mode: 'hover',
        });
    }
}
{'fraction_non_alphanumeric': 0.17655642023346305, 'fraction_numerical': 0.0009727626459143969, 'mean_word_length': 2.6151142355008785, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, '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': '198015', 'n_tokens_mistral': 616, 'n_tokens_neox': 611, 'n_words': 103}