import React, { Component } from 'react'; import Draggable from 'react-draggable'; import Resizable from 're-resizable'; import { styles } from './styles.scss'; import { defineMessages, injectIntl } from 'react-intl'; import Icon from '/imports/ui/components/icon/component'; import Button from '/imports/ui/components/button/component'; import Toggle from '/imports/ui/components/switch/component'; import Storage from '/imports/ui/services/storage/session'; import { withLayoutConsumer } from '/imports/ui/components/layout/context'; import ChatLogger from '/imports/ui/components/chat/chat-logger/ChatLogger'; const intlMessages = defineMessages({ modalClose: { id: 'app.modal.close', description: 'Close', }, modalCloseDescription: { id: 'app.modal.close.description', description: 'Disregards changes and closes the modal', }, debugWindowTitle: { id: 'app.debugWindow.windowTitle', description: 'Debug window title', }, userAgentLabel: { id: 'app.debugWindow.form.userAgentLabel', description: 'User agent form label', }, copyButtonLabel: { id: 'app.debugWindow.form.button.copy', description: 'User agent form copy button', }, enableAutoarrangeLayoutLabel: { id: 'app.debugWindow.form.enableAutoarrangeLayoutLabel', description: 'Enable Autoarrange layout label', }, enableAutoarrangeLayoutDescription: { id: 'app.debugWindow.form.enableAutoarrangeLayoutDescription', description: 'Enable Autoarrange layout description', }, }); const DEBUG_WINDOW_ENABLED = Meteor.settings.public.app.enableDebugWindow; const SHOW_DEBUG_WINDOW_ACCESSKEY = Meteor.settings.public.app.shortcuts.openDebugWindow.accesskey; class DebugWindow extends Component { constructor(props) { super(props); this.state = { showDebugWindow: false, logLevel: ChatLogger.getLogLevel(), }; } componentDidMount() { document.addEventListener('keyup', (event) => { const key = event.key.toUpperCase(); if (DEBUG_WINDOW_ENABLED && event.altKey && key === SHOW_DEBUG_WINDOW_ACCESSKEY) { this.debugWindowToggle(); } }); } setShowDebugWindow(showDebugWindow) { this.setState({ showDebugWindow }); } debugWindowToggle() { const { showDebugWindow } = this.state; if (showDebugWindow) { this.setShowDebugWindow(false); } else { this.setShowDebugWindow(true); } } autoArrangeToggle() { const { layoutContextDispatch } = this.props; const autoArrangeLayout = Storage.getItem('autoArrangeLayout'); layoutContextDispatch( { type: 'setAutoArrangeLayout', value: !autoArrangeLayout, }, ); window.dispatchEvent(new Event('autoArrangeChanged')); } render() { const { showDebugWindow, logLevel } = this.state; const chatLoggerLevelsNames = Object.keys(ChatLogger.levels); if (!DEBUG_WINDOW_ENABLED || !showDebugWindow) return false; const { intl } = this.props; const autoArrangeLayout = Storage.getItem('autoArrangeLayout'); return ( { // this.setWebcamsAreaResizable(d.width, d.height); // }} enable={{ top: false, bottom: false, left: false, right: false, topLeft: false, topRight: false, bottomLeft: false, bottomRight: true, }} >
{intl.formatMessage(intlMessages.debugWindowTitle)}
{`${intl.formatMessage(intlMessages.userAgentLabel)}:`}
{`${intl.formatMessage(intlMessages.enableAutoarrangeLayoutLabel)}:`}
this.autoArrangeToggle()} ariaLabel={intl.formatMessage(intlMessages.enableAutoarrangeLayoutLabel)} />

{`${intl.formatMessage(intlMessages.enableAutoarrangeLayoutDescription)}`}

testando o chatLogger levels:
); } } export default withLayoutConsumer(injectIntl(DebugWindow));