From 058edef86abe7e66097da7af43c6748b3c05a19e Mon Sep 17 00:00:00 2001 From: tomlum Date: Tue, 26 Oct 2021 13:11:26 -0400 Subject: [PATCH] adds modal progress and new logic for showing share button on project page --- .../email-confirmation/banner.jsx | 46 +++++++++++++++++++ .../modal/email-confirmation/modal.jsx | 26 +++++++++++ src/views/preview/presentation.jsx | 26 ++++++++--- src/views/preview/project-view.jsx | 10 ++++ src/views/splash/presentation.jsx | 31 ++----------- 5 files changed, 106 insertions(+), 33 deletions(-) create mode 100644 src/components/dropdown-banner/email-confirmation/banner.jsx create mode 100644 src/components/modal/email-confirmation/modal.jsx diff --git a/src/components/dropdown-banner/email-confirmation/banner.jsx b/src/components/dropdown-banner/email-confirmation/banner.jsx new file mode 100644 index 000000000..c197b02df --- /dev/null +++ b/src/components/dropdown-banner/email-confirmation/banner.jsx @@ -0,0 +1,46 @@ +import React, {useState} from 'react'; +import DropdownBanner from '../banner.jsx'; + + +/* { // eslint-disable-line react/jsx-no-bind + this.emailConfirmationiFrame = iframe; + }} + isOpen={this.props.emailConfirmationModalOpen} + key="iframe-modal" + src="/accounts/email_resend_standalone/" + onRequestClose={this.props.onHideEmailConfirmationModal} + /> */ + + +const EmailConfirmationBanner = onRequestDismiss => { + + const [showEmailConfirmationModal, setShowEmailConfirmationModal] = useState(false); + + return ( + + {(showEmailConfirmationModal &&

test

)} + + + Confirm your email + {' '}to enable sharing.{' '} + + Having trouble? + + +
); +}; + +EmailConfirmationBanner.propTypes = { + +}; + +module.exports = EmailConfirmationBanner; diff --git a/src/components/modal/email-confirmation/modal.jsx b/src/components/modal/email-confirmation/modal.jsx new file mode 100644 index 000000000..9ed283b1e --- /dev/null +++ b/src/components/modal/email-confirmation/modal.jsx @@ -0,0 +1,26 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import {FormattedMessage} from 'react-intl'; + +import Modal from '../base/modal.jsx'; +import ModalTitle from '../base/modal-title.jsx'; +// import ModalInnerContent from '../../../components/modal/base/modal-inner-content.jsx'; + +// import './manager-limit-modal.scss'; +// import {STUDIO_MANAGER_LIMIT} from '../../../redux/studio.js'; + + +const EmailConfirmationModal = () => ( + + + test 1234 + +); + +EmailConfirmationModal.propTypes = { + handleClose: PropTypes.func +}; + +export default EmailConfirmationModal; diff --git a/src/views/preview/presentation.jsx b/src/views/preview/presentation.jsx index 408bed818..5762e4736 100644 --- a/src/views/preview/presentation.jsx +++ b/src/views/preview/presentation.jsx @@ -32,6 +32,7 @@ const ComposeComment = require('./comment/compose-comment.jsx'); const ExtensionChip = require('./extension-chip.jsx'); const thumbnailUrl = require('../../lib/user-thumbnail'); const FormsyProjectUpdater = require('./formsy-project-updater.jsx'); +const EmailConfirmationModal = require('../../components/modal/emailConfirmation/modal.jsx').default; const projectShape = require('./projectshape.jsx').projectShape; require('./preview.scss'); @@ -62,6 +63,7 @@ const PreviewPresentation = ({ canRestoreComments, canSave, canShare, + canSeeShare, canToggleComments, canUseBackpack, cloudHost, @@ -109,6 +111,7 @@ const PreviewPresentation = ({ onSeeInside, onSetProjectThumbnailer, onShare, + onShareAttempt, onSocialClicked, onSocialClosed, onToggleComments, @@ -129,6 +132,7 @@ const PreviewPresentation = ({ reportOpen, showAdminPanel, showModInfo, + showEmailConfirmationModal, singleCommentId, socialOpen, userOwnsProject, @@ -170,7 +174,7 @@ const PreviewPresentation = ({ } /> ); - } else if (canShare) { + } else if (canSeeShare) { if (isShared && justShared) { // if was shared a while ago, don't show any share banner if (isNewScratcher) { banner = (); } } else if (!isShared) { - banner = (} - message={} - onAction={onShare} - />); + if (canShare){ + banner = (} + message={} + onAction={onShare} + />); + } else { + banner = (} + message={} + onAction={onShareAttempt} + /> + ); + } } } @@ -208,6 +221,7 @@ const PreviewPresentation = ({ ); return (
+ {showEmailConfirmationModal && } {showAdminPanel && ( - {this.props.shouldShowEmailConfirmation ? [ - { // eslint-disable-line react/jsx-no-bind + {(this.props.shouldShowEmailConfirmation && + { // eslint-disable-line react/jsx-no-bind this.props.onDismiss('confirmed_email'); }} - > - - Confirm your email - {' '}to enable sharing.{' '} - - Having trouble? - - , - { // eslint-disable-line react/jsx-no-bind - this.emailConfirmationiFrame = iframe; - }} - isOpen={this.props.emailConfirmationModalOpen} - key="iframe-modal" - src="/accounts/email_resend_standalone/" - onRequestClose={this.props.onHideEmailConfirmationModal} - /> - ] : []} + />)} {this.props.isEducator ? [