import * as React from 'react' import * as q from '../../../../backend/src/Model' import Button from '@material-ui/core/Button' import { withStyles, Theme, StyleRulesCallback } from '@material-ui/core/styles' import { treeActions } from '../../actions' import { bindActionCreators } from 'redux' import { connect } from 'react-redux' import { TopicViewModel } from '../../TopicViewModel' interface Props { classes: any theme: Theme node?: q.TreeNode selected?: q.TreeNode actions: typeof treeActions didSelectNode: (node: q.TreeNode) => void } const styles: StyleRulesCallback = (theme: Theme) => ({ button: { textTransform: 'none', padding: '3px 5px 3px 5px', minWidth: '30px', }, }) class Topic extends React.Component { public render() { const { node } = this.props if (!node) { return null } let key = 0 const breadCrumps = node.branch() .map(node => node.sourceEdge) .filter(edge => Boolean(edge)) .map(edge => [( )], ) if (breadCrumps.length === 0) { return null } const joinedBreadCrumps = breadCrumps.reduce((prev, current) => prev.concat([/]).concat(current), ) return {joinedBreadCrumps} } } const mapDispatchToProps = (dispatch: any) => { return { actions: bindActionCreators(treeActions, dispatch), } } export default connect(null, mapDispatchToProps)(withStyles(styles, { withTheme: true })(Topic))