<commit_before>// displays cards for all possible tasks/analysis

import React from 'react'
import { Link } from 'react-router-dom'
import Card from 'react-md/lib/Cards/Card'
import CardTitle from 'react-md/lib/Cards/CardTitle'
import CardText from 'react-md/lib/Cards/CardText'
import CardActions from 'react-md/lib/Cards/CardActions'
import Button from 'react-md/lib/Buttons/Button'
import Avatar from 'react-md/lib/Avatars'
import { analyses } from '../middleware/api'
import { HOME } from '../Routes'
import { RedirectToken } from '../components/RedirectToken'

export function Home(props){
  return (
    <RedirectToken token={props.token}>
      <div>
        {analyses.map(analysis =>
          <Card style={{ maxWidth: 600 }} key={analysis.analysis}>
            <CardTitle
              avatar={<Avatar random >{analysis.analysis.substring(0,2)}</Avatar>}
              title={analysis.analysis}
              subtitle={analysis.description}
            />
            <CardActions expander>
              <Link to={HOME + analysis.analysis}>
                <Button flat primary label="Go">input</Button>
              </Link>
            </CardActions>
            <CardText expandable>
              {analysis.text}
            </CardText>
          </Card>
        )}
      </div>
    </RedirectToken>
  )
}
<commit_msg>edit: use a func to create cards in home<commit_after>// displays cards for all possible tasks/analysis

import React from 'react'
import { Link } from 'react-router-dom'
import Card from 'react-md/lib/Cards/Card'
import CardTitle from 'react-md/lib/Cards/CardTitle'
import CardText from 'react-md/lib/Cards/CardText'
import CardActions from 'react-md/lib/Cards/CardActions'
import Button from 'react-md/lib/Buttons/Button'
import Avatar from 'react-md/lib/Avatars'
import { analyses } from '../middleware/api'
import { HOME } from '../Routes'
import { RedirectToken } from '../components/RedirectToken'

const card = (analysis) => (
  <Card style={{ maxWidth: 600 }} key={analysis.analysis}>
    <CardTitle
      avatar={<Avatar random >{analysis.analysis.substring(0,2)}</Avatar>}
      title={analysis.analysis}
      subtitle={analysis.description}
    />
    <CardActions expander>
      <Link to={HOME + analysis.analysis}>
        <Button flat primary label="Go">input</Button>
      </Link>
    </CardActions>
    <CardText expandable>
      {analysis.text}
    </CardText>
  </Card>
);

export function Home(props){
  return (
    <RedirectToken token={props.token}>
      <div>
        {analyses.map(analysis =>
          card(analysis)
        )}
      </div>
    </RedirectToken>
  )
}

{'fraction_non_alphanumeric': 0.13416951729380464, 'fraction_numerical': 0.003800836183960471, 'mean_word_length': 2.7707736389684814, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 40, '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': '5029739', 'n_tokens_mistral': 787, 'n_tokens_neox': 773, 'n_words': 188}