Skip to content

Commit 60b5223

Browse files
authored
Merge pull request #77 from PathOnAI/messagelog-v1
del node value, add color label
2 parents 5381173 + b10a737 commit 60b5223

File tree

2 files changed

+28
-36
lines changed

2 files changed

+28
-36
lines changed

visual-tree-search-app/components/LATSVisual.tsx

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -367,34 +367,20 @@ const LATSVisual: React.FC<SimpleSearchVisualProps> = ({ messages }) => {
367367
.attr("font-weight", "500")
368368
.attr("fill", d => {
369369
if (d.data.isSimulated) {
370-
return theme === 'dark' ? "#FDBA74" : "#C2410C"; // Orange for simulated node
370+
return theme === 'dark' ? "#FDBA74" : "#C2410C";
371371
}
372372

373373
if (d.data.id === simulationStartNodeId) {
374-
return theme === 'dark' ? "#A7F3D0" : "#047857"; // Green for simulation start
374+
return theme === 'dark' ? "#A7F3D0" : "#047857";
375375
}
376376

377377
if (d.data.id === selectedNodeId) {
378-
return theme === 'dark' ? "#93C5FD" : "#1D4ED8"; // Blue for selected node
378+
return theme === 'dark' ? "#93C5FD" : "#1D4ED8";
379379
}
380380

381381
return theme === 'dark' ? "#FFFFFF" : "#111827";
382382
});
383383

384-
// Add reward values near nodes
385-
nodes.append("text")
386-
.attr("dy", "1.5em")
387-
.attr("x", d => d.children ? -18 : 18)
388-
.attr("text-anchor", d => d.children ? "end" : "start")
389-
.text(d => {
390-
if (typeof d.data.reward === 'number') {
391-
return `R: ${d.data.reward.toFixed(2)}`;
392-
}
393-
return "";
394-
})
395-
.attr("font-size", "12px")
396-
.attr("fill", theme === 'dark' ? "#E5E7EB" : "#4B5563");
397-
398384
// Add tooltip interactions
399385
nodes
400386
.on("mouseover", function(event, d) {

visual-tree-search-app/components/SimpleSearchVisual.tsx

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,18 @@ const SimpleSearchVisual: React.FC<SimpleSearchVisualProps> = ({ messages }) =>
216216
// Action node (default)
217217
return theme === 'dark' ? "#4B5563" : "#E5E7EB";
218218
})
219-
.attr("stroke", d => d.data.id === selectedNodeId
220-
? theme === 'dark' ? "#93C5FD" : "#2563EB"
221-
: theme === 'dark' ? "#374151" : "#D1D5DB")
222-
.attr("stroke-width", d => d.data.id === selectedNodeId ? 3 : 2);
219+
.attr("stroke", d => {
220+
if (d.data.id === selectedNodeId) {
221+
return theme === 'dark' ? "#93C5FD" : "#2563EB";
222+
}
223+
return theme === 'dark' ? "#374151" : "#D1D5DB";
224+
})
225+
.attr("stroke-width", d => {
226+
if (d.data.id === selectedNodeId) {
227+
return 3;
228+
}
229+
return 2;
230+
});
223231

224232
// Add node labels with tooltips
225233
nodes.append("text")
@@ -241,25 +249,11 @@ const SimpleSearchVisual: React.FC<SimpleSearchVisualProps> = ({ messages }) =>
241249
.attr("font-weight", "500")
242250
.attr("fill", d => {
243251
if (d.data.id === selectedNodeId) {
244-
return "#ff5722"; // Orange for selected node
252+
return theme === 'dark' ? "#93C5FD" : "#1D4ED8";
245253
}
246254
return theme === 'dark' ? "#FFFFFF" : "#111827";
247255
});
248256

249-
// Add reward values near nodes
250-
nodes.append("text")
251-
.attr("dy", "1.5em")
252-
.attr("x", d => d.children ? -18 : 18)
253-
.attr("text-anchor", d => d.children ? "end" : "start")
254-
.text(d => {
255-
if (typeof d.data.reward === 'number') {
256-
return `R: ${d.data.reward.toFixed(2)}`;
257-
}
258-
return "";
259-
})
260-
.attr("font-size", "12px")
261-
.attr("fill", theme === 'dark' ? "#E5E7EB" : "#4B5563");
262-
263257
// Add tooltip interactions
264258
nodes
265259
.on("mouseover", function(event, d) {
@@ -309,6 +303,18 @@ const SimpleSearchVisual: React.FC<SimpleSearchVisualProps> = ({ messages }) =>
309303
</svg>
310304
Tree Visualization
311305
</h2>
306+
307+
{/* Legend */}
308+
<div className="mt-2 flex flex-wrap gap-2 text-xs">
309+
<div className="flex items-center">
310+
<span className="w-3 h-3 rounded-full inline-block mr-1 bg-blue-500 dark:bg-blue-600"></span>
311+
<span className="text-gray-700 dark:text-gray-300">Selected</span>
312+
</div>
313+
<div className="flex items-center">
314+
<span className="w-3 h-3 rounded-full inline-block mr-1 bg-gray-500 dark:bg-gray-600"></span>
315+
<span className="text-gray-700 dark:text-gray-300">Root</span>
316+
</div>
317+
</div>
312318
</div>
313319
<div
314320
ref={containerRef}

0 commit comments

Comments
 (0)