+ /> + {error ? error : 'No invoices yet'} -
+- {totalMemberCount === 0 - ? 'No team members found.' - : 'No members match your search.'} -
+ {totalMemberCount === 0 + ? 'No team members found.' + : 'No members match your search.'}{label}
+} + +export const ApiKeysPageContent = ({ + teamSlug, + className, +}: ApiKeysPageContentProps) => { + const trpc = useTRPC() + const [query, setQuery] = useState('') + const hasActiveSearch = query.trim().length > 0 + + const { data, isLoading, isError, error } = useQuery( + trpc.teams.listApiKeys.queryOptions({ teamSlug }) + ) + + const apiKeys = data?.apiKeys ?? [] + + const sortedKeys = useMemo(() => { + const normal = apiKeys.filter((k) => k.name !== CLI_GENERATED_KEY_NAME) + const cli = apiKeys.filter((k) => k.name === CLI_GENERATED_KEY_NAME) + return [...normal, ...cli] + }, [apiKeys]) + + const filtered = useMemo(() => { + return sortedKeys.filter((k) => matchesApiKeySearch(k, query)) + }, [sortedKeys, query]) + + if (isLoading) { + return ( ++ These keys authenticate API requests from your team's + applications. +
+