import React from "react"; import { useNavigate } from "react-router"; import { Rotate3d, ArrowBigRight } from "lucide-react"; import { Box, Alert, Button, Stack, Heading, HStack } from "@chakra-ui/react"; import { useWorkbenchStateStore, useSessionStore, useEntityDetail, useSettings, } from "@trustgraph/react-state"; import EntityHelp from "./EntityHelp"; import ElementNode from "./ElementNode"; const EntityDetail = () => { const navigate = useNavigate(); const flowId = useSessionStore((state) => state.flowId); const selected = useWorkbenchStateStore((state) => state.selected); const { settings, isLoaded: settingsLoaded } = useSettings(); // Use the new Tanstack Query hook for entity details const { detail, isLoading, isError } = useEntityDetail( selected?.uri, flowId, settings?.collection || "default", ); if (!settingsLoaded) { return ( Loading settings... ); } if (!selected) { return ( No data to view. Try Chat or Search to find data. ); } if (isLoading || !detail) return ( {isLoading ? "Loading entity details..." : "No data to view. Try Chat or Search to find data."} ); if (isError) return ( Error loading entity details. ); const graphView = () => { navigate("/graph"); }; return ( <> {selected.label} {detail.triples.map((t) => { return ( ); })} ); }; export default EntityDetail;