@anchrd/intel-ui 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/i18n/en.json
CHANGED
|
@@ -120,7 +120,6 @@
|
|
|
120
120
|
"view.showEditor": "Back to the editor",
|
|
121
121
|
"view.showRuns": "Show this flow's runs",
|
|
122
122
|
"view.graph": "Relation graph",
|
|
123
|
-
"view.graphDescription": "{nodes} nodes and {edges} relationships you are allowed to see.",
|
|
124
123
|
"view.graphTruncated": "{omitted} more left out — this view draws at most {limit}.",
|
|
125
124
|
"view.graphEmpty": "Nothing here that you may see.",
|
|
126
125
|
"view.graphFailed": "The graph could not be loaded.",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RelationGraph } from "@anchrd/intel-contract";
|
|
2
|
+
import type { I18n } from "@/i18n/i18n.types.ts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The one line above a graph, and it appears only when there is something to say (#88).
|
|
6
|
+
*
|
|
7
|
+
* ⚠️ It counted what was drawn directly below it — "3 nodes and 0 relationships you are allowed to
|
|
8
|
+
* see" — permanently, above every graph. Three nodes are three nodes; the reader sees them. What
|
|
9
|
+
* they cannot see is what the view stopped short of, and that is what stayed.
|
|
10
|
+
*
|
|
11
|
+
* Its own file because `knowledge-graph.tsx` pulls Sigma in at module level, and Sigma needs WebGL:
|
|
12
|
+
* a case about this line could not render there at all.
|
|
13
|
+
*/
|
|
14
|
+
export function GraphNotice({ data, i18n }: { data: RelationGraph; i18n: I18n }) {
|
|
15
|
+
if (data.omitted === 0) return null;
|
|
16
|
+
return (
|
|
17
|
+
<p className="border-b px-6 py-3 text-sm text-muted-foreground">
|
|
18
|
+
{i18n.t("view.graphTruncated", { omitted: data.omitted, limit: data.limit })}
|
|
19
|
+
</p>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -3,6 +3,7 @@ import { ControlsContainer, SigmaContainer, useCamera, useRegisterEvents } from
|
|
|
3
3
|
import { LocateFixed, Minus, Plus } from "lucide-react";
|
|
4
4
|
import { useEffect, useMemo } from "react";
|
|
5
5
|
import type { I18n } from "@/i18n/i18n.types.ts";
|
|
6
|
+
import { GraphNotice } from "./graph-notice.tsx";
|
|
6
7
|
import { createRelationGraph, resolveGraphColor } from "./knowledge-graph.ts";
|
|
7
8
|
|
|
8
9
|
function labelColors() {
|
|
@@ -77,16 +78,7 @@ export function RelationGraphView({
|
|
|
77
78
|
const byId = useMemo(() => new Map(data.nodes.map((node) => [node.id, node])), [data.nodes]);
|
|
78
79
|
return (
|
|
79
80
|
<section aria-label={i18n.t("view.graph")} className="flex min-h-0 flex-1 flex-col">
|
|
80
|
-
<
|
|
81
|
-
{i18n.t("view.graphDescription", { nodes: data.nodes.length, edges: data.edges.length })}
|
|
82
|
-
{/* ⚠️ The cut-off is said out loud. A graph that quietly stopped drawing would read as "this
|
|
83
|
-
folder holds nothing else", which is worse than a graph that admits it is partial. */}
|
|
84
|
-
{data.omitted > 0 ? (
|
|
85
|
-
<span className="ml-2 rounded-md border px-2 py-0.5 text-xs">
|
|
86
|
-
{i18n.t("view.graphTruncated", { omitted: data.omitted, limit: data.limit })}
|
|
87
|
-
</span>
|
|
88
|
-
) : null}
|
|
89
|
-
</p>
|
|
81
|
+
<GraphNotice data={data} i18n={i18n} />
|
|
90
82
|
<div className="min-h-0 flex-1 bg-muted/20">
|
|
91
83
|
{data.nodes.length === 0 ? (
|
|
92
84
|
<div className="grid h-full place-items-center p-8 text-sm text-muted-foreground">
|