Frontend School

Interactive Organizational Chart Viewer

Machine Coding
medium

Interactive Organizational Chart Viewer

Medium
Tree
UI
React
TypeScript
Frontend
Data Visualization

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:

  1. Render the Org Chart: Display employees and their direct reports in a clear, hierarchical tree-like structure.
  2. 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.
  3. 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.

Constraints

Constraints & assumptions

  • Data Structure: You will be provided with a mock hierarchical data structure representing the organization.
  • Data Size: The organization chart will contain a maximum of 50-100 employees and a maximum depth of 5-7 levels. Performance for extremely large datasets is not the primary focus, but efficient rendering is expected.
  • Technology Stack: React with TypeScript is required.
  • No Backend: All data will be static and provided within the application code; no API calls are necessary.
  • Browser Support: Modern web browsers (Chrome, Firefox, Safari, Edge) are targeted.

Out of scope

  • Editing, adding, or deleting employees.
  • Search or filtering functionality for employees.
  • Complex drag-and-drop interactions or advanced animations.
  • Persistence of expanded/selected states across page reloads.

What interviewers evaluate

  • Correctness and Completeness: Does the solution meet all functional requirements, including rendering, expand/collapse, and path highlighting?
  • Code Quality and Structure: Is the code clean, readable, well-organized into components, and maintainable? Are appropriate React patterns used?
  • State Management: Is React's state managed effectively to handle UI interactions and data flow?
  • TypeScript Proficiency: Is TypeScript used correctly for type definitions, ensuring type safety and improving code clarity?
  • UI/UX Implementation: Is the user interface intuitive, visually clear, and responsive to user interactions?

Loading editor...