fixing call layout with name size

This commit is contained in:
balzack 2023-05-21 23:51:29 -07:00
parent b89de05885
commit 0251ea7dca
3 changed files with 16 additions and 4 deletions

View File

@ -352,12 +352,22 @@ export function Session({ sharing, clearSharing }) {
for (let i = 0; i < state.ringing.length; i++) { for (let i = 0; i < state.ringing.length; i++) {
const call = state.ringing[i]; const call = state.ringing[i];
const { img, cardId, callId, name, handle, contactNode } = call || {}; const { img, cardId, callId, name, handle, contactNode } = call || {};
const label = name ? name : contactNode ? `${handle}@${contactNode}` : handle;
const key = `${cardId}:${callId}` const key = `${cardId}:${callId}`
incoming.push( incoming.push(
<View key={key} style={styles.ringEntry}> <View key={key} style={styles.ringEntry}>
<Logo src={img} width={40} height={40} radius={4} /> <Logo src={img} width={40} height={40} radius={4} />
<Text style={styles.ringName} numberOfLines={1} ellipsizeMode={'tail'}>{ label }</Text> { name != null && (
<Text style={styles.ringName} numberOfLines={2} ellipsizeMode={'tail'}>{ name }</Text>
)}
{ name == null && contactNode != null && (
<View style={styles.ringName}>
<Text numberOfLines={1} ellipsizeMode={'tail'}>{ handle }</Text>
<Text numberOfLines={1} ellipsizeMode={'tail'}>{ contactNode }</Text>
</View>
)}
{ name == null && contactNode == null && (
<Text style={styles.ringName} numberOfLines={1} ellipsizeMode={'tail'}>{ handle }</Text>
)}
<TouchableOpacity style={styles.ringIgnore} onPress={() => actions.ignore({ cardId, callId })}> <TouchableOpacity style={styles.ringIgnore} onPress={() => actions.ignore({ cardId, callId })}>
<MatIcons name={'eye-off-outline'} size={20} color={Colors.text} /> <MatIcons name={'eye-off-outline'} size={20} color={Colors.text} />
</TouchableOpacity> </TouchableOpacity>

View File

@ -160,6 +160,7 @@ export const styles = StyleSheet.create({
justifyContent: 'center', justifyContent: 'center',
}, },
ringName: { ringName: {
flexShrink: 1,
flexGrow: 1, flexGrow: 1,
paddingLeft: 8, paddingLeft: 8,
paddingRight: 8, paddingRight: 8,

View File

@ -104,7 +104,7 @@ export function useTopicItem(item, hosting, remove, contentKey) {
name = identity.name; name = identity.name;
} }
else { else {
name = `${identity.handle}@${identity.node}`; name = identity.node ? `${identity.handle}@${identity.node}` : identity.handle;
} }
const img = profile.state.imageUrl; const img = profile.state.imageUrl;
if (img) { if (img) {
@ -125,7 +125,8 @@ export function useTopicItem(item, hosting, remove, contentKey) {
nameSet = true; nameSet = true;
} }
else { else {
name = `${contact.profile.handle}@${contact.profile.node}`; const { node, handle } = contact.profile || {};
name = node ? `${handle}@${node}` : handle;
nameSet = false; nameSet = false;
} }
} }