32 lines
1.6 KiB
TypeScript
32 lines
1.6 KiB
TypeScript
import type { ReactNode } from "react";
|
|
import { ActivityAside } from "@/components/ActivityAside";
|
|
import { Footer } from "@/components/Footer";
|
|
import { cn } from "@/lib/utils";
|
|
import { getT } from "@/lib/i18n";
|
|
|
|
/**
|
|
* Centre + right panel of the console (PEP-38). The page decides what the right panel shows;
|
|
* without `aside` it gets the default activity panel, `aside={null}` hides it.
|
|
* `wide` lets the centre grow past the reading width (the board page, with its panel moved into a dialog).
|
|
* Below xl the panel goes under the page content (`asideWideOnly`: shown on xl only), the footer is always last.
|
|
*/
|
|
export async function Workspace({ children, aside, asideWideOnly = false, wide = false }: { children: ReactNode; aside?: ReactNode; asideWideOnly?: boolean; wide?: boolean }) {
|
|
const t = await getT();
|
|
const panel = aside === undefined ? <ActivityAside /> : aside;
|
|
return (
|
|
<div className={cn("grid flex-1", panel && "xl:grid-cols-[minmax(0,1fr)_360px] xl:grid-rows-[1fr_auto]")}>
|
|
<main className="min-w-0 px-4 py-5 md:px-8 md:py-7">
|
|
<div className={cn("mx-auto w-full", wide ? "max-w-[1600px]" : "max-w-5xl")}>{children}</div>
|
|
</main>
|
|
{panel && (
|
|
<aside aria-label={t("Панель")} className={cn(asideWideOnly && "max-xl:hidden", "min-w-0 border-t bg-sidebar/60 px-4 py-5 xl:sticky xl:top-0 xl:col-start-2 xl:row-span-2 xl:row-start-1 xl:h-dvh xl:overflow-y-auto xl:border-t-0 xl:border-l")}>
|
|
{panel}
|
|
</aside>
|
|
)}
|
|
<div className="xl:col-start-1">
|
|
<Footer />
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|