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

View file

@ -63,6 +63,7 @@ class Preview extends React.Component {
'handlePopState', 'handlePopState',
'handleCloseAdminPanel', 'handleCloseAdminPanel',
'handleCloseEmailConfirmationModal', 'handleCloseEmailConfirmationModal',
'handleBannerDismiss',
'handleIsRemixing', 'handleIsRemixing',
'handleOpenAdminPanel', 'handleOpenAdminPanel',
'handleReportClick', 'handleReportClick',
@ -630,6 +631,17 @@ class Preview extends React.Component {
handleCloseEmailConfirmationModal () { handleCloseEmailConfirmationModal () {
this.setState({showEmailConfirmationModal: false}); 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) { handleUpdateProjectTitle (title) {
this.props.updateProject( this.props.updateProject(
this.props.projectInfo.id, this.props.projectInfo.id,
@ -784,6 +796,7 @@ class Preview extends React.Component {
onAddComment={this.handleAddComment} onAddComment={this.handleAddComment}
onAddToStudioClicked={this.handleAddToStudioClick} onAddToStudioClicked={this.handleAddToStudioClick}
onAddToStudioClosed={this.handleAddToStudioClose} onAddToStudioClosed={this.handleAddToStudioClose}
onBannerDismiss={this.handleBannerDismiss}
onCloseAdminPanel={this.handleCloseAdminPanel} onCloseAdminPanel={this.handleCloseAdminPanel}
onCloseEmailConfirmationModal={this.handleCloseEmailConfirmationModal} onCloseEmailConfirmationModal={this.handleCloseEmailConfirmationModal}
onDeleteComment={this.handleDeleteComment} onDeleteComment={this.handleDeleteComment}
@ -933,6 +946,7 @@ Preview.propTypes = {
projectInfo: projectShape, projectInfo: projectShape,
projectNotAvailable: PropTypes.bool, projectNotAvailable: PropTypes.bool,
projectStudios: PropTypes.arrayOf(PropTypes.object), projectStudios: PropTypes.arrayOf(PropTypes.object),
refreshSession: PropTypes.func,
registrationOpen: PropTypes.bool, registrationOpen: PropTypes.bool,
remixProject: PropTypes.func, remixProject: PropTypes.func,
remixes: PropTypes.arrayOf(PropTypes.object), remixes: PropTypes.arrayOf(PropTypes.object),
@ -1164,6 +1178,9 @@ const mapDispatchToProps = dispatch => ({
dispatch(GUI.remixProject()); dispatch(GUI.remixProject());
dispatch(projectCommentActions.resetComments()); dispatch(projectCommentActions.resetComments());
}, },
refreshSession: () => {
dispatch(sessionActions.refreshSession());
},
setPlayer: player => { setPlayer: player => {
dispatch(GUI.setPlayer(player)); dispatch(GUI.setPlayer(player));
}, },