/* eslint-disable jsx-a11y/no-href*/ import React from 'react'; import PropTypes from 'prop-types'; import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'; import { Grid, Alert, Button } from 'react-bootstrap'; import { Meteor } from 'meteor/meteor'; import { createContainer } from 'meteor/react-meteor-data'; import { Roles } from 'meteor/alanning:roles'; import { Bert } from 'meteor/themeteorchef:bert'; import Navigation from '../../components/Navigation/Navigation'; import Authenticated from '../../components/Authenticated/Authenticated'; import Public from '../../components/Public/Public'; import Index from '../../pages/Index/Index'; import Documents from '../../pages/Documents/Documents'; import NewDocument from '../../pages/NewDocument/NewDocument'; import ViewDocument from '../../pages/ViewDocument/ViewDocument'; import EditDocument from '../../pages/EditDocument/EditDocument'; import Signup from '../../pages/Signup/Signup'; import Login from '../../pages/Login/Login'; import Logout from '../../pages/Logout/Logout'; import VerifyEmail from '../../pages/VerifyEmail/VerifyEmail'; import RecoverPassword from '../../pages/RecoverPassword/RecoverPassword'; import ResetPassword from '../../pages/ResetPassword/ResetPassword'; import Profile from '../../pages/Profile/Profile'; import NotFound from '../../pages/NotFound/NotFound'; import Footer from '../../components/Footer/Footer'; import Terms from '../../pages/Terms/Terms'; import Privacy from '../../pages/Privacy/Privacy'; import ExamplePage from '../../pages/ExamplePage/ExamplePage'; import './App.scss'; const handleResendVerificationEmail = (emailAddress) => { Meteor.call('users.sendVerificationEmail', (error) => { if (error) { Bert.alert(error.reason, 'danger'); } else { Bert.alert(`Check ${emailAddress} for a verification link!`, 'success'); } }); }; const App = props => ( {!props.loading ?
{props.userId && !props.emailVerified ?

Hey friend! Can you verify your email address ({props.emailAddress}) for us?

: ''}
: ''}
); App.defaultProps = { userId: '', emailAddress: '', }; App.propTypes = { loading: PropTypes.bool.isRequired, userId: PropTypes.string, emailAddress: PropTypes.string, emailVerified: PropTypes.bool.isRequired, }; const getUserName = name => ({ string: name, object: `${name.first} ${name.last}`, }[typeof name]); export default createContainer(() => { const loggingIn = Meteor.loggingIn(); const user = Meteor.user(); const userId = Meteor.userId(); const loading = !Roles.subscription.ready(); const name = user && user.profile && user.profile.name && getUserName(user.profile.name); const emailAddress = user && user.emails && user.emails[0].address; return { loading, loggingIn, authenticated: !loggingIn && !!userId, name: name || emailAddress, roles: !loading && Roles.getRolesForUser(userId), userId, emailAddress, emailVerified: user && user.emails ? user && user.emails && user.emails[0].verified : true, }; }, App);