{"size": 3222, "ext": "js", "max_stars_repo_path": "app/shared/components/Producers/Arbitration.js", "max_stars_repo_name": "Chrisaiki/sqrl", "max_stars_repo_stars_event_min_datetime": "2018-09-08T06:14:58.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-08T10:35:17.000Z", "max_issues_repo_path": "app/shared/components/Producers/Arbitration.js", "max_issues_repo_name": "Chrisaiki/sqrl", "max_issues_repo_issues_event_min_datetime": "2018-10-12T18:18:52.000Z", "max_issues_repo_issues_event_max_datetime": "2020-03-14T09:02:01.000Z", "max_forks_repo_path": "app/shared/components/Producers/Arbitration.js", "max_forks_repo_name": "Chrisaiki/sqrl", "max_forks_repo_forks_event_min_datetime": "2018-09-26T08:11:55.000Z", "max_forks_repo_forks_event_max_datetime": "2020-12-15T15:18:38.000Z"}
{"max_stars_count": 40, "max_issues_count": 75, "max_forks_count": 23, "avg_line_length": 26.6280991736, "max_line_length": 228, "alphanum_fraction": 0.5397268777}
// @flow
import React, { Component } from 'react';
import { translate } from 'react-i18next';

import { Container, Header, Message, Segment } from 'semantic-ui-react';

import GovernanceArbitrationArbitration from './Governance/Arbitration/Arbitration';
import GovernanceArbitrationButtonArbitration from './Governance/Arbitration/Button/Arbitration';

class GovernanceArbitration extends Component<Props> {
  componentDidMount() {
    this.tick();
    this.interval = setInterval(this.tick.bind(this), 5000);
  }

  componentWillUnmount() {
    clearInterval(this.interval);
  }

  tick() {
    const {
      actions,
      validate
    } = this.props;
    const {
      getLeaderBoards
    } = actions;
    if (validate && validate.NODE) {
      getLeaderBoards();
    }
  }

  onChange = (e, { name, selection, value }) => {
    this.setState({ [name]: value }, () => {
      // If this is the dropdown, fire the submit
      if (selection) {
        this.sync();
      }
    });
  }
  onClose = () => {
    
  }
  render() {
    const {
      accounts,
      actions,
      blockExplorers,
      arbitration,
      proposals,
      settings,
      system,
      t,
      tables,
      validate,
      wallet
    } = this.props;
    const {
      arbitrators,
      leaderboards
    } = arbitration;
    const {
      ballots,
      votes
    } = proposals;
    
    return (
      <Segment basic>
        <Header floated="left">
          Arbitration Portal
        </Header>
          <Container floated="right" style={{ marginBottom: '50px' }}>
            <GovernanceArbitrationButtonArbitration
              accounts={accounts}
              actions={actions}
              arbitrators={arbitrators}
              blockExplorers={blockExplorers}
              leaderboards={leaderboards}
              onClose={this.onClose}
              settings={settings}
              system={system}
              tables={tables}
              validate={validate}
              wallet={wallet}
            />
          </Container>
          <Message 
            content={(
              <React.Fragment>
                <p>
                  This portal allows you to participate in the on-chain arbitration process. You can apply to be an arbitrator during open election, vote for arbitrator candidates, or manage arbitration claims using this portal.
                </p>
              </React.Fragment>
            )}
            info
          />
          {([].concat(leaderboards)
            .filter((board) => { return board.voting_symbol && board.voting_symbol.indexOf('VOTE') != -1;})
            .map((leaderboard) => (
              <GovernanceArbitrationArbitration
                actions={actions}
                arbitrators={arbitrators}
                key={leaderboard.board_id}
                ballots={ballots}
                blockExplorers={blockExplorers}
                leaderboard={leaderboard}
                settings={settings}
                system={system}
                votes={votes}
                validate={validate}
                wallet={wallet}
              />
            ))
          )}
      </Segment>
    );
  }
}

export default translate('tools')(GovernanceArbitration);
