import React, {Component} from 'react'; import {Col, Container, Row} from 'reactstrap'; import {Link} from 'react-router-dom'; import {withTranslation, Trans} from 'react-i18next'; import {faCopy, faUsers, faExclamationTriangle} from '@fortawesome/free-solid-svg-icons'; import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'; import logoLine from '../../logos/logo-line-white.svg'; import {AppContext} from '../../AppContext'; import CopyField from '../CopyField'; class CreateSuccess extends Component { static contextType = AppContext; constructor(props) { super(props); const electionSlug = this.props.match.params.slug; this.state = { urlOfVote: window.location.origin + '/vote/' + electionSlug, urlOfResult: window.location.origin + '/result/' + electionSlug, }; this.urlVoteField = React.createRef(); this.urlResultField = React.createRef(); } handleClickOnCopyResult = event => { const input = this.urlResultField.current; input.focus(); input.select(); document.execCommand('copy'); }; render() { const {t} = this.props; const electionLink = this.props.invitationOnly ? ( <>
{t('Voters received a link to vote by email. Each link can be used only once!')}
> ) : ( <>{t('You can now share the election link to participants:')}
{t('Here is the link for the results in real time:')}