
import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import { motion } from "framer-motion";
import { FaPlus, FaCircle } from "react-icons/fa";
import { api } from "../API/api";
import { useLoading } from "../Context/LoadingContext";
import PartnersCardComponent from "../Components/PartnersPageCardComponent";
import ClientsCardComponent from "../Components/ClientsPageCardComponent";
import MappingComponent from "../Components/MappingComponent";

const ClientPartnerMapping = () => {
    const [clients, setClients] = useState([]);
    const [upd, setUpd] = useState(0);
    const navigate = useNavigate();
    const { setLoading } = useLoading();

    useEffect(() => {
        const fetchClients = async () => {
            try {
                setLoading(true);
                const response = await api.get("/admin/partners");

                setClients(response);


            } catch (error) {
                console.error("Error fetching clients:", error);
            } finally {
                setLoading(false);
            }
        };
        fetchClients();
    }, [upd]);

    return (
        <div className="min-h-screen bg-gray-900 text-white p-8">
            <motion.h1
                className="text-3xl font-bold text-center mb-8"
                initial={{ opacity: 0, y: -20 }}
                animate={{ opacity: 1, y: 0 }}
            >
                Ads Configuration
            </motion.h1>


            <MappingComponent Data={clients} setUpd={setUpd} />
        </div>
    );
};

export default ClientPartnerMapping

