Update scene items in mainmenu to use generated avatars

zio/stable
Paul Frazee 2022-11-01 10:06:24 -05:00
parent 6329ab4b08
commit 0fd2c3c4cb
1 changed files with 8 additions and 25 deletions

View File

@ -1,8 +1,6 @@
import React, {useEffect} from 'react' import React, {useEffect} from 'react'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import { import {
Image,
ImageSourcePropType,
StyleSheet, StyleSheet,
SafeAreaView, SafeAreaView,
Text, Text,
@ -22,7 +20,6 @@ import {HomeIcon, UserGroupIcon} from '../../lib/icons'
import {UserAvatar} from '../../com/util/UserAvatar' import {UserAvatar} from '../../com/util/UserAvatar'
import {useStores} from '../../../state' import {useStores} from '../../../state'
import {s, colors} from '../../lib/styles' import {s, colors} from '../../lib/styles'
import {DEF_AVATAR} from '../../lib/assets'
export const MainMenu = observer( export const MainMenu = observer(
({active, onClose}: {active: boolean; onClose: () => void}) => { ({active, onClose}: {active: boolean; onClose: () => void}) => {
@ -91,13 +88,11 @@ export const MainMenu = observer(
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
) )
const MenuItemImage = ({ const MenuItemActor = ({
img,
label, label,
url, url,
count, count,
}: { }: {
img: ImageSourcePropType
label: string label: string
url: string url: string
count?: number count?: number
@ -105,7 +100,9 @@ export const MainMenu = observer(
<TouchableOpacity <TouchableOpacity
style={[styles.menuItem, styles.menuItemMargin]} style={[styles.menuItem, styles.menuItemMargin]}
onPress={() => onNavigate(url)}> onPress={() => onNavigate(url)}>
<Image style={styles.menuItemImg} source={img} /> <View style={s.mb5}>
<UserAvatar size={60} displayName={label} name={label} />
</View>
{count ? ( {count ? (
<View style={styles.menuItemCount}> <View style={styles.menuItemCount}>
<Text style={styles.menuItemCountLabel}>{count}</Text> <Text style={styles.menuItemCountLabel}>{count}</Text>
@ -178,20 +175,12 @@ export const MainMenu = observer(
label="Create Scene" label="Create Scene"
url="/contacts" url="/contacts"
/> />
<MenuItemImage img={DEF_AVATAR} label="Galaxy Brain" url="/" /> <MenuItemActor label="Galaxy Brain" url="/" />
<MenuItemImage <MenuItemActor label="Paul's Friends" url="/" />
img={DEF_AVATAR}
label="Paul's Friends"
url="/"
/>
</View> </View>
<View style={[styles.menuItems]}> <View style={[styles.menuItems]}>
<MenuItemImage <MenuItemActor label="Cool People Only" url="/" />
img={DEF_AVATAR} <MenuItemActor label="Techsky" url="/" />
label="Cool People Only"
url="/"
/>
<MenuItemImage img={DEF_AVATAR} label="Techsky" url="/" />
</View> </View>
</Animated.View> </Animated.View>
</SafeAreaView> </SafeAreaView>
@ -271,12 +260,6 @@ const styles = StyleSheet.create({
menuItemMargin: { menuItemMargin: {
marginRight: 10, marginRight: 10,
}, },
menuItemImg: {
borderRadius: 30,
width: 60,
height: 60,
marginBottom: 5,
},
menuItemIconWrapper: { menuItemIconWrapper: {
borderRadius: 6, borderRadius: 6,
width: 60, width: 60,