diff --git a/pkg/interface/src/apps/graph-post/app.js b/pkg/interface/src/apps/graph-post/app.js index 6bed5b273f..2d89dcc855 100644 --- a/pkg/interface/src/apps/graph-post/app.js +++ b/pkg/interface/src/apps/graph-post/app.js @@ -133,18 +133,26 @@ export default class GraphPostApp extends React.Component { /> { let resource = `${props.match.params.ship}/${props.match.params.name}`; - const graph = state.graphs[resource] || new Map(); let index = props.match.params.nodeId - .split('-').map((ind) => { + .split('/').map((ind) => { return parseInt(ind, 10); }); - let node = null; - if (index.length > 0) { - node = graph.get(index[0]) || null; + let graph = state.graphs[resource] || new Map(); + let node = {}; + + while (index.length > 0) { + if (!node) { + return
; + } + + node = graph.get(index[0]); + graph = (!!node && 'children' in node) ? + node.children : new Map(); + index = index.slice(1); } return ( @@ -162,7 +170,7 @@ export default class GraphPostApp extends React.Component { subscription={this.subscription} node={node} sidebarShown={state.sidebarShown} - parentIndex={'/' + props.match.params.nodeId.split('-').join('/')} + parentIndex={'/' + props.match.params.nodeId} {...props} /> diff --git a/pkg/interface/src/apps/graph-post/components/lib/message.js b/pkg/interface/src/apps/graph-post/components/lib/message.js index d285bb7773..52cf57f91a 100644 --- a/pkg/interface/src/apps/graph-post/components/lib/message.js +++ b/pkg/interface/src/apps/graph-post/components/lib/message.js @@ -184,7 +184,8 @@ export class Message extends Component { minHeight: 'min-content' }} onClick={() => { - props.history.push(`/~post/room/${props.resource}/${props.index}`); + props.history.push(`/~post/room/` + + `${props.resource.ship}/${props.resource.name}${props.index}`); }} > ); } + + let prevIndex = node.post.index.split('/'); + prevIndex.pop(); + prevIndex = prevIndex.join('/'); return (
+ + + ⟵ + +
@@ -53,22 +66,24 @@ export class NodeTreeScreen extends Component { let graph = !!props.node && 'children' in props.node ? props.node.children : new Map(); let messages = Array.from(graph).reverse(); - console.log(messages); const messageElements = messages.map((msg, i) => { let index = msg[0]; let node = msg[1]; let post = node.post; + console.log(post); return ( ); }); - return (