<commit_before>"use strict";
var React = require("react/addons"),

    {GoogleMapsMixin, Map, InfoWindow} = require("react-google-maps"),
    {geolocation} = navigator;

if (!geolocation) {
  geolocation = {
    getCurrentPosition: (success, failure) => { failure("Your browser doesn't support geolocation."); }
  };
}

module.exports = React.createClass({
  /*
   * https://developers.google.com/maps/documentation/javascript/examples/map-geolocation
   */
  displayName: "Geolocation",

  mixins: [require("../../ReactFutureMixin"), GoogleMapsMixin],

  getInitialState () {
    return {
      center: null,
      content: null,
    };
  },

  componentDidMount () {
    geolocation.getCurrentPosition((position) => {
      this.setState({
        center: {
          lat: position.coords.latitude,
          lng: position.coords.longitude
        },
        content: "'Location found using HTML5.",

      });
    }, (reason) => {
      this.setState({
        center: {
          lat: 60,
          lng: 105
        },
        content: `Error: The Geolocation service failed (${ reason }).`
      });
    });
  },

  _render (props, state) {
    var {center} = state;

    return <div style={{height: "100%"}} {...props}>
      <Map style={{height: "100%"}} zoom={6} center={center} />
      {center ? <InfoWindow position={center} content={state.content} /> : null}
    </div>;
  }
});<commit_msg>chore(Geolocation): add client code that renders Geolocation<commit_after>"use strict";
var React = require("react/addons"),

    {GoogleMapsMixin, Map, InfoWindow} = require("react-google-maps"),
    {geolocation} = navigator,
    Geolocation;

if (!geolocation) {
  geolocation = {
    getCurrentPosition: (success, failure) => { failure("Your browser doesn't support geolocation."); }
  };
}
/*
 * https://developers.google.com/maps/documentation/javascript/examples/map-geolocation
 */
Geolocation = React.createClass({
  displayName: "Geolocation",

  mixins: [require("../../ReactFutureMixin"), GoogleMapsMixin],

  getInitialState () {
    return {
      center: null,
      content: null,
    };
  },

  componentDidMount () {
    geolocation.getCurrentPosition((position) => {
      this.setState({
        center: {
          lat: position.coords.latitude,
          lng: position.coords.longitude
        },
        content: "Location found using HTML5.",
      });
    }, (reason) => {
      this.setState({
        center: {
          lat: 60,
          lng: 105
        },
        content: `Error: The Geolocation service failed (${ reason }).`
      });
    });
  },

  _render (props, state) {
    var {center} = state;

    return <div style={{height: "100%"}} {...props}>
      <Map style={{height: "100%"}} zoom={6} center={center} />
      {center ? <InfoWindow position={center} content={state.content} /> : null}
    </div>;
  }
});

module.exports = React.createClass({
  mixins: [require("../../ReactFutureMixin")],

  _render (props, state) {
    return <Geolocation googleMapsApi={google.maps} {...props} />;
  }
});
{'fraction_non_alphanumeric': 0.16951379763469118, 'fraction_numerical': 0.008541392904073587, 'mean_word_length': 2.7316176470588234, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 18, 'https://': 2, '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': '6194294', 'n_tokens_mistral': 973, 'n_tokens_neox': 942, 'n_words': 188}