<commit_before>import React, { Component } from 'react';
import PropTypes from 'prop-types';

import { MapPopup } from 'wri-api-components';

import Button from 'components/ui/button/button-component';
import Dropdown from 'components/ui/dropdown/dropdown-component';

class Popup extends Component {
  render() {
    const {
      map,
      data,
      latlng,
      options,
      value,
      interactions,
      setInteractionSelected
    } = this.props;

    return (
      <MapPopup
        map={map}
        latlng={latlng}
        data={{ ...interactions, selected: value }}
      >
        <div className="c-popup">
          {options &&
            options.length > 1 && (
              <Dropdown
                className="layer-selector"
                theme="theme-dropdown-native-plain"
                value={value}
                options={options}
                onChange={e => setInteractionSelected(e.target.value)}
                native
              />
            )}
          {options &&
            options.length === 1 && (
              <div className="popup-title">{options[0].label}</div>
            )}
          <div className="values">
            {data &&
              data.map(d => (
                <div key={d.label} className="wrapper">
                  <div className="label">{d.label}:</div>
                  <div className="value">{d.value || 'n/a'}</div>
                </div>
              ))}
          </div>
          <div className="nav-footer">
            <Button>Analyse</Button>
          </div>
        </div>
      </MapPopup>
    );
  }
}

Popup.propTypes = {
  map: PropTypes.object,
  data: PropTypes.array,
  options: PropTypes.array,
  value: PropTypes.string,
  setInteractionSelected: PropTypes.func,
  latlng: PropTypes.object,
  interactions: PropTypes.object
};

export default Popup;
<commit_msg>update tooltip when layers change<commit_after>import React, { Component } from 'react';
import PropTypes from 'prop-types';

import { MapPopup } from 'wri-api-components';

import Button from 'components/ui/button/button-component';
import Dropdown from 'components/ui/dropdown/dropdown-component';

class Popup extends Component {
  render() {
    const {
      map,
      data,
      latlng,
      options,
      value,
      interactions,
      setInteractionSelected
    } = this.props;

    return (
      <MapPopup
        map={map}
        latlng={latlng}
        data={{ ...interactions, selected: value, options, data }}
      >
        <div className="c-popup">
          {options &&
            options.length > 1 && (
              <Dropdown
                className="layer-selector"
                theme="theme-dropdown-native-plain"
                value={value}
                options={options}
                onChange={e => setInteractionSelected(e.target.value)}
                native
              />
            )}
          {options &&
            options.length === 1 && (
              <div className="popup-title">{options[0].label}</div>
            )}
          <div className="values">
            {data &&
              data.map(d => (
                <div key={d.label} className="wrapper">
                  <div className="label">{d.label}:</div>
                  <div className="value">{d.value || 'n/a'}</div>
                </div>
              ))}
          </div>
          <div className="nav-footer">
            <Button>Analyse</Button>
          </div>
        </div>
      </MapPopup>
    );
  }
}

Popup.propTypes = {
  map: PropTypes.object,
  data: PropTypes.array,
  options: PropTypes.array,
  value: PropTypes.string,
  setInteractionSelected: PropTypes.func,
  latlng: PropTypes.object,
  interactions: PropTypes.object
};

export default Popup;

{'fraction_non_alphanumeric': 0.13166976373772232, 'fraction_numerical': 0.0015927794000530925, 'mean_word_length': 1.7166546503244413, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 47, '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': '2650469', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1049, 'n_words': 204}