"use client";

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

type Props = {
    project: ProjectSchema;
};

const BoardsMobileEditorDrawer: 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),
                },
            }}>
            <BoardsMobileContextProvider project={project}>
                <BoardsDrawerBody onClose={onClose} />
            </BoardsMobileContextProvider>
        </Drawer>
    );
};

export default BoardsMobileEditorDrawer;
