import { cn } from '@graphiql/react' import { useIntersectionObserver } from '@uidotdev/usehooks' import { Fragment, useEffect } from 'react' import { Card, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from 'ui' import { PageSection, PageSectionContent, PageSectionDescription, PageSectionMeta, PageSectionSummary, PageSectionTitle, } from 'ui-patterns/PageSection' import { ShimmeringLoader } from 'ui-patterns/ShimmeringLoader' import { GrantRow } from './GrantRow' import { AlertError } from '@/components/ui/AlertError' import { useOAuthGrantsQuery } from '@/data/oauth-apps/oauth-apps-grants-query' export const OAuthApps = () => { const { data, hasNextPage, fetchNextPage, isFetchingNextPage, isPending, isSuccess, isError, error, } = useOAuthGrantsQuery({}) const [sentinelRef, entry] = useIntersectionObserver({ root: null, threshold: 0, rootMargin: '0px', }) useEffect(() => { if (hasNextPage && entry?.isIntersecting && !isFetchingNextPage && !isError) { fetchNextPage() } }, [hasNextPage, entry?.isIntersecting, fetchNextPage, isFetchingNextPage, isError]) return ( Authorized apps Applications that have access to your organizations and projects {isPending && (
)} {isError && } {isSuccess && ( App Organization Approved at Actions {data.pages.length === 0 || data.pages[0].data.length === 0 ? (

No results found

No apps have been authorized for your account yet.

) : ( <> {data.pages.map((page, pageIndex) => ( {page.data.map((grant, index) => ( ))} ))}

{isFetchingNextPage ? 'Loading...' : ''}

)}
)}
) }