MessageRepeat.js (1039B)
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 PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.mjs"); 8 const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js"); 9 const { PluralForm } = require("resource://devtools/shared/plural-form.js"); 10 const { 11 l10n, 12 } = require("resource://devtools/client/webconsole/utils/messages.js"); 13 const messageRepeatsTooltip = l10n.getStr("messageRepeats.tooltip2"); 14 15 MessageRepeat.displayName = "MessageRepeat"; 16 17 MessageRepeat.propTypes = { 18 repeat: PropTypes.number.isRequired, 19 }; 20 21 function MessageRepeat(props) { 22 const { repeat } = props; 23 return dom.span( 24 { 25 className: "message-repeats", 26 title: PluralForm.get(repeat, messageRepeatsTooltip).replace( 27 "#1", 28 repeat 29 ), 30 }, 31 repeat 32 ); 33 } 34 35 module.exports = MessageRepeat;