diff --git a/lms/static/js/demographics_collection/DemographicsCollectionBanner.jsx b/lms/static/js/demographics_collection/DemographicsCollectionBanner.jsx deleted file mode 100644 index d914d7fb03f7..000000000000 --- a/lms/static/js/demographics_collection/DemographicsCollectionBanner.jsx +++ /dev/null @@ -1,99 +0,0 @@ -/* global gettext */ -import React from 'react'; -import Cookies from 'js-cookie'; -import {DemographicsCollectionModal} from './DemographicsCollectionModal'; - -// eslint-disable-next-line import/prefer-default-export -export class DemographicsCollectionBanner extends React.Component { - constructor(props) { - super(props); - this.state = { - modalOpen: false, - hideBanner: false - }; - - this.dismissBanner = this.dismissBanner.bind(this); - } - - /** - * Utility function that controls hiding the CTA from the Course Dashboard where appropriate. - * This can be called one of two ways - when a user clicks the "dismiss" button on the CTA - * itself, or when the learner completes all of the questions within the modal. - * - * The dismiss button itself is nested inside of an , so we need to call stopPropagation() - * here to prevent the Modal from _also_ opening when the Dismiss button is clicked. - */ - async dismissBanner(e) { - // Since this function also doubles as a callback in the Modal, we check if e is null/undefined - // before calling stopPropagation() - if (e) { - e.stopPropagation(); - } - - const requestOptions = { - method: 'PATCH', - credentials: 'include', - headers: { - 'Content-Type': 'application/json', - 'X-CSRFTOKEN': Cookies.get('csrftoken'), - }, - body: JSON.stringify({ - show_call_to_action: false, - }) - }; - - await fetch(`${this.props.lmsRootUrl}/api/demographics/v1/demographics/status/`, requestOptions); - // No matter what the response is from the API call we always allow the learner to dismiss the - // banner when clicking the dismiss button - this.setState({hideBanner: true}); - } - - render() { - if (!(this.state.hideBanner)) { - return ( -
- {/* eslint-disable-next-line jsx-a11y/anchor-is-valid, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */} - this.setState({modalOpen: true})}> -
-
- -
- {gettext('Want to make edX better for everyone?')} -
- {/* eslint-disable-next-line react/button-has-type */} - -
-
-