"use client" import { useState } from "react"; import { LocationTreeNode } from "../../types/inventory"; type Props = { node: LocationTreeNode; selectedId: string | null; focusedId: string | null; openMap: Record; setOpenMap: React.Dispatch>>; setFocusedId: (id: string) => void; onSelect: (id: string ) => void; }; export function LocationTreeNodeItem({ node, selectedId, focusedId, openMap, setOpenMap, setFocusedId, onSelect }: Props) { const hasChildren = node.children.length > 0; const isOpen = openMap[node._id]; return (
{hasChildren && ( )} {!hasChildren && }
{isOpen && hasChildren && (
    {node.children.map(child => ( ))}
)}
); }