<commit_before>import React, { PureComponent, Fragment } from 'react';
import PropTypes from 'prop-types';
import { SCREEN_M } from 'utils/constants';
import cx from 'classnames';
import MediaQuery from 'react-responsive';
import { Tooltip } from 'react-tippy';

import CountryDataProvider from 'providers/country-data-provider';
import GeostoreProvider from 'providers/geostore-provider';
import WhitelistsProvider from 'providers/whitelists-provider';
import DatasetsProvider from 'providers/datasets-provider';
import LatestProvider from 'providers/latest-provider';

import Map from 'components/map';
import ModalMeta from 'components/modals/meta';
import ModalSource from 'components/modals/sources';
import Share from 'components/modals/share';
import Tip from 'components/ui/tip';
import SubscribeModal from 'components/modals/subscribe';
import MapPrompts from 'components/map-prompts';
import ModalWelcome from 'components/modals/welcome';
import RecentImagery from 'components/recent-imagery';

import DataAnalysisMenu from './components/data-analysis-menu';
import MapControlButtons from './components/map-controls';

import './styles.scss';

class MainMapComponent extends PureComponent {
  renderInfoTooltip = string => (
    <div>
      <p className="tooltip-info">{string}</p>
    </div>
  );

  render() {
    const {
      embed,
      hidePanels,
      oneClickAnalysis,
      showTooltip,
      tooltipData,
      handleClickMap,
      handleShowTooltip,
      recentActive,
      handleClickAnalysis,
      setMainMapAnalysisView,
      onDrawComplete
    } = this.props;

    return (
      <MediaQuery minWidth={SCREEN_M}>
        {isDesktop => (
          <div className={cx('c-map-main', { embed })}>
            <div
              className="main-map-container"
              role="button"
              tabIndex={0}
              onClick={handleClickMap}
              onMouseOver={() =>
                oneClickAnalysis &&
                handleShowTooltip(true, 'Click shape to analyze.')
              }
              onMouseOut={() => handleShowTooltip(false, '')}
            >
              <Tooltip
                className="map-tooltip"
                theme="tip"
                html={
                  <Tip
                    className="map-hover-tooltip"
                    text={this.renderInfoTooltip(tooltipData)}
                  />
                }
                position="top"
                followCursor
                hideOnClick
                animateFill={false}
                open={showTooltip}
                disabled={!isDesktop}
              >
                <Map
                  className="main-map"
                  onSelectBoundary={setMainMapAnalysisView}
                  onDrawComplete={onDrawComplete}
                  popupActions={[
                    {
                      label: 'Analyze',
                      action: handleClickAnalysis
                    }
                  ]}
                />
              </Tooltip>
            </div>
            {isDesktop &&
              !hidePanels && (
                <DataAnalysisMenu
                  className="data-analysis-menu"
                  embed={embed}
                />
              )}
            {!embed && (
              <MapControlButtons
                className="main-map-controls"
                isDesktop={isDesktop}
              />
            )}
            <RecentImagery active={recentActive} />
            <SubscribeModal />
            {!embed &&
              isDesktop && (
                <Fragment>
                  <MapPrompts />
                  <ModalWelcome />
                </Fragment>
              )}
            <Share />
            <ModalMeta />
            <ModalSource />
            <CountryDataProvider />
            <WhitelistsProvider />
            <DatasetsProvider /><commit_msg>hide map prompts when embed<commit_after>import React, { PureComponent, Fragment } from 'react';
import PropTypes from 'prop-types';
import { SCREEN_M } from 'utils/constants';
import cx from 'classnames';
import MediaQuery from 'react-responsive';
import { Tooltip } from 'react-tippy';

import CountryDataProvider from 'providers/country-data-provider';
import GeostoreProvider from 'providers/geostore-provider';
import WhitelistsProvider from 'providers/whitelists-provider';
import DatasetsProvider from 'providers/datasets-provider';
import LatestProvider from 'providers/latest-provider';

import Map from 'components/map';
import ModalMeta from 'components/modals/meta';
import ModalSource from 'components/modals/sources';
import Share from 'components/modals/share';
import Tip from 'components/ui/tip';
import SubscribeModal from 'components/modals/subscribe';
import MapPrompts from 'components/map-prompts';
import ModalWelcome from 'components/modals/welcome';
import RecentImagery from 'components/recent-imagery';

import DataAnalysisMenu from './components/data-analysis-menu';
import MapControlButtons from './components/map-controls';

import './styles.scss';

class MainMapComponent extends PureComponent {
  renderInfoTooltip = string => (
    <div>
      <p className="tooltip-info">{string}</p>
    </div>
  );

  render() {
    const {
      embed,
      hidePanels,
      oneClickAnalysis,
      showTooltip,
      tooltipData,
      handleClickMap,
      handleShowTooltip,
      recentActive,
      handleClickAnalysis,
      setMainMapAnalysisView,
      onDrawComplete
    } = this.props;

    return (
      <MediaQuery minWidth={SCREEN_M}>
        {isDesktop => (
          <div className={cx('c-map-main', { embed })}>
            <div
              className="main-map-container"
              role="button"
              tabIndex={0}
              onClick={handleClickMap}
              onMouseOver={() =>
                oneClickAnalysis &&
                handleShowTooltip(true, 'Click shape to analyze.')
              }
              onMouseOut={() => handleShowTooltip(false, '')}
            >
              <Tooltip
                className="map-tooltip"
                theme="tip"
                html={
                  <Tip
                    className="map-hover-tooltip"
                    text={this.renderInfoTooltip(tooltipData)}
                  />
                }
                position="top"
                followCursor
                hideOnClick
                animateFill={false}
                open={showTooltip}
                disabled={!isDesktop}
              >
                <Map
                  className="main-map"
                  onSelectBoundary={setMainMapAnalysisView}
                  onDrawComplete={onDrawComplete}
                  popupActions={[
                    {
                      label: 'Analyze',
                      action: handleClickAnalysis
                    }
                  ]}
                />
              </Tooltip>
            </div>
            {isDesktop &&
              !hidePanels && (
              <DataAnalysisMenu
                className="data-analysis-menu"
                embed={embed}
              />
            )}
            {!embed && (
              <MapControlButtons
                className="main-map-controls"
                isDesktop={isDesktop}
              />
            )}
            <RecentImagery active={recentActive} />
            <SubscribeModal />
            {!embed &&
              isDesktop && (
              <Fragment>
                {!embed && <MapPrompts />}
                <ModalWelcome />
              </Fragment>
            )}
            <Share />
            <ModalMeta />
            <ModalSource />
            <CountryDataProvider />
            <WhitelistsProvider />
            <DatasetsProvider />
{'fraction_non_alphanumeric': 0.10028321318228631, 'fraction_numerical': 0.00025746652935118434, 'mean_word_length': 1.6114285714285714, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 63, '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': '1442539', 'n_tokens_mistral': 1959, 'n_tokens_neox': 1874, 'n_words': 375}