<commit_before>import React from "react";
import PropTypes from "prop-types";
import Article from "@times-components/article";
import Context, { defaults } from "@times-components/context";
import { ArticleProvider } from "@times-components/provider";
import { colours } from "@times-components/styleguide";
import withClient from "./client/with-client";
import adTargetConfig from "./client/ad-targeting-config";

const ArticleDetailsPage = ({
  articleId,
  analyticsStream,
  platformAdConfig,
  onArticlePress,
  onAuthorPress,
  onCommentsPress,
  onCommentGuidelinesPress,
  onVideoPress,
  onLinkPress,
  onTopicPress,
  scale,
  sectionName: pageSection
}) => (
  <ArticleProvider debounceTimeMs={100} id={articleId}>
    {({ article, isLoading, error }) => {
      const adConfig =
        isLoading || error ? {} : adTargetConfig(platformAdConfig, article);
      const articleSection = article ? article.section : null;
      const theme = {
        scale: scale || defaults.theme.scale,
        sectionColour: colours.section[pageSection || articleSection]
      };

      return (
        <Context.Provider value={{ theme }}>
          <Article
            adConfig={adConfig}
            analyticsStream={analyticsStream}
            article={article}
            error={error}
            isLoading={isLoading}
            onAuthorPress={(event, { slug }) => onAuthorPress(slug)}
            onCommentGuidelinesPress={onCommentGuidelinesPress}
            onCommentsPress={(event, { articleId: id, url }) =>
              onCommentsPress(id, url)
            }
            onLinkPress={(event, { type, url }) => {
              if (type === "article") {
                onArticlePress(url);
              } else if (type === "topic") {
                onTopicPress(url);
              } else {
                onLinkPress(url);
              }
            }}
            onRelatedArticlePress={(event, { url }) => onArticlePress(url)}
            onTopicPress={(event, { slug }) => onTopicPress(slug)}
            onTwitterLinkPress={(_, { url }) => onLinkPress(url)}
            onVideoPress={(event, info) => onVideoPress(info)}
          />
        </Context.Provider>
      );
    }}
  </ArticleProvider>
);

ArticleDetailsPage.propTypes = {
  articleId: PropTypes.string.isRequired,
  analyticsStream: PropTypes.func.isRequired,<commit_msg>fix: Omit params in onCommentGuidelinesPress (#1230)<commit_after>import React from "react";
import PropTypes from "prop-types";
import Article from "@times-components/article";
import Context, { defaults } from "@times-components/context";
import { ArticleProvider } from "@times-components/provider";
import { colours } from "@times-components/styleguide";
import withClient from "./client/with-client";
import adTargetConfig from "./client/ad-targeting-config";

const ArticleDetailsPage = ({
  articleId,
  analyticsStream,
  platformAdConfig,
  onArticlePress,
  onAuthorPress,
  onCommentsPress,
  onCommentGuidelinesPress,
  onVideoPress,
  onLinkPress,
  onTopicPress,
  scale,
  sectionName: pageSection
}) => (
  <ArticleProvider debounceTimeMs={100} id={articleId}>
    {({ article, isLoading, error }) => {
      const adConfig =
        isLoading || error ? {} : adTargetConfig(platformAdConfig, article);
      const articleSection = article ? article.section : null;
      const theme = {
        scale: scale || defaults.theme.scale,
        sectionColour: colours.section[pageSection || articleSection]
      };

      return (
        <Context.Provider value={{ theme }}>
          <Article
            adConfig={adConfig}
            analyticsStream={analyticsStream}
            article={article}
            error={error}
            isLoading={isLoading}
            onAuthorPress={(event, { slug }) => onAuthorPress(slug)}
            onCommentGuidelinesPress={() => onCommentGuidelinesPress()}
            onCommentsPress={(event, { articleId: id, url }) =>
              onCommentsPress(id, url)
            }
            onLinkPress={(event, { type, url }) => {
              if (type === "article") {
                onArticlePress(url);
              } else if (type === "topic") {
                onTopicPress(url);
              } else {
                onLinkPress(url);
              }
            }}
            onRelatedArticlePress={(event, { url }) => onArticlePress(url)}
            onTopicPress={(event, { slug }) => onTopicPress(slug)}
            onTwitterLinkPress={(_, { url }) => onLinkPress(url)}
            onVideoPress={(event, info) => onVideoPress(info)}
          />
        </Context.Provider>
      );
    }}
  </ArticleProvider>
);

ArticleDetailsPage.propTypes = {
  articleId: PropTypes.string.isRequired,
  analyticsStream: PropTypes.func.isRequired,
{'fraction_non_alphanumeric': 0.12586532410320955, 'fraction_numerical': 0.0020977554017201595, 'mean_word_length': 2.5903614457831323, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 32, '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': '4486330', 'n_tokens_mistral': 1305, 'n_tokens_neox': 1280, 'n_words': 257}