graph-store: sort graph with most recent at left of graph (gth)

This commit is contained in:
Logan Allen 2020-06-24 14:13:15 -04:00
parent 8707816d25
commit f1b10f2a07
4 changed files with 6 additions and 5 deletions

View File

@ -28,7 +28,7 @@
rose+(ot style+(ot mid+sa open+sa close+sa ~) lines+(ar dank) ~)
==
::
++ orm ((or-map atom node) lth)
++ orm ((or-map atom node) gth)
++ orm-log ((or-map time action) lth)
::
++ enjs
@ -252,7 +252,7 @@
++ graph
|= a=json
^- ^graph
=/ or-mp ((or-map atom ^node) lth)
=/ or-mp ((or-map atom ^node) gth)
%+ gas:or-mp ~
%+ turn ~(tap by ((om node) a))
|* [b=cord c=*]

View File

@ -20,7 +20,7 @@
::
+$ action-log ((mop time action) lth)
::
+$ graph ((mop atom node) lth)
+$ graph ((mop atom node) gth)
::
+$ internal-graph
$~ [%empty ~]

View File

@ -34,7 +34,9 @@ export class PostList extends Component {
paginatedNodes() {
const { props, state } = this;
let nodes = Array.from(props.graph).reverse();
let nodes = Array.from(props.graph).sort((a,b) => {
return b[0] - a[0];
});
return {
nodes: nodes.slice(

View File

@ -123,7 +123,6 @@ export default class GraphReducer {
}
}
// TODO: recursive add node
_addNode(graph, index, node) {
console.log(index, node);
// set child of graph