<commit_before>import { Flex, Pill } from "@artsy/palette"
import { FC } from "react"
import { createFragmentContainer, graphql } from "react-relay"
import { extractNodes } from "v2/Utils/extractNodes"
import { ArtistInsightPills_artist } from "v2/__generated__/ArtistInsightPills_artist.graphql"

interface ArtistInsightPillsProps {
  artist: ArtistInsightPills_artist
}

export const ArtistInsightPills: FC<ArtistInsightPillsProps> = ({ artist }) => {
  const blueChipRepresentation = extractNodes(
    artist.artistHighlights?.partnersConnection
  )

  // The first result is the highest auction result
  const highAuctionResult = extractNodes(artist.auctionResultsConnection)[0]

  if (artist.insightsList.length === 0 && !highAuctionResult) {
    return null
  }

  return (
    <Flex flexDirection="row" flexWrap="wrap" mb={-1}>
      {blueChipRepresentation.length > 0 && (
        <Pill variant="badge" disabled mr={1} mb={1}>
          Blue Chip Representation
        </Pill>
      )}

      {highAuctionResult?.priceRealized?.display && (
        <Pill variant="badge" disabled mr={1} mb={1}>
          High Auction Record
        </Pill>
      )}

      {artist.insightsList.map(insight => {
        return (
          <Pill variant="badge" disabled mr={1} mb={1} key={insight.kind!}>
            {insight.label}
          </Pill>
        )
      })}
    </Flex>
  )
}

export const ArtistInsightPillsFragmentContainer = createFragmentContainer(
  ArtistInsightPills,
  {
    artist: graphql`
      fragment ArtistInsightPills_artist on Artist {
        insightsList: insights(kind: [ACTIVE_SECONDARY_MARKET]) {
          kind
          label
          entities
        }
        auctionResultsConnection(
          recordsTrusted: true
          first: 1
          sort: PRICE_AND_DATE_DESC
        ) {
          edges {
            node {
              priceRealized {
                display(format: "0.0a")
              }
              organization
              sale_date: saleDate(format: "YYYY")
            }
          }
        }
      }
    `,
  }
)
<commit_msg>fix(artist-insights): add scrollTo capability to badges section onClick<commit_after>import { Flex, Pill } from "@artsy/palette"
import { FC } from "react"
import { createFragmentContainer, graphql } from "react-relay"
import { extractNodes } from "v2/Utils/extractNodes"
import { ArtistInsightPills_artist } from "v2/__generated__/ArtistInsightPills_artist.graphql"
import { useScrollTo } from "v2/Utils/Hooks/useScrollTo"

interface ArtistInsightPillsProps {
  artist: ArtistInsightPills_artist
}

export const ArtistInsightPills: FC<ArtistInsightPillsProps> = ({ artist }) => {
  const { scrollTo } = useScrollTo({ behavior: "smooth" })
  const handleClick = () => {
    scrollTo("#jump--artistCareerHighlights")
  }

  // The first result is the highest auction result
  const highAuctionResult = extractNodes(artist.auctionResultsConnection)[0]

  if (artist.insightsList.length === 0 && !highAuctionResult) {
    return null
  }

  return (
    <Flex flexDirection="row" flexWrap="wrap" mb={-1}>
      {artist.insightsList.map(insight => {
        return (
          <Pill
            variant="badge"
            mr={1}
            mb={1}
            key={insight.kind!}
            onClick={handleClick}
          >
            {insight.label}
          </Pill>
        )
      })}

      {highAuctionResult?.priceRealized?.display && (
        <Pill variant="badge" mr={1} mb={1} onClick={handleClick}>
          High Auction Record
        </Pill>
      )}
    </Flex>
  )
}

export const ArtistInsightPillsFragmentContainer = createFragmentContainer(
  ArtistInsightPills,
  {
    artist: graphql`
      fragment ArtistInsightPills_artist on Artist {
        insightsList: insights(kind: [ACTIVE_SECONDARY_MARKET]) {
          kind
          label
          entities
        }
        auctionResultsConnection(
          recordsTrusted: true
          first: 1
          sort: PRICE_AND_DATE_DESC
        ) {
          edges {
            node {
              priceRealized {
                display(format: "0.0a")
              }
              organization
              sale_date: saleDate(format: "YYYY")
            }
          }
        }
      }
    `,
  }
)

{'fraction_non_alphanumeric': 0.1044355785026989, 'fraction_numerical': 0.006571227411405773, 'mean_word_length': 2.2784615384615385, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 25, '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': '7488115', 'n_tokens_mistral': 1298, 'n_tokens_neox': 1275, 'n_words': 248}