"use client";

import React, { FC } from "react";
import { Center, Divider, Drawer, rem, Text } from "@mantine/core";
import { ProjectsContextProvider } from "@/app/deals/contexts/ProjectsContext";
import ProjectsDrawerBody from "@/app/deals/drawers/BoardStatusesEditorDrawer/components/ProjectsDrawerBody";
import { DrawerProps } from "@/drawers/types";

type Props = {
    setSelectedProjectId: (projectId: number | null) => void;
};

const ProjectsEditorDrawer: FC<DrawerProps<Props>> = ({
    opened,
    onClose,
    props: { setSelectedProjectId },
}) => {
    return (
        <Drawer
            size={"100%"}
            position={"left"}
            onClose={onClose}
            removeScrollProps={{ allowPinchZoom: true }}
            withCloseButton={false}
            opened={opened}
            trapFocus={false}
            styles={{
                body: {
                    height: "100%",
                    display: "flex",
                    flexDirection: "column",
                    gap: rem(10),
                },
            }}>
            <Center>
                <Text>Проекты</Text>
            </Center>
            <Divider />
            <ProjectsContextProvider>
                <ProjectsDrawerBody
                    setSelectedProjectId={setSelectedProjectId}
                    onClose={onClose}
                />
            </ProjectsContextProvider>
        </Drawer>
    );
};

export default ProjectsEditorDrawer;
