<commit_before>import React, { Component } from 'react'
import { connect } from 'react-redux'
import { createStructuredSelector } from 'reselect'

import { Col, Row } from 'react-bootstrap'
import { withAllFixtures } from 'components/forms/PlayerSearchForm'
import { requestPlayer } from 'actions/playerSearch'
import { playerSearchSelector } from 'utils/selectors'
import { FixtureDisplay, Loading } from 'utils'
import { RegionIcon, PositionIcon, SkillBracketIcon } from 'utils/components/icons'
import TeamSnippet from 'containers/TeamSnippet'

const FixtureRow = ({ label, children }) => (
    <Row>
        <Col sm={2} md={2} lg={2} className='hidden-xs'>
            {label}
        </Col>
        <Col xs={12} sm={6} md={4} lg={3}>
            {children}
        </Col>
    </Row>
)

class PlayerProfile extends Component {

    componentDidMount() {
        this.props.onLoad()
    }

    componentDidUpdate(oldProps) {
        if (this.props.params.id !== oldProps.params.id) {
            this.props.onLoad()
        }
    }

    render() {
        const { playerSearch: { player, playerIsLoading, playerLastUpdated } } = this.props
        const { fixtures: { regions, positions, skillBrackets } } = this.props
        return (
            <div>
                <h1>Player Profile</h1>
                {playerIsLoading ? <Loading /> : (
                    playerLastUpdated ? (
                        <div>
                            <h2>{player.username}</h2>
                            <FixtureRow label='Regions:'>
                                <RegionIcon fixedWidth={true}/>&nbsp;
                                <FixtureDisplay value={player.regions} fixture={regions}/>
                            </FixtureRow>
                            <FixtureRow label='Skill Bracket:'>
                                <SkillBracketIcon fixedWidth={true}/>&nbsp;
                                <FixtureDisplay value={player.skill_bracket} fixture={skillBrackets}/>
                            </FixtureRow>
                            <FixtureRow label='Positions:'>
                                <PositionIcon fixedWidth={true}/>&nbsp;
                                <FixtureDisplay value={player.positions} fixture={positions}/>
                            </FixtureRow>
                            {player.teams.map(team => (
                                <Row key={`row-team-${team.id}`}>
                                    <Col md={8}>
                                        <TeamSnippet teamId={team.id} />
                                    </Col>
                                </Row>
                            ))}
                        </div>
                    ) : <div>Error loading player</div>
                )}
            </div>
        )<commit_msg>Add teams header to player profile page<commit_after>import React, { Component } from 'react'
import { connect } from 'react-redux'
import { createStructuredSelector } from 'reselect'

import { Col, Row } from 'react-bootstrap'
import { withAllFixtures } from 'components/forms/PlayerSearchForm'
import { requestPlayer } from 'actions/playerSearch'
import { playerSearchSelector } from 'utils/selectors'
import { FixtureDisplay, Loading } from 'utils'
import { RegionIcon, PositionIcon, SkillBracketIcon } from 'utils/components/icons'
import TeamSnippet from 'containers/TeamSnippet'

const FixtureRow = ({ label, children }) => (
    <Row>
        <Col sm={2} md={2} lg={2} className='hidden-xs'>
            {label}
        </Col>
        <Col xs={12} sm={6} md={4} lg={3}>
            {children}
        </Col>
    </Row>
)

class PlayerProfile extends Component {

    componentDidMount() {
        this.props.onLoad()
    }

    componentDidUpdate(oldProps) {
        if (this.props.params.id !== oldProps.params.id) {
            this.props.onLoad()
        }
    }

    render() {
        const { playerSearch: { player, playerIsLoading, playerLastUpdated } } = this.props
        const { fixtures: { regions, positions, skillBrackets } } = this.props
        return (
            <div>
                <h1>Player Profile</h1>
                {playerIsLoading ? <Loading /> : (
                    playerLastUpdated ? (
                        <div>
                            <h2>{player.username}</h2>
                            <FixtureRow label='Regions:'>
                                <RegionIcon fixedWidth={true}/>&nbsp;
                                <FixtureDisplay value={player.regions} fixture={regions}/>
                            </FixtureRow>
                            <FixtureRow label='Skill Bracket:'>
                                <SkillBracketIcon fixedWidth={true}/>&nbsp;
                                <FixtureDisplay value={player.skill_bracket} fixture={skillBrackets}/>
                            </FixtureRow>
                            <FixtureRow label='Positions:'>
                                <PositionIcon fixedWidth={true}/>&nbsp;
                                <FixtureDisplay value={player.positions} fixture={positions}/>
                            </FixtureRow>
                            <h3>Teams</h3>
                            {player.teams.map(team => (
                                <Row key={`row-team-${team.id}`}>
                                    <Col md={8}>
                                        <TeamSnippet teamId={team.id} />
                                    </Col>
                                </Row>
                            ))}
                        </div>
                    ) : <div>Error loading player</div>
                )}
            </div>
        )
{'fraction_non_alphanumeric': 0.11543220788403748, 'fraction_numerical': 0.004949619939897472, 'mean_word_length': 1.3525987525987526, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 77, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2751116', 'n_tokens_mistral': 1468, 'n_tokens_neox': 1408, 'n_words': 281}