<commit_before>import * as React from "react";
import { connect } from "react-redux";

import { ITask } from "../lib/tasks";
import { actionCreators } from "../redux/tasks";
import CreateTask from "./CreateTask";
import ItemsMenu from "./ItemsMenu";
import "./style/TasksMenu.css";
import TaskTag from "./TaskTag";

interface IProps {
    currentTag: string | null;
    done: boolean;
    setCurrentTag: (tag: string | null) => void;
    tags: string[];
    onItemsStateChange: (done: boolean) => void;
}

class TasksMenu extends React.Component<IProps> {
    public render() {
        const { currentTag, setCurrentTag, tags } = this.props;

        return (
            <ItemsMenu {...this.props} createItem={<CreateTask />}>
                {tags.length !== 0 &&
                    <div className="TasksMenu-tags">
                        <div className="TasksMenu-tags-title">tags</div>
                        {tags.map((tag, index) =>
                            <TaskTag
                                key={index}
                                tag={tag}
                                highlight={currentTag && tag === currentTag}
                                onClick={() => setCurrentTag(tag === currentTag ? null : tag)}
                            />)}
                    </div>}
            </ItemsMenu>
        );
    }
}

export default connect(
    ({ tasks: { currentTag, tags } }) => ({ currentTag, tags }),
    actionCreators,
)(TasksMenu);<commit_msg>Refactor tasks menu<commit_after>import * as React from "react";
import { connect } from "react-redux";

import { ITask } from "../lib/tasks";
import { actionCreators } from "../redux/tasks";
import CreateTask from "./CreateTask";
import ItemsMenu from "./ItemsMenu";
import "./style/TasksMenu.css";
import TaskTag from "./TaskTag";

interface IProps {
    currentTag: string | null;
    done: boolean;
    setCurrentTag: (tag: string | null) => void;
    tags: string[];
    onItemsStateChange: (done: boolean) => void;
}

class TasksMenu extends React.Component<IProps> {
    public render() {
        const { currentTag, setCurrentTag, tags } = this.props;

        return (
            <ItemsMenu {...this.props} createItem={<CreateTask />}>
                {tags.length !== 0 &&
                    <div className="TasksMenu-tags">
                        <div className="TasksMenu-tags-title">tags</div>
                        {tags.map((tag, index) =>
                            <TaskTag
                                key={index}
                                tag={tag}
                                highlight={currentTag && tag === currentTag}
                                onClick={() => setCurrentTag(tag === currentTag ? null : tag)}
                            />)}
                    </div>}
            </ItemsMenu>
        );
    }
}

export default connect(({ tasks }) => tasks, actionCreators)(TasksMenu);
{'fraction_non_alphanumeric': 0.13745704467353953, 'fraction_numerical': 0.0006872852233676976, 'mean_word_length': 1.7003710575139146, 'pattern_counts': {'":': 0, '<': 21, '<?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': '101537', 'n_tokens_mistral': 763, 'n_tokens_neox': 745, 'n_words': 187}