"use client"; import { EmptyPlaceholder } from "@/components/dashboard/empty-placeholder"; import { PageHeader } from "@/components/dashboard/page-header"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Separator } from "@/components/ui/separator"; // import { PostHogIdentify } from "@/providers/PostHogProvider"; // import { useUser } from "@clerk/nextjs"; import { BookOpen, Code, Search } from "lucide-react"; import Link from "next/link"; import { useEffect, useState } from "react"; import { CreateApiButton } from "./create-api-button"; export type ApiWithKeys = { id: string; name: string; keys: { count: number; }[]; }[]; export function ApiList({ apis }: { apis: ApiWithKeys }) { // const { user, isLoaded } = useUser(); useEffect(() => { if (apis.length) { setLocalData(apis); } }, [apis]); const [localData, setLocalData] = useState(apis); // if (isLoaded && user) { // PostHogIdentify({ user }); // } return (
{ const filtered = apis.filter((a) => a.name.toLowerCase().includes(e.target.value.toLowerCase()), ); setLocalData(filtered); }} />
{apis.length ? (
    {localData.map((api) => (
    {api.name}
    {api.id}
    API Keys
    {api.keys.at(0)?.count ?? 0}
    ))}
) : ( No APIs found You haven't created any APIs yet. Create one to get started.
)}
); }