<commit_before>import React from 'react';
import { Components, registerComponent } from 'meteor/vulcan:core';
import { Link } from 'react-router';
import withUser from '../common/withUser';
import { withStyles } from '@material-ui/core/styles';
import { legacyBreakpoints } from '../../lib/modules/utils/theme';

const testCollections = [
  {
    title: "Rationality: A-Z",
    id: "dummyId",
    user: {userName: "Eliezer_Yudkowsky", displayName: "EliezerYudkowsky", slug: "eliezer_yudkowsky"},
    summary: 'A set of essays by <NAME> that serve as a long-form introduction to formative ideas behind Less Wrong, the Machine Intelligence Research Institute, the Center for Applied Rationality, and substantial parts of the effective altruism community.',
    imageId: "dVXiZtw_xrmvpm.png",
    color: "#B1D4B4",
    big: true,
  },
  {
    title: "The Codex",
    id: "dummyId2",
    user: {username: "Yvain", displayName: "<NAME>", slug: "yvain"},
    summary: "The Codex contains essays about science, medicine, philosophy, politics, and futurism. (There’s also one post about hallucinatory cactus-people, but it’s not representative)",
    imageId: "ItFKgn4_rrr58y.png",
    color: "#88ACB8",
    big: false,
  },
  {
    title: "<NAME> and the Methods of Rationality",
    id: "dummyId3",
    user: {userName: "Eliezer_Yudkowsky", displayName: "EliezerYudkowsky", slug: "eliezer_yudkowsky"},
    summary: "In an Alternate Universe, Petunia married a scientist. Now Rationalist!Harry enters the wizarding world armed with Enlightenment ideals and the experimental spirit.",
    imageId: "uu4fJ5R_zeefim.png",
    color: "#757AA7",
    big: false,
  }
]

const styles = theme => ({
  frontpageSequencesGridList: {
    [legacyBreakpoints.maxSmall]: {
      marginTop: 40,
    }
  }
});


const RecommendedReading = ({currentUser, classes}) => {
  if (currentUser) {
    return (
      <div>
        <Components.Section
          title="Recommended Sequences"
          titleLink="/library"
          titleComponent= {<Components.SectionSubtitle to="/library">
            <Link to="/library">Sequence Library</Link>
          </Components.SectionSubtitle>}
        >
          <Components.SequencesGridWrapper
            terms={{view:"curatedSequences", limit:3}}
            showAuthor={true}
            showLoadMore={false}
            className={classes.frontpageSequencesGridList}
          />
        </Components.Section>
      </div>
    );
  } else {
    return (
      <Components.Section
        title="Recommended Reading"
        titleLink="/library"
        titleComponent= {<Components.SectionSubtitle>
          <Link to="/library">Sequence Library</Link>
        </Components.SectionSubtitle>}
      >
        <Components.CollectionsCardContainer>
          <Components.BigCollectionsCard collection={testCollections[0]} url={"/rationality"}/>
          <Components.CollectionsCard collection={testCollections[1]} url={"/codex"}/>
          <Components.CollectionsCard collection={testCollections[2]} url={"/hpmor"}/>
        </Components.CollectionsCardContainer>
      </Components.Section>
    );
  }
}

registerComponent("RecommendedReading", RecommendedReading, withUser,
  withStyles(styles, {name: "RecommendedReading"}));<commit_msg>Mobile front page omits first section heading to save space<commit_after>import React from 'react';
import { Components, registerComponent } from 'meteor/vulcan:core';
import { Link } from 'react-router';
import withUser from '../common/withUser';
import { withStyles } from '@material-ui/core/styles';
import { legacyBreakpoints } from '../../lib/modules/utils/theme';
import Hidden from '@material-ui/core/Hidden';

const testCollections = [
  {
    title: "Rationality: A-Z",
    id: "dummyId",
    user: {userName: "Eliezer_Yudkowsky", displayName: "EliezerYudkowsky", slug: "eliezer_yudkowsky"},
    summary: 'A set of essays by <NAME> that serve as a long-form introduction to formative ideas behind Less Wrong, the Machine Intelligence Research Institute, the Center for Applied Rationality, and substantial parts of the effective altruism community.',
    imageId: "dVXiZtw_xrmvpm.png",
    color: "#B1D4B4",
    big: true,
  },
  {
    title: "The Codex",
    id: "dummyId2",
    user: {username: "Yvain", displayName: "<NAME>", slug: "yvain"},
    summary: "The Codex contains essays about science, medicine, philosophy, politics, and futurism. (There’s also one post about hallucinatory cactus-people, but it’s not representative)",
    imageId: "ItFKgn4_rrr58y.png",
    color: "#88ACB8",
    big: false,
  },
  {
    title: "Harry Potter and the Methods of Rationality",
    id: "dummyId3",
    user: {userName: "Eliezer_Yudkowsky", displayName: "EliezerYudkowsky", slug: "eliezer_yudkowsky"},
    summary: "In an Alternate Universe, Petunia married a scientist. Now Rationalist!Harry enters the wizarding world armed with Enlightenment ideals and the experimental spirit.",
    imageId: "uu4fJ5R_zeefim.png",
    color: "#757AA7",
    big: false,
  }
]

const styles = theme => ({
  smallScreenRecommendedReading: {
    maxWidth: 720,
    margin: "0 auto",
  },
});


const RecommendedReading = ({currentUser, classes}) => {
  let sectionTitle = currentUser ? "Recommended Sequences" : "Recommended Reading";
  
  let sectionWrapper = recommendedContent => <React.Fragment>
    <Hidden smDown implementation="css">
      <Components.Section
        title={sectionTitle}
        titleLink="/library"
        titleComponent= {<Components.SectionSubtitle to="/library">
          <Link to="/library">Sequence Library</Link>
        </Components.SectionSubtitle>}
      >{recommendedContent}</Components.Section>
    </Hidden>
    <Hidden mdUp implementation="css">
      <div className={classes.smallScreenRecommendedReading}>
        {recommendedContent}
      </div>
    </Hidden>
  </React.Fragment>;
  
  if (currentUser) {
    return sectionWrapper(
      <Components.SequencesGridWrapper
        terms={{view:"curatedSequences", limit:3}}
        showAuthor={true}
        showLoadMore={false}
        className={classes.frontpageSequencesGridList}
      />
    );
  } else {
    return sectionWrapper(
      <Components.CollectionsCardContainer>
        <Components.BigCollectionsCard collection={testCollections[0]} url={"/rationality"}/>
        <Components.CollectionsCard collection={testCollections[1]} url={"/codex"}/>
        <Components.CollectionsCard collection={testCollections[2]} url={"/hpmor"}/>
      </Components.CollectionsCardContainer>
    );
  }
}

registerComponent("RecommendedReading", RecommendedReading, withUser,
  withStyles(styles, {name: "RecommendedReading"}));
{'fraction_non_alphanumeric': 0.12625581046633677, 'fraction_numerical': 0.007197480881691408, 'mean_word_length': 3.693877551020408, 'pattern_counts': {'":': 0, '<': 48, '<?xml version=': 0, '>': 53, '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': '6645173', 'n_tokens_mistral': 2017, 'n_tokens_neox': 1949, 'n_words': 491}