tooot/src/screens/Compose/Root/Header/PostingAs.tsx

35 lines
892 B
TypeScript
Raw Normal View History

import CustomText from '@components/Text'
2021-02-20 19:12:44 +01:00
import {
getInstanceAccount,
getInstanceUri
} from '@utils/slices/instancesSlice'
2021-01-19 01:13:45 +01:00
import { useTheme } from '@utils/styles/ThemeManager'
import React from 'react'
import { useTranslation } from 'react-i18next'
2021-01-24 02:25:43 +01:00
import { useSelector } from 'react-redux'
2021-01-19 01:13:45 +01:00
2021-01-24 02:25:43 +01:00
const ComposePostingAs = React.memo(
() => {
2021-03-28 23:31:10 +02:00
const { t } = useTranslation('screenCompose')
2022-02-12 14:51:01 +01:00
const { colors } = useTheme()
2021-01-19 01:13:45 +01:00
2021-02-20 19:12:44 +01:00
const instanceAccount = useSelector(
getInstanceAccount,
2021-02-10 00:40:44 +01:00
(prev, next) => prev?.acct === next?.acct
)
2021-02-20 19:12:44 +01:00
const instanceUri = useSelector(getInstanceUri)
2021-01-19 01:13:45 +01:00
2021-01-24 02:25:43 +01:00
return (
<CustomText fontStyle='S' style={{ color: colors.secondary }}>
2021-01-24 02:25:43 +01:00
{t('content.root.header.postingAs', {
2021-02-20 19:12:44 +01:00
acct: instanceAccount?.acct,
domain: instanceUri
2021-01-24 02:25:43 +01:00
})}
</CustomText>
2021-01-24 02:25:43 +01:00
)
},
() => true
)
2021-01-19 01:13:45 +01:00
export default ComposePostingAs