<commit_before>import * as React from 'react';
import { EmoteDataHolder } from './EmoteDataHolder';
import { EmoteArrayRender } from './EmoteArrayRender';
import { EmoteArrayText } from './EmoteArrayText';
import { EmoteMap, EmoteObject, EmoteObjectBuilder, IEmoteDataEntry } from 'emotes';
import { bootstrapEmoteData } from './SampleData';
import './EmoteBuilder.css';

interface EmoteBuilderProps {
}

interface EmoteBuilderState {
    emoteObjects: EmoteObject[];
    emoteMap: EmoteMap;
}

export class EmoteBuilder extends React.Component<EmoteBuilderProps, EmoteBuilderState> {
    private defaultEmoteObjects = [
        EmoteObjectBuilder.create({
            emoteIdentifier: 'adviceajlie',
            firstLineText: 'apples?',
            secondLineText: 'I didn\'t see any apples',
        }),
        EmoteObjectBuilder.create({
            emoteIdentifier: 'ivyrage',
        }),
        EmoteObjectBuilder.create({
            emoteIdentifier: 'keystrokeguitar',
        }),
        EmoteObjectBuilder.create({
            emoteIdentifier: 'rdwut',
        }),
    ];

    constructor(props: EmoteBuilderProps) {
        super(props);
        this.state = {
            emoteObjects: [
                EmoteObjectBuilder.clone(this.defaultEmoteObjects[0]),
                EmoteObjectBuilder.clone(this.defaultEmoteObjects[1]),
            ],
            emoteMap: new EmoteMap(bootstrapEmoteData),
        };

        this.numberOfEmotesChanged = this.numberOfEmotesChanged.bind(this);
        this.emoteObjectDataChanged = this.emoteObjectDataChanged.bind(this);

        this.populateEmoteMap(); // kick off loading the real emote data
    }

    async populateEmoteMap() {
        const response = await fetch('//berrymotes.com/assets/berrymotes_json_data.json');
        const emoteData: IEmoteDataEntry[] = await response.json();
        this.state.emoteMap.loadData(emoteData);
        this.setState({}); // trigger a re-render so count updates<commit_msg>default to 1 emote instead of 2<commit_after>import * as React from 'react';
import { EmoteDataHolder } from './EmoteDataHolder';
import { EmoteArrayRender } from './EmoteArrayRender';
import { EmoteArrayText } from './EmoteArrayText';
import { EmoteMap, EmoteObject, EmoteObjectBuilder, IEmoteDataEntry } from 'emotes';
import { bootstrapEmoteData } from './SampleData';
import './EmoteBuilder.css';

interface EmoteBuilderProps {
}

interface EmoteBuilderState {
    emoteObjects: EmoteObject[];
    emoteMap: EmoteMap;
}

export class EmoteBuilder extends React.Component<EmoteBuilderProps, EmoteBuilderState> {
    private defaultEmoteObjects = [
        EmoteObjectBuilder.create({
            emoteIdentifier: 'adviceajlie',
            firstLineText: 'apples?',
            secondLineText: 'I didn\'t see any apples',
        }),
        EmoteObjectBuilder.create({
            emoteIdentifier: 'ivyrage',
        }),
        EmoteObjectBuilder.create({
            emoteIdentifier: 'keystrokeguitar',
        }),
        EmoteObjectBuilder.create({
            emoteIdentifier: 'rdwut',
        }),
    ];

    constructor(props: EmoteBuilderProps) {
        super(props);
        this.state = {
            emoteObjects: [
                EmoteObjectBuilder.clone(this.defaultEmoteObjects[0]),
                // EmoteObjectBuilder.clone(this.defaultEmoteObjects[1]),
            ],
            emoteMap: new EmoteMap(bootstrapEmoteData),
        };

        this.numberOfEmotesChanged = this.numberOfEmotesChanged.bind(this);
        this.emoteObjectDataChanged = this.emoteObjectDataChanged.bind(this);

        this.populateEmoteMap(); // kick off loading the real emote data
    }

    async populateEmoteMap() {
        const response = await fetch('//berrymotes.com/assets/berrymotes_json_data.json');
        const emoteData: IEmoteDataEntry[] = await response.json();
        this.state.emoteMap.loadData(emoteData);
        this.setState({}); // trigger a re-render so count updates
{'fraction_non_alphanumeric': 0.10706207589846695, 'fraction_numerical': 0.0015079165619502387, 'mean_word_length': 2.88671875, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2089956', 'n_tokens_mistral': 1129, 'n_tokens_neox': 1110, 'n_words': 219}