move edit photos onto edit profile modal
This commit is contained in:
@@ -13,6 +13,8 @@ import {
|
|||||||
MAX_DESCRIPTION,
|
MAX_DESCRIPTION,
|
||||||
} from '../../../lib/strings'
|
} from '../../../lib/strings'
|
||||||
import * as Profile from '../../../third-party/api/src/client/types/app/bsky/actor/profile'
|
import * as Profile from '../../../third-party/api/src/client/types/app/bsky/actor/profile'
|
||||||
|
import {UserBanner} from '../util/UserBanner'
|
||||||
|
import {UserAvatar} from '../util/UserAvatar'
|
||||||
|
|
||||||
export const snapPoints = ['60%']
|
export const snapPoints = ['60%']
|
||||||
|
|
||||||
@@ -67,6 +69,17 @@ export function Component({
|
|||||||
<View style={s.flex1}>
|
<View style={s.flex1}>
|
||||||
<BottomSheetScrollView style={styles.inner}>
|
<BottomSheetScrollView style={styles.inner}>
|
||||||
<Text style={styles.title}>Edit my profile</Text>
|
<Text style={styles.title}>Edit my profile</Text>
|
||||||
|
<View style={styles.photos}>
|
||||||
|
<UserBanner isEditable handle={profileView.handle} />
|
||||||
|
<View style={styles.avi}>
|
||||||
|
<UserAvatar
|
||||||
|
isEditable
|
||||||
|
size={80}
|
||||||
|
displayName={profileView.displayName}
|
||||||
|
handle={profileView.handle}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
{error !== '' && (
|
{error !== '' && (
|
||||||
<View style={s.mb10}>
|
<View style={s.mb10}>
|
||||||
<ErrorMessage message={error} />
|
<ErrorMessage message={error} />
|
||||||
@@ -155,4 +168,18 @@ const styles = StyleSheet.create({
|
|||||||
padding: 10,
|
padding: 10,
|
||||||
marginBottom: 10,
|
marginBottom: 10,
|
||||||
},
|
},
|
||||||
|
avi: {
|
||||||
|
position: 'absolute',
|
||||||
|
top: 80,
|
||||||
|
left: 10,
|
||||||
|
width: 84,
|
||||||
|
height: 84,
|
||||||
|
borderWidth: 2,
|
||||||
|
borderRadius: 42,
|
||||||
|
borderColor: colors.white,
|
||||||
|
backgroundColor: colors.white,
|
||||||
|
},
|
||||||
|
photos: {
|
||||||
|
marginBottom: 48,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -152,11 +152,10 @@ export const ProfileHeader = observer(function ProfileHeader({
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<View style={styles.outer}>
|
<View style={styles.outer}>
|
||||||
<UserBanner isMe={isMe} handle={view.handle} />
|
<UserBanner handle={view.handle} />
|
||||||
<View style={styles.avi}>
|
<View style={styles.avi}>
|
||||||
<UserAvatar
|
<UserAvatar
|
||||||
size={80}
|
size={80}
|
||||||
isMe={isMe}
|
|
||||||
displayName={view.displayName}
|
displayName={view.displayName}
|
||||||
handle={view.handle}
|
handle={view.handle}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,30 +1,31 @@
|
|||||||
import React, {useCallback, useState} from 'react'
|
import React, {useCallback} from 'react'
|
||||||
import {StyleSheet, View, TouchableOpacity, Alert, Image} from 'react-native'
|
import {StyleSheet, View, TouchableOpacity, Alert, Image} from 'react-native'
|
||||||
import Svg, {Circle, Text, Defs, LinearGradient, Stop} from 'react-native-svg'
|
import Svg, {Circle, Text, Defs, LinearGradient, Stop} from 'react-native-svg'
|
||||||
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||||
import {openCamera, openCropper, openPicker} from 'react-native-image-crop-picker'
|
import {
|
||||||
|
openCamera,
|
||||||
|
openCropper,
|
||||||
|
openPicker,
|
||||||
|
} from 'react-native-image-crop-picker'
|
||||||
import {getGradient} from '../../lib/asset-gen'
|
import {getGradient} from '../../lib/asset-gen'
|
||||||
import {colors} from '../../lib/styles'
|
import {colors} from '../../lib/styles'
|
||||||
|
|
||||||
export function UserAvatar({
|
export function UserAvatar({
|
||||||
isMe = false,
|
isEditable = false,
|
||||||
size,
|
size,
|
||||||
handle,
|
handle,
|
||||||
displayName,
|
displayName,
|
||||||
}: {
|
}: {
|
||||||
isMe?: boolean
|
isEditable?: boolean
|
||||||
size: number
|
size: number
|
||||||
handle: string
|
handle: string
|
||||||
displayName: string | undefined
|
displayName: string | undefined
|
||||||
}) {
|
}) {
|
||||||
const [localAvatarPicture, setLocalAvatarPicture] = useState<string | null>(
|
|
||||||
null,
|
|
||||||
)
|
|
||||||
const initials = getInitials(displayName || handle)
|
const initials = getInitials(displayName || handle)
|
||||||
const gradient = getGradient(handle)
|
const gradient = getGradient(handle)
|
||||||
|
|
||||||
const handleEditAvatar = useCallback(() => {
|
const handleEditAvatar = useCallback(() => {
|
||||||
Alert.alert('', 'Select upload method', [
|
Alert.alert('Select upload method', '', [
|
||||||
{
|
{
|
||||||
text: 'Take a new photo',
|
text: 'Take a new photo',
|
||||||
onPress: () => {
|
onPress: () => {
|
||||||
@@ -35,7 +36,8 @@ export function UserAvatar({
|
|||||||
height: 80,
|
height: 80,
|
||||||
cropperCircleOverlay: true,
|
cropperCircleOverlay: true,
|
||||||
}).then(item => {
|
}).then(item => {
|
||||||
setLocalAvatarPicture(item.path)
|
// setLocalAvatarPicture(item.path)
|
||||||
|
console.log(item)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -52,7 +54,8 @@ export function UserAvatar({
|
|||||||
height: 80,
|
height: 80,
|
||||||
cropperCircleOverlay: true,
|
cropperCircleOverlay: true,
|
||||||
}).then(croppedItem => {
|
}).then(croppedItem => {
|
||||||
setLocalAvatarPicture(croppedItem.path)
|
// setLocalAvatarPicture(croppedItem.path)
|
||||||
|
console.log(croppedItem)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -81,13 +84,14 @@ export function UserAvatar({
|
|||||||
</Svg>
|
</Svg>
|
||||||
)
|
)
|
||||||
|
|
||||||
return isMe ? (
|
return isEditable ? (
|
||||||
<TouchableOpacity onPress={handleEditAvatar}>
|
<TouchableOpacity onPress={handleEditAvatar}>
|
||||||
{localAvatarPicture != null ? (
|
{/* {localAvatarPicture != null ? (
|
||||||
<Image style={styles.avatarImage} source={{uri: localAvatarPicture}} />
|
<Image style={styles.avatarImage} source={{uri: localAvatarPicture}} />
|
||||||
) : (
|
) : (
|
||||||
renderSvg(size, initials)
|
renderSvg(size, initials)
|
||||||
)}
|
)} */}
|
||||||
|
{renderSvg(size, initials)}
|
||||||
<View style={styles.editButtonContainer}>
|
<View style={styles.editButtonContainer}>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon="camera"
|
icon="camera"
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
import React, {useCallback, useState} from 'react'
|
import React, {useCallback} from 'react'
|
||||||
import {StyleSheet, View, TouchableOpacity, Alert, Image} from 'react-native'
|
import {StyleSheet, View, TouchableOpacity, Alert, Image} from 'react-native'
|
||||||
import Svg, {Rect, Defs, LinearGradient, Stop} from 'react-native-svg'
|
import Svg, {Rect, Defs, LinearGradient, Stop} from 'react-native-svg'
|
||||||
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||||
import {getGradient} from '../../lib/asset-gen'
|
import {getGradient} from '../../lib/asset-gen'
|
||||||
import {colors} from '../../lib/styles'
|
import {colors} from '../../lib/styles'
|
||||||
import {openCamera, openCropper, openPicker} from 'react-native-image-crop-picker'
|
import {
|
||||||
|
openCamera,
|
||||||
|
openCropper,
|
||||||
|
openPicker,
|
||||||
|
} from 'react-native-image-crop-picker'
|
||||||
|
|
||||||
export function UserBanner({
|
export function UserBanner({
|
||||||
handle,
|
handle,
|
||||||
isMe = false,
|
isEditable = false,
|
||||||
}: {
|
}: {
|
||||||
handle: string
|
handle: string
|
||||||
isMe?: boolean
|
isEditable?: boolean
|
||||||
}) {
|
}) {
|
||||||
const [localBannerPicture, setLocalBannerPicture] = useState<string | null>(
|
|
||||||
null,
|
|
||||||
)
|
|
||||||
|
|
||||||
const gradient = getGradient(handle)
|
const gradient = getGradient(handle)
|
||||||
|
|
||||||
const handleEditBanner = useCallback(() => {
|
const handleEditBanner = useCallback(() => {
|
||||||
Alert.alert('', 'Select upload method', [
|
Alert.alert('Select upload method', '', [
|
||||||
{
|
{
|
||||||
text: 'Take a new photo',
|
text: 'Take a new photo',
|
||||||
onPress: () => {
|
onPress: () => {
|
||||||
@@ -30,7 +30,8 @@ export function UserBanner({
|
|||||||
width: 1000,
|
width: 1000,
|
||||||
height: 120,
|
height: 120,
|
||||||
}).then(item => {
|
}).then(item => {
|
||||||
setLocalBannerPicture(item.path)
|
// setLocalBannerPicture(item.path)
|
||||||
|
console.log(item)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -46,7 +47,8 @@ export function UserBanner({
|
|||||||
width: 1000,
|
width: 1000,
|
||||||
height: 120,
|
height: 120,
|
||||||
}).then(croppedItem => {
|
}).then(croppedItem => {
|
||||||
setLocalBannerPicture(croppedItem.path)
|
// setLocalBannerPicture(croppedItem.path)
|
||||||
|
console.log(croppedItem)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -71,13 +73,14 @@ export function UserBanner({
|
|||||||
</Svg>
|
</Svg>
|
||||||
)
|
)
|
||||||
|
|
||||||
return isMe ? (
|
return isEditable ? (
|
||||||
<TouchableOpacity onPress={handleEditBanner}>
|
<TouchableOpacity onPress={handleEditBanner}>
|
||||||
{localBannerPicture != null ? (
|
{/* {localBannerPicture != null ? (
|
||||||
<Image style={styles.bannerImage} source={{uri: localBannerPicture}} />
|
<Image style={styles.bannerImage} source={{uri: localBannerPicture}} />
|
||||||
) : (
|
) : (
|
||||||
renderSvg()
|
renderSvg()
|
||||||
)}
|
)} */}
|
||||||
|
{renderSvg()}
|
||||||
<View style={styles.editButtonContainer}>
|
<View style={styles.editButtonContainer}>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon="camera"
|
icon="camera"
|
||||||
|
|||||||
Reference in New Issue
Block a user