pinakes-ui: add graph view, backlinks panel, and link extraction
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ibf40b009f5d18d16fc115b349b1f681d6a6a6964
This commit is contained in:
parent
0f9c1383a9
commit
3e1e8dea26
5 changed files with 103 additions and 43 deletions
|
|
@ -68,9 +68,7 @@ pub fn GraphView(
|
|||
}
|
||||
}
|
||||
if let Some(ref data) = *data {
|
||||
div { class: "graph-stats",
|
||||
"{data.node_count} nodes, {data.edge_count} edges"
|
||||
}
|
||||
div { class: "graph-stats", "{data.node_count} nodes, {data.edge_count} edges" }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -176,8 +174,9 @@ fn GraphSvg(
|
|||
for edge in &edges {
|
||||
if let (Some(&(x1, y1)), Some(&(x2, y2))) = (
|
||||
id_to_pos.get(edge.source.as_str()),
|
||||
id_to_pos.get(edge.target.as_str())
|
||||
) {
|
||||
id_to_pos.get(edge.target.as_str()),
|
||||
)
|
||||
{
|
||||
line {
|
||||
class: "graph-edge edge-type-{edge.link_type}",
|
||||
x1: "{x1}",
|
||||
|
|
@ -201,16 +200,13 @@ fn GraphSvg(
|
|||
ref_x: "10",
|
||||
ref_y: "3.5",
|
||||
orient: "auto",
|
||||
polygon {
|
||||
points: "0 0, 10 3.5, 0 7",
|
||||
fill: "#888",
|
||||
}
|
||||
polygon { points: "0 0, 10 3.5, 0 7", fill: "#888" }
|
||||
}
|
||||
}
|
||||
|
||||
// Draw nodes
|
||||
g { class: "graph-nodes",
|
||||
for (i, node) in nodes.iter().enumerate() {
|
||||
for (i , node) in nodes.iter().enumerate() {
|
||||
{
|
||||
let (x, y) = positions[i];
|
||||
let node_id = node.id.clone();
|
||||
|
|
@ -226,6 +222,7 @@ fn GraphSvg(
|
|||
onclick: move |_| on_node_click.call(node_id.clone()),
|
||||
ondoubleclick: move |_| on_node_double_click.call(node_id2.clone()),
|
||||
|
||||
|
||||
circle {
|
||||
cx: "{x}",
|
||||
cy: "{y}",
|
||||
|
|
@ -264,11 +261,7 @@ fn NodeDetailsPanel(
|
|||
div { class: "node-details-panel",
|
||||
div { class: "node-details-header",
|
||||
h3 { "{node.label}" }
|
||||
button {
|
||||
class: "close-btn",
|
||||
onclick: move |_| on_close.call(()),
|
||||
"\u{2715}"
|
||||
}
|
||||
button { class: "close-btn", onclick: move |_| on_close.call(()), "\u{2715}" }
|
||||
}
|
||||
div { class: "node-details-content",
|
||||
if let Some(ref title) = node.title {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue