import React, { Component, CSSProperties, MouseEventHandler } from 'react'; import JSONTree from 'react-json-tree'; import { Base16Theme } from 'redux-devtools-themes'; 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 ? ( ) : ( '' )}
); } shouldExpandNode = ( keyPath: (string | number)[], data: any, level: number ) => { return this.props.expandActionRoot && level === 0; }; render() { const { type, ...payload } = this.props.action; return (
{type !== null && (type as string).toString()}
{!this.props.collapsed ? this.renderPayload(payload) : ''}
); } }