tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

EvaluationNotification.js (1732B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 const {
      8  Component,
      9 } = require("resource://devtools/client/shared/vendor/react.mjs");
     10 const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js");
     11 const {
     12  connect,
     13 } = require("resource://devtools/client/shared/vendor/react-redux.js");
     14 
     15 const {
     16  getAllUi,
     17 } = require("resource://devtools/client/webconsole/selectors/ui.js");
     18 
     19 const {
     20  ORIGINAL_VARIABLE_MAPPING,
     21 } = require("resource://devtools/client/webconsole/constants.js");
     22 
     23 loader.lazyRequireGetter(
     24  this,
     25  "PropTypes",
     26  "resource://devtools/client/shared/vendor/react-prop-types.js"
     27 );
     28 
     29 const l10n = require("resource://devtools/client/webconsole/utils/l10n.js");
     30 
     31 /**
     32 * Show the results of evaluating the current terminal text, if possible.
     33 */
     34 class EvaluationNotification extends Component {
     35  static get propTypes() {
     36    return {
     37      notification: PropTypes.string,
     38    };
     39  }
     40 
     41  render() {
     42    const { notification } = this.props;
     43    if (notification == ORIGINAL_VARIABLE_MAPPING) {
     44      return dom.span(
     45        { className: "evaluation-notification warning" },
     46        dom.span({ className: "evaluation-notification__icon" }),
     47        dom.span(
     48          { className: "evaluation-notification__text" },
     49          l10n.getStr("evaluationNotifcation.noOriginalVariableMapping.msg")
     50        )
     51      );
     52    }
     53    return null;
     54  }
     55 }
     56 
     57 function mapStateToProps(state) {
     58  return {
     59    notification: getAllUi(state).notification,
     60  };
     61 }
     62 
     63 module.exports = connect(mapStateToProps, null)(EvaluationNotification);