All files / src/pages/integrations AddIntegration.tsx

0% Statements 0/11
0% Branches 0/6
0% Functions 0/2
0% Lines 0/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40                                                                               
import Heading from "../../components/Heading.js";
import { useGetConnectorListQuery } from "../../store/features/integrations/api/index.ts";
import BasicSearch from "../../components/common/BasicSearch/index.tsx";
import IntegrationCard from "../../components/common/IntegrationCard";
import GroupedIntegrations from "../../components/Integration/GroupedIntegrations.tsx";
import useBasicSearch from "../../hooks/common/useBasicSearch";
 
function AddIntegration() {
  const { data: integrations } = useGetConnectorListQuery();
  const { query, setValue, filteredList, notFound } = useBasicSearch(
    integrations?.integrations?.allAvailableConnectors ?? [],
    ["title", "desc"],
  );
 
  return (
    <>
      <Heading heading={"Add an Integration"} />
      <div className="m-4">
        <BasicSearch query={query} setValue={setValue} />
      </div>
      {query ? (
        <div className="flex flex-wrap">
          {notFound && (
            <p className="mx-4 text-sm">
              No Integrations found. Try changing the search query.
            </p>
          )}
          {filteredList.map((e, index) => (
            <IntegrationCard key={index} data={e} />
          ))}
        </div>
      ) : (
        <GroupedIntegrations />
      )}
    </>
  );
}
 
export default AddIntegration;