import { useMatches } from "@remix-run/react";
import { AppLayoutLoader } from "~/types/AppLayoutLoader.types";

export const useAppLayoutData = () => {
  const matches = useMatches();
  const rootData =
    (matches.find((match) => match.id === "routes/app+/project+/$projectId+/env+/$envId+/_layout")
      ?.data as AppLayoutLoader) || {};

  return rootData;
};
