tooot/src/components/Timeline/Shared/FullConversation.tsx

40 lines
1.1 KiB
TypeScript
Raw Normal View History

2021-03-14 21:48:28 +01:00
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
2021-03-14 01:35:38 +01:00
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React from 'react'
import { useTranslation } from 'react-i18next'
import { Text } from 'react-native'
export interface Props {
2021-03-14 21:48:28 +01:00
queryKey?: QueryKeyTimeline
2021-03-14 01:35:38 +01:00
status: Mastodon.Status
}
const TimelineFullConversation = React.memo(
2021-03-14 21:48:28 +01:00
({ queryKey, status }: Props) => {
2021-03-14 01:35:38 +01:00
const { t } = useTranslation('componentTimeline')
const { theme } = useTheme()
2021-03-14 21:48:28 +01:00
return queryKey &&
queryKey[1].page !== 'Toot' &&
status.in_reply_to_account_id &&
2021-03-14 01:35:38 +01:00
(status.mentions.length === 0 ||
status.mentions.filter(
mention => mention.id !== status.in_reply_to_account_id
).length) ? (
<Text
style={{
2021-03-16 23:15:37 +01:00
...StyleConstants.FontStyle.S,
2021-03-14 01:35:38 +01:00
color: theme.blue,
2021-05-19 23:28:01 +02:00
marginTop: StyleConstants.Spacing.S
2021-03-14 01:35:38 +01:00
}}
>
{t('shared.fullConversation')}
</Text>
) : null
},
() => true
)
export default TimelineFullConversation