@ramme-io/ui 4.1.1 → 4.2.1
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/dist/components/ai/AIChatThread/AIChatThread.js +76 -79
- package/dist/components/ai/ArchitectureReferenceCard/ArchitectureReferenceCard.js +14 -13
- package/dist/components/ai/CompanyProfileCard/CompanyProfileCard.js +20 -19
- package/dist/components/ai/CounterpartyGraphCard/CounterpartyGraphCard.js +22 -21
- package/dist/components/ai/DivergenceMetricsCard/DivergenceMetricsCard.js +23 -22
- package/dist/components/ai/LiveQuoteCard/LiveQuoteCard.js +29 -28
- package/dist/components/ai/NewsSummaryCard/NewsSummaryCard.js +23 -22
- package/dist/components/ai/StockChart/StockChart.js +33 -33
- package/dist/components/data-display/StatusBadge.d.ts +4 -3
- package/dist/components/data-display/StatusBadge.js +18 -18
- package/dist/components/feedback/Alert.js +19 -19
- package/dist/components/forms/SegmentedControl.js +10 -10
- package/dist/components/layout/DetailDrawer.d.ts +9 -1
- package/dist/components/layout/DetailDrawer.js +61 -51
- package/dist/components/layout/Drawer.js +47 -39
- package/dist/components/layout/Modal.js +28 -23
- package/dist/components/layout/Sheet.js +38 -36
- package/dist/formFieldFloor.test.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +188 -186
- package/dist/lib/hooks/useDialogFocus.d.ts +1 -0
- package/dist/lib/hooks/useDialogFocus.js +46 -0
- package/dist/utils/apiBaseUrl.d.ts +1 -0
- package/dist/utils/apiBaseUrl.js +10 -0
- package/dist/wizardManifest.js +9 -4
- package/package.json +2 -2
- package/src/wizardManifest.ts +9 -4
- package/tailwind.preset.js +8 -0
|
@@ -1,89 +1,86 @@
|
|
|
1
|
-
import { jsxs as c, jsx as
|
|
2
|
-
import { useState as B, useRef as R, useEffect as D, useCallback as
|
|
1
|
+
import { jsxs as c, jsx as e, Fragment as w } from "react/jsx-runtime";
|
|
2
|
+
import { useState as B, useRef as R, useEffect as D, useCallback as g } from "react";
|
|
3
3
|
import { CodeBlock as G } from "../../data-display/CodeBlock.js";
|
|
4
|
-
import { Icon as
|
|
4
|
+
import { Icon as N } from "../../ui/Icon.js";
|
|
5
5
|
import { PromptInput as $ } from "../../../blocks/ai/PromptInput.js";
|
|
6
|
-
import { Actions as
|
|
6
|
+
import { Actions as E, Suggestion as F } from "../../../blocks/ai/Actions.js";
|
|
7
7
|
import { cn as p } from "../../../utils/cn.js";
|
|
8
|
-
import { TelemetryGraph as
|
|
9
|
-
import { StockChart as
|
|
10
|
-
import { LiveQuoteCard as
|
|
8
|
+
import { TelemetryGraph as S } from "../TelemetryGraph/TelemetryGraph.js";
|
|
9
|
+
import { StockChart as V } from "../StockChart/StockChart.js";
|
|
10
|
+
import { LiveQuoteCard as z } from "../LiveQuoteCard/LiveQuoteCard.js";
|
|
11
11
|
import { NewsSummaryCard as M } from "../NewsSummaryCard/NewsSummaryCard.js";
|
|
12
12
|
import { CompanyProfileCard as O } from "../CompanyProfileCard/CompanyProfileCard.js";
|
|
13
13
|
import { CounterpartyGraphCard as U } from "../CounterpartyGraphCard/CounterpartyGraphCard.js";
|
|
14
14
|
import { DivergenceMetricsCard as q } from "../DivergenceMetricsCard/DivergenceMetricsCard.js";
|
|
15
15
|
import { ArchitectureReferenceCard as L } from "../ArchitectureReferenceCard/ArchitectureReferenceCard.js";
|
|
16
|
-
function Q(
|
|
17
|
-
if (!
|
|
18
|
-
const l =
|
|
19
|
-
return /* @__PURE__ */
|
|
16
|
+
function Q(t) {
|
|
17
|
+
if (!t) return null;
|
|
18
|
+
const l = t.split(/(```[\w]*\n[\s\S]*?```)/g);
|
|
19
|
+
return /* @__PURE__ */ e(w, { children: l.map((o, a) => {
|
|
20
20
|
const n = o.match(/^```([\w]*)\n([\s\S]*?)```$/);
|
|
21
21
|
if (n) {
|
|
22
22
|
const i = n[1] || "text", d = n[2].replace(/\n$/, "");
|
|
23
|
-
return /* @__PURE__ */
|
|
23
|
+
return /* @__PURE__ */ e("div", { className: "my-3", children: /* @__PURE__ */ e(G, { language: i, code: d }) }, a);
|
|
24
24
|
}
|
|
25
|
-
return o ? /* @__PURE__ */
|
|
25
|
+
return o ? /* @__PURE__ */ e("p", { className: "whitespace-pre-wrap text-sm leading-relaxed", children: o }, a) : null;
|
|
26
26
|
}) });
|
|
27
27
|
}
|
|
28
|
-
const W = () => /* @__PURE__ */
|
|
28
|
+
const W = () => /* @__PURE__ */ e("div", { className: "flex items-center gap-1 px-1 py-0.5", "aria-label": "Assistant is typing", children: [0, 1, 2].map((t) => /* @__PURE__ */ e(
|
|
29
29
|
"span",
|
|
30
30
|
{
|
|
31
31
|
className: "w-1.5 h-1.5 rounded-full bg-muted-foreground/60 animate-bounce",
|
|
32
|
-
style: { animationDelay: `${
|
|
32
|
+
style: { animationDelay: `${t * 0.15}s`, animationDuration: "0.9s" }
|
|
33
33
|
},
|
|
34
|
-
|
|
35
|
-
)) }), H = ({ message:
|
|
34
|
+
t
|
|
35
|
+
)) }), H = ({ message: t, isLastAssistant: l, isStreaming: o, renderContent: a }) => {
|
|
36
36
|
var h, s;
|
|
37
|
-
const n =
|
|
37
|
+
const n = t.role === "user", i = !t.content && !t.toolCall && l && o, d = !n && t.toolCall, u = ((h = t.content) == null ? void 0 : h.trim()) && t.content.trim().length > 0, f = !d && (u || i);
|
|
38
38
|
return /* @__PURE__ */ c("div", { className: p("flex flex-col gap-2 mb-4", n ? "items-end" : "items-start"), children: [
|
|
39
|
-
f && /* @__PURE__ */
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
e.toolCall.name === "get_counterparty_graph" && /* @__PURE__ */ t(U, { params: e.toolCall.arguments }),
|
|
68
|
-
e.toolCall.name === "get_divergence_metrics" && /* @__PURE__ */ t(q, { params: e.toolCall.arguments }),
|
|
69
|
-
e.toolCall.name === "get_architecture_reference" && /* @__PURE__ */ t(L, {})
|
|
39
|
+
f && /* @__PURE__ */ e("div", { className: p("flex w-full", n ? "justify-end" : "justify-start"), children: /* @__PURE__ */ e(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
className: p(
|
|
43
|
+
"relative text-sm",
|
|
44
|
+
n ? "max-w-[80%] rounded-2xl rounded-br-sm bg-primary px-4 py-2.5 text-primary-foreground" : "w-full text-foreground"
|
|
45
|
+
),
|
|
46
|
+
children: n ? /* @__PURE__ */ e("p", { className: "whitespace-pre-wrap leading-relaxed", children: t.content }) : i ? /* @__PURE__ */ e(W, {}) : /* @__PURE__ */ c(w, { children: [
|
|
47
|
+
a ? a(t.content) : Q(t.content),
|
|
48
|
+
l && o && t.content && !t.toolCall && /* @__PURE__ */ e(
|
|
49
|
+
"span",
|
|
50
|
+
{
|
|
51
|
+
className: "inline-block w-[2px] h-[1em] bg-current ml-0.5 align-middle animate-pulse",
|
|
52
|
+
"aria-hidden": "true"
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] })
|
|
56
|
+
}
|
|
57
|
+
) }),
|
|
58
|
+
d && t.toolCall && /* @__PURE__ */ c("div", { className: "w-full", children: [
|
|
59
|
+
t.toolCall.name === "get_telemetry_graph" && /* @__PURE__ */ e(S, { params: t.toolCall.arguments }),
|
|
60
|
+
t.toolCall.name === "get_stock_chart" && /* @__PURE__ */ e(V, { params: t.toolCall.arguments }),
|
|
61
|
+
t.toolCall.name === "get_live_quote" && /* @__PURE__ */ e(z, { params: t.toolCall.arguments }),
|
|
62
|
+
t.toolCall.name === "get_company_news" && /* @__PURE__ */ e(M, { params: t.toolCall.arguments }),
|
|
63
|
+
t.toolCall.name === "get_company_profile" && /* @__PURE__ */ e(O, { ticker: (s = t.toolCall.arguments) == null ? void 0 : s.ticker }),
|
|
64
|
+
t.toolCall.name === "get_counterparty_graph" && /* @__PURE__ */ e(U, { params: t.toolCall.arguments }),
|
|
65
|
+
t.toolCall.name === "get_divergence_metrics" && /* @__PURE__ */ e(q, { params: t.toolCall.arguments }),
|
|
66
|
+
t.toolCall.name === "get_architecture_reference" && /* @__PURE__ */ e(L, {})
|
|
70
67
|
] })
|
|
71
68
|
] });
|
|
72
69
|
}, J = {
|
|
73
70
|
idle: { dot: "bg-emerald-500", label: "Ready" },
|
|
74
71
|
streaming: { dot: "bg-amber-500 animate-pulse", label: "Generating…" },
|
|
75
72
|
error: { dot: "bg-red-500", label: "Error" }
|
|
76
|
-
}, K = ({ status:
|
|
77
|
-
const { dot: a, label: n } = J[
|
|
73
|
+
}, K = ({ status: t, provider: l, model: o }) => {
|
|
74
|
+
const { dot: a, label: n } = J[t];
|
|
78
75
|
return /* @__PURE__ */ c("div", { className: "shrink-0 flex items-center justify-between px-3 py-1.5 border-b border-border/50 bg-muted/20", children: [
|
|
79
76
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ e("span", { className: `w-2 h-2 rounded-full ${a}` }),
|
|
78
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] font-semibold uppercase tracking-widest opacity-60", children: n })
|
|
82
79
|
] }),
|
|
83
|
-
(l || o) && /* @__PURE__ */
|
|
80
|
+
(l || o) && /* @__PURE__ */ e("span", { className: "text-[10px] font-mono opacity-50 truncate max-w-[200px]", children: [l, o].filter(Boolean).join(" · ") })
|
|
84
81
|
] });
|
|
85
|
-
},
|
|
86
|
-
messages:
|
|
82
|
+
}, mt = ({
|
|
83
|
+
messages: t,
|
|
87
84
|
isStreaming: l,
|
|
88
85
|
onSubmit: o,
|
|
89
86
|
error: a = null,
|
|
@@ -96,25 +93,25 @@ const W = () => /* @__PURE__ */ t("div", { className: "flex items-center gap-1 p
|
|
|
96
93
|
suggestions: s,
|
|
97
94
|
onSuggestionClick: k
|
|
98
95
|
}) => {
|
|
99
|
-
const _ = d ?? (a ? "error" : l ? "streaming" : "idle"), [b,
|
|
96
|
+
const _ = d ?? (a ? "error" : l ? "streaming" : "idle"), [b, C] = B(""), y = R(null);
|
|
100
97
|
D(() => {
|
|
101
98
|
var r;
|
|
102
|
-
(r =
|
|
103
|
-
}, [
|
|
104
|
-
const I =
|
|
105
|
-
(r) =>
|
|
99
|
+
(r = y.current) == null || r.scrollIntoView({ behavior: "smooth", block: "end" });
|
|
100
|
+
}, [t.length, l]);
|
|
101
|
+
const I = g(
|
|
102
|
+
(r) => C(r.target.value),
|
|
106
103
|
[]
|
|
107
|
-
), A =
|
|
104
|
+
), A = g(
|
|
108
105
|
(r) => {
|
|
109
106
|
r.preventDefault();
|
|
110
107
|
const m = b.trim();
|
|
111
|
-
!m || l || (o(m),
|
|
108
|
+
!m || l || (o(m), C(""));
|
|
112
109
|
},
|
|
113
110
|
[b, l, o]
|
|
114
|
-
), j =
|
|
111
|
+
), j = t.reduce(
|
|
115
112
|
(r, m, x) => m.role === "assistant" ? x : r,
|
|
116
113
|
-1
|
|
117
|
-
),
|
|
114
|
+
), v = t.filter((r) => r.role !== "system");
|
|
118
115
|
return /* @__PURE__ */ c(
|
|
119
116
|
"div",
|
|
120
117
|
{
|
|
@@ -123,7 +120,7 @@ const W = () => /* @__PURE__ */ t("div", { className: "flex items-center gap-1 p
|
|
|
123
120
|
h
|
|
124
121
|
),
|
|
125
122
|
children: [
|
|
126
|
-
(n || i || l || a) && /* @__PURE__ */
|
|
123
|
+
(n || i || l || a) && /* @__PURE__ */ e(
|
|
127
124
|
K,
|
|
128
125
|
{
|
|
129
126
|
status: _,
|
|
@@ -132,14 +129,14 @@ const W = () => /* @__PURE__ */ t("div", { className: "flex items-center gap-1 p
|
|
|
132
129
|
}
|
|
133
130
|
),
|
|
134
131
|
/* @__PURE__ */ c("div", { className: "flex-1 overflow-y-auto px-4 py-4 scroll-smooth [scrollbar-width:thin] [scrollbar-color:hsl(var(--border))_transparent]", children: [
|
|
135
|
-
|
|
136
|
-
/* @__PURE__ */
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
s && s.length > 0 && /* @__PURE__ */
|
|
132
|
+
v.length === 0 && /* @__PURE__ */ c("div", { className: "flex flex-col items-center justify-center h-full gap-2 text-muted-foreground/50 select-none", children: [
|
|
133
|
+
/* @__PURE__ */ e(N, { name: "sparkles", size: 28 }),
|
|
134
|
+
/* @__PURE__ */ e("p", { className: "text-sm", children: "Start a conversation" }),
|
|
135
|
+
s && s.length > 0 && /* @__PURE__ */ e("div", { className: "mt-2 select-auto", children: /* @__PURE__ */ e(E, { children: s.map((r) => /* @__PURE__ */ e(F, { onClick: () => (k ?? o)(r), children: r }, r)) }) })
|
|
139
136
|
] }),
|
|
140
|
-
|
|
141
|
-
const x =
|
|
142
|
-
return /* @__PURE__ */
|
|
137
|
+
v.map((r, m) => {
|
|
138
|
+
const x = t.indexOf(r);
|
|
139
|
+
return /* @__PURE__ */ e(
|
|
143
140
|
H,
|
|
144
141
|
{
|
|
145
142
|
message: r,
|
|
@@ -150,20 +147,20 @@ const W = () => /* @__PURE__ */ t("div", { className: "flex items-center gap-1 p
|
|
|
150
147
|
m
|
|
151
148
|
);
|
|
152
149
|
}),
|
|
153
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ e("div", { ref: y })
|
|
154
151
|
] }),
|
|
155
152
|
a && /* @__PURE__ */ c("div", { className: "shrink-0 mx-3 mb-2 flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: [
|
|
156
|
-
/* @__PURE__ */
|
|
157
|
-
/* @__PURE__ */
|
|
153
|
+
/* @__PURE__ */ e(N, { name: "alert-circle", size: 14, className: "mt-px shrink-0" }),
|
|
154
|
+
/* @__PURE__ */ e("span", { className: "leading-snug", children: a })
|
|
158
155
|
] }),
|
|
159
|
-
/* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ e(
|
|
160
157
|
"div",
|
|
161
158
|
{
|
|
162
159
|
className: p(
|
|
163
160
|
"shrink-0 border-t border-border/60 bg-background/80 backdrop-blur-sm transition-opacity",
|
|
164
161
|
l && "opacity-70"
|
|
165
162
|
),
|
|
166
|
-
children: /* @__PURE__ */
|
|
163
|
+
children: /* @__PURE__ */ e(
|
|
167
164
|
$,
|
|
168
165
|
{
|
|
169
166
|
value: b,
|
|
@@ -179,5 +176,5 @@ const W = () => /* @__PURE__ */ t("div", { className: "flex items-center gap-1 p
|
|
|
179
176
|
);
|
|
180
177
|
};
|
|
181
178
|
export {
|
|
182
|
-
|
|
179
|
+
mt as AIChatThread
|
|
183
180
|
};
|
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { apiBaseUrl as f } from "../../../utils/apiBaseUrl.js";
|
|
2
3
|
import { useState as c, useEffect as x } from "react";
|
|
3
4
|
import { Card as h, CardHeader as b, CardTitle as g, CardContent as N } from "../../layout/Card.js";
|
|
4
5
|
import { Icon as n } from "../../ui/Icon.js";
|
|
5
|
-
const
|
|
6
|
-
const [t,
|
|
6
|
+
const C = () => {
|
|
7
|
+
const [t, p] = c(null), [o, l] = c(!0), [d, i] = c(null);
|
|
7
8
|
x(() => {
|
|
8
9
|
(async () => {
|
|
9
10
|
try {
|
|
10
|
-
|
|
11
|
-
const s = (
|
|
12
|
-
if (!
|
|
11
|
+
l(!0), i(null);
|
|
12
|
+
const s = f(), m = await fetch(`${s}/architecture/reference`);
|
|
13
|
+
if (!m.ok)
|
|
13
14
|
throw new Error("Could not load the architecture reference");
|
|
14
|
-
|
|
15
|
+
p(await m.json());
|
|
15
16
|
} catch (s) {
|
|
16
|
-
|
|
17
|
+
i(s instanceof Error ? s.message : "Failed to fetch architecture reference");
|
|
17
18
|
} finally {
|
|
18
|
-
|
|
19
|
+
l(!1);
|
|
19
20
|
}
|
|
20
21
|
})();
|
|
21
22
|
}, []);
|
|
22
|
-
const
|
|
23
|
+
const u = (t == null ? void 0 : t.data_model.groups.reduce((a, s) => a + s.tables.length, 0)) ?? 0;
|
|
23
24
|
return /* @__PURE__ */ r(h, { className: "w-full min-w-[280px] max-w-md shadow-lg border-primary/20", children: [
|
|
24
25
|
/* @__PURE__ */ e(b, { className: "pb-3", children: /* @__PURE__ */ r(g, { className: "text-sm font-medium text-muted-foreground flex items-center gap-2", children: [
|
|
25
26
|
/* @__PURE__ */ e(n, { name: "book-open", size: 14 }),
|
|
26
27
|
"Platform Architecture"
|
|
27
28
|
] }) }),
|
|
28
29
|
/* @__PURE__ */ r(N, { className: "pt-0", children: [
|
|
29
|
-
|
|
30
|
+
o && /* @__PURE__ */ e("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ e(n, { name: "loader", size: 24, className: "animate-spin text-muted-foreground" }) }),
|
|
30
31
|
d && /* @__PURE__ */ r("div", { className: "flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: [
|
|
31
32
|
/* @__PURE__ */ e(n, { name: "alert-circle", size: 14, className: "mt-px shrink-0" }),
|
|
32
33
|
/* @__PURE__ */ e("span", { children: d })
|
|
33
34
|
] }),
|
|
34
|
-
t && !
|
|
35
|
+
t && !o && !d && /* @__PURE__ */ r("div", { className: "space-y-3", children: [
|
|
35
36
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
36
37
|
/* @__PURE__ */ r("div", { className: "rounded-md border border-border/60 bg-muted/20 p-2 text-center", children: [
|
|
37
|
-
/* @__PURE__ */ e("p", { className: "font-mono text-sm font-semibold tabular-nums", children:
|
|
38
|
+
/* @__PURE__ */ e("p", { className: "font-mono text-sm font-semibold tabular-nums", children: u }),
|
|
38
39
|
/* @__PURE__ */ e("p", { className: "text-[10px] text-muted-foreground", children: "tables" })
|
|
39
40
|
] }),
|
|
40
41
|
/* @__PURE__ */ r("div", { className: "rounded-md border border-border/60 bg-muted/20 p-2 text-center", children: [
|
|
@@ -66,5 +67,5 @@ const o = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, E =
|
|
|
66
67
|
] });
|
|
67
68
|
};
|
|
68
69
|
export {
|
|
69
|
-
|
|
70
|
+
C as ArchitectureReferenceCard
|
|
70
71
|
};
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { jsx as r, jsxs as t, Fragment as
|
|
1
|
+
import { jsx as r, jsxs as t, Fragment as f } from "react/jsx-runtime";
|
|
2
|
+
import { apiBaseUrl as w } from "../../../utils/apiBaseUrl.js";
|
|
2
3
|
import { useState as n, useEffect as v } from "react";
|
|
3
4
|
import { Icon as a } from "../../ui/Icon.js";
|
|
4
|
-
const
|
|
5
|
-
const [e, x] = n(null), [
|
|
5
|
+
const _ = ({ ticker: i }) => {
|
|
6
|
+
const [e, x] = n(null), [u, l] = n(!0), [m, p] = n(null), [o, h] = n(!1);
|
|
6
7
|
if (v(() => {
|
|
7
8
|
(async () => {
|
|
8
9
|
try {
|
|
9
|
-
|
|
10
|
-
const d = (
|
|
10
|
+
l(!0), p(null);
|
|
11
|
+
const d = w(), c = await fetch(`${d}/companies/${i.toUpperCase()}/profile`);
|
|
11
12
|
if (!c.ok)
|
|
12
13
|
throw new Error(`Failed to fetch profile: ${c.statusText}`);
|
|
13
|
-
const
|
|
14
|
-
x(
|
|
14
|
+
const N = await c.json();
|
|
15
|
+
x(N);
|
|
15
16
|
} catch (d) {
|
|
16
|
-
|
|
17
|
+
p(d instanceof Error ? d.message : "Failed to fetch company profile");
|
|
17
18
|
} finally {
|
|
18
|
-
|
|
19
|
+
l(!1);
|
|
19
20
|
}
|
|
20
21
|
})();
|
|
21
|
-
}, [i]),
|
|
22
|
+
}, [i]), u)
|
|
22
23
|
return /* @__PURE__ */ r("div", { className: "w-full min-w-[320px] max-w-2xl rounded-lg border border-border bg-card p-4 animate-pulse", children: /* @__PURE__ */ t("div", { className: "space-y-3", children: [
|
|
23
24
|
/* @__PURE__ */ r("div", { className: "h-5 w-32 bg-muted rounded" }),
|
|
24
25
|
/* @__PURE__ */ r("div", { className: "h-4 w-48 bg-muted rounded" }),
|
|
@@ -28,15 +29,15 @@ const l = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, E =
|
|
|
28
29
|
] }),
|
|
29
30
|
/* @__PURE__ */ r("div", { className: "h-20 bg-muted rounded" })
|
|
30
31
|
] }) });
|
|
31
|
-
if (
|
|
32
|
+
if (m || !e)
|
|
32
33
|
return /* @__PURE__ */ r("div", { className: "w-full min-w-[320px] max-w-2xl rounded-lg border border-destructive/40 bg-destructive/5 p-4", children: /* @__PURE__ */ t("div", { className: "flex items-start gap-2", children: [
|
|
33
34
|
/* @__PURE__ */ r(a, { name: "alert-triangle", className: "h-4 w-4 text-destructive flex-shrink-0 mt-0.5" }),
|
|
34
35
|
/* @__PURE__ */ t("div", { className: "min-w-0", children: [
|
|
35
36
|
/* @__PURE__ */ r("p", { className: "text-sm font-medium text-destructive", children: "Profile unavailable" }),
|
|
36
|
-
/* @__PURE__ */ r("p", { className: "text-xs text-muted-foreground mt-1", children:
|
|
37
|
+
/* @__PURE__ */ r("p", { className: "text-xs text-muted-foreground mt-1", children: m || `Unable to load profile for ${i}` })
|
|
37
38
|
] })
|
|
38
39
|
] }) });
|
|
39
|
-
const
|
|
40
|
+
const g = (s) => s >= 1e12 ? `$${(s / 1e12).toFixed(2)}T` : s >= 1e9 ? `$${(s / 1e9).toFixed(2)}B` : s >= 1e6 ? `$${(s / 1e6).toFixed(1)}M` : `$${s.toLocaleString()}`, b = e.description && e.description.length > 200 ? e.description.slice(0, 200) + "..." : e.description;
|
|
40
41
|
return /* @__PURE__ */ t("div", { className: "w-full min-w-[320px] max-w-2xl rounded-lg border border-border bg-card p-4 space-y-3", children: [
|
|
41
42
|
/* @__PURE__ */ t("div", { className: "flex items-start justify-between gap-2", children: [
|
|
42
43
|
/* @__PURE__ */ t("div", { className: "min-w-0 flex-1", children: [
|
|
@@ -64,7 +65,7 @@ const l = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, E =
|
|
|
64
65
|
(e.market_cap || e.pe_ratio) && /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
65
66
|
e.market_cap && /* @__PURE__ */ t("div", { className: "rounded-md border border-border bg-muted/30 p-3 space-y-1", children: [
|
|
66
67
|
/* @__PURE__ */ r("p", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Market Cap" }),
|
|
67
|
-
/* @__PURE__ */ r("p", { className: "text-lg font-bold font-mono text-foreground", children:
|
|
68
|
+
/* @__PURE__ */ r("p", { className: "text-lg font-bold font-mono text-foreground", children: g(e.market_cap) })
|
|
68
69
|
] }),
|
|
69
70
|
e.pe_ratio && /* @__PURE__ */ t("div", { className: "rounded-md border border-border bg-muted/30 p-3 space-y-1", children: [
|
|
70
71
|
/* @__PURE__ */ r("p", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "P/E Ratio" }),
|
|
@@ -79,16 +80,16 @@ const l = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, E =
|
|
|
79
80
|
/* @__PURE__ */ r(a, { name: "file-text", className: "h-3 w-3" }),
|
|
80
81
|
"Company Overview"
|
|
81
82
|
] }),
|
|
82
|
-
/* @__PURE__ */ r("p", { className: "text-sm text-muted-foreground leading-relaxed", children: o ? e.description :
|
|
83
|
+
/* @__PURE__ */ r("p", { className: "text-sm text-muted-foreground leading-relaxed", children: o ? e.description : b }),
|
|
83
84
|
e.description.length > 200 && /* @__PURE__ */ r(
|
|
84
85
|
"button",
|
|
85
86
|
{
|
|
86
|
-
onClick: () =>
|
|
87
|
+
onClick: () => h(!o),
|
|
87
88
|
className: "text-xs text-primary hover:underline flex items-center gap-1",
|
|
88
|
-
children: o ? /* @__PURE__ */ t(
|
|
89
|
+
children: o ? /* @__PURE__ */ t(f, { children: [
|
|
89
90
|
/* @__PURE__ */ r(a, { name: "chevron-up", className: "h-3 w-3" }),
|
|
90
91
|
"Show less"
|
|
91
|
-
] }) : /* @__PURE__ */ t(
|
|
92
|
+
] }) : /* @__PURE__ */ t(f, { children: [
|
|
92
93
|
/* @__PURE__ */ r(a, { name: "chevron-down", className: "h-3 w-3" }),
|
|
93
94
|
"Read more"
|
|
94
95
|
] })
|
|
@@ -105,5 +106,5 @@ const l = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, E =
|
|
|
105
106
|
] });
|
|
106
107
|
};
|
|
107
108
|
export {
|
|
108
|
-
|
|
109
|
+
_ as CompanyProfileCard
|
|
109
110
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsxs as r, jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { apiBaseUrl as y } from "../../../utils/apiBaseUrl.js";
|
|
3
|
+
import { useState as c, useEffect as w } from "react";
|
|
4
|
+
import { Card as N, CardHeader as b, CardTitle as C, CardContent as _ } from "../../layout/Card.js";
|
|
4
5
|
import { Icon as l } from "../../ui/Icon.js";
|
|
5
|
-
const
|
|
6
|
+
const v = {
|
|
6
7
|
supplies_to: "Supplies to",
|
|
7
8
|
purchases_from: "Purchases from",
|
|
8
9
|
partners_with: "Partners with",
|
|
@@ -11,45 +12,45 @@ const p = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, k =
|
|
|
11
12
|
invests_in: "Invests in",
|
|
12
13
|
acquires: "Acquires",
|
|
13
14
|
same_as: "Also known as"
|
|
14
|
-
},
|
|
15
|
-
const { ticker: n, hops:
|
|
15
|
+
}, B = ({ params: f }) => {
|
|
16
|
+
const { ticker: n, hops: p } = f, [a, x] = c(null), [d, m] = c(!0), [o, u] = c(null);
|
|
16
17
|
w(() => {
|
|
17
18
|
(async () => {
|
|
18
19
|
try {
|
|
19
|
-
|
|
20
|
-
const e = (
|
|
21
|
-
`${e}/fleet/counterparties/${n.toUpperCase()}?hops=${
|
|
20
|
+
m(!0), u(null);
|
|
21
|
+
const e = y(), h = await fetch(
|
|
22
|
+
`${e}/fleet/counterparties/${n.toUpperCase()}?hops=${p ?? 1}`
|
|
22
23
|
);
|
|
23
|
-
if (!
|
|
24
|
+
if (!h.ok)
|
|
24
25
|
throw new Error(`No counterparty data available for ${n.toUpperCase()}`);
|
|
25
|
-
|
|
26
|
+
x(await h.json());
|
|
26
27
|
} catch (e) {
|
|
27
|
-
|
|
28
|
+
u(e instanceof Error ? e.message : "Failed to fetch counterparty graph");
|
|
28
29
|
} finally {
|
|
29
|
-
|
|
30
|
+
m(!1);
|
|
30
31
|
}
|
|
31
32
|
})();
|
|
32
|
-
}, [n,
|
|
33
|
-
const
|
|
33
|
+
}, [n, p]);
|
|
34
|
+
const g = new Map(((a == null ? void 0 : a.nodes) ?? []).map((t) => [t.id, t])), i = (a == null ? void 0 : a.edges) ?? [];
|
|
34
35
|
return /* @__PURE__ */ r(N, { className: "w-full min-w-[280px] max-w-md shadow-lg border-primary/20", children: [
|
|
35
36
|
/* @__PURE__ */ s(b, { className: "pb-3", children: /* @__PURE__ */ r(C, { className: "text-sm font-medium text-muted-foreground flex items-center gap-2", children: [
|
|
36
37
|
/* @__PURE__ */ s(l, { name: "share-2", size: 14 }),
|
|
37
38
|
"Counterparty Network — ",
|
|
38
39
|
n.toUpperCase()
|
|
39
40
|
] }) }),
|
|
40
|
-
/* @__PURE__ */ r(
|
|
41
|
-
|
|
41
|
+
/* @__PURE__ */ r(_, { className: "pt-0", children: [
|
|
42
|
+
d && /* @__PURE__ */ s("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ s(l, { name: "loader", size: 24, className: "animate-spin text-muted-foreground" }) }),
|
|
42
43
|
o && /* @__PURE__ */ r("div", { className: "flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: [
|
|
43
44
|
/* @__PURE__ */ s(l, { name: "alert-circle", size: 14, className: "mt-px shrink-0" }),
|
|
44
45
|
/* @__PURE__ */ s("span", { children: o })
|
|
45
46
|
] }),
|
|
46
|
-
!
|
|
47
|
+
!d && !o && i.length === 0 && /* @__PURE__ */ r("p", { className: "text-xs text-muted-foreground py-2", children: [
|
|
47
48
|
"No counterparty relationships inferred yet for ",
|
|
48
49
|
n.toUpperCase(),
|
|
49
50
|
"."
|
|
50
51
|
] }),
|
|
51
|
-
|
|
52
|
-
const e =
|
|
52
|
+
i.length > 0 && /* @__PURE__ */ s("div", { className: "space-y-1.5 max-h-72 overflow-y-auto", children: i.map((t) => {
|
|
53
|
+
const e = g.get(t.target_id);
|
|
53
54
|
return e ? /* @__PURE__ */ r(
|
|
54
55
|
"div",
|
|
55
56
|
{
|
|
@@ -61,7 +62,7 @@ const p = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, k =
|
|
|
61
62
|
e.ticker && e.resolution === "public" && /* @__PURE__ */ s("span", { className: "ml-1.5 font-mono text-primary", children: e.ticker.toUpperCase() })
|
|
62
63
|
] }),
|
|
63
64
|
/* @__PURE__ */ r("span", { className: "text-[10px] font-mono text-muted-foreground uppercase tracking-wide", children: [
|
|
64
|
-
|
|
65
|
+
v[t.edge_type] ?? t.edge_type,
|
|
65
66
|
t.hop === 2 && /* @__PURE__ */ s("span", { className: "ml-1.5 opacity-70", children: "· 2nd degree" })
|
|
66
67
|
] })
|
|
67
68
|
] }),
|
|
@@ -78,5 +79,5 @@ const p = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, k =
|
|
|
78
79
|
] });
|
|
79
80
|
};
|
|
80
81
|
export {
|
|
81
|
-
|
|
82
|
+
B as CounterpartyGraphCard
|
|
82
83
|
};
|
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { apiBaseUrl as h } from "../../../utils/apiBaseUrl.js";
|
|
2
3
|
import { useState as c, useEffect as v } from "react";
|
|
3
4
|
import { Card as N, CardHeader as b, CardTitle as y, CardContent as C } from "../../layout/Card.js";
|
|
4
5
|
import { Icon as d } from "../../ui/Icon.js";
|
|
5
|
-
const
|
|
6
|
+
const w = {
|
|
6
7
|
operations: "Operations",
|
|
7
8
|
customer: "Customer",
|
|
8
9
|
operational: "Operations",
|
|
9
10
|
ux: "Customer"
|
|
10
|
-
},
|
|
11
|
-
const { ticker: a } =
|
|
11
|
+
}, k = ({ params: u }) => {
|
|
12
|
+
const { ticker: a } = u, [x, g] = c(null), [l, m] = c(!0), [o, p] = c(null);
|
|
12
13
|
v(() => {
|
|
13
14
|
(async () => {
|
|
14
15
|
try {
|
|
15
|
-
|
|
16
|
-
const r = (
|
|
17
|
-
if (!
|
|
16
|
+
m(!0), p(null);
|
|
17
|
+
const r = h(), n = await fetch(`${r}/fleet/divergence/${a.toUpperCase()}`);
|
|
18
|
+
if (!n.ok)
|
|
18
19
|
throw new Error(`No divergence data available for ${a.toUpperCase()}`);
|
|
19
|
-
|
|
20
|
+
g(await n.json());
|
|
20
21
|
} catch (r) {
|
|
21
|
-
|
|
22
|
+
p(r instanceof Error ? r.message : "Failed to fetch divergence metrics");
|
|
22
23
|
} finally {
|
|
23
|
-
|
|
24
|
+
m(!1);
|
|
24
25
|
}
|
|
25
26
|
})();
|
|
26
27
|
}, [a]);
|
|
27
|
-
const
|
|
28
|
-
return (
|
|
29
|
-
|
|
28
|
+
const i = /* @__PURE__ */ new Map();
|
|
29
|
+
return (x ?? []).forEach((e) => {
|
|
30
|
+
i.has(e.metric) || i.set(e.metric, e);
|
|
30
31
|
}), /* @__PURE__ */ s(N, { className: "w-full min-w-[280px] max-w-md shadow-lg border-primary/20", children: [
|
|
31
32
|
/* @__PURE__ */ t(b, { className: "pb-3", children: /* @__PURE__ */ s(y, { className: "text-sm font-medium text-muted-foreground flex items-center gap-2", children: [
|
|
32
33
|
/* @__PURE__ */ t(d, { name: "activity", size: 14 }),
|
|
@@ -34,27 +35,27 @@ const l = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, E =
|
|
|
34
35
|
a.toUpperCase()
|
|
35
36
|
] }) }),
|
|
36
37
|
/* @__PURE__ */ s(C, { className: "pt-0", children: [
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
l && /* @__PURE__ */ t("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ t(d, { name: "loader", size: 24, className: "animate-spin text-muted-foreground" }) }),
|
|
39
|
+
o && /* @__PURE__ */ s("div", { className: "flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: [
|
|
39
40
|
/* @__PURE__ */ t(d, { name: "alert-circle", size: 14, className: "mt-px shrink-0" }),
|
|
40
|
-
/* @__PURE__ */ t("span", { children:
|
|
41
|
+
/* @__PURE__ */ t("span", { children: o })
|
|
41
42
|
] }),
|
|
42
|
-
!
|
|
43
|
+
!l && !o && i.size === 0 && /* @__PURE__ */ s("p", { className: "text-xs text-muted-foreground py-2", children: [
|
|
43
44
|
"No divergence readings yet for ",
|
|
44
45
|
a.toUpperCase(),
|
|
45
46
|
"."
|
|
46
47
|
] }),
|
|
47
|
-
|
|
48
|
+
i.size > 0 && /* @__PURE__ */ t("div", { className: "space-y-2", children: Array.from(i.values()).map((e) => {
|
|
48
49
|
var f;
|
|
49
|
-
const r = e.score > 0,
|
|
50
|
+
const r = e.score > 0, n = e.score === 0;
|
|
50
51
|
return /* @__PURE__ */ s("div", { className: "rounded-md border border-border/60 bg-muted/20 p-2.5 space-y-1", children: [
|
|
51
52
|
/* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
|
|
52
|
-
/* @__PURE__ */ t("span", { className: "text-xs font-semibold uppercase tracking-wide text-foreground", children:
|
|
53
|
+
/* @__PURE__ */ t("span", { className: "text-xs font-semibold uppercase tracking-wide text-foreground", children: w[e.metric] }),
|
|
53
54
|
/* @__PURE__ */ t(
|
|
54
55
|
"span",
|
|
55
56
|
{
|
|
56
|
-
className: `text-xs font-mono font-semibold ${
|
|
57
|
-
children:
|
|
57
|
+
className: `text-xs font-mono font-semibold ${n ? "text-muted-foreground" : r ? "text-green-500" : "text-red-500"}`,
|
|
58
|
+
children: n ? "—" : `${r ? "+" : ""}${e.score.toFixed(0)}`
|
|
58
59
|
}
|
|
59
60
|
)
|
|
60
61
|
] }),
|
|
@@ -65,5 +66,5 @@ const l = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, E =
|
|
|
65
66
|
] });
|
|
66
67
|
};
|
|
67
68
|
export {
|
|
68
|
-
|
|
69
|
+
k as DivergenceMetricsCard
|
|
69
70
|
};
|