tor-browser

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

RuntimeInfo.js (2580B)


      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  createFactory,
      9  PureComponent,
     10 } = require("resource://devtools/client/shared/vendor/react.mjs");
     11 const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js");
     12 const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.mjs");
     13 
     14 const Actions = require("resource://devtools/client/aboutdebugging/src/actions/index.js");
     15 const FluentReact = require("resource://devtools/client/shared/vendor/fluent-react.js");
     16 const Localized = createFactory(FluentReact.Localized);
     17 
     18 const {
     19  RUNTIMES,
     20 } = require("resource://devtools/client/aboutdebugging/src/constants.js");
     21 
     22 /**
     23 * This component displays runtime information.
     24 */
     25 class RuntimeInfo extends PureComponent {
     26  static get propTypes() {
     27    return {
     28      dispatch: PropTypes.func.isRequired,
     29      icon: PropTypes.string.isRequired,
     30      deviceName: PropTypes.string,
     31      name: PropTypes.string.isRequired,
     32      version: PropTypes.string.isRequired,
     33      runtimeId: PropTypes.string.isRequired,
     34    };
     35  }
     36  render() {
     37    const { icon, deviceName, name, version, runtimeId, dispatch } = this.props;
     38 
     39    return dom.h1(
     40      {
     41        className: "main-heading runtime-info",
     42      },
     43      dom.img({
     44        className: "main-heading__icon runtime-info__icon qa-runtime-icon",
     45        src: icon,
     46      }),
     47      Localized(
     48        {
     49          id: "about-debugging-runtime-name",
     50          $name: name,
     51          $version: version,
     52        },
     53        dom.label(
     54          {
     55            className: "qa-runtime-name runtime-info__title",
     56          },
     57          `${name} (${version})`
     58        )
     59      ),
     60      deviceName
     61        ? dom.label(
     62            {
     63              className: "main-heading-subtitle runtime-info__subtitle",
     64            },
     65            deviceName
     66          )
     67        : null,
     68      runtimeId !== RUNTIMES.THIS_FIREFOX
     69        ? Localized(
     70            {
     71              id: "about-debugging-runtime-disconnect-button",
     72            },
     73            dom.button(
     74              {
     75                className:
     76                  "default-button runtime-info__action qa-runtime-info__action",
     77                onClick() {
     78                  dispatch(Actions.disconnectRuntime(runtimeId, true));
     79                },
     80              },
     81              "Disconnect"
     82            )
     83          )
     84        : null
     85    );
     86  }
     87 }
     88 
     89 module.exports = RuntimeInfo;