<commit_before>﻿import React from "react";
import ReactDOM from "react-dom";
import axios from "axios";
import Pusher from "pusher-js";
import GoogleMap from 'google-map-react';

import 'bootstrap/dist/css/bootstrap.css';
import '../../Styles/site.css';
import {getBaseUrl} from './commonScript.jsx';

var center = { lat: 49.1951, lng: 16.6068 };
var zoom = 3;

const K_WIDTH = 40;
const K_HEIGHT = 40;

const greatPlaceStyle = {
    // initially any map object has left top corner at lat lng coordinates
    // it's on you to set object origin to 0,0 coordinates
    position: 'absolute',
    width: K_WIDTH,
    height: K_HEIGHT,
    left: -K_WIDTH / 2,
    top: -K_HEIGHT / 2,

    border: '5px solid #f44336',
    borderRadius: K_HEIGHT,
    backgroundColor: 'white',
    textAlign: 'center',
    color: '#3f51b5',
    fontSize: 16,
    fontWeight: 'bold',
    padding: 4
};

var myEvent = null;
var PeopleRowIDs = [];
var DateTimeRowIDs = [];

class BasicInfoBlock extends React.Component {

    constructor(props) {
        super(props);

        this.state = { 
            name : "<NAME>",
            desc : "Event Description"
        };
    }

    componentDidMount() {
        axios
        .get(getBaseUrl()+`get`)
        .then((response) => {
            this.setState({
                name: response.data.name,
                desc: response.data.desc
            });
            myEvent = response.data;
            console.log("Response data:");
            console.log(JSON.stringify(myEvent));
        })
        .catch((e) => 
        {
            console.error(e);
        });
    }

    handleSave(){
        //basic
        myEvent.name = this.refs.eventName.value;
        myEvent.desc = this.refs.eventDesc.value;

        //people
        var pplCount = 0;
        PeopleRowIDs.forEach(function(person) {          
            myEvent.people[pplCount] =  document.getElementById(person).value;
            pplCount++;
        });
        //remove empty people
        for(var i = myEvent.people.length - 1; i >= 0; i--) {
            if(myEvent.people[i] === "") {
                myEvent.people.splice(i, 1);
            }
        }

        //dates
        var dtCount = 0;
        DateTimeRowIDs.forEach(function(datevalue) {
            myEvent.dates[dtCount] =  document.getElementById(datevalue).value;
            dtCount++;
        });

        console.log("Saving data:");
        console.log(JSON.stringify(myEvent));

        axios
             .post(getBaseUrl()+`save`, myEvent)
             .catch(() => alert('Something went wrong :( '));
    }

    render(){
        return(
                <form className="form-horizontal">
                    <div className="form-group">
                        <label htmlFor="eventName" className="col-sm-2 control-label">Name</label><commit_msg>eventEdit UTC datetime now works correctly<commit_after>﻿import React from "react";
import ReactDOM from "react-dom";
import axios from "axios";
import Pusher from "pusher-js";
import GoogleMap from 'google-map-react';

import 'bootstrap/dist/css/bootstrap.css';
import '../../Styles/site.css';
import {getBaseUrl} from './commonScript.jsx';

var center = { lat: 49.1951, lng: 16.6068 };
var zoom = 3;

const K_WIDTH = 40;
const K_HEIGHT = 40;

const greatPlaceStyle = {
    // initially any map object has left top corner at lat lng coordinates
    // it's on you to set object origin to 0,0 coordinates
    position: 'absolute',
    width: K_WIDTH,
    height: K_HEIGHT,
    left: -K_WIDTH / 2,
    top: -K_HEIGHT / 2,

    border: '5px solid #f44336',
    borderRadius: K_HEIGHT,
    backgroundColor: 'white',
    textAlign: 'center',
    color: '#3f51b5',
    fontSize: 16,
    fontWeight: 'bold',
    padding: 4
};

var myEvent = null;
var PeopleRowIDs = [];
var DateTimeRowIDs = [];

class BasicInfoBlock extends React.Component {

    constructor(props) {
        super(props);

        this.state = { 
            name : "<NAME>",
            desc : "Event Description"
        };
    }

    componentDidMount() {
        axios
        .get(getBaseUrl()+`get`)
        .then((response) => {
            this.setState({
                name: response.data.name,
                desc: response.data.desc
            });
            myEvent = response.data;
            console.log("Response data:");
            console.log(JSON.stringify(myEvent));
        })
        .catch((e) => 
        {
            console.error(e);
        });
    }

    handleSave(){
        //basic
        myEvent.name = this.refs.eventName.value;
        myEvent.desc = this.refs.eventDesc.value;

        //people
        var pplCount = 0;
        PeopleRowIDs.forEach(function(person) {          
            myEvent.people[pplCount] =  document.getElementById(person).value;
            pplCount++;
        });
        //remove empty people
        for(var i = myEvent.people.length - 1; i >= 0; i--) {
            if(myEvent.people[i] === "") {
                myEvent.people.splice(i, 1);
            }
        }

        //dates
        var dtCount = 0;
        DateTimeRowIDs.forEach(function(dateID) {
            var datetimeval = document.getElementById(dateID).value;;
            var utcDate = new Date(datetimeval).toUTCString();
            myEvent.dates[dtCount] =  utcDate;
            dtCount++;
        });

        console.log("Saving data:");
        console.log(JSON.stringify(myEvent));

        axios
             .post(getBaseUrl()+`save`, myEvent)
             .catch(() => alert('Something went wrong :( '));
    }

    render(){
        return(
                <form className="form-horizontal">
                    <div className="form-group">
                        <label htmlFor="eventName" className="col-sm-2 control-label">Name</label>
{'fraction_non_alphanumeric': 0.13377117179398548, 'fraction_numerical': 0.013826477704804701, 'mean_word_length': 1.9051204819277108, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 21, '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': '3513331', 'n_tokens_mistral': 1781, 'n_tokens_neox': 1690, 'n_words': 385}