"use client";

import { Group } from "@mantine/core";
import ViewSelector from "@/app/deals/components/desktop/ViewSelector/ViewSelector";
import { useProjectsContext } from "@/app/deals/contexts/ProjectsContext";
import ProjectSelect from "@/components/selects/ProjectSelect/ProjectSelect";
import useIsMobile from "@/hooks/utils/useIsMobile";

const TopToolPanel = () => {
    const { projects, setSelectedProjectId, selectedProject } =
        useProjectsContext();
    const isMobile = useIsMobile();

    if (isMobile) return;

    return (
        <Group justify={"space-between"}>
            <ViewSelector />
            <ProjectSelect
                data={projects}
                value={selectedProject}
                onChange={value => value && setSelectedProjectId(value.id)}
            />
        </Group>
    );
};

export default TopToolPanel;
