Merge branch 'main' into 4-update-to-react-native-070

This commit is contained in:
João Ferreiro
2022-12-06 17:20:42 +00:00
4 changed files with 30 additions and 34 deletions
+6 -5
View File
@@ -43,7 +43,7 @@ export class ProfileViewModel {
postsCount: number = 0 postsCount: number = 0
myState = new ProfileViewMyStateModel() myState = new ProfileViewMyStateModel()
// data to be implemented in the protocol // TODO TEMP data to be implemented in the protocol
userAvatar: string | null = null userAvatar: string | null = null
userBanner: string | null = null userBanner: string | null = null
@@ -121,13 +121,14 @@ export class ProfileViewModel {
async updateProfile( async updateProfile(
fn: (existing?: Profile.Record) => Profile.Record, fn: (existing?: Profile.Record) => Profile.Record,
userAvatar: string | null, userAvatar: string | null, // TODO TEMP
userBanner: string | null, userBanner: string | null, // TODO TEMP
) { ) {
await apilib.updateProfile(this.rootStore, this.did, fn) // TODO TEMP add userBanner & userAvatar in the protocol when suported
// add userBanner & userAvatar in the protocol when suported
this.userAvatar = userAvatar this.userAvatar = userAvatar
this.userBanner = userBanner this.userBanner = userBanner
await apilib.updateProfile(this.rootStore, this.did, fn)
await this.refresh() await this.refresh()
} }
+8 -11
View File
@@ -16,7 +16,7 @@ import * as Profile from '../../../third-party/api/src/client/types/app/bsky/act
import {UserBanner} from '../util/UserBanner' import {UserBanner} from '../util/UserBanner'
import {UserAvatar} from '../util/UserAvatar' import {UserAvatar} from '../util/UserAvatar'
export const snapPoints = ['60%'] export const snapPoints = ['80%']
export function Component({ export function Component({
profileView, profileView,
@@ -59,8 +59,8 @@ export function Component({
description, description,
} }
}, },
userAvatar, userAvatar, // TEMP
userBanner, userBanner, // TEMP
) )
Toast.show('Profile updated') Toast.show('Profile updated')
onUpdate?.() onUpdate?.()
@@ -79,14 +79,12 @@ export function Component({
<Text style={styles.title}>Edit my profile</Text> <Text style={styles.title}>Edit my profile</Text>
<View style={styles.photos}> <View style={styles.photos}>
<UserBanner <UserBanner
isMe
userBanner={userBanner} userBanner={userBanner}
setUserBanner={setUserBanner} setUserBanner={setUserBanner}
handle={profileView.handle} handle={profileView.handle}
/> />
<View style={styles.avi}> <View style={styles.avi}>
<UserAvatar <UserAvatar
isMe
size={80} size={80}
userAvatar={userAvatar} userAvatar={userAvatar}
handle={profileView.handle} handle={profileView.handle}
@@ -100,7 +98,7 @@ export function Component({
<ErrorMessage message={error} /> <ErrorMessage message={error} />
</View> </View>
)} )}
<View style={styles.group}> <View>
<Text style={styles.label}>Display Name</Text> <Text style={styles.label}>Display Name</Text>
<BottomSheetTextInput <BottomSheetTextInput
style={styles.textInput} style={styles.textInput}
@@ -109,7 +107,7 @@ export function Component({
onChangeText={v => setDisplayName(enforceLen(v, MAX_DISPLAY_NAME))} onChangeText={v => setDisplayName(enforceLen(v, MAX_DISPLAY_NAME))}
/> />
</View> </View>
<View style={styles.group}> <View style={s.pb10}>
<Text style={styles.label}>Description</Text> <Text style={styles.label}>Description</Text>
<BottomSheetTextInput <BottomSheetTextInput
style={[styles.textArea]} style={[styles.textArea]}
@@ -148,13 +146,11 @@ const styles = StyleSheet.create({
fontSize: 24, fontSize: 24,
marginBottom: 18, marginBottom: 18,
}, },
group: {
marginBottom: 10,
},
label: { label: {
fontWeight: 'bold', fontWeight: 'bold',
paddingHorizontal: 4, paddingHorizontal: 4,
paddingBottom: 4, paddingBottom: 4,
marginTop: 20,
}, },
textInput: { textInput: {
borderWidth: 1, borderWidth: 1,
@@ -195,6 +191,7 @@ const styles = StyleSheet.create({
backgroundColor: colors.white, backgroundColor: colors.white,
}, },
photos: { photos: {
marginBottom: 48, marginBottom: 36,
marginHorizontal: -14,
}, },
}) })
+8 -9
View File
@@ -100,8 +100,8 @@ export function UserAvatar({
<View style={styles.editButtonContainer}> <View style={styles.editButtonContainer}>
<FontAwesomeIcon <FontAwesomeIcon
icon="camera" icon="camera"
size={24} size={12}
style={{color: colors.gray1 + '99'}} style={{color: colors.white}}
/> />
</View> </View>
</TouchableOpacity> </TouchableOpacity>
@@ -135,15 +135,14 @@ function getInitials(str: string): string {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
editButtonContainer: { editButtonContainer: {
position: 'absolute', position: 'absolute',
width: 50, width: 24,
height: 50, height: 24,
top: '50%', bottom: 0,
left: '50%', right: 0,
borderRadius: 25, borderRadius: 12,
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
backgroundColor: colors.gray5 + '99', backgroundColor: colors.gray5,
transform: [{translateX: -25}, {translateY: -25}],
}, },
avatarImage: { avatarImage: {
width: 80, width: 80,
+8 -9
View File
@@ -89,8 +89,8 @@ export function UserBanner({
<View style={styles.editButtonContainer}> <View style={styles.editButtonContainer}>
<FontAwesomeIcon <FontAwesomeIcon
icon="camera" icon="camera"
size={24} size={12}
style={{color: colors.gray1 + '99'}} style={{color: colors.white}}
/> />
</View> </View>
</TouchableOpacity> </TouchableOpacity>
@@ -108,15 +108,14 @@ export function UserBanner({
const styles = StyleSheet.create({ const styles = StyleSheet.create({
editButtonContainer: { editButtonContainer: {
position: 'absolute', position: 'absolute',
width: 50, width: 24,
height: 50, height: 24,
top: '50%', bottom: 8,
left: '50%', right: 8,
borderRadius: 25, borderRadius: 12,
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
backgroundColor: colors.gray5 + '99', backgroundColor: colors.gray5,
transform: [{translateX: -25}, {translateY: -25}],
}, },
bannerImage: { bannerImage: {
width: '100%', width: '100%',