{"size": 1662, "ext": "js", "max_stars_repo_path": "client/src/components/EventPanel/index.js", "max_stars_repo_name": "jasmaa/throw-trash-in-the-ocean", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "client/src/components/EventPanel/index.js", "max_issues_repo_name": "jasmaa/throw-trash-in-the-ocean", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "client/src/components/EventPanel/index.js", "max_forks_repo_name": "jasmaa/throw-trash-in-the-ocean", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 35.3617021277, "max_line_length": 87, "alphanum_fraction": 0.4031287605}
import React, { useState } from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faPaperPlane } from '@fortawesome/free-solid-svg-icons';

import Log from './Log';

const EventPanel = (props) => {

    const [message, setMessage] = useState('');

    return (
        <div className="card">
            <div className="card-body">
                <div className="input-group my-3">
                    <input
                        type="text"
                        className="form-control"
                        maxLength="200"
                        value={message}
                        onChange={e => setMessage(e.target.value)}
                        onKeyPress={e => {
                            if (e.charCode === 13 && message.length > 0) {
                                props.sendChatHandler(message);
                                setMessage('');
                            }
                        }}
                    />
                    <div className="input-group-append">
                        <div className="btn btn-info" type="button" onClick={() => {
                            if (message.length > 0) {
                                props.sendChatHandler(message);
                                setMessage('');
                            }
                        }}>
                            <FontAwesomeIcon icon={faPaperPlane} />
                        </div>
                    </div>
                </div>

                <Log events={props.syncData.events} players={props.syncData.players} />
            </div>
        </div >
    );
}

export default EventPanel;
