2021-01-01 23:10:47 +01:00
|
|
|
import openLink from '@components/openLink'
|
2022-05-07 00:52:32 +02:00
|
|
|
import CustomText from '@components/Text'
|
2021-01-01 23:10:47 +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 {
|
|
|
|
application?: Mastodon.Application
|
|
|
|
}
|
|
|
|
|
2021-03-06 21:01:38 +01:00
|
|
|
const HeaderSharedApplication = React.memo(
|
|
|
|
({ application }: Props) => {
|
2022-02-12 14:51:01 +01:00
|
|
|
const { colors } = useTheme()
|
2021-03-06 21:01:38 +01:00
|
|
|
const { t } = useTranslation('componentTimeline')
|
2021-01-01 23:10:47 +01:00
|
|
|
|
2021-03-06 21:01:38 +01:00
|
|
|
return application && application.name !== 'Web' ? (
|
2022-05-07 00:52:32 +02:00
|
|
|
<CustomText
|
|
|
|
fontStyle='S'
|
2021-04-09 21:43:12 +02:00
|
|
|
accessibilityRole='link'
|
2021-03-06 21:01:38 +01:00
|
|
|
onPress={async () => {
|
|
|
|
application.website && (await openLink(application.website))
|
|
|
|
}}
|
2022-05-07 00:52:32 +02:00
|
|
|
style={{
|
|
|
|
marginLeft: StyleConstants.Spacing.S,
|
|
|
|
color: colors.secondary
|
|
|
|
}}
|
2021-03-13 14:18:14 +01:00
|
|
|
numberOfLines={1}
|
2021-03-06 21:01:38 +01:00
|
|
|
>
|
|
|
|
{t('shared.header.shared.application', {
|
|
|
|
application: application.name
|
|
|
|
})}
|
2022-05-07 00:52:32 +02:00
|
|
|
</CustomText>
|
2021-03-06 21:01:38 +01:00
|
|
|
) : null
|
|
|
|
},
|
|
|
|
() => true
|
|
|
|
)
|
2021-01-01 23:10:47 +01:00
|
|
|
|
|
|
|
export default HeaderSharedApplication
|