Add creator to scene profile header

zio/stable
Paul Frazee 2022-11-09 13:12:03 -06:00
parent 0cdfd089f5
commit 41a18bf32f
4 changed files with 39 additions and 20 deletions

View File

@ -27,6 +27,7 @@ export class ProfileViewModel {
did: string = ''
handle: string = ''
actorType = ACTOR_TYPE_USER
creator: string = ''
displayName?: string
description?: string
followersCount: number = 0
@ -145,6 +146,7 @@ export class ProfileViewModel {
this.did = res.data.did
this.handle = res.data.handle
this.actorType = res.data.actorType
this.creator = res.data.creator
this.displayName = res.data.displayName
this.description = res.data.description
this.followersCount = res.data.followersCount

View File

@ -18,6 +18,7 @@ import {getGradient} from '../../lib/asset-gen'
import Toast from '../util/Toast'
import {UserAvatar} from '../util/UserAvatar'
import {UserBanner} from '../util/UserBanner'
import {UserInfoText} from '../util/UserInfoText'
export const ProfileHeader = observer(function ProfileHeader({
view,
@ -194,19 +195,20 @@ export const ProfileHeader = observer(function ProfileHeader({
</Text>
</View>
</View>
{view.description && (
{view.description ? (
<Text style={[s.mb5, s.f16, s['lh16-1.3']]}>{view.description}</Text>
)}
{
undefined /*<View style={styles.badgesLine}>
<FontAwesomeIcon icon="shield" style={s.mr5} size={12} />
<Link href="/" title="Badge TODO">
<Text style={[s.f12, s.bold]}>
Employee <Text style={[s.blue3]}>@blueskyweb.xyz</Text>
</Text>
</Link>
</View>*/
}
) : undefined}
{view.isScene && view.creator ? (
<View style={styles.relationshipsLine}>
<Text style={[s.mr2, s.gray5]}>Created by</Text>
<UserInfoText
style={[s.blue3]}
did={view.creator}
prefix="@"
asLink
/>
</View>
) : undefined}
</View>
</View>
)
@ -313,7 +315,7 @@ const styles = StyleSheet.create({
fontSize: 15,
},
badgesLine: {
relationshipsLine: {
flexDirection: 'row',
alignItems: 'center',
marginBottom: 10,

View File

@ -1,6 +1,7 @@
import React, {useState, useEffect} from 'react'
import * as GetProfile from '../../../third-party/api/src/client/types/app/bsky/actor/getProfile'
import {StyleProp, Text, TextStyle} from 'react-native'
import {Link} from './Link'
import {useStores} from '../../../state'
export function UserInfoText({
@ -10,6 +11,7 @@ export function UserInfoText({
failed,
prefix,
style,
asLink,
}: {
did: string
attr?: keyof GetProfile.OutputSchema
@ -17,6 +19,7 @@ export function UserInfoText({
failed?: string
prefix?: string
style?: StyleProp<TextStyle>
asLink?: boolean
}) {
attr = attr || 'handle'
loading = loading || '...'
@ -46,9 +49,26 @@ export function UserInfoText({
}
}, [did, store.api.app.bsky])
if (asLink) {
const title = profile?.displayName || profile?.handle || 'User'
return (
<Link
href={`/profile/${profile?.handle ? profile.handle : did}`}
title={title}>
<Text style={style}>
{didFail
? failed
: profile
? `${prefix || ''}${profile[attr]}`
: loading}
</Text>
</Link>
)
}
return (
<Text style={style}>
{didFail ? failed : profile ? `${prefix}${profile[attr]}` : loading}
{didFail ? failed : profile ? `${prefix || ''}${profile[attr]}` : loading}
</Text>
)
}

View File

@ -9,22 +9,16 @@ Paul's todo list
- *
- Avatars
- SVG generate
- Main menu
- Scenes list
- Create scene view
- *
- Discover scenes view
- *
- User profile
- Distinguish by declared type
- User
- List scenes
- Invite to scene
- Remove from scene
- Scene
- Trending
- Members
- Profile header
- Invite to scene
- Remove from scene
- Edit profile
@ -41,6 +35,7 @@ Paul's todo list
- Reposted by
- Followers list
- Follows list
- Members list
- Bugs
- Follows are broken
- Auth token refresh seems broken