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

40 lines
1.1 KiB
TypeScript
Raw Normal View History

import CustomText from '@components/Text'
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'
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')
2022-02-12 14:51:01 +01:00
const { colors } = useTheme()
2021-03-14 01:35:38 +01:00
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) ? (
<CustomText
fontStyle='S'
2021-03-14 01:35:38 +01:00
style={{
2022-02-12 14:51:01 +01:00
color: colors.blue,
2021-05-19 23:28:01 +02:00
marginTop: StyleConstants.Spacing.S
2021-03-14 01:35:38 +01:00
}}
>
{t('shared.fullConversation')}
</CustomText>
2021-03-14 01:35:38 +01:00
) : null
},
() => true
)
export default TimelineFullConversation