Tidy up ui

This commit is contained in:
Thomas Nordquist
2019-06-17 18:27:19 +02:00
parent 4e982be613
commit 3d5a4af705
3 changed files with 18 additions and 4 deletions

View File

@@ -40,7 +40,7 @@ function ChartPreview(props: Props) {
const hasEnoughDataToDisplayDiagrams = props.treeNode.messageHistory.count() > 1 const hasEnoughDataToDisplayDiagrams = props.treeNode.messageHistory.count() > 1
const addChartToPanelButton = hasEnoughDataToDisplayDiagrams ? ( const addChartToPanelButton = hasEnoughDataToDisplayDiagrams ? (
<Tooltip title="Click to add to chart panel"> <Tooltip title="Add to chart panel">
<ShowChart <ShowChart
ref={chartIconRef} ref={chartIconRef}
className={props.classes.icon} className={props.classes.icon}
@@ -50,7 +50,7 @@ function ChartPreview(props: Props) {
/> />
</Tooltip> </Tooltip>
) : ( ) : (
<Tooltip title="Click to add to chart panel, not enough data for preview"> <Tooltip title="Add to chart panel, not enough data for preview">
<ShowChart onClick={onClick} className={props.classes.icon} style={{ color: '#aaa' }} /> <ShowChart onClick={onClick} className={props.classes.icon} style={{ color: '#aaa' }} />
</Tooltip> </Tooltip>
) )

View File

@@ -11,6 +11,7 @@ import { TopicViewModel } from '../../../model/TopicViewModel'
import { bindActionCreators } from 'redux' import { bindActionCreators } from 'redux'
import { chartActions } from '../../../actions' import { chartActions } from '../../../actions'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import CustomIconButton from '../../helper/CustomIconButton'
const throttle = require('lodash.throttle') const throttle = require('lodash.throttle')
@@ -109,7 +110,19 @@ class MessageHistory extends React.Component<Props, State> {
<div> <div>
<History <History
items={historyElements} items={historyElements}
contentTypeIndicator={isMessagePlottable ? <ShowChart onClick={this.addNodeToCharts} /> : undefined} contentTypeIndicator={
isMessagePlottable ? (
<CustomIconButton
style={{ height: '22px', width: '22px' }}
onClick={this.addNodeToCharts}
tooltip="Add to chart panel"
>
<ShowChart style={{ marginTop: '-5px' }} />
</CustomIconButton>
) : (
undefined
)
}
onClick={this.displayMessage} onClick={this.displayMessage}
> >
{isMessagePlottable ? <TopicPlot history={node.messageHistory} /> : null} {isMessagePlottable ? <TopicPlot history={node.messageHistory} /> : null}

View File

@@ -6,6 +6,7 @@ interface Props {
onClick: any onClick: any
tooltip: string tooltip: string
classes: any classes: any
style?: React.CSSProperties
} }
const styles = (theme: Theme) => ({ const styles = (theme: Theme) => ({
@@ -32,7 +33,7 @@ class CustomIconButton extends React.Component<Props, {}> {
public render() { public render() {
return ( return (
<IconButton className={this.props.classes.button} onClick={this.onClick}> <IconButton className={this.props.classes.button} style={this.props.style} onClick={this.onClick}>
<Tooltip title={this.props.tooltip} className={this.props.classes.label}> <Tooltip title={this.props.tooltip} className={this.props.classes.label}>
<span>{this.props.children}</span> <span>{this.props.children}</span>
</Tooltip> </Tooltip>