import { getStockSilo } from "@/utils/querys/logistics/siloAdjustments/getStockSilo";
import { useQuery } from "@tanstack/react-query";
import SiloCard from "./SiloCard";

export default function SiloPage() {
    const { data, isError, error, isLoading } = useQuery(getStockSilo());

    if (isLoading) return;

    if (isError) return;

    if (error)
        return (
            <div>
                {" "}
                There was an error getting the silos please notify your admin if
                this continues to be an issue
            </div>
        );

    return (
        <div className="flex flex-wrap">
            {data?.map((s: any) => (
                <div key={s.LocationID} className="grow m-2 max-w-[800px]">
                    <SiloCard silo={s} />
                </div>
            ))}
        </div>
    );
}
