Wire up banner dismissal

This commit is contained in:
seotts 2021-11-17 14:53:44 -05:00
parent 92824f43aa
commit 6814c8f5b1
2 changed files with 23 additions and 4 deletions

View file

@ -92,6 +92,7 @@ const PreviewPresentation = ({
onAddComment,
onAddToStudioClicked,
onAddToStudioClosed,
onBannerDismiss,
onCloseAdminPanel,
onCloseEmailConfirmationModal,
onDeleteComment,
@ -225,7 +226,7 @@ const PreviewPresentation = ({
return (
<div className="preview">
{showEmailConfirmationModal && <EmailConfirmationModal
isOpen={true}
isOpen
onRequestClose={onCloseEmailConfirmationModal}
/>}
{showAdminPanel && (
@ -249,9 +250,9 @@ const PreviewPresentation = ({
{ projectInfo && projectInfo.author && projectInfo.author.id && (
<React.Fragment>
{showEmailConfirmationBanner && <EmailConfirmationBanner
onRequestDismiss={() => { // eslint-disable-line react/jsx-no-bind
console.log('dismiss');
}}
/* eslint-disable react/jsx-no-bind */
onRequestDismiss={() => onBannerDismiss('confirmed_email')}
/* eslint-enable react/jsx-no-bind */
/>}
{banner}
<div className="inner">
@ -749,6 +750,7 @@ PreviewPresentation.propTypes = {
onAddComment: PropTypes.func,
onAddToStudioClicked: PropTypes.func,
onAddToStudioClosed: PropTypes.func,
onBannerDismiss: PropTypes.func,
onCloseAdminPanel: PropTypes.func,
onCloseEmailConfirmationModal: PropTypes.func,
onDeleteComment: PropTypes.func,

View file

@ -63,6 +63,7 @@ class Preview extends React.Component {
'handlePopState',
'handleCloseAdminPanel',
'handleCloseEmailConfirmationModal',
'handleBannerDismiss',
'handleIsRemixing',
'handleOpenAdminPanel',
'handleReportClick',
@ -630,6 +631,17 @@ class Preview extends React.Component {
handleCloseEmailConfirmationModal () {
this.setState({showEmailConfirmationModal: false});
}
handleBannerDismiss (cue) {
api({
host: '',
uri: '/site-api/users/set-template-cue/',
method: 'post',
useCsrf: true,
json: {cue: cue, value: false}
}, err => {
if (!err) this.props.refreshSession();
});
}
handleUpdateProjectTitle (title) {
this.props.updateProject(
this.props.projectInfo.id,
@ -784,6 +796,7 @@ class Preview extends React.Component {
onAddComment={this.handleAddComment}
onAddToStudioClicked={this.handleAddToStudioClick}
onAddToStudioClosed={this.handleAddToStudioClose}
onBannerDismiss={this.handleBannerDismiss}
onCloseAdminPanel={this.handleCloseAdminPanel}
onCloseEmailConfirmationModal={this.handleCloseEmailConfirmationModal}
onDeleteComment={this.handleDeleteComment}
@ -933,6 +946,7 @@ Preview.propTypes = {
projectInfo: projectShape,
projectNotAvailable: PropTypes.bool,
projectStudios: PropTypes.arrayOf(PropTypes.object),
refreshSession: PropTypes.func,
registrationOpen: PropTypes.bool,
remixProject: PropTypes.func,
remixes: PropTypes.arrayOf(PropTypes.object),
@ -1164,6 +1178,9 @@ const mapDispatchToProps = dispatch => ({
dispatch(GUI.remixProject());
dispatch(projectCommentActions.resetComments());
},
refreshSession: () => {
dispatch(sessionActions.refreshSession());
},
setPlayer: player => {
dispatch(GUI.setPlayer(player));
},