<commit_before>import React, { Component } from 'react';
import {Page, List, ListItem, ListHeader, Icon} from 'react-onsenui';
import ons from 'onsenui';

import {ngm} from './NagomeConn.js';
import SettingPlugin from './SettingPlugin.js';
import SettingAccount from './SettingAccount.js';
import Settings from './Settings.js';

export default class Menu extends Component {
    constructor() {
        super();

        this.refSettingPlugin = null;
        this.refSettings = null;

        ngm.addNgmEvHandler("nagome_directngm", this.settingsDirectHandler.bind(this));
    }

    settingsDirectHandler(arrM) {
        for (let i = 0, len = arrM.length; i < len; i++) {
            let m = arrM[i];
            switch (m.command) {
            case "Plug.List":
                if (this.refSettingPlugin === null) return;
                this.refSettingPlugin.updateList(m.content.plugins);
                break;

            case "Settings.Current":
                if (this.refSettings === null) return;
                this.refSettings.update(m.content);
                break;

            default:
                console.log(m);
            }
        }
    }

    componentWillMount() {
        this.menuLists = [
            {
                title: "Comment",
                list: [
                    {text: "Connect to URI",
                        icon: "fa-link",
                        fn: () => {
                            ons.notification.prompt({
                                title: 'Connect',
                                message: 'Input Live ID or URI',
                                cancelable: true,
                                callback: (br) => {
                                    ngm.broadConnect(br);
                                },
                            }).catch(()=>{});
                        }},
                    {text: "Disconnect",
                        icon: "fa-minus-circle",
                        fn: () => {
                            ngm.broadDisconnect();
                        }},
                    {text: "Clear comments",
                        icon: "fa-file-o",
                        fn: () => {
                            ngm.clearComments();
                        }},
                ],
            },
            {
                title: "Settings",
                list: [
                    {text: "Plugins",
                        icon: "fa-file-o",
                        fn: () => {
                            ngm.pluginList();
                            this.props.navigator.pushPage({
                                component: SettingPlugin,
                                props: {
                                    ref: (r) => {
                                        this.refSettingPlugin = r;
                                    },
                                },
                                key: "Plugins"
                            });
                        }},
                    {text: "Settings",
                        icon: "fa-file-o",
                        fn: () => {
                            ngm.settingsCurrent();
                            this.props.navigator.pushPage({
                                component: Settings,
                                props: {
                                    ref: (r) => {
                                        this.refSettings = r;
                                    },
                                },
                                key: "Settings"
                            });
                        }},
                ]
            },
            {
                title: "App Settings",
                list: [
                    {text: "Account",
                        icon: "fa-file-o",
                        fn: () => {
                            this.props.navigator.pushPage({
                                component: SettingAccount,
                                key: "Account"
                            });
                        }},
                ]
            },
        ];
    }

    handleMenuSelect(f) {
        this.props.onSelect();
        f();
    }

    renderRow(m) {
        return (
            <ListItem key={m.text} onClick={this.handleMenuSelect.bind(this, m.fn)} tappable>
                <div className="left">
                        <Icon icon={m.icon} />
                    </div>
                    <div className="center">
                        {m.text}
                    </div>
                </ListItem>
            );
    }

    renderLists(lists) {
        return lists.map((list)=>{
            return (
                <List
                    key={list.title}
                    dataSource={list.list}
                    renderRow={this.renderRow.bind(this)}
                    renderHeader={() =>
                        <ListHeader>{list.title}</ListHeader>
                    }
                />
            );
        });
    }

    render() {
        return (
            <Page>
                {this.renderLists(this.menuLists)}
            </Page>
        );
    }
}
<commit_msg>change menu icons<commit_after>import React, { Component } from 'react';
import {Page, List, ListItem, ListHeader, Icon} from 'react-onsenui';
import ons from 'onsenui';

import {ngm} from './NagomeConn.js';
import SettingPlugin from './SettingPlugin.js';
import SettingAccount from './SettingAccount.js';
import Settings from './Settings.js';

export default class Menu extends Component {
    constructor() {
        super();

        this.refSettingPlugin = null;
        this.refSettings = null;

        ngm.addNgmEvHandler("nagome_directngm", this.settingsDirectHandler.bind(this));
    }

    settingsDirectHandler(arrM) {
        for (let i = 0, len = arrM.length; i < len; i++) {
            let m = arrM[i];
            switch (m.command) {
            case "Plug.List":
                if (this.refSettingPlugin === null) return;
                this.refSettingPlugin.updateList(m.content.plugins);
                break;

            case "Settings.Current":
                if (this.refSettings === null) return;
                this.refSettings.update(m.content);
                break;

            default:
                console.log(m);
            }
        }
    }

    componentWillMount() {
        this.menuLists = [
            {
                title: "Comment",
                list: [
                    {text: "Connect to URI",
                        icon: "fa-link",
                        fn: () => {
                            ons.notification.prompt({
                                title: 'Connect',
                                message: 'Input Live ID or URI',
                                cancelable: true,
                                callback: (br) => {
                                    ngm.broadConnect(br);
                                },
                            }).catch(()=>{});
                        }},
                    {text: "Disconnect",
                        icon: "fa-minus-circle",
                        fn: () => {
                            ngm.broadDisconnect();
                        }},
                    {text: "Clear comments",
                        icon: "fa-trash",
                        fn: () => {
                            ngm.clearComments();
                        }},
                ],
            },
            {
                title: "Settings",
                list: [
                    {text: "Plugins",
                        icon: "fa-plug",
                        fn: () => {
                            ngm.pluginList();
                            this.props.navigator.pushPage({
                                component: SettingPlugin,
                                props: {
                                    ref: (r) => {
                                        this.refSettingPlugin = r;
                                    },
                                },
                                key: "Plugins"
                            });
                        }},
                    {text: "Settings",
                        icon: "fa-gear",
                        fn: () => {
                            ngm.settingsCurrent();
                            this.props.navigator.pushPage({
                                component: Settings,
                                props: {
                                    ref: (r) => {
                                        this.refSettings = r;
                                    },
                                },
                                key: "Settings"
                            });
                        }},
                ]
            },
            {
                title: "App Settings",
                list: [
                    {text: "Account",
                        icon: "fa-user",
                        fn: () => {
                            this.props.navigator.pushPage({
                                component: SettingAccount,
                                key: "Account"
                            });
                        }},
                ]
            },
        ];
    }

    handleMenuSelect(f) {
        this.props.onSelect();
        f();
    }

    renderRow(m) {
        return (
            <ListItem key={m.text} onClick={this.handleMenuSelect.bind(this, m.fn)} tappable>
                <div className="left">
                        <Icon icon={m.icon} />
                    </div>
                    <div className="center">
                        {m.text}
                    </div>
                </ListItem>
            );
    }

    renderLists(lists) {
        return lists.map((list)=>{
            return (
                <List
                    key={list.title}
                    dataSource={list.list}
                    renderRow={this.renderRow.bind(this)}
                    renderHeader={() =>
                        <ListHeader>{list.title}</ListHeader>
                    }
                />
            );
        });
    }

    render() {
        return (
            <Page>
                {this.renderLists(this.menuLists)}
            </Page>
        );
    }
}

{'fraction_non_alphanumeric': 0.1072848966922107, 'fraction_numerical': 0.00019400523814142983, 'mean_word_length': 0.7255230125523012, 'pattern_counts': {'":': 4, '<': 29, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '593598', 'n_tokens_mistral': 2426, 'n_tokens_neox': 2218, 'n_words': 410}