From 4ad7ba0c16301c39987e565fcce3c106a14acf2f Mon Sep 17 00:00:00 2001
From: Heberto Mayorquin
Date: Mon, 14 Sep 2026 11:48:33 -0600
Subject: [PATCH 1/2] Add JSON download and probeinterface snippet to the
viewer
---
apps/probe-viewer/src/App.css | 49 ++++++++++-
.../src/components/ProbeViewer.tsx | 83 +++++++++++++++++--
2 files changed, 125 insertions(+), 7 deletions(-)
diff --git a/apps/probe-viewer/src/App.css b/apps/probe-viewer/src/App.css
index 48a2600..00050cb 100644
--- a/apps/probe-viewer/src/App.css
+++ b/apps/probe-viewer/src/App.css
@@ -291,7 +291,7 @@
color: var(--ink);
}
-/* "{ } JSON" link inline in the subtitle metadata line. It uses the blue link
+/* "JSON" link inline in the subtitle metadata line. It uses the blue link
color and a persistent underline (on the word, not the icon) so it clearly
reads as a clickable link rather than just emphasized text. */
.viewer-json-link {
@@ -314,6 +314,27 @@
color: var(--accent-strong);
}
+.viewer-json-download {
+ display: inline-flex;
+ align-items: center;
+ vertical-align: middle;
+ margin-left: 0.35rem;
+ padding: 0.15rem;
+ border-radius: 0.3rem;
+ color: var(--accent);
+ transition: color 0.2s ease, background 0.2s ease;
+}
+
+.viewer-json-download svg {
+ width: 14px;
+ height: 14px;
+}
+
+.viewer-json-download:hover {
+ color: var(--accent-strong);
+ background: var(--accent-soft);
+}
+
.viewer-subtitle {
margin: 0.25rem 0 0;
color: #475569;
@@ -566,6 +587,32 @@
background: var(--accent-soft);
}
+.viewer-snippet {
+ position: relative;
+}
+
+.viewer-snippet-popover {
+ position: absolute;
+ top: calc(100% + 0.4rem);
+ right: 0;
+ z-index: 10;
+ display: flex;
+ align-items: flex-start;
+ gap: 0.75rem;
+ padding: 0.75rem;
+ background: var(--surface);
+ border: 1px solid var(--line);
+ border-radius: var(--radius);
+ box-shadow: var(--shadow);
+}
+
+.viewer-snippet-code {
+ margin: 0;
+ font-size: 0.85rem;
+ color: var(--ink);
+ white-space: pre;
+}
+
.viewer-canvas-placeholder {
height: 360px;
border-radius: 1rem;
diff --git a/apps/probe-viewer/src/components/ProbeViewer.tsx b/apps/probe-viewer/src/components/ProbeViewer.tsx
index c43dbe1..d2092d7 100644
--- a/apps/probe-viewer/src/components/ProbeViewer.tsx
+++ b/apps/probe-viewer/src/components/ProbeViewer.tsx
@@ -131,11 +131,10 @@ const DownloadIcon = (
);
-// Curly-braces glyph, the de-facto standard symbol for JSON/code.
-const JsonIcon = (
-
+ {/* A local file is not in the library, so get_probe cannot load it. */}
+ {!isLocalProbe && (
+
+
+ {snippetOpen && (
+
+
{pythonSnippet}
+
+
+ )}
+
+ )}
- {/* A local file is not in the library, so get_probe cannot load it. */}
- {!isLocalProbe && (
-
-
- {snippetOpen && (
-
-
{pythonSnippet}
-
-
- )}
-
- )}