import { FC } from "react";
import { IconPlus } from "@tabler/icons-react";
import { Box, Group, Text } from "@mantine/core";
import { modals } from "@mantine/modals";
import { useBoardStatusesContext } from "@/app/deals/drawers/BoardStatusesEditorDrawer/contexts/BoardStatusesContext";

const CreateStatusButton: FC = () => {
    const { statusesCrud } = useBoardStatusesContext();

    const onStartCreating = () => {
        modals.openContextModal({
            modal: "enterNameModal",
            title: "Создание колонки",
            withCloseButton: true,
            innerProps: {
                onComplete: statusesCrud.onCreate,
            },
        });
    };

    return (
        <Group
            ml={"xs"}
            onClick={onStartCreating}>
            <IconPlus />
            <Box mt={5}>
                <Text>Создать колонку</Text>
            </Box>
        </Group>
    );
};

export default CreateStatusButton;
