Overview
Understanding organizational structures is crucial in large enterprises like Adobe. Employees often need to quickly visualize reporting lines, identify team members, and understand departmental hierarchies. This problem challenges you to build an interactive organizational chart viewer that can display hierarchical employee data, allow users to expand and collapse sections, and highlight specific reporting paths.
What you need to do / Task
Your primary task is to develop a React component that renders an interactive organizational chart based on a provided hierarchical data structure. Specifically, you must:
- Render the Org Chart: Display employees and their direct reports in a clear, hierarchical tree-like structure.
- Expand/Collapse Functionality: Implement a mechanism to expand and collapse direct reports for any employee node. This should toggle the visibility of their immediate children.
- Employee Selection & Path Highlighting: Allow users to select an employee. Upon selection, visually highlight the entire reporting path from that selected employee up to the top-level CEO (root of the tree).
UI/UX expectations
- Tree Structure: Use indentation or a similar visual cue to represent hierarchy. Each employee node should clearly display their name and title.
- Expand/Collapse Indicators: Provide clear visual indicators (e.g.,
+/- icons, arrows) next to employee names that have direct reports, to toggle the visibility of their children.
- Clickable Nodes: Employee names should be clickable to trigger selection.
- Path Highlighting: The selected employee and all their managers up to the CEO should have a distinct visual style (e.g., different background color, border).
- Initial State: The chart should initially display only the CEO and their immediate direct reports. All other sub-branches should be collapsed.
Acceptance criteria
- The application correctly renders the provided hierarchical employee data.
- Clicking an expand/collapse control accurately toggles the visibility of an employee's direct reports.
- Clicking an employee's name selects that employee and updates the UI.
- The entire reporting path from the selected employee to the root (CEO) is visually highlighted.
- The initial view of the org chart shows only the CEO and their first level of direct reports, with all other branches collapsed.
- The UI is responsive and interactive without noticeable lag for the given data size.