"use client";

import React, { FC } from "react";
import { Drawer, rem } from "@mantine/core";
import StatusesDrawerBody from "@/app/deals/drawers/StatusesMobileEditorDrawer/components/StatusesDrawerBody";
import { StatusesMobileContextProvider } from "@/app/deals/drawers/StatusesMobileEditorDrawer/contexts/BoardStatusesContext";
import { DrawerProps } from "@/drawers/types";
import { BoardSchema } from "@/lib/client";

type Props = {
    board: BoardSchema;
};

const StatusesMobileEditorDrawer: FC<DrawerProps<Props>> = ({
    opened,
    onClose,
    props: { board },
}) => {
    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),
                },
            }}>
            <StatusesMobileContextProvider board={board}>
                <StatusesDrawerBody onClose={onClose} />
            </StatusesMobileContextProvider>
        </Drawer>
    );
};

export default StatusesMobileEditorDrawer;
