aboutsummaryrefslogtreecommitdiffstats
path: root/src/index.js
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2022-01-13 14:19:44 +0000
committers-ol <s+removethis@s-ol.nu>2022-01-13 14:19:44 +0000
commit370d1f7dc1873b4e52990a65fc2694f173593356 (patch)
treed28fad42bc97aa89c9986073cb16689c93b51a5f /src/index.js
parentadd instructions and commands for local CORS proxy (diff)
downloadfedidag-370d1f7dc1873b4e52990a65fc2694f173593356.tar.gz
fedidag-370d1f7dc1873b4e52990a65fc2694f173593356.zip
use @container:@id in defualt graph
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/index.js b/src/index.js
index e94dec9..8cad259 100644
--- a/src/index.js
+++ b/src/index.js
@@ -153,6 +153,7 @@ class GraphContainer extends Component {
context: { '@embed': '@never' },
replies: { '@embed': '@never' },
inReplyTo: { '@embed': '@never' },
+ attributedTo: { '@embed': '@always' },
},
},
{ omitGraph: true }
@@ -225,8 +226,20 @@ class SelectionContainer extends Component {
}
class CollapseContainer extends Component {
+ /**
+ * Contains the collapse-state for each node.
+ *
+ * - `false`: visible
+ * - `true`: implicitly hidden
+ * - `'explicit'`: explicitly hidden
+ */
state = {};
+ /**
+ * Toggle a node's collapse-state.
+ * - `false` → `'explicit'`
+ * - `true`, `'explicit'` → `false`
+ */
toggle = (id) => {
const { items } = this.props;
@@ -236,6 +249,14 @@ class CollapseContainer extends Component {
this.setState(this.update(items[id], state));
}
+ /**
+ * Recursively update child node's collapse-state.
+ *
+ * If a node has parents and they are all collapsed,
+ * mark that node as implicitly hidden (`true`).
+ *
+ * Then update all of that node's children.
+ */
update(node, state) {
const { items } = this.props;