{subtitle}
-{t('You have two options: take a nap or be productive.')}
+{t('No items to show')}
; +} + +function LoadingMoreMessage() { + return ( + + ); +} + +function LoadingCompleteMessage() { + return{t('Nothing more to load')}
; +} + +const FlexOverscroll = styled('div')` + display: flex; + width: 100%; + height: 100%; + flex-direction: column; + overflow: auto; + overscroll-behavior: contain; + contain: strict; +`; + +const FlexListContainer = styled('div')` + position: absolute; + display: flex; + width: 100%; + flex-direction: column; +`; + +const PositionedList = styled('ul')` + position: absolute; + left: 0; + top: 0; + width: 100%; + + margin: 0; + padding: 0; + list-style: none; + & > li { + margin: 0; + padding: 0; + } +`; + +const Footer = styled('footer')` + position: absolute; + bottom: 0; + z-index: ${p => p.theme.zIndex.initial}; + display: flex; + width: 100%; + flex-grow: 1; + align-items: center; + justify-content: center; +`; diff --git a/static/app/components/infiniteList/infiniteListState.tsx b/static/app/components/infiniteList/infiniteListState.tsx new file mode 100644 index 00000000000000..aa76a7cbfe30c3 --- /dev/null +++ b/static/app/components/infiniteList/infiniteListState.tsx @@ -0,0 +1,60 @@ +import {Fragment} from 'react'; +import type {UseInfiniteQueryResult, UseQueryResult} from '@tanstack/react-query'; + +import type {ApiResult} from 'sentry/api'; +import {t} from 'sentry/locale'; + +interface Props { + children: React.ReactNode; + queryResult: + | Pick{t('Loading...')}
; +} + +function ErrorMessage({error}: {error: Error}) { + return{t('Error: %s', error.message)}
; +} + +function BackgroundUpdatingMessage() { + return ; +} diff --git a/static/app/utils/api/useFetchInfiniteListData.tsx b/static/app/utils/api/useFetchInfiniteListData.tsx deleted file mode 100644 index 5ef4b323376f2f..00000000000000 --- a/static/app/utils/api/useFetchInfiniteListData.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import {useCallback, useMemo} from 'react'; -import type {Index, IndexRange} from 'react-virtualized'; - -import type {InfiniteApiQueryKey} from 'sentry/utils/queryClient'; -import {useInfiniteApiQuery} from 'sentry/utils/queryClient'; - -function uniqueItems>( - items: Data[], - uniqueField: string -) { - const uniqueIds = new Set(items.map(item => item[uniqueField])); - return items.filter(item => { - if (uniqueIds.has(item[uniqueField])) { - uniqueIds.delete(item[uniqueField]); - return true; - } - return false; - }); -} - -interface Props { - queryKey: NonNullable