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

const CreateProjectButton: FC = () => {
    const { projectsCrud } = useProjectsContext();

    const onStartCreating = () => {
        modals.openContextModal({
            modal: "enterNameModal",
            title: "Создание проекта",
            withCloseButton: true,
            innerProps: {
                onChange: projectsCrud.onCreate,
            },
        });
    };

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

export default CreateProjectButton;
