"use client";

import React, { FC } from "react";
import { Drawer, rem } from "@mantine/core";
import BoardsDrawerBody from "@/app/deals/drawers/ProjectBoardsEditorDrawer/components/BoardsDrawerBody";
import { ProjectBoardsContextProvider } from "@/app/deals/drawers/ProjectBoardsEditorDrawer/contexts/ProjectBoardsContext";
import { DrawerProps } from "@/drawers/types";
import { ProjectSchema } from "@/lib/client";

type Props = {
    project: ProjectSchema;
};

const ProjectBoardsEditorDrawer: FC<DrawerProps<Props>> = ({
    onClose,
    opened,
    props: { project },
}) => {
    return (
        <Drawer
            size={"100%"}
            position={"right"}
            onClose={onClose}
            removeScrollProps={{ allowPinchZoom: true }}
            withCloseButton={false}
            opened={opened}
            trapFocus={false}
            styles={{
                body: {
                    height: "100%",
                    display: "flex",
                    flexDirection: "column",
                    gap: rem(10),
                },
            }}>
            <ProjectBoardsContextProvider project={project}>
                <BoardsDrawerBody onClose={onClose} />
            </ProjectBoardsContextProvider>
        </Drawer>
    );
};

export default ProjectBoardsEditorDrawer;
