/* @flow */ import Distribution from 'Components/Distribution' import PaySlip from 'Components/PaySlip' import SearchButton from 'Components/SearchButton' import withTracker from 'Components/utils/withTracker' import { compose } from 'ramda' import React, { Component } from 'react' import { Trans } from 'react-i18next' import { connect } from 'react-redux' import ficheDePaieSelectors from 'Selectors/ficheDePaieSelectors' import Card from 'Ui/Card' import './ResultView.css' import type { Tracker } from 'Components/utils/withTracker' type State = { resultView: 'distribution' | 'payslip' } type Props = { conversationStarted: boolean, tracker: Tracker, displayResults: boolean } const resultViewTitle = { distribution: 'Cotisations', payslip: 'Fiche de paie' } class ResultView extends Component { state = { resultView: this.props.conversationStarted ? 'payslip' : 'distribution' } handleClickOnTab = resultView => () => { this.setState({ resultView }) this.props.tracker.push(['trackEvent', 'results', 'selectView', resultView]) } render() { return ( this.props.displayResults && ( <>
{['payslip', 'distribution'].map(resultView => ( ))}
{this.state.resultView === 'payslip' ? ( ) : ( )} ) ) } } export default compose( withTracker, connect( state => ({ conversationStarted: state.conversationStarted, key: state.conversationStarted, displayResults: !!ficheDePaieSelectors(state) }), {} ) )(ResultView)