2021-01-03 02:00:26 +01:00
|
|
|
import Icon from '@components/Icon'
|
|
|
|
import { StyleConstants } from '@utils/styles/constants'
|
|
|
|
import { useTheme } from '@utils/styles/ThemeManager'
|
2020-12-27 16:25:29 +01:00
|
|
|
import { LinearGradient } from 'expo-linear-gradient'
|
|
|
|
import React, { forwardRef } from 'react'
|
|
|
|
import { StyleSheet, Text, View } from 'react-native'
|
|
|
|
import ShimmerPlaceholder, {
|
|
|
|
createShimmerPlaceholder
|
|
|
|
} from 'react-native-shimmer-placeholder'
|
|
|
|
|
|
|
|
export interface Props {
|
|
|
|
account: Mastodon.Account | undefined
|
|
|
|
}
|
|
|
|
|
|
|
|
const AccountInformationAccount = forwardRef<ShimmerPlaceholder, Props>(
|
|
|
|
({ account }, ref) => {
|
|
|
|
const { theme } = useTheme()
|
|
|
|
|
|
|
|
const ShimmerPlaceholder = createShimmerPlaceholder(LinearGradient)
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ShimmerPlaceholder
|
|
|
|
ref={ref}
|
|
|
|
visible={account?.acct !== undefined}
|
|
|
|
width={StyleConstants.Font.Size.M * 8}
|
2021-01-15 01:15:27 +01:00
|
|
|
height={StyleConstants.Font.LineHeight.M}
|
2020-12-27 16:25:29 +01:00
|
|
|
style={{ marginBottom: StyleConstants.Spacing.L }}
|
2021-01-16 00:00:31 +01:00
|
|
|
shimmerColors={[
|
|
|
|
theme.shimmerDefault,
|
|
|
|
theme.shimmerHighlight,
|
|
|
|
theme.shimmerDefault
|
|
|
|
]}
|
2020-12-27 16:25:29 +01:00
|
|
|
>
|
|
|
|
<View style={styles.account}>
|
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
color: theme.secondary,
|
2020-12-29 00:21:05 +01:00
|
|
|
...StyleConstants.FontStyle.M
|
2020-12-27 16:25:29 +01:00
|
|
|
}}
|
|
|
|
selectable
|
|
|
|
>
|
|
|
|
@{account?.acct}
|
|
|
|
</Text>
|
2020-12-29 12:36:21 +01:00
|
|
|
{account?.locked ? (
|
2021-01-03 02:00:26 +01:00
|
|
|
<Icon
|
|
|
|
name='Lock'
|
|
|
|
style={styles.type}
|
|
|
|
color={theme.secondary}
|
|
|
|
size={StyleConstants.Font.Size.M}
|
|
|
|
/>
|
2020-12-29 12:36:21 +01:00
|
|
|
) : null}
|
|
|
|
{account?.bot ? (
|
2021-01-03 02:00:26 +01:00
|
|
|
<Icon
|
|
|
|
name='HardDrive'
|
2020-12-27 16:25:29 +01:00
|
|
|
style={styles.type}
|
|
|
|
color={theme.secondary}
|
2021-01-03 02:00:26 +01:00
|
|
|
size={StyleConstants.Font.Size.M}
|
2020-12-27 16:25:29 +01:00
|
|
|
/>
|
2020-12-29 12:36:21 +01:00
|
|
|
) : null}
|
2020-12-27 16:25:29 +01:00
|
|
|
</View>
|
|
|
|
</ShimmerPlaceholder>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
account: {
|
|
|
|
flexDirection: 'row',
|
|
|
|
alignItems: 'center'
|
|
|
|
},
|
|
|
|
type: { marginLeft: StyleConstants.Spacing.S }
|
|
|
|
})
|
|
|
|
|
2021-01-16 00:00:31 +01:00
|
|
|
export default React.memo(
|
|
|
|
AccountInformationAccount,
|
|
|
|
(_, next) => next.account === undefined
|
|
|
|
)
|