"use client"; import { useState } from "react"; import { SegmentedControl } from "@/components/ui/SegmentedControl"; import { AsOfPicker } from "./AsOfPicker"; import { EmployeeTree } from "./EmployeeTree"; import { PositionTree } from "./PositionTree"; import type { OrgEmployee, OrgUnitNode, OrgVacancy } from "./types"; type View = "ma" | "pos"; type OrgChartClientProps = { employees: OrgEmployee[]; units: OrgUnitNode[]; vacancies: OrgVacancy[]; asOf: string; today: string; projectedCount: number; historyStartsAt: string | null; /** Arrived via "Im Organigramm anzeigen" — unfold and centre this person. */ focusId: string | null; }; export function OrgChartClient({ employees, units, vacancies, asOf, today, projectedCount, historyStartsAt, focusId, }: OrgChartClientProps) { const [view, setView] = useState("ma"); return (
value={view} onChange={setView} options={[ { value: "ma", label: "Mitarbeiter" }, { value: "pos", label: "Organisation" }, ]} /> {view === "ma" && } {view === "pos" && }
); }