2021-01-03 02:00:26 +01:00
|
|
|
import Icon from '@components/Icon'
|
2022-05-07 00:52:32 +02:00
|
|
|
import CustomText from '@components/Text'
|
2023-01-17 15:35:36 +01:00
|
|
|
import { useAccountStorage } from '@utils/storage/actions'
|
2021-01-03 02:00:26 +01:00
|
|
|
import { StyleConstants } from '@utils/styles/constants'
|
|
|
|
import { useTheme } from '@utils/styles/ThemeManager'
|
2023-01-02 02:08:12 +01:00
|
|
|
import React, { useContext } from 'react'
|
2022-05-08 00:24:15 +02:00
|
|
|
import { useTranslation } from 'react-i18next'
|
2022-05-07 00:52:32 +02:00
|
|
|
import { View } from 'react-native'
|
2021-01-23 02:41:50 +01:00
|
|
|
import { PlaceholderLine } from 'rn-placeholder'
|
2023-01-02 02:08:12 +01:00
|
|
|
import AccountContext from '../Context'
|
2020-12-27 16:25:29 +01:00
|
|
|
|
2023-01-02 02:08:12 +01:00
|
|
|
const AccountInformationAccount: React.FC = () => {
|
2023-02-25 23:42:04 +01:00
|
|
|
const { account, relationship, pageMe, localInstance } = useContext(AccountContext)
|
2020-12-27 16:25:29 +01:00
|
|
|
|
2022-05-08 00:24:15 +02:00
|
|
|
const { t } = useTranslation('screenTabs')
|
2022-02-12 14:51:01 +01:00
|
|
|
const { colors } = useTheme()
|
2022-12-28 23:41:36 +01:00
|
|
|
|
|
|
|
const [acct] = useAccountStorage.string('auth.account.acct')
|
2023-01-17 15:35:36 +01:00
|
|
|
const [domain] = useAccountStorage.string('auth.account.domain')
|
2020-12-27 16:25:29 +01:00
|
|
|
|
2023-01-02 02:08:12 +01:00
|
|
|
if (account || pageMe) {
|
2020-12-27 16:25:29 +01:00
|
|
|
return (
|
2021-01-23 02:41:50 +01:00
|
|
|
<View
|
2022-05-07 00:52:32 +02:00
|
|
|
style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
alignItems: 'center',
|
|
|
|
borderRadius: 0,
|
|
|
|
marginBottom: StyleConstants.Spacing.L
|
|
|
|
}}
|
2020-12-27 16:25:29 +01:00
|
|
|
>
|
2022-05-29 17:28:27 +02:00
|
|
|
<CustomText fontStyle='M' style={{ color: colors.secondary }}>
|
|
|
|
{account?.moved ? (
|
|
|
|
<>
|
|
|
|
{' '}
|
|
|
|
<CustomText selectable>@{account.moved.acct}</CustomText>
|
|
|
|
</>
|
|
|
|
) : null}
|
|
|
|
<CustomText
|
|
|
|
style={{
|
2022-12-12 20:43:45 +01:00
|
|
|
textDecorationLine: account?.moved || account?.suspended ? 'line-through' : undefined
|
2022-05-29 17:28:27 +02:00
|
|
|
}}
|
|
|
|
selectable
|
|
|
|
>
|
2023-01-02 02:08:12 +01:00
|
|
|
@{pageMe ? acct : account?.acct}
|
2022-12-28 23:41:36 +01:00
|
|
|
{localInstance ? `@${domain}` : null}
|
2022-05-08 00:24:15 +02:00
|
|
|
</CustomText>
|
2022-05-29 17:28:27 +02:00
|
|
|
{relationship?.followed_by ? t('shared.account.followed_by') : null}
|
|
|
|
</CustomText>
|
2021-01-23 02:41:50 +01:00
|
|
|
{account?.locked ? (
|
|
|
|
<Icon
|
2023-01-25 00:15:46 +01:00
|
|
|
name='lock'
|
2022-05-07 00:52:32 +02:00
|
|
|
style={{ marginLeft: StyleConstants.Spacing.S }}
|
2022-02-12 14:51:01 +01:00
|
|
|
color={colors.secondary}
|
2021-01-23 02:41:50 +01:00
|
|
|
size={StyleConstants.Font.Size.M}
|
|
|
|
/>
|
|
|
|
) : null}
|
|
|
|
{account?.bot ? (
|
|
|
|
<Icon
|
2023-01-25 00:15:46 +01:00
|
|
|
name='hard-drive'
|
2022-05-07 00:52:32 +02:00
|
|
|
style={{ marginLeft: StyleConstants.Spacing.S }}
|
2022-02-12 14:51:01 +01:00
|
|
|
color={colors.secondary}
|
2021-01-23 02:41:50 +01:00
|
|
|
size={StyleConstants.Font.Size.M}
|
|
|
|
/>
|
|
|
|
) : null}
|
|
|
|
</View>
|
|
|
|
)
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<PlaceholderLine
|
2021-04-24 15:03:17 +02:00
|
|
|
width={StyleConstants.Font.Size.M * 3}
|
2021-01-23 02:41:50 +01:00
|
|
|
height={StyleConstants.Font.LineHeight.M}
|
2022-02-12 14:51:01 +01:00
|
|
|
color={colors.shimmerDefault}
|
2021-01-23 02:41:50 +01:00
|
|
|
noMargin
|
2022-05-07 00:52:32 +02:00
|
|
|
style={{ borderRadius: 0, marginBottom: StyleConstants.Spacing.L }}
|
2021-01-23 02:41:50 +01:00
|
|
|
/>
|
2020-12-27 16:25:29 +01:00
|
|
|
)
|
|
|
|
}
|
2021-01-23 02:41:50 +01:00
|
|
|
}
|
2020-12-27 16:25:29 +01:00
|
|
|
|
2022-12-12 20:43:45 +01:00
|
|
|
export default AccountInformationAccount
|