building refactored contacts screen

This commit is contained in:
balzack 2023-09-18 23:08:26 -07:00
parent 35e1b55685
commit 7eb88452d1
5 changed files with 178 additions and 29 deletions

View File

@ -51,6 +51,13 @@ const LightColors = {
disconnectedIndicator: '#aa0000', disconnectedIndicator: '#aa0000',
sliderGrip: '#eeeeee', sliderGrip: '#eeeeee',
areaBorder: '#ffffff', areaBorder: '#ffffff',
connected: '#4488FF',
connecting: '#dd88ff',
requested: '#448844',
pending: '#ffaa22',
confirmed: '#aaaaaa',
offsync: '#ff4444',
unsaved: '#888888',
}; };
const DarkColors = { const DarkColors = {
@ -104,6 +111,13 @@ const DarkColors = {
disconnectedIndicator: '#aa0000', disconnectedIndicator: '#aa0000',
sliderGrip: '#eeeeee', sliderGrip: '#eeeeee',
areaBorder: '#777777', areaBorder: '#777777',
connected: '#4488FF',
connecting: '#dd88ff',
requested: '#448844',
pending: '#ffaa22',
confirmed: '#aaaaaa',
offsync: '#ff4444',
unsaved: '#888888',
}; };
function getColor(label) { function getColor(label) {
@ -160,6 +174,13 @@ export const Colors = {
disconnectedIndicator: getColor('disconnectedIndicator'), disconnectedIndicator: getColor('disconnectedIndicator'),
sliderGrip: getColor('sliderGrip'), sliderGrip: getColor('sliderGrip'),
areaBorder: getColor('areaBorder'), areaBorder: getColor('areaBorder'),
connected: getColor('connected'),
connecting: getColor('connecting'),
requested: getColor('requested'),
pending: getColor('pending'),
confirmed: getColor('confirmed'),
offsync: getColor('offsync'),
unsaved: getColor('unsaved'),
background: '#8fbea7', background: '#8fbea7',
primary: '#448866', primary: '#448866',
@ -182,12 +203,6 @@ export const Colors = {
active: '#222222', active: '#222222',
idle: '#707070', idle: '#707070',
connected: '#4488FF',
connecting: '#dd88ff',
requested: '#448844',
pending: '#ffaa22',
confirmed: '#aaaaaa',
error: '#ff4444', error: '#ff4444',
profileForm: '#e8e8e8', profileForm: '#e8e8e8',

View File

@ -87,22 +87,22 @@ const Strings = [
back: 'Back', back: 'Back',
confirmed: 'Saved', confirmed: 'Saved',
pending: 'Unknown Contact', pending: 'Unknown',
connecting: 'Request Sent', connecting: 'Requested',
connected: 'Connected', connected: 'Connected',
requested: 'Request Received', requested: 'Received',
unsaved: 'Unsaved Contact', unsaved: 'Unsaved',
offsync: 'Offsync', offsync: 'Offsync',
saveContact: 'Save Contact', resyncContact: 'Resync',
requestConnection: 'Request Connection', requestConnection: 'Request',
deleteContact: 'Delete Contact', acceptConnection: 'Accept',
blockContact: 'Block Contact', saveContact: 'Save',
reportContact: 'Report Contact', cancelRequest: 'Cancel',
cancelRequest: 'Cancel Request', ignoreContact: 'Ignore',
acceptConnection: 'Accept Connection', deleteContact: 'Delete',
ignoreContact: 'Ignore Contact', blockContact: 'Block',
resyncContact: 'Resync Contact', reportContact: 'Report',
}, },
{ {
visibleRegistry: 'Visible dans le Registre', visibleRegistry: 'Visible dans le Registre',
@ -185,6 +185,24 @@ const Strings = [
//constacts page //constacts page
add: 'Ajouter', add: 'Ajouter',
back: 'Arrière', back: 'Arrière',
confirmed: 'Enregistré',
pending: 'Inconnu',
connecting: 'Demandé',
connected: 'Connecté',
requested: 'Reçue',
unsaved: 'Non Enregistré',
offsync: 'Hors Sync',
resyncContact: 'Resync',
requestConnection: 'Connexion',
acceptConnection: 'Accepter',
saveContact: 'Enregistrer',
cancelRequest: 'Annuler',
ignoreContact: 'Ignorer',
deleteContact: 'Supprimer',
blockContact: 'Bloquer',
reportContact: 'Signaler',
}, },
{ {
visibleRegistry: 'Visible en el Registro', visibleRegistry: 'Visible en el Registro',
@ -267,6 +285,24 @@ const Strings = [
// contacts page // contacts page
add: 'Agregar', add: 'Agregar',
back: 'Atrás', back: 'Atrás',
confirmed: 'Guardado',
pending: 'Desconocido',
connecting: 'Conectando',
connected: 'Conectado',
requested: 'Solicitado',
unsaved: 'No Guardado',
offsync: 'Fuera de Sync',
resyncContact: 'Resinc',
requestConnection: 'Conectar',
acceptConnection: 'Aceptar',
saveContact: 'Guardar',
cancelRequest: 'Cancelar',
ignoreContact: 'Ignorar',
deleteContact: 'Borrar',
blockContact: 'Bloquear',
reportContact: 'Informe',
}, },
{ {
visibleRegistry: 'Sichtbar in der Registrierung', visibleRegistry: 'Sichtbar in der Registrierung',
@ -349,6 +385,24 @@ const Strings = [
//contacts page //contacts page
add: 'Hinzufügen', add: 'Hinzufügen',
back: 'Rückwärts', back: 'Rückwärts',
confirmed: 'Gerettet',
pending: 'Unbekannt',
connecting: 'Verbinden',
connected: 'Beigetreten',
requested: 'Angefordert',
unsaved: 'Nicht Gespeichert',
offsync: 'Nicht Sync',
resyncContact: 'Neu Sync',
requestConnection: 'Verbinden',
acceptConnection: 'Akzeptieren',
saveContact: 'Speichern',
cancelRequest: 'Stornieren',
ignoreContact: 'Ignorieren',
deleteContact: 'Löschen',
blockContact: 'Verstecken',
reportContact: 'Bericht',
} }
]; ];

View File

@ -332,12 +332,42 @@ export function Contact({ contact, drawer, back }) {
<View style={styles.status}> <View style={styles.status}>
{ state.status === 'connected' && ( { state.status === 'connected' && (
<View style={styles.statusConnected}> <View style={styles.statusConnected}>
<Text style={styles.statusLabel}>Connected</Text> <Text numberOfLines={1} style={styles.statusLabel}>{ state.strings.connected }</Text>
</View> </View>
)} )}
{ state.status !== 'connected' && ( { state.status === 'connecting' && (
<View style={styles.statusConnected}> <View style={styles.statusConnecting}>
<Text style={styles.statusLabel}>Connected</Text> <Text numberOfLines={1} style={styles.statusLabel}>{ state.strings.connecting }</Text>
</View>
)}
{ state.status === 'requested' && (
<View style={styles.statusRequested}>
<Text numberOfLines={1} style={styles.statusLabel}>{ state.strings.requested }</Text>
</View>
)}
{ state.status === 'offsync' && (
<View style={styles.statusOffsync}>
<Text numberOfLines={1} style={styles.statusLabel}>{ state.strings.offsync }</Text>
</View>
)}
{ state.status === 'received' && (
<View style={styles.statusReceived}>
<Text numberOfLines={1} style={styles.statusLabel}>{ state.strings.received }</Text>
</View>
)}
{ state.status === 'pending' && (
<View style={styles.statusPending}>
<Text numberOfLines={1} style={styles.statusLabel}>{ state.strings.pending }</Text>
</View>
)}
{ state.status === 'saved' && (
<View style={styles.statusSaved}>
<Text numberOfLines={1} style={styles.statusLabel}>{ state.strings.saved }</Text>
</View>
)}
{ state.status === 'unsaved' && (
<View style={styles.statusUnsaved}>
<Text numberOfLines={1} style={styles.statusLabel}>{ state.strings.unsaved }</Text>
</View> </View>
)} )}
</View> </View>

View File

@ -79,6 +79,7 @@ export const styles = StyleSheet.create({
username: { username: {
color: Colors.text, color: Colors.text,
fontFamily: 'roboto', fontFamily: 'roboto',
flexShrink: 1,
fontSize: 18, fontSize: 18,
paddingLeft: 16, paddingLeft: 16,
paddingRight: 16, paddingRight: 16,
@ -86,12 +87,12 @@ export const styles = StyleSheet.create({
usernameStatus: { usernameStatus: {
display: 'flex', display: 'flex',
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', marginTop: 4,
}, },
status: { status: {
display: 'flex', display: 'flex',
flexGrow: 1, flexGrow: 1,
paddingRight: 32, paddingRight: 16,
alignItems: 'flex-end', alignItems: 'flex-end',
}, },
statusConnected: { statusConnected: {
@ -100,7 +101,55 @@ export const styles = StyleSheet.create({
paddingTop: 2, paddingTop: 2,
paddingBottom: 2, paddingBottom: 2,
borderRadius: 8, borderRadius: 8,
backgroundColor: 'yellow', backgroundColor: Colors.connected,
},
statusConfirmed: {
paddingLeft: 8,
paddingRight: 8,
paddingTop: 2,
paddingBottom: 2,
borderRadius: 8,
backgroundColor: Colors.confirmed,
},
statusPending: {
paddingLeft: 8,
paddingRight: 8,
paddingTop: 2,
paddingBottom: 2,
borderRadius: 8,
backgroundColor: Colors.pending,
},
statusConnecting: {
paddingLeft: 8,
paddingRight: 8,
paddingTop: 2,
paddingBottom: 2,
borderRadius: 8,
backgroundColor: Colors.connecting,
},
statusRequested: {
paddingLeft: 8,
paddingRight: 8,
paddingTop: 2,
paddingBottom: 2,
borderRadius: 8,
backgroundColor: Colors.requested,
},
statusUnsaved: {
paddingLeft: 8,
paddingRight: 8,
paddingTop: 2,
paddingBottom: 2,
borderRadius: 8,
backgroundColor: Colors.unsaved,
},
statusOffysnc: {
paddingLeft: 8,
paddingRight: 8,
paddingTop: 2,
paddingBottom: 2,
borderRadius: 8,
backgroundColor: Colors.offsync,
}, },
statusLabel: { statusLabel: {
color: Colors.text, color: Colors.text,
@ -110,7 +159,7 @@ export const styles = StyleSheet.create({
marginRight: 16, marginRight: 16,
backgroundColor: Colors.areaBase, backgroundColor: Colors.areaBase,
borderRadius: 8, borderRadius: 8,
marginTop: 32, marginTop: 24,
display: 'flex', display: 'flex',
flexShrink: 1, flexShrink: 1,
}, },

View File

@ -60,7 +60,8 @@ export function useContact(contact) {
const username = `${handle}/${node}` const username = `${handle}/${node}`
const imageSource = imageSet ? { uri: card.actions.getCardImageUrl(cardId) } : avatar; const imageSource = imageSet ? { uri: card.actions.getCardImageUrl(cardId) } : avatar;
updateState({ offsync, name, handle, node: server, location, description, imageSource, username, cardId, guid, status: detail.status }); const status = offsync ? 'offsync' : detail.status;
updateState({ name, handle, node: server, location, description, imageSource, username, cardId, guid, status });
} }
else { else {
const { guid, handle, node, name, location, description, imageSet } = contact || {}; const { guid, handle, node, name, location, description, imageSet } = contact || {};
@ -68,7 +69,7 @@ export function useContact(contact) {
const username = `${handle}/${node}` const username = `${handle}/${node}`
const imageSource = imageSet ? { uri: getListingImageUrl(server, guid) } : avatar; const imageSource = imageSet ? { uri: getListingImageUrl(server, guid) } : avatar;
updateState({ guid, handle, node: host, name, location, description, imageSource, username, offsync: false, status: null }); updateState({ guid, handle, node: host, name, location, description, imageSource, username, offsync: false, status: 'unsaved' });
} }
}, [contact, card.state, profile.state]); }, [contact, card.state, profile.state]);