2021-01-01 16:48:16 +01:00
|
|
|
import { ParseEmojis } from '@components/Parse'
|
2022-05-07 00:52:32 +02:00
|
|
|
import CustomText from '@components/Text'
|
2021-01-01 16:48:16 +01:00
|
|
|
import { StyleConstants } from '@utils/styles/constants'
|
|
|
|
import { useTheme } from '@utils/styles/ThemeManager'
|
2022-09-18 01:02:25 +02:00
|
|
|
import React, { useMemo } from 'react'
|
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'
|
2020-12-27 16:25:29 +01:00
|
|
|
|
|
|
|
export interface Props {
|
|
|
|
account: Mastodon.Account | undefined
|
|
|
|
}
|
|
|
|
|
2022-09-18 01:02:25 +02:00
|
|
|
const AccountInformationName: React.FC<Props> = ({ account }) => {
|
2022-02-12 14:51:01 +01:00
|
|
|
const { colors } = useTheme()
|
2020-12-27 16:25:29 +01:00
|
|
|
|
2021-01-23 02:41:50 +01:00
|
|
|
const movedContent = useMemo(() => {
|
|
|
|
if (account?.moved) {
|
|
|
|
return (
|
2022-05-07 00:52:32 +02:00
|
|
|
<View style={{ marginLeft: StyleConstants.Spacing.S }}>
|
2021-01-23 02:41:50 +01:00
|
|
|
<ParseEmojis
|
|
|
|
content={account.moved.display_name || account.moved.username}
|
|
|
|
emojis={account.moved.emojis}
|
|
|
|
size='L'
|
|
|
|
fontBold
|
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}, [account?.moved])
|
|
|
|
|
2021-04-24 15:03:17 +02:00
|
|
|
return (
|
2022-05-07 00:52:32 +02:00
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
borderRadius: 0,
|
|
|
|
marginTop: StyleConstants.Spacing.S,
|
|
|
|
marginBottom: StyleConstants.Spacing.XS,
|
|
|
|
flexDirection: 'row'
|
|
|
|
}}
|
|
|
|
>
|
2021-04-24 15:03:17 +02:00
|
|
|
{account ? (
|
2022-09-18 01:02:25 +02:00
|
|
|
<>
|
|
|
|
<CustomText
|
|
|
|
style={{
|
2022-11-06 23:39:31 +01:00
|
|
|
textDecorationLine: account?.moved || account.suspended ? 'line-through' : undefined
|
2022-09-18 01:02:25 +02:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
<ParseEmojis
|
|
|
|
content={account.display_name || account.username}
|
|
|
|
emojis={account.emojis}
|
|
|
|
size='L'
|
|
|
|
fontBold
|
|
|
|
/>
|
|
|
|
</CustomText>
|
|
|
|
{movedContent}
|
|
|
|
</>
|
2021-04-24 15:03:17 +02:00
|
|
|
) : (
|
|
|
|
<PlaceholderLine
|
|
|
|
width={StyleConstants.Font.Size.L * 2}
|
|
|
|
height={StyleConstants.Font.LineHeight.L}
|
2022-02-12 14:51:01 +01:00
|
|
|
color={colors.shimmerDefault}
|
2021-04-24 15:03:17 +02:00
|
|
|
noMargin
|
|
|
|
style={{ borderRadius: 0 }}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</View>
|
|
|
|
)
|
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 AccountInformationName
|