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

View File

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

View File

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

View File

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