import { Outlet, useLocation } from 'react-router-dom'
import PlanningRouteNav from '../components/planning/PlanningRouteNav'
import { isPlanningUnitEditorPath } from '../utils/planningUnitRoutes'

/** Gemeinsame Hülle für Planung, Rahmenprogramme, Module und Vorlagen. */
export default function PlanningLayout() {
  const { pathname } = useLocation()
  const hideRouteNav = isPlanningUnitEditorPath(pathname)

  return (
    <div className="app-page planning-layout">
      {!hideRouteNav ? <PlanningRouteNav /> : null}
      <div className="planning-layout__main">
        <Outlet />
      </div>
    </div>
  )
}
