sum + char.charCodeAt(0),
- 0
- ) * Math.abs(Math.sin(token.length));
+ const number = finalToken.reduce(
+ (sum, char) => sum + char.charCodeAt(0),
+ 0
+ ) * Math.abs(Math.sin(token.length));
- const h = Math.round((number * (180 / Math.PI) * token.length) % 360);
- const s = number % 100 / 100;
- const v = 1;
+ const h = Math.round((number * (180 / Math.PI) * token.length) % 360);
+ const s = number % 100 / 100;
+ const v = 1;
- return hsvToRgb(h, s, v);
+ return hsvToRgb(h, s, v);
}
-export default class LogMonitorEntry {
- static propTypes = {
- index: PropTypes.number.isRequired,
- state: PropTypes.object.isRequired,
- action: PropTypes.object.isRequired,
- select: PropTypes.func.isRequired,
- error: PropTypes.string,
- onActionClick: PropTypes.func.isRequired,
- collapsed: PropTypes.bool
- };
-
- printState(state, error) {
- let errorText = error;
- if (!errorText) {
- try {
- return JSON.stringify(this.props.select(state), null, 2);
- } catch (err) {
- errorText = 'Error selecting state.';
+export default class LogMonitorEntry extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ maximized: false,
+ time: new Date()
}
- }
+ }
- return (
-
({errorText})
- );
- }
+ );
+ }
- handleActionClick() {
- const { index, onActionClick } = this.props;
- if (index > 0) {
- onActionClick(index);
- }
- }
+ handleCollapseClick() {
+ const { index, onActionClick } = this.props;
+ if (index > 0) {
+ onActionClick(index);
+ }
+ }
- render() {
- const { index, error, action, state, collapsed } = this.props;
- const { r, g, b } = colorFromString(action.type);
+ handleMaximizeClick() {
+ const { maximized } = this.state;
+ this.setState({maximized: !maximized});
+ }
- return (
-
+
+
+
+ {maximized ?
+ :
+
+ }
+
+ );
+ return (
+ 0) ? 'pointer' : 'default',
WebkitUserSelect: 'none'
}}>
- {JSON.stringify(action, null, 2)}
+ {JSON.stringify(action, null, 2)}
- }
+ ⇧
+
+ }
- {!collapsed &&
-