mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
added status message to registry screen
This commit is contained in:
parent
8484b4212e
commit
493621e7ed
@ -55,11 +55,20 @@ export function RegistryTitle({ state, actions }) {
|
||||
|
||||
export function RegistryBody({ state, actions, openContact }) {
|
||||
return (
|
||||
<FlatList style={styles.accounts}
|
||||
data={state.accounts}
|
||||
renderItem={({ item }) => <RegistryItem item={item} openContact={openContact} />}
|
||||
keyExtractor={item => item.guid}
|
||||
/>
|
||||
<View style={styles.accounts}>
|
||||
{ state.accounts.length === 0 && state.searcheg && (
|
||||
<View style={styles.empty}>
|
||||
<Text style={styles.emptyText}>No Contacts Found</Text>
|
||||
</View>
|
||||
)}
|
||||
{ state.accounts.length !== 0 && (
|
||||
<FlatList
|
||||
data={state.accounts}
|
||||
renderItem={({ item }) => <RegistryItem item={item} openContact={openContact} />}
|
||||
keyExtractor={item => item.guid}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@ -104,11 +113,18 @@ export function Registry({ closeRegistry, openContact }) {
|
||||
<Ionicons name={'close'} size={24} color={Colors.text} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
<FlatList style={styles.accounts}
|
||||
data={state.accounts}
|
||||
renderItem={({ item }) => <RegistryItem item={item} openContact={openContact} />}
|
||||
keyExtractor={item => item.guid}
|
||||
/>
|
||||
{ state.accounts.length === 0 && state.searched && (
|
||||
<View style={styles.empty}>
|
||||
<Text style={styles.emptyText}>No Contacts Found</Text>
|
||||
</View>
|
||||
)}
|
||||
{ state.accounts.length !== 0 && (
|
||||
<FlatList style={styles.accounts}
|
||||
data={state.accounts}
|
||||
renderItem={({ item }) => <RegistryItem item={item} openContact={openContact} />}
|
||||
keyExtractor={item => item.guid}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{ !state.tabbed && (
|
||||
@ -134,11 +150,18 @@ export function Registry({ closeRegistry, openContact }) {
|
||||
</SafeAreaView>
|
||||
</View>
|
||||
<SafeAreaView edges={['right']}>
|
||||
<FlatList style={styles.accounts}
|
||||
data={state.accounts}
|
||||
renderItem={({ item }) => <RegistryItem item={item} openContact={openContact} />}
|
||||
keyExtractor={item => item.guid}
|
||||
/>
|
||||
{ state.accounts.length === 0 && state.searched && (
|
||||
<View style={style.empty}>
|
||||
<Text style={styles.emptyText}>No Contacts Found</Text>
|
||||
</View>
|
||||
)}
|
||||
{ state.accounts.length !== 0 && (
|
||||
<FlatList style={styles.accounts}
|
||||
data={state.accounts}
|
||||
renderItem={({ item }) => <RegistryItem item={item} openContact={openContact} />}
|
||||
keyExtractor={item => item.guid}
|
||||
/>
|
||||
)}
|
||||
</SafeAreaView>
|
||||
</>
|
||||
)}
|
||||
|
@ -79,9 +79,19 @@ export const styles = StyleSheet.create({
|
||||
flexShrink: 1,
|
||||
width: '100%',
|
||||
paddingLeft: 16,
|
||||
paddingRight: 16,
|
||||
minHeight: 0,
|
||||
},
|
||||
empty: {
|
||||
flexGrow: 1,
|
||||
width: '100%',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
emptyText: {
|
||||
color: Colors.grey,
|
||||
fontSize: 16,
|
||||
},
|
||||
addbottom: {
|
||||
marginRight: 8,
|
||||
display: 'flex',
|
||||
|
@ -14,6 +14,7 @@ export function useRegistry() {
|
||||
server: null,
|
||||
filter: false,
|
||||
username: null,
|
||||
searched: false,
|
||||
busy: false,
|
||||
});
|
||||
|
||||
@ -63,8 +64,7 @@ export function useRegistry() {
|
||||
return true;
|
||||
});
|
||||
const items = filtered.map(setAccountItem);
|
||||
items.push({guid:''});
|
||||
updateState({ busy: false, accounts: items });
|
||||
updateState({ busy: false, searched: true, accounts: items });
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
@ -78,7 +78,7 @@ export function useRegistry() {
|
||||
|
||||
const actions = {
|
||||
setServer: (server) => {
|
||||
updateState({ server, accounts: [] });
|
||||
updateState({ server, searched: false, accounts: [] });
|
||||
},
|
||||
search: async () => {
|
||||
await getAccounts(state.server, false);
|
||||
|
Loading…
Reference in New Issue
Block a user