<commit_before>import { Component }          from 'react';
import { connect }            from 'react-redux';
import { bindActionCreators } from 'redux';

import { 
  fetchActionPlan,
  deleteActionPlan,
  approveActionPlan
} from './action_plans.actions';

import Loading              from '../application/loading.component';
import DangerLink           from '../application/danger_link.component';
import FilterMeta           from '../filters/filter_meta.component';
import ActionPlanProposals  from './action_plan_proposals.component';

class ActionPlanShow extends Component {
  constructor(props) {
    super(props);

    this.state = {
      loading: true
    }
  }

  componentDidMount() {
    const { session } = this.props;

    this.props.fetchActionPlan(this.props.actionPlanId);
  }

  componentWillReceiveProps(newProps) {
    if (newProps.actionPlan.id) {
      this.setState({ loading: false });
    }
  }

  render() {
    return (
      <div className="action-plan-show component">
        <Loading show={this.state.loading} />
        {this.renderActionPlan()}
      </div>
    );
  }

  renderActionPlan() {
    const { actionPlan } = this.props;

    if (actionPlan.id) {
      const { 
        id,
        url,
        edit_url,
        deleted,
        new_revision_url,
        title, 
        description,
        created_at,
        scope_,
        category,
        subcategory,
        district
      } = actionPlan;

      return (
        <div>
          <div className="row" id={`action_plan_${actionPlan.id}`}>
            <div className="small-12 medium-12 column">
              <i className="icon-angle-left left"></i>&nbsp;

              <a className="left back" href="/action_plans">
                {I18n.t('proposals.show.back_link')}
              </a>

              <DangerLink className="delete-proposal button danger tiny radius right" onClick={ () => this.props.deleteActionPlan(this.props.actionPlan.id) }>
                <i className="icon-cross"></i>
                { I18n.t("components.action_plan_show.delete") }
              </DangerLink>

              <a href={edit_url} className="edit-proposal button success tiny radius right">
                <i className="icon-edit"></i>
                { I18n.t("components.action_plan_show.edit") }
              </a>

              <a href={new_revision_url} className="edit-proposal button success tiny radius right">
                <i className="icon-edit"></i>
                { I18n.t("components.action_plan_show.new_revision") }
              </a>

              { this.renderNotice() }

              <h2>
                <a href={url}>{title}</a>
              </h2>

              <p className="proposal-info">
                <span>{ created_at }</span>
              </p>

              <div 
                className="proposal-description"
                dangerouslySetInnerHTML={{ __html: description.autoLink() }} />

              <FilterMeta 
                scope={ scope_ }
                district={ district }
                category={ category }
                subcategory={ subcategory } 
                namespace="action_plans"
                useServerLinks={ true }/>

              <ActionPlanProposals actionPlan={actionPlan} />
            </div>
          </div>
        </div>
      );
    }
    return null;
  }

  renderNotice(){
    if(this.props.actionPlan && this.props.actionPlan.deleted){
      return (
        <div className="alert-box warning">{I18n.t("components.action_plan_show.deleted")}</div>
      )
    }
  }
<<<<<<< HEAD
=======

  renderApproveButton() {
    return (
      <DangerLink onClick={() => this.props.approveActionPlan(this.props.actionPlan.id)}
        className="approve-proposal button tiny radius right">
        <i className="icon-edit"></i>
        { I18n.t("components.action_plan_show.approve") }
      </DangerLink>
    )
  }
>>>>>>> e321e47... WIP
}


function mapStateToProps({ session, actionPlan }) {
  return { session, actionPlan };<commit_msg>Fix bad merge<commit_after>import { Component }          from 'react';
import { connect }            from 'react-redux';
import { bindActionCreators } from 'redux';

import { 
  fetchActionPlan,
  deleteActionPlan,
  approveActionPlan
} from './action_plans.actions';

import Loading              from '../application/loading.component';
import DangerLink           from '../application/danger_link.component';
import FilterMeta           from '../filters/filter_meta.component';
import ActionPlanProposals  from './action_plan_proposals.component';

class ActionPlanShow extends Component {
  constructor(props) {
    super(props);

    this.state = {
      loading: true
    }
  }

  componentDidMount() {
    const { session } = this.props;

    this.props.fetchActionPlan(this.props.actionPlanId);
  }

  componentWillReceiveProps(newProps) {
    if (newProps.actionPlan.id) {
      this.setState({ loading: false });
    }
  }

  render() {
    return (
      <div className="action-plan-show component">
        <Loading show={this.state.loading} />
        {this.renderActionPlan()}
      </div>
    );
  }

  renderActionPlan() {
    const { actionPlan } = this.props;

    if (actionPlan.id) {
      const { 
        id,
        url,
        edit_url,
        deleted,
        new_revision_url,
        title, 
        description,
        created_at,
        scope_,
        category,
        subcategory,
        district
      } = actionPlan;

      return (
        <div>
          <div className="row" id={`action_plan_${actionPlan.id}`}>
            <div className="small-12 medium-12 column">
              <i className="icon-angle-left left"></i>&nbsp;

              <a className="left back" href="/action_plans">
                {I18n.t('proposals.show.back_link')}
              </a>

              <DangerLink className="delete-proposal button danger tiny radius right" onClick={ () => this.props.deleteActionPlan(this.props.actionPlan.id) }>
                <i className="icon-cross"></i>
                { I18n.t("components.action_plan_show.delete") }
              </DangerLink>

              <a href={edit_url} className="edit-proposal button success tiny radius right">
                <i className="icon-edit"></i>
                { I18n.t("components.action_plan_show.edit") }
              </a>

              <a href={new_revision_url} className="edit-proposal button success tiny radius right">
                <i className="icon-edit"></i>
                { I18n.t("components.action_plan_show.new_revision") }
              </a>

              { this.renderNotice() }

              <h2>
                <a href={url}>{title}</a>
              </h2>

              <p className="proposal-info">
                <span>{ created_at }</span>
              </p>

              <div 
                className="proposal-description"
                dangerouslySetInnerHTML={{ __html: description.autoLink() }} />

              <FilterMeta 
                scope={ scope_ }
                district={ district }
                category={ category }
                subcategory={ subcategory } 
                namespace="action_plans"
                useServerLinks={ true }/>

              <ActionPlanProposals actionPlan={actionPlan} />
            </div>
          </div>
        </div>
      );
    }
    return null;
  }

  renderNotice(){
    if(this.props.actionPlan && this.props.actionPlan.deleted){
      return (
        <div className="alert-box warning">{I18n.t("components.action_plan_show.deleted")}</div>
      )
    }
  }

  renderApproveButton() {
    return (
      <DangerLink onClick={() => this.props.approveActionPlan(this.props.actionPlan.id)}
        className="approve-proposal button tiny radius right">
        <i className="icon-edit"></i>
        { I18n.t("components.action_plan_show.approve") }
      </DangerLink>
    )
  }
}


function mapStateToProps({ session, actionPlan }) {
  return { session, actionPlan };
{'fraction_non_alphanumeric': 0.1295, 'fraction_numerical': 0.005125, 'mean_word_length': 1.9179431072210065, 'pattern_counts': {'":': 0, '<': 94, '<?xml version=': 0, '>': 98, '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': '4437449', 'n_tokens_mistral': 2336, 'n_tokens_neox': 2230, 'n_words': 407}