import React from 'react' import {atoms as a, useBreakpoints, useTheme} from '#/alf' import {View} from 'react-native' import {useLingui} from '@lingui/react' import {Trans, msg} from '@lingui/macro' import {CenteredView} from 'view/com/util/Views' import {Loader} from '#/components/Loader' import {cleanError} from 'lib/strings/errors' import {Button} from '#/components/Button' import {Text} from '#/components/Typography' import {Error} from '#/components/Error' export function ListFooter({ isFetching, isError, error, onRetry, height, }: { isFetching?: boolean isError?: boolean error?: string onRetry?: () => Promise height?: number }) { const t = useTheme() return ( {isFetching ? ( ) : ( )} ) } function ListFooterMaybeError({ isError, error, onRetry, }: { isError?: boolean error?: string onRetry?: () => Promise }) { const t = useTheme() const {_} = useLingui() if (!isError) return null return ( {error ? ( cleanError(error) ) : ( Oops, something went wrong! )} ) } export function ListHeaderDesktop({ title, subtitle, }: { title: string subtitle?: string }) { const {gtTablet} = useBreakpoints() const t = useTheme() if (!gtTablet) return null return ( {title} {subtitle ? ( {subtitle} ) : undefined} ) } export function ListMaybePlaceholder({ isLoading, isEmpty, isError, emptyTitle, emptyMessage, errorTitle, errorMessage, emptyType = 'page', onRetry, }: { isLoading: boolean isEmpty?: boolean isError?: boolean emptyTitle?: string emptyMessage?: string errorTitle?: string errorMessage?: string emptyType?: 'page' | 'results' onRetry?: () => Promise }) { const t = useTheme() const {_} = useLingui() const {gtMobile, gtTablet} = useBreakpoints() if (!isLoading && isError) { return ( ) } if (isLoading) { return ( ) } if (isEmpty) { return ( ) } }