import React, { Component, CSSProperties, MouseEventHandler } from 'react'; import { JSONTree } from 'react-json-tree'; import type { ShouldExpandNodeInitially } from 'react-json-tree'; import type { Base16Theme } from 'react-base16-styling'; import { Action } from 'redux'; const styles = { actionBar: { paddingTop: 8, paddingBottom: 7, paddingLeft: 16, }, payload: { margin: 0, paddingLeft: 16, overflow: 'auto', }, }; interface Props> { theme: Base16Theme; collapsed: boolean; action: A; expandActionRoot: boolean; onClick: MouseEventHandler; style: CSSProperties; } export default class LogMonitorAction< A extends Action, > extends Component> { renderPayload(payload: Record) { return (
{Object.keys(payload).length > 0 ? ( ) : ( '' )}
); } shouldExpandNodeInitially: ShouldExpandNodeInitially = ( keyPath, data, level, ) => { return this.props.expandActionRoot && level === 0; }; render() { const { type, ...payload } = this.props.action; return (
{type !== null && type.toString()}
{!this.props.collapsed ? this.renderPayload(payload) : ''}
); } }