<commit_before>import React from 'react';
import { Message } from 'retranslate';
import { PropTypes as Types } from 'prop-types';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import StatusBoxRow from './statusBoxRow';

export const StatusBox = ({
  conversion,
  memberNumber,
  loading,
  secondPillarFunds,
  thirdPillarFunds,
}) => {
  const joinTuleva2 = !(
    conversion.secondPillar.selectionComplete && conversion.secondPillar.transfersComplete
  );
  const joinTuleva3 = !(
    conversion.thirdPillar.selectionComplete && conversion.thirdPillar.transfersComplete
  );

  const isTulevaMember = memberNumber != null;

  const tulevaData = isTulevaMember
    ? [<Message params={{ memberNumber }}>account.member.statement</Message>]
    : [<Message>account.non.member.statement</Message>];

  return (
    <>
      <div className="row">
        <div className="col-md-6 mb-4 lead">
          <Message>account.status.choices</Message>
        </div>
      </div>

      <div className="card card-secondary">
        <StatusBoxRow
          ok={!joinTuleva2}
          showAction={!loading}
          name={<Message>account.status.choice.pillar.second</Message>}
          lines={secondPillarFunds.filter(fund => fund.activeFund).map(({ name }) => name)}
        >
          {joinTuleva2 && (
            <Link to="/2nd-pillar-flow" className="btn btn-light">
              <Message>account.status.choice.join.tuleva.2</Message>
            </Link>
          )}
        </StatusBoxRow>

        <StatusBoxRow
          ok={!joinTuleva3}
          showAction={!loading}
          name={<Message>account.status.choice.pillar.third</Message>}
          lines={thirdPillarFunds.filter(fund => fund.activeFund).map(({ name }) => name)}
        >
          {joinTuleva3 && (
            <Link to="/3rd-pillar-flow" className="btn btn-light">
              <Message>account.status.choice.join.tuleva.3</Message>
            </Link>
          )}
        </StatusBoxRow>

        <StatusBoxRow
          last
          ok={isTulevaMember}
          showAction={!loading}
          name={<Message>account.status.choice.tuleva</Message>}
          lines={tulevaData}
        >
          {!isTulevaMember && (
            <span>
              <a className="btn btn-light" href="https://tuleva.ee/tulundusyhistu/">
                <Message>account.status.choice.join.tuleva</Message>
              </a>
            </span>
          )}
        </StatusBoxRow>
      </div>
      <div className="mt-3">
        <small className="text-muted">
          <Message
            params={{ contribution: conversion.thirdPillar.yearToDateContribution }}
            dangerouslyTranslateInnerHTML="account.status.yearToDateContribution"
          />
        </small>
      </div>
    </>
  );
};

StatusBox.defaultProps = {
  memberNumber: null,
  conversion: {},<commit_msg>Fix 0 euro contribution bug<commit_after>import React from 'react';
import { Message } from 'retranslate';
import { PropTypes as Types } from 'prop-types';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import StatusBoxRow from './statusBoxRow';

export const StatusBox = ({
  conversion,
  memberNumber,
  loading,
  secondPillarFunds,
  thirdPillarFunds,
}) => {
  const joinTuleva2 = !(
    conversion.secondPillar.selectionComplete && conversion.secondPillar.transfersComplete
  );
  const joinTuleva3 = !(
    conversion.thirdPillar.selectionComplete && conversion.thirdPillar.transfersComplete
  );

  const isTulevaMember = memberNumber != null;

  const tulevaData = isTulevaMember
    ? [<Message params={{ memberNumber }}>account.member.statement</Message>]
    : [<Message>account.non.member.statement</Message>];

  return (
    <>
      <div className="row">
        <div className="col-md-6 mb-4 lead">
          <Message>account.status.choices</Message>
        </div>
      </div>

      <div className="card card-secondary">
        <StatusBoxRow
          ok={!joinTuleva2}
          showAction={!loading}
          name={<Message>account.status.choice.pillar.second</Message>}
          lines={secondPillarFunds.filter(fund => fund.activeFund).map(({ name }) => name)}
        >
          {joinTuleva2 && (
            <Link to="/2nd-pillar-flow" className="btn btn-light">
              <Message>account.status.choice.join.tuleva.2</Message>
            </Link>
          )}
        </StatusBoxRow>

        <StatusBoxRow
          ok={!joinTuleva3}
          showAction={!loading}
          name={<Message>account.status.choice.pillar.third</Message>}
          lines={thirdPillarFunds.filter(fund => fund.activeFund).map(({ name }) => name)}
        >
          {joinTuleva3 && (
            <Link to="/3rd-pillar-flow" className="btn btn-light">
              <Message>account.status.choice.join.tuleva.3</Message>
            </Link>
          )}
        </StatusBoxRow>

        <StatusBoxRow
          last
          ok={isTulevaMember}
          showAction={!loading}
          name={<Message>account.status.choice.tuleva</Message>}
          lines={tulevaData}
        >
          {!isTulevaMember && (
            <span>
              <a className="btn btn-light" href="https://tuleva.ee/tulundusyhistu/">
                <Message>account.status.choice.join.tuleva</Message>
              </a>
            </span>
          )}
        </StatusBoxRow>
      </div>
      <div className="mt-3">
        <small className="text-muted">
          <Message
            params={{
              contribution: (conversion.thirdPillar.yearToDateContribution || 0).toString(),
            }}
            dangerouslyTranslateInnerHTML="account.status.yearToDateContribution"
          />
        </small>
      </div>
    </>
  );
};

StatusBox.defaultProps = {
  memberNumber: null,
  conversion: {},
{'fraction_non_alphanumeric': 0.13931199726168064, 'fraction_numerical': 0.004792058873866164, 'mean_word_length': 2.2794612794612794, 'pattern_counts': {'":': 0, '<': 93, '<?xml version=': 0, '>': 103, 'https://': 2, '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': '6341258', 'n_tokens_mistral': 1787, 'n_tokens_neox': 1721, 'n_words': 267}