<commit_before>import React, { Component, PropTypes } from 'react';
import { useGenericBlock, GenericBlock } from 'olymp/cms';
import { GoogleMap, gql, withApollo } from 'olymp';

const Marker = ({ lat, lng }) => <i style={{ marginTop: '-20px' }} className="fa fa-map-marker fa-2x text-primary" />

const defaultAddress = { lat: 59.724465, lng: 30.080121 };
const actions = props => [{
  type: 'gmap.url',
  icon: 'picture-o',
  toggle: () => {
    const { setData, getData, client } = props;
    const current = getData('address');
    const address = window.prompt('Adresse', current ? current.formattedAddress : '');

    if (address) {
      client.query({
        query: gql`query geocode { item: geocode(address:"${address}") { formattedAddress, lat, lng } }`, /* eslint-disable-line no-undef */
        forceFetch: true,
      }).then(x => setData({ address: x.data.item }));
    };
  },
  active: false,
}];

@withApollo
@useGenericBlock({
  label: 'GoogleMap',
  category: 'Media',
  props: ['address'],
  editable: false,
  align: true,
  resize: {
    coverOnResize: true,
    ratio: 7 / 4,
  },
  actions,
})
export default class GoogleMapBlock extends Component {
  static propTypes = {
    children: PropTypes.node,
    style: PropTypes.object,
    className: PropTypes.string,
    getData: PropTypes.func,
  }
  static defaultProps = {
    zoom: 16,
  }

  render() {
    const { style, getData, children, zoom, ...rest } = this.props;
    const address = getData('address', defaultAddress);

    const styles = {
      backgroundColor: 'gray',
      position: 'relative',
      ...style,
    };

    console.log(style);

    return (
      <GenericBlock {...rest} style={styles}>
        <GoogleMap center={address} zoom={zoom}>
          <Marker {...address} />
        </GoogleMap>
        {children}
      </GenericBlock>
    );
  }
}<commit_msg>console.log<commit_after>import React, { Component, PropTypes } from 'react';
import { useGenericBlock, GenericBlock } from 'olymp/cms';
import { GoogleMap, gql, withApollo } from 'olymp';

const Marker = ({ lat, lng }) => <i style={{ marginTop: '-20px' }} className="fa fa-map-marker fa-2x text-primary" />

const defaultAddress = { lat: 59.724465, lng: 30.080121 };
const actions = props => [{
  type: 'gmap.url',
  icon: 'picture-o',
  toggle: () => {
    const { setData, getData, client } = props;
    const current = getData('address');
    const address = window.prompt('Adresse', current ? current.formattedAddress : '');

    if (address) {
      client.query({
        query: gql`query geocode { item: geocode(address:"${address}") { formattedAddress, lat, lng } }`, /* eslint-disable-line no-undef */
        forceFetch: true,
      }).then(x => setData({ address: x.data.item }));
    };
  },
  active: false,
}];

@withApollo
@useGenericBlock({
  label: 'GoogleMap',
  category: 'Media',
  props: ['address'],
  editable: false,
  align: true,
  resize: {
    coverOnResize: true,
    ratio: 7 / 4,
  },
  actions,
})
export default class GoogleMapBlock extends Component {
  static propTypes = {
    children: PropTypes.node,
    style: PropTypes.object,
    className: PropTypes.string,
    getData: PropTypes.func,
  }
  static defaultProps = {
    zoom: 16,
  }

  render() {
    const { style, getData, children, zoom, ...rest } = this.props;
    const address = getData('address', defaultAddress);

    const styles = {
      backgroundColor: 'gray',
      position: 'relative',
      ...style,
    };

    return (
      <GenericBlock {...rest} style={styles}>
        <GoogleMap center={address} zoom={zoom}>
          <Marker {...address} />
        </GoogleMap>
        {children}
      </GenericBlock>
    );
  }
}
{'fraction_non_alphanumeric': 0.1612206319200648, 'fraction_numerical': 0.012422360248447204, 'mean_word_length': 2.9614973262032085, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, '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': '3925623', 'n_tokens_mistral': 1220, 'n_tokens_neox': 1181, 'n_words': 295}