import React, {
	Component
} from 'react';
import {
	observer
} from 'mobx-react';
import {
	Row,
	Col,
	Button
} from 'antd';
import {
	i18n
} from '../../public/i18n';

@observer
export default class Timer extends Component {
	constructor(props) {
		super(props);
	}

	componentDidMount() {}

	componentWillReceiveProps(nextProps) {}

	render() {
		const {
			store
		} = this.props;
		const {
			timer,
			resetData
		} = store;
		if (timer === 0)
			return (<div className='timer'></div>);

		let countDownLabelStr = i18n.label.countDown();
		const str = countDownLabelStr.replace('{seconds}', `<span class='seconds'>${timer}</span>`)
		const alarmCom = (<i className='icon-coms-Edition'>
							<span className='message' dangerouslySetInnerHTML={{__html: str}}></span>
						</i>)

		return (
			<div className='timer'>
			{
				timer != 0
				&&
				<div>
					<div className='alarm'>
					{alarmCom}
					</div>
					<div><Button ecId={`${this && this.props && this.props.ecId || ''}_Button@xg1nz7`} type='primary' onClick={resetData}>{i18n.button.stop()}</Button></div>
				</div>
			}
			</div>
		)
	}
}