<commit_before>import React from 'react'
import PropTypes from 'prop-types'
import axios from 'axios'
import qs from 'qs'
import { throttle } from 'lodash'
import { Route } from 'react-router-dom'
import styled from 'styled-components'
import { FONT_WEIGHTS } from '@govuk-react/constants'

import { Typeahead, FieldWrapper } from '../../../../components'

import Task from '../../../../components/Task'

import { parseAdviserData } from '../../../../../common/formatAdviser'

const getAdviserIds = (advisers) => ({
  adviser: advisers ? advisers.map(({ value }) => value) : [],
})

const fetchAdvisers = (onlyShowActiveAdvisers) =>
  throttle(
    (searchString) =>
      axios
        .get('/api-proxy/adviser/', {
          params: {
            autocomplete: searchString,
            is_active: onlyShowActiveAdvisers,
          },
        })
        .then(({ data: { results } }) => parseAdviserData(results)),
    500
  )

const StyledFieldWrapper = styled(FieldWrapper)`
  label {
    font-weight: ${FONT_WEIGHTS.regular};
  }
`

const FilterAdvisersTypeAhead = ({
  name,
  taskProps,
  label = '',
  hint = '',
  isMulti = false,
  placeholder = '',
  onlyShowActiveAdvisers = true,
  noOptionsMessage = () => null,
  closeMenuOnSelect = false,
  selectedAdvisers = null,
  loadOptions = fetchAdvisers(onlyShowActiveAdvisers),
}) => (
  <StyledFieldWrapper label={label} name={name} hint={hint}>
    <Task.Status {...taskProps}>
      {() => (
        <Route>
          {({ history }) => {
            const qsParams = qs.parse(location.search.slice(1))
            return (
              <Typeahead
                name={name}<commit_msg>Remove the click event from the adviser typeahead<commit_after>import React from 'react'
import PropTypes from 'prop-types'
import axios from 'axios'
import qs from 'qs'
import { throttle } from 'lodash'
import { Route } from 'react-router-dom'
import styled from 'styled-components'
import { FONT_WEIGHTS } from '@govuk-react/constants'

import { Typeahead, FieldWrapper } from '../../../../components'

import Task from '../../../../components/Task'

import { parseAdviserData } from '../../../../../common/formatAdviser'

const getAdviserIds = (advisers) => ({
  adviser: advisers ? advisers.map(({ value }) => value) : [],
})

const fetchAdvisers = (onlyShowActiveAdvisers) =>
  throttle(
    (searchString) =>
      axios
        .get('/api-proxy/adviser/', {
          params: {
            autocomplete: searchString,
            is_active: onlyShowActiveAdvisers,
          },
        })
        .then(({ data: { results } }) => parseAdviserData(results)),
    500
  )

const StyledFieldWrapper = styled(FieldWrapper)`
  label {
    font-weight: ${FONT_WEIGHTS.regular};
  }
`

const FilterAdvisersTypeAhead = ({
  name,
  taskProps,
  label = '',
  hint = '',
  isMulti = false,
  placeholder = '',
  onlyShowActiveAdvisers = true,
  noOptionsMessage = () => null,
  closeMenuOnSelect = false,
  selectedAdvisers = null,
  loadOptions = fetchAdvisers(onlyShowActiveAdvisers),
}) => (
  <StyledFieldWrapper label={label} name={name} hint={hint}>
    <Task.Status {...taskProps}>
      {() => (
        <Route>
          {({ history }) => {
            const qsParams = qs.parse(location.search.slice(1))
            return (
              <Typeahead
                styles={{
                  multiValueRemove: () => ({
                    display: 'none',
                  }),
                  clearIndicator: () => ({
                    display: 'none',
                  }),
                }}
                ClearIndicator={() => null}
                name={name}
{'fraction_non_alphanumeric': 0.15210801873794433, 'fraction_numerical': 0.002204464039680353, 'mean_word_length': 2.3830382106244175, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 30, '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': '420261', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1093, 'n_words': 233}