<commit_before>import React from 'react';
import { PropTypes as T } from 'prop-types';
import styled from 'styled-components';

import SmartLink from '../smart-link';
import Card from '../card';
import config from '../../config';

const SourceList = styled.ul`
  padding: 0;
  list-style: none;
  display: grid;
  grid-gap: 0.5rem;
`;

const InfoMessage = styled.div`
  box-shadow: 0 0 0 1px rgba(35, 47, 59, 0.08);
  border-radius: 0.25rem;
  text-align: center;
`;

export default function SourceInfo({ sources }) {
  return (
    <Card
      title={sources && sources.length > 1 ? 'Sources' : 'Source'}
      gridColumn={'11 / -1'}
      renderBody={() => {
        if (sources) {
          return (
            <SourceList>
              {sources.map(source => (
                <li key={source.id}>
                  {source.url ? (
                    <a
                      className="source__title source__title--external"
                      href={source.url}
                    >
                      {source.name}
                    </a>
                  ) : (
                    <p className="source__title">{source.name}</p>
                  )}
                  <p className="source__readme">
                    {source.readme ? (
                      <a
                        href={`${config.api}/${source.readme.replace(
                          /^\/v2\//,
                          ''
                        )}`}
                      >
                        Technical readme
                      </a>
                    ) : (
                      'No technical readme for this source'
                    )}
                  </p>
                </li>
              ))}
            </SourceList>
          );
        }
        return (
          <InfoMessage><commit_msg>Open links in new tabs<commit_after>import React from 'react';
import { PropTypes as T } from 'prop-types';
import styled from 'styled-components';

import SmartLink from '../smart-link';
import Card from '../card';
import config from '../../config';

const SourceList = styled.ul`
  padding: 0;
  list-style: none;
  display: grid;
  grid-gap: 0.5rem;
`;

const InfoMessage = styled.div`
  box-shadow: 0 0 0 1px rgba(35, 47, 59, 0.08);
  border-radius: 0.25rem;
  text-align: center;
`;

export default function SourceInfo({ sources }) {
  return (
    <Card
      title={sources && sources.length > 1 ? 'Sources' : 'Source'}
      gridColumn={'11 / -1'}
      renderBody={() => {
        if (sources) {
          return (
            <SourceList>
              {sources.map(source => (
                <li key={source.id}>
                  {source.url ? (
                    <a
                      className="source__title source__title--external"
                      href={source.url}
                      rel="noreferrer noopener"
                      target="_blank"
                    >
                      {source.name}
                    </a>
                  ) : (
                    <p className="source__title">{source.name}</p>
                  )}
                  <p className="source__readme">
                    {source.readme ? (
                      <a
                        href={`${config.api}/${source.readme.replace(
                          /^\/v2\//,
                          ''
                        )}`}
                        rel="noreferrer noopener"
                        target="_blank"
                      >
                        Technical readme
                      </a>
                    ) : (
                      'No technical readme for this source'
                    )}
                  </p>
                </li>
              ))}
            </SourceList>
          );
        }
        return (
          <InfoMessage>
{'fraction_non_alphanumeric': 0.12398213816653533, 'fraction_numerical': 0.01260835303388495, 'mean_word_length': 1.0352752538749332, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 35, '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': '5447502', 'n_tokens_mistral': 1049, 'n_tokens_neox': 959, 'n_words': 217}