"use client"; import { ColumnDef } from "@tanstack/react-table"; import { DataTable, DTExtraParamsProps, IconTextButtonWithTooltip, } from "ikoncomponents"; import { RefreshCcw } from "lucide-react"; import { useEffect, useState } from "react"; /** * Type for Integration data */ export interface ConnectorData { connectorId: string; connectorName: string; appName: string; } function IntegrationTable() { const [data, setData] = useState([]); const [loading, setLoading] = useState(true); // Dummy fetch (replace with API call) useEffect(() => { const fetchConnectors = async () => { try { setLoading(true); // Replace this with your actual API const response: ConnectorData[] = [ { connectorId: "1", connectorName: "Salesforce Connector", appName: "Sales CRM", }, { connectorId: "2", connectorName: "Zoho Connector", appName: "Project Management", }, ]; setData(response); } catch (error) { console.error("Failed to fetch integrations", error); setData([]); } finally { setLoading(false); } }; fetchConnectors(); }, []); const handleSync = () => { console.log("Sync button clicked"); // Call sync API here }; const columns: ColumnDef[] = [ { accessorKey: "connectorName", header: () =>
Connector Name
, cell: ({ row }) => ( {row.original.connectorName} ), }, { accessorKey: "appName", header: () =>
App Name
, cell: ({ row }) => {row.original.appName}, }, ]; const extraParams: DTExtraParamsProps = { extraTools: [ , ], }; if (loading) { return (
); } return ; } export default IntegrationTable;