FPSMS-frontend
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

41 lines
995 B

  1. "use client";
  2. import { isFullBleedMainRoute } from "@/app/(main)/isFullBleedMainRoute";
  3. import { usePathname } from "next/navigation";
  4. import type { ReactNode } from "react";
  5. type MainLayoutBodyProps = {
  6. appBar: ReactNode;
  7. mainContent: ReactNode;
  8. };
  9. /**
  10. * On `/po/workbench`, wraps the AppBar and main in a `100dvh` flex column so `<main>` can
  11. * use `flex: 1` instead of `calc(100dvh - 56/64px)` (which misses the real AppBar height).
  12. */
  13. export default function MainLayoutBody({
  14. appBar,
  15. mainContent,
  16. }: MainLayoutBodyProps) {
  17. const pathname = usePathname();
  18. const isWorkbench = isFullBleedMainRoute(pathname);
  19. if (isWorkbench) {
  20. return (
  21. <div className="flex h-[100dvh] min-h-0 w-full flex-col overflow-hidden">
  22. <div className="shrink-0">{appBar}</div>
  23. <div className="flex min-h-0 flex-1 flex-col overflow-hidden">
  24. {mainContent}
  25. </div>
  26. </div>
  27. );
  28. }
  29. return (
  30. <>
  31. {appBar}
  32. {mainContent}
  33. </>
  34. );
  35. }