import { h, Component } from 'preact'; import PropTypes from 'prop-types'; import { getContentOfToken } from '../utilities'; class ClosingSlide extends Component { componentDidMount() { const csrfToken = getContentOfToken('csrf-token'); fetch('/onboarding_update', { method: 'PATCH', headers: { 'X-CSRF-Token': csrfToken, 'Content-Type': 'application/json', }, body: JSON.stringify({ user: { last_onboarding_page: 'closing slide' } }), credentials: 'same-origin', }); } render() { const { previousLocation, variant } = this.props; const previousLocationListElement = () => { if (variant === '6' || variant === '8') { return (
{' '} Challenge: Leave 3 constructive comments today {' '}
); } if (previousLocation !== 'none' && previousLocation !== null) { return (
Or go back to the page you were on before you signed up
{previousLocation}
); } return null; }; const nextStepLinks = () => { if (variant === '7' || variant === '8') { return (
Join the Welcome Thread

😊

); } if (variant === '9') { return (
Join the Welcome Thread 🚀

Challenge: Leave 3 constructive comments

Ask questions, offer encouragement and participate in discussion threads.

); } return (
Join the Welcome Thread

😊

Write your first DEV post

✍️

Read all-time top posts

🤓

Customize your profile

💅

); }; return (

You‘re part of the community! {' '} 🎉

What next?

{nextStepLinks()} {previousLocationListElement()}
); } } ClosingSlide.propTypes = { previousLocation: PropTypes.string.isRequired, variant: PropTypes.string.isRequired, }; export default ClosingSlide;