/**
 * AboutTop view
 *
 * Generated by coz on 2016-11-11,
 * from a template provided by apeman-asset-templates.
 *
 * @function AboutTopView
 */
'use strict'

import React, { Component, PropTypes as types } from 'react'
import defineDebug from 'debug'
import {
  ApView, ApViewHeader, ApViewBody,
  ApList, ApListHeader, ApListBody, ApListItem
} from 'apeman-react-basic'
import { asConnected, asView, asLocaled, asServed, forSpin, combine } from '../../wrappers'
import { IconClasses } from 'ore-fol-enums'
const {
  ABOUT_ICON
} = IconClasses

const debug = defineDebug('project:view:about-top')

/** @lends AboutTopView */
class AboutTopView extends Component {
  // --------------------
  // Specs
  // --------------------
  static get propTypes () {
    return {}
  }

  static get defaultProps () {
    return {}
  }

  render () {
    const s = this
    const {
      props,
      l
    } = s
    return (
      <ApView id='about-top-view'
              className='view'
              spinning={ props.spinning }
              way={ props.way }
      >
        <ApViewHeader onLeftTap={ s.handlePop }
                      leftText={ null }
                      leftIcon={ props.popIcon }
                      titleText={ l('titles.ABOUT') }
                      titleIcon={ ABOUT_ICON }
                      onRightTap={ null }
                      rightIcon={ null }
                      rightText={ null }
        />

        <ApViewBody>
          <ApList>
            <ApListHeader>{ l('headings.APP') }</ApListHeader>
            <ApListBody>
              <ApListItem disclosure
                          onTap={ s.handleApp }
                          title={ l('buttons.SHOW_ABOUT_APP') }
              />
            </ApListBody>
            <ApListHeader>{ l('headings.POLICIES') }</ApListHeader>
            <ApListBody>
              <ApListItem disclosure
                          onTap={ s.handleTerm }
                          title={ l('buttons.SHOW_TERMS_OF_USE') }
              />
              <ApListItem disclosure
                          onTap={ s.handlePrivacy }
                          title={ l('buttons.SHOW_PRIVACY_POLICY') }
              />
            </ApListBody>
          </ApList>
        </ApViewBody>
      </ApView>
    )
  }

  // --------------------
  // Lifecycle
  // --------------------

  componentWillMount () {
    debug('willMount')
    const s = this
  }

  componentDidMount () {
    debug('didMount')
    const s = this
  }

  componentWillUnmount () {
    debug('willUnmount')
    const s = this
  }

  // --------------------
  // Handlers
  // --------------------

  handleTerm () {
    const s = this
    s.handlePush('AboutTermOfUseView', {})
  }

  handlePrivacy () {
    const s = this
    s.handlePush('AboutPrivacyPolicyView', {})
  }

  handleApp () {
    const s = this
    s.handlePush('AboutAppView')
  }

  // --------------------
  // For redux
  // --------------------
  static mapStateToProps (state, ownProps) {
    return {}
  }

}

export default combine(
  asServed(),
  forSpin(),
  asLocaled(),
  asView(),
  asConnected()
)(AboutTopView)

