2021-02-27 16:33:54 +01:00
|
|
|
import Icon from '@components/Icon'
|
2022-05-07 00:52:32 +02:00
|
|
|
import CustomText from '@components/Text'
|
2021-02-27 16:33:54 +01:00
|
|
|
import { QueryKeyTimeline, useTimelineQuery } from '@utils/queryHooks/timeline'
|
|
|
|
import { StyleConstants } from '@utils/styles/constants'
|
|
|
|
import { useTheme } from '@utils/styles/ThemeManager'
|
|
|
|
import React from 'react'
|
|
|
|
import { Trans } from 'react-i18next'
|
2022-05-07 00:52:32 +02:00
|
|
|
import { View } from 'react-native'
|
2021-02-27 16:33:54 +01:00
|
|
|
import { Circle } from 'react-native-animated-spinkit'
|
|
|
|
|
|
|
|
export interface Props {
|
|
|
|
queryKey: QueryKeyTimeline
|
|
|
|
disableInfinity: boolean
|
|
|
|
}
|
|
|
|
|
2022-12-24 01:18:20 +01:00
|
|
|
const TimelineFooter: React.FC<Props> = ({ queryKey, disableInfinity }) => {
|
|
|
|
const { hasNextPage } = useTimelineQuery({
|
|
|
|
...queryKey[1],
|
2023-01-07 18:01:08 +01:00
|
|
|
options: { enabled: !disableInfinity, notifyOnChangeProps: ['hasNextPage'] }
|
2022-12-24 01:18:20 +01:00
|
|
|
})
|
2021-02-27 16:33:54 +01:00
|
|
|
|
2022-12-24 01:18:20 +01:00
|
|
|
const { colors } = useTheme()
|
2021-02-27 16:33:54 +01:00
|
|
|
|
2022-12-24 01:18:20 +01:00
|
|
|
return (
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
flex: 1,
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'center',
|
|
|
|
padding: StyleConstants.Spacing.M
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{!disableInfinity && hasNextPage ? (
|
|
|
|
<Circle size={StyleConstants.Font.Size.L} color={colors.secondary} />
|
|
|
|
) : (
|
|
|
|
<CustomText fontStyle='S' style={{ color: colors.secondary }}>
|
|
|
|
<Trans
|
|
|
|
ns='componentTimeline'
|
|
|
|
i18nKey='end.message'
|
|
|
|
components={[
|
|
|
|
<Icon name='Coffee' size={StyleConstants.Font.Size.S} color={colors.secondary} />
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
</CustomText>
|
|
|
|
)}
|
|
|
|
</View>
|
|
|
|
)
|
|
|
|
}
|
2021-02-27 16:33:54 +01:00
|
|
|
|
|
|
|
export default TimelineFooter
|