"use client";
import React from "react";
function NodeBadge({ children, tone = "gray" }) {
const tones = {
gray: "border-gray-200 bg-gray-50 text-gray-700",
blue: "border-blue-200 bg-blue-50 text-blue-700",
green: "border-green-200 bg-green-50 text-green-700",
yellow: "border-yellow-200 bg-yellow-50 text-yellow-700",
red: "border-red-200 bg-red-50 text-red-700",
purple: "border-purple-200 bg-purple-50 text-purple-700",
};
return (
{children}
);
}
function NodeGroup({
title,
nodes,
resolvedNodeIds = new Set(),
newlySurfacedNodeIds = new Set(),
activeUnknownNodeId = null,
}) {
if (!nodes?.length) return null;
return (
);
}
export default function SituationGraphView({
situationGraph,
selectedQuestion,
newlySurfacedNodeIds = [],
}) {
if (!situationGraph) return null;
const selectedQuestionText =
typeof selectedQuestion === "string"
? selectedQuestion
: selectedQuestion?.question ?? null;
const activeUnknown = situationGraph.activeUnknownNodeId
? situationGraph.nodes.find((node) => node.id === situationGraph.activeUnknownNodeId)
: null;
const nodesByKind = situationGraph.nodes.reduce((acc, node) => {
if (!acc[node.kind]) acc[node.kind] = [];
acc[node.kind].push(node);
return acc;
}, {});
const resolvedNodeIdSet = new Set(situationGraph.resolvedNodeIds || []);
const newlySurfacedNodeIdSet = new Set(newlySurfacedNodeIds || []);
return (
{selectedQuestionText && (
Selected Question
{selectedQuestionText}
)}
Situation Graph
- Central statement
- {situationGraph.centralStatement}
{situationGraph.currentSummary && (
- Current summary
- {situationGraph.currentSummary}
)}
{activeUnknown && (
- Active unknown
- {activeUnknown.label}
)}
- Edge count
- {situationGraph.edges.length}
{Object.entries(nodesByKind).map(([kind, nodes]) => (
))}
Raw graph JSON
{JSON.stringify(situationGraph, null, 2)}
);
}