<commit_before>import _ from "lodash";
import React from "react";
import ReactDOMServer from "react-dom/server";
import PropTypes from "prop-types";
import { Dropdown } from "react-bootstrap";
import SplitTaxon from "../../../shared/components/split_taxon";
import { urlForTaxon, taxonLayerForTaxon } from "../../../taxa/shared/util";
import TaxonMap from "../../identify/components/taxon_map";
import MapDetails from "./map_details";

class Map extends React.Component {
  constructor( ) {
    super( );
    this.state = { showLongLabel: false };
  }

  render( ) {
    let taxonMap;
    const {
      observation,
      observationPlaces,
      config,
      updateCurrentUser
    } = this.props;
    let geoprivacyIconClass = "fa fa-map-marker";
    let geoprivacyTitle = I18n.t( "location_is_public" );
    let geoprivacyLabel = I18n.t( "location_unknown" );
    if (
      observation.obscured
      && (
        observation.geoprivacy
        || observation.taxon_geoprivacy
      )
    ) {
      if (
        observation.geoprivacy === "private"
        || observation.taxon_geoprivacy === "private"
      ) {
        geoprivacyIconClass = "icon-icn-location-private";
        geoprivacyTitle = I18n.t( "location_is_private" );
        geoprivacyLabel = I18n.t( "location_private" );
      } else {
        geoprivacyIconClass = "icon-icn-location-obscured";
        geoprivacyTitle = I18n.t( "location_is_obscured" );
      }
    } else if ( !observation.latitude && !observation.private_geojson ) {
      geoprivacyIconClass = "icon-no-location";
      geoprivacyLabel = I18n.t( "location_unknown" );
    }
    if ( !observation || !observation.latitude ) {
      return (
        <div className="Map">
          <div className="TaxonMap empty">
            <div className="no_location">
              <i className="fa fa-map-marker" />
              { geoprivacyLabel }
            </div>
          </div>
          <div className="map_details">
            <i
              className={`geoprivacy-icon ${geoprivacyIconClass}`}
              title={geoprivacyTitle}
              alt={geoprivacyTitle}
            />
            <div className="place-guess">{ observation && observation.place_guess }</div>
            <div className="details_menu">
              <Dropdown
                id="grouping-control"
              >
                <Dropdown.Toggle>
                  { I18n.t( "details" ) }
                </Dropdown.Toggle>
                <Dropdown.Menu className="dropdown-menu-right">
                  <li>
                    <MapDetails
                      observation={observation}
                      observationPlaces={observationPlaces}
                      config={config}
                    />
                  </li>
                </Dropdown.Menu>
              </Dropdown>
            </div>
          </div>
        </div>
      );
    }
    if ( observation.latitude ) {
      // Select a small set of attributes that won't change wildy as the
      // observation changes.
      const obsForMap = _.pick( observation, [
        "id",
        "species_guess",
        "latitude",
        "longitude",
        "positional_accuracy",
        "public_positional_accuracy",
        "geoprivacy",
        "user",
        "map_scale"
      ] );
      if ( observation.taxon ) {
        obsForMap.taxon = Object.assign( { }, observation.taxon, {
          forced_name: ReactDOMServer.renderToString(
            <SplitTaxon
              taxon={observation.taxon}
              user={config.currentUser}
              noParens
              iconLink
              url={urlForTaxon( observation.taxon )}
            />
          )
        } );
      }
      obsForMap.coordinates_obscured = observation.obscured && !observation.private_geojson;
      const mapKey = `map-for-${observation.id}-${observation.taxon ? observation.taxon.id : null}`;
      taxonMap = (
        <TaxonMap
          key={mapKey}
          reloadKey={mapKey}
          taxonLayers={[
            taxonLayerForTaxon( obsForMap.taxon, {
              currentUser: config.currentUser,
              updateCurrentUser,
              observation
            } )
          ]}
          observations={[obsForMap]}
          zoomLevel={observation.map_scale || 8}
          showAccuracy
          enableShowAllLayer={false}
          overlayMenu
          clickable={false}
          zoomControlOptions={{ position: google.maps.ControlPosition.TOP_LEFT }}
          currentUser={config.currentUser}
          updateCurrentUser={updateCurrentUser}
        />
      );
    }
    let placeGuessElement;<commit_msg>Remove checklist places and ranges from obs show maps<commit_after>import _ from "lodash";
import React from "react";
import ReactDOMServer from "react-dom/server";
import PropTypes from "prop-types";
import { Dropdown } from "react-bootstrap";
import SplitTaxon from "../../../shared/components/split_taxon";
import { urlForTaxon, taxonLayerForTaxon } from "../../../taxa/shared/util";
import TaxonMap from "../../identify/components/taxon_map";
import MapDetails from "./map_details";

class Map extends React.Component {
  constructor( ) {
    super( );
    this.state = { showLongLabel: false };
  }

  render( ) {
    let taxonMap;
    const {
      observation,
      observationPlaces,
      config,
      updateCurrentUser
    } = this.props;
    let geoprivacyIconClass = "fa fa-map-marker";
    let geoprivacyTitle = I18n.t( "location_is_public" );
    let geoprivacyLabel = I18n.t( "location_unknown" );
    if (
      observation.obscured
      && (
        observation.geoprivacy
        || observation.taxon_geoprivacy
      )
    ) {
      if (
        observation.geoprivacy === "private"
        || observation.taxon_geoprivacy === "private"
      ) {
        geoprivacyIconClass = "icon-icn-location-private";
        geoprivacyTitle = I18n.t( "location_is_private" );
        geoprivacyLabel = I18n.t( "location_private" );
      } else {
        geoprivacyIconClass = "icon-icn-location-obscured";
        geoprivacyTitle = I18n.t( "location_is_obscured" );
      }
    } else if ( !observation.latitude && !observation.private_geojson ) {
      geoprivacyIconClass = "icon-no-location";
      geoprivacyLabel = I18n.t( "location_unknown" );
    }
    if ( !observation || !observation.latitude ) {
      return (
        <div className="Map">
          <div className="TaxonMap empty">
            <div className="no_location">
              <i className="fa fa-map-marker" />
              { geoprivacyLabel }
            </div>
          </div>
          <div className="map_details">
            <i
              className={`geoprivacy-icon ${geoprivacyIconClass}`}
              title={geoprivacyTitle}
              alt={geoprivacyTitle}
            />
            <div className="place-guess">{ observation && observation.place_guess }</div>
            <div className="details_menu">
              <Dropdown
                id="grouping-control"
              >
                <Dropdown.Toggle>
                  { I18n.t( "details" ) }
                </Dropdown.Toggle>
                <Dropdown.Menu className="dropdown-menu-right">
                  <li>
                    <MapDetails
                      observation={observation}
                      observationPlaces={observationPlaces}
                      config={config}
                    />
                  </li>
                </Dropdown.Menu>
              </Dropdown>
            </div>
          </div>
        </div>
      );
    }
    if ( observation.latitude ) {
      // Select a small set of attributes that won't change wildy as the
      // observation changes.
      const obsForMap = _.pick( observation, [
        "id",
        "species_guess",
        "latitude",
        "longitude",
        "positional_accuracy",
        "public_positional_accuracy",
        "geoprivacy",
        "user",
        "map_scale"
      ] );
      if ( observation.taxon ) {
        obsForMap.taxon = Object.assign( { }, observation.taxon, {
          forced_name: ReactDOMServer.renderToString(
            <SplitTaxon
              taxon={observation.taxon}
              user={config.currentUser}
              noParens
              iconLink
              url={urlForTaxon( observation.taxon )}
            />
          )
        } );
      }
      obsForMap.coordinates_obscured = observation.obscured && !observation.private_geojson;
      const mapKey = `map-for-${observation.id}-${observation.taxon ? observation.taxon.id : null}`;
      const taxonLayer = taxonLayerForTaxon( obsForMap.taxon, {
        currentUser: config.currentUser,
        updateCurrentUser,
        observation
      } );
      taxonLayer.places = false;
      taxonLayer.ranges = false;
      taxonMap = (
        <TaxonMap
          key={mapKey}
          reloadKey={mapKey}
          taxonLayers={[taxonLayer]}
          observations={[obsForMap]}
          zoomLevel={observation.map_scale || 8}
          showAccuracy
          enableShowAllLayer={false}
          overlayMenu
          clickable={false}
          zoomControlOptions={{ position: google.maps.ControlPosition.TOP_LEFT }}
          currentUser={config.currentUser}
          updateCurrentUser={updateCurrentUser}
        />
      );
    }
    let placeGuessElement;
{'fraction_non_alphanumeric': 0.11397964649169791, 'fraction_numerical': 0.0032137118371719335, 'mean_word_length': 1.8179897373981286, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 53, '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': '2551825', 'n_tokens_mistral': 2701, 'n_tokens_neox': 2668, 'n_words': 461}