mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import React, {memo} from 'react'
2import {StyleSheet, View} from 'react-native'
3import {
4 AppBskyActorDefs,
5 AppBskyLabelerDefs,
6 ModerationOpts,
7 RichText as RichTextAPI,
8} from '@atproto/api'
9
10import {LoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder'
11import {useTheme} from '#/alf'
12import {ProfileHeaderLabeler} from './ProfileHeaderLabeler'
13import {ProfileHeaderStandard} from './ProfileHeaderStandard'
14
15let ProfileHeaderLoading = (_props: {}): React.ReactNode => {
16 const t = useTheme()
17 return (
18 <View style={t.atoms.bg}>
19 <LoadingPlaceholder width="100%" height={150} style={{borderRadius: 0}} />
20 <View
21 style={[
22 t.atoms.bg,
23 {borderColor: t.atoms.bg.backgroundColor},
24 styles.avi,
25 ]}>
26 <LoadingPlaceholder width={90} height={90} style={styles.br45} />
27 </View>
28 <View style={styles.content}>
29 <View style={[styles.buttonsLine]}>
30 <LoadingPlaceholder width={167} height={36} style={styles.br50} />
31 </View>
32 </View>
33 </View>
34 )
35}
36ProfileHeaderLoading = memo(ProfileHeaderLoading)
37export {ProfileHeaderLoading}
38
39interface Props {
40 profile: AppBskyActorDefs.ProfileViewDetailed
41 labeler: AppBskyLabelerDefs.LabelerViewDetailed | undefined
42 descriptionRT: RichTextAPI | null
43 moderationOpts: ModerationOpts
44 hideBackButton?: boolean
45 isPlaceholderProfile?: boolean
46}
47
48let ProfileHeader = (props: Props): React.ReactNode => {
49 if (props.profile.associated?.labeler) {
50 if (!props.labeler) {
51 return <ProfileHeaderLoading />
52 }
53 return <ProfileHeaderLabeler {...props} labeler={props.labeler} />
54 }
55 return <ProfileHeaderStandard {...props} />
56}
57ProfileHeader = memo(ProfileHeader)
58export {ProfileHeader}
59
60const styles = StyleSheet.create({
61 avi: {
62 position: 'absolute',
63 top: 110,
64 left: 10,
65 width: 94,
66 height: 94,
67 borderRadius: 47,
68 borderWidth: 2,
69 },
70 content: {
71 paddingTop: 12,
72 paddingHorizontal: 14,
73 paddingBottom: 4,
74 },
75 buttonsLine: {
76 flexDirection: 'row',
77 marginLeft: 'auto',
78 marginBottom: 12,
79 },
80 br45: {borderRadius: 45},
81 br50: {borderRadius: 50},
82})