2021-06-01 22:27:27 +02:00
|
|
|
import { useRoute } from '@react-navigation/native'
|
2020-12-13 14:04:25 +01:00
|
|
|
import { StyleConstants } from '@utils/styles/constants'
|
2021-01-23 02:41:50 +01:00
|
|
|
import { useTheme } from '@utils/styles/ThemeManager'
|
2022-08-07 01:18:10 +02:00
|
|
|
import React from 'react'
|
2021-01-23 02:41:50 +01:00
|
|
|
import { StyleSheet, View } from 'react-native'
|
2022-12-28 23:41:36 +01:00
|
|
|
import { Fade, Placeholder } from 'rn-placeholder'
|
2020-12-27 16:25:29 +01:00
|
|
|
import AccountInformationAccount from './Information/Account'
|
|
|
|
import AccountInformationActions from './Information/Actions'
|
2021-01-07 19:13:09 +01:00
|
|
|
import AccountInformationAvatar from './Information/Avatar'
|
|
|
|
import AccountInformationCreated from './Information/Created'
|
2020-12-27 16:25:29 +01:00
|
|
|
import AccountInformationFields from './Information/Fields'
|
2021-01-07 19:13:09 +01:00
|
|
|
import AccountInformationName from './Information/Name'
|
2021-05-09 21:59:03 +02:00
|
|
|
import AccountInformationNote from './Information/Note'
|
2021-01-07 19:13:09 +01:00
|
|
|
import AccountInformationStats from './Information/Stats'
|
2020-11-22 00:46:23 +01:00
|
|
|
|
|
|
|
export interface Props {
|
|
|
|
account: Mastodon.Account | undefined
|
|
|
|
}
|
|
|
|
|
2022-12-20 10:47:33 +01:00
|
|
|
const AccountInformation: React.FC<Props> = ({ account }) => {
|
|
|
|
const { colors } = useTheme()
|
2021-01-23 02:41:50 +01:00
|
|
|
|
2022-12-20 10:47:33 +01:00
|
|
|
const { name } = useRoute()
|
|
|
|
const myInfo = name !== 'Tab-Shared-Account'
|
2021-06-01 22:27:27 +02:00
|
|
|
|
2022-12-20 10:47:33 +01:00
|
|
|
return (
|
|
|
|
<View style={styles.base}>
|
|
|
|
<Placeholder
|
|
|
|
Animation={props => (
|
|
|
|
<Fade {...props} style={{ backgroundColor: colors.shimmerHighlight }} />
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
<View style={styles.avatarAndActions}>
|
|
|
|
<AccountInformationAvatar account={account} myInfo={myInfo} />
|
|
|
|
<AccountInformationActions account={account} myInfo={myInfo} />
|
|
|
|
</View>
|
2020-11-22 00:46:23 +01:00
|
|
|
|
2022-12-20 10:47:33 +01:00
|
|
|
<AccountInformationName account={account} />
|
2020-12-14 23:44:57 +01:00
|
|
|
|
2022-12-28 23:41:36 +01:00
|
|
|
<AccountInformationAccount account={account} myInfo={myInfo} />
|
2020-11-22 00:46:23 +01:00
|
|
|
|
2022-12-20 10:47:33 +01:00
|
|
|
<AccountInformationFields account={account} myInfo={myInfo} />
|
2020-11-23 00:07:32 +01:00
|
|
|
|
2022-12-20 10:47:33 +01:00
|
|
|
<AccountInformationNote account={account} myInfo={myInfo} />
|
2021-05-09 21:59:03 +02:00
|
|
|
|
2022-12-20 10:47:33 +01:00
|
|
|
<AccountInformationCreated account={account} hidden={myInfo} />
|
2021-05-09 21:59:03 +02:00
|
|
|
|
2022-12-20 10:47:33 +01:00
|
|
|
<AccountInformationStats account={account} myInfo={myInfo} />
|
|
|
|
</Placeholder>
|
|
|
|
</View>
|
|
|
|
)
|
|
|
|
}
|
2020-11-22 00:46:23 +01:00
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
2020-12-21 21:47:15 +01:00
|
|
|
base: {
|
2021-02-01 02:16:53 +01:00
|
|
|
marginTop: -StyleConstants.Avatar.L / 2,
|
2021-01-16 00:00:31 +01:00
|
|
|
padding: StyleConstants.Spacing.Global.PagePadding
|
2020-11-23 00:07:32 +01:00
|
|
|
},
|
2020-12-21 21:47:15 +01:00
|
|
|
avatarAndActions: {
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'space-between'
|
2021-01-07 19:13:09 +01:00
|
|
|
},
|
|
|
|
actions: {
|
|
|
|
alignSelf: 'flex-end',
|
|
|
|
flexDirection: 'row'
|
2020-11-22 00:46:23 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2021-05-09 21:59:03 +02:00
|
|
|
export default AccountInformation
|