MCPcopy Index your code
hub / github.com/triggerdotdev/jsonhero-web / PathBar

Function PathBar

app/components/PathBar.tsx:19–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17import { JSONHeroPath } from '@jsonhero/path';
18
19export function PathBar() {
20 const [isEditable, setIsEditable] = useState(false);
21 const { selectedNodes, highlightedNodeId } = useJsonColumnViewState();
22 const { goToNodeId } = useJsonColumnViewAPI();
23 const [json] = useJson();
24
25 if (isEditable) {
26 return (
27 <PathBarText
28 selectedNodes={selectedNodes}
29 onConfirm={(newPath) => {
30 setIsEditable(false);
31 const heroPath = new JSONHeroPath(newPath);
32 const node = heroPath.first(json);
33 if (node) {
34 goToNodeId(newPath, 'pathBar');
35 }
36 }}
37 />
38 );
39 }
40
41 return (
42 <PathBarLink
43 selectedNodes={selectedNodes}
44 highlightedNodeId={highlightedNodeId}
45 enableEdit={() => setIsEditable(true)}
46 />
47 );
48}
49
50export function PathBarText({ selectedNodes, onConfirm }: { selectedNodes: ColumnViewNode[], onConfirm: (newPath: string) => void; }) {
51 const [path, setPath] = useState('');

Callers

nothing calls this directly

Calls 3

useJsonColumnViewStateFunction · 0.90
useJsonColumnViewAPIFunction · 0.90
useJsonFunction · 0.90

Tested by

no test coverage detected