<commit_before>import React, { Component } from 'react';
import { withGoogleMap, GoogleMap, Marker } from 'react-google-maps';
import { DEFAULT_LOCATION } from '../utils/constants';

const BaseMap = withGoogleMap((props) => {
  const markers = props.markers.map((marker) => (
    <Marker {...marker} />
  ));

  return (
    <GoogleMap
      ref={props.onMapLoad}
      defaultZoom={16}
      defaultCenter={DEFAULT_LOCATION.coordinates}
      onClick={props.onMapClick}
    >
      {markers}
    </GoogleMap>
  );
});

export class Map extends Component {
  constructor() {
    super();
    this.state = {
      markers: []
    };
    this.handleMapLoad = this.handleMapLoad.bind(this);
  }

  handleMapLoad(googleMap) {
    if (!this.gmap) return;

    const { map } = this.gmap.state;
    const { lat, lng } = this.props.currentLocation;

    const request = {
      location: new window.google.maps.LatLng(
        lat || DEFAULT_LOCATION.coordinates.lat,
        lng || DEFAULT_LOCATION.coordinates.lng,
      ),
      radius: '500',
      type: ['restaurant'],
      openNow: true
    };

    const service = new window.google.maps.places.PlacesService(map);

    service.nearbySearch(request, (results, status) => {
      if (status === 'OK') {
        const markers = results.map(place => {
          const { location } = place.geometry;
          return {
            position: {
              lat: location.lat(),
              lng: location.lng()
            },
            defaultAnimation: 2
          };
        });

        this.props.nearbyLocations(results);
      }
    });
  }

  componentDidMount() {
    this.props.geolocate();
  }

  render() {
    return (
      <BaseMap
        ref={googleMap => (this.gmap = googleMap)}
        containerElement={<div className="map-container" />}
        mapElement={<div className="map-element" />}
        onMapLoad={this.handleMapLoad}
        markers={this.props.locations}
        onMapClick={this.handleMapClick}
        onMarkerRightClick={this.handleMarkerRightClick}
      />
    );
  }
}<commit_msg>remove unused markers from map component<commit_after>import React, { Component } from 'react';
import { withGoogleMap, GoogleMap, Marker } from 'react-google-maps';
import { DEFAULT_LOCATION } from '../utils/constants';

const BaseMap = withGoogleMap((props) => {
  const markers = props.markers.map((marker) => (
    <Marker {...marker} />
  ));

  return (
    <GoogleMap
      ref={props.onMapLoad}
      defaultZoom={16}
      defaultCenter={DEFAULT_LOCATION.coordinates}
      onClick={props.onMapClick}
    >
      {markers}
    </GoogleMap>
  );
});

export class Map extends Component {
  constructor() {
    super();
    this.state = {
      markers: []
    };
    this.handleMapLoad = this.handleMapLoad.bind(this);
  }

  handleMapLoad(googleMap) {
    if (!this.gmap) return;

    const { map } = this.gmap.state;
    const { lat, lng } = this.props.currentLocation;

    const request = {
      location: new window.google.maps.LatLng(
        lat || DEFAULT_LOCATION.coordinates.lat,
        lng || DEFAULT_LOCATION.coordinates.lng,
      ),
      radius: '500',
      type: ['restaurant'],
      openNow: true
    };

    const service = new window.google.maps.places.PlacesService(map);

    service.nearbySearch(request, (results, status) => {
      if (status === 'OK') {
        this.props.nearbyLocations(results);
      }
    });
  }

  componentDidMount() {
    this.props.geolocate();
  }

  render() {
    return (
      <BaseMap
        ref={googleMap => (this.gmap = googleMap)}
        containerElement={<div className="map-container" />}
        mapElement={<div className="map-element" />}
        onMapLoad={this.handleMapLoad}
        markers={this.props.locations}
        onMapClick={this.handleMapClick}
        onMarkerRightClick={this.handleMarkerRightClick}
      />
    );
  }
}
{'fraction_non_alphanumeric': 0.14127637673700463, 'fraction_numerical': 0.0028306742151312406, 'mean_word_length': 2.4829749103942653, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 24, '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': '4308080', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1187, 'n_words': 209}