diff --git a/app/mobile/src/constants/Colors.js b/app/mobile/src/constants/Colors.js index ab1cb9a6..ff256256 100644 --- a/app/mobile/src/constants/Colors.js +++ b/app/mobile/src/constants/Colors.js @@ -1,6 +1,7 @@ export const Colors = { background: '#8fbea7', primary: '#448866', + titleBackground: '#f6f6f6', formBackground: '#f2f2f2', formFocus: '#f8f8f8', formHover: '#efefef', diff --git a/app/mobile/src/session/Session.jsx b/app/mobile/src/session/Session.jsx index 94f78e84..4b119ff7 100644 --- a/app/mobile/src/session/Session.jsx +++ b/app/mobile/src/session/Session.jsx @@ -9,11 +9,13 @@ import Ionicons from '@expo/vector-icons/AntDesign'; import { useSession } from './useSession.hook'; import { styles } from './Session.styled'; import Colors from 'constants/Colors'; -import { Profile } from './profile/Profile'; +import { ProfileTitle, Profile } from './profile/Profile'; import { Channels } from './channels/Channels'; -import { Cards } from './cards/Cards'; -import { Registry } from './registry/Registry'; -import { Contact } from './contact/Contact'; +import { CardsTitle, CardsBody, Cards } from './cards/Cards'; +import { useCards } from './cards/useCards.hook'; +import { RegistryTitle, RegistryBody, Registry } from './registry/Registry'; +import { useRegistry } from './registry/useRegistry.hook'; +import { Contact, ContactTitle } from './contact/Contact'; import { Details } from './details/Details'; import { Conversation } from './conversation/Conversation'; import { Welcome } from './welcome/Welcome'; @@ -92,8 +94,8 @@ export function Session() { } const ProfileStackScreen = () => { return ( - ({ headerShown: false })}> - + ({ headerShown: true })}> + }} /> ); } @@ -113,16 +115,31 @@ export function Session() { navigation.goBack(); } + const registry = useRegistry(); + const cards = useCards(); + return ( - ({ headerShown: false })}> - - {(props) => setRegistryStack(props.navigation)} openContact={(contact) => setCardStack(props.navigation, contact)} />} + ({ headerShow: true })}> + { console.log(props); return } + }}> + {(props) => setCardStack(props.navigation, contact)} />} - + + }}> {(props) => clearCardStack(props.navigation)} />} - - {(props) => clearRegistryStack(props.navigation)} openContact={(contact) => setCardStack(props.navigation, contact)} />} + + }}> + {(props) => setCardStack(props.navigation, contact)} />} ); @@ -306,12 +323,8 @@ export function Session() { {(props) => ()} - - {(props) => ()} - - - {(props) => ()} - + + )} diff --git a/app/mobile/src/session/cards/Cards.jsx b/app/mobile/src/session/cards/Cards.jsx index 3c78c7ac..6ec93e90 100644 --- a/app/mobile/src/session/cards/Cards.jsx +++ b/app/mobile/src/session/cards/Cards.jsx @@ -6,6 +6,46 @@ import { SafeAreaView } from 'react-native-safe-area-context'; import Ionicons from '@expo/vector-icons/AntDesign'; import { CardItem } from './cardItem/CardItem'; import Colors from 'constants/Colors'; +import { useNavigation } from '@react-navigation/native'; + +export function CardsTitle({ state, actions, openRegistry }) { + const navigation = useNavigation(); + + return ( + + { state.sorting && ( + + + + )} + { !state.sorting && ( + + + + )} + + + + + + openRegistry(navigation)}> + + New + + + ); +} + +export function CardsBody({ state, actions, openContact }) { + return ( + } + keyExtractor={item => item.cardId} + /> + ); +} export function Cards({ openRegistry, openContact }) { const { state, actions } = useCards(); diff --git a/app/mobile/src/session/cards/Cards.styled.js b/app/mobile/src/session/cards/Cards.styled.js index 78714eb4..09646ad3 100644 --- a/app/mobile/src/session/cards/Cards.styled.js +++ b/app/mobile/src/session/cards/Cards.styled.js @@ -8,11 +8,17 @@ export const styles = StyleSheet.create({ display: 'flex', flexDirection: 'column', }, + title: { + display: 'flex', + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'center', + }, topbar: { borderTopWidth: 1, borderBottomWidth: 1, borderColor: Colors.divider, - paddingTop: 6, + paddingTop: 32, paddingBottom: 6, paddingLeft: 16, paddingRight: 16, diff --git a/app/mobile/src/session/contact/Contact.jsx b/app/mobile/src/session/contact/Contact.jsx index 908694c8..dcaf14fe 100644 --- a/app/mobile/src/session/contact/Contact.jsx +++ b/app/mobile/src/session/contact/Contact.jsx @@ -7,6 +7,11 @@ import { Logo } from 'utils/Logo'; import Ionicons from '@expo/vector-icons/AntDesign'; import Colors from 'constants/Colors'; +export function ContactTitle({ contact, closeContact }) { + const { state, actions } = useContact(contact, closeContact); + return ({ `${state.handle}@${state.node}` }); +} + export function Contact({ contact, closeContact }) { const { state, actions } = useContact(contact, closeContact); @@ -119,19 +124,9 @@ export function Contact({ contact, closeContact }) { setContact(actions.connectContact); } - return ( - - - { state.tabbed && ( - - - - - - )} - - { `${state.handle}@${state.node}` } - + const Body = () => { + return ( + { `[${getStatusText(state.status)}]` } @@ -235,7 +230,23 @@ export function Contact({ contact, closeContact }) { )} - + + ); + } + + return ( + + { state.tabbed && ( + + )} + { !state.tabbed && ( + + + { `${state.handle}@${state.node}` } + + + + )} ) } diff --git a/app/mobile/src/session/contact/Contact.styled.js b/app/mobile/src/session/contact/Contact.styled.js index a538af98..78125f42 100644 --- a/app/mobile/src/session/contact/Contact.styled.js +++ b/app/mobile/src/session/contact/Contact.styled.js @@ -11,6 +11,12 @@ export const styles = StyleSheet.create({ alignItems: 'center', justifyContent: 'center', }, + title: { + fontSize: 18, + }, + drawer: { + paddingTop: 16, + }, close: { width: '100%', display: 'flex', diff --git a/app/mobile/src/session/profile/Profile.jsx b/app/mobile/src/session/profile/Profile.jsx index e00bd69a..f2160c65 100644 --- a/app/mobile/src/session/profile/Profile.jsx +++ b/app/mobile/src/session/profile/Profile.jsx @@ -10,6 +10,13 @@ import { SafeAreaView } from 'react-native-safe-area-context'; import { BlockedTopics } from './blockedTopics/BlockedTopics'; import { BlockedContacts } from './blockedContacts/BlockedContacts'; +export function ProfileTitle(props) { + const { state, actions } = useProfile(); + return ( + { `${state.handle}@${state.node}` } + ) +} + export function Profile() { const { state, actions } = useProfile(); @@ -94,12 +101,9 @@ export function Profile() { const enabled = (state.checked && state.available && state.editConfirm === state.editPassword && state.editPassword); - return ( - - - - { `${state.handle}@${state.node}` } - + const Body = () => { + return ( + @@ -129,6 +133,9 @@ export function Profile() { + + Change Login + Manage Blocked Contacts @@ -139,7 +146,25 @@ export function Profile() { Logout - + + ); + }; + + return ( + + { state.tabbed && ( + + + + )} + { !state.tabbed && ( + + + { `${state.handle}@${state.node}` } + + + + )} ({ ...s, ...value })); } + useEffect(() => { + if (dimensions.width > config.tabbedWidth) { + updateState({ tabbed: false }); + } + else { + updateState({ tabbed: true }); + } + }, [dimensions]); + useEffect(() => { const { name, handle, node, location, description, image } = profile.state.profile; const imageSource = image ? profile.state.imageUrl : 'avatar'; diff --git a/app/mobile/src/session/registry/Registry.jsx b/app/mobile/src/session/registry/Registry.jsx index e9c46f3a..0ae61445 100644 --- a/app/mobile/src/session/registry/Registry.jsx +++ b/app/mobile/src/session/registry/Registry.jsx @@ -7,6 +7,53 @@ import Ionicons from '@expo/vector-icons/AntDesign'; import { RegistryItem } from './registryItem/RegistryItem'; import Colors from 'constants/Colors'; +export function RegistryTitle({ state, actions }) { + + const search = async () => { + try { + await actions.search(); + } + catch (err) { + console.log(err); + Alert.alert( + 'Server Listing Failed', + 'Please try again.' + ); + } + } + + return ( + + + + + + { state.busy && ( + + + + )} + { !state.busy && ( + + + + )} + + ); +} + +export function RegistryBody({ state, actions, openContact }) { + return ( + } + keyExtractor={item => item.guid} + /> + ); +} + + export function Registry({ closeRegistry, openContact }) { const search = async () => { diff --git a/app/mobile/src/session/registry/Registry.styled.js b/app/mobile/src/session/registry/Registry.styled.js index a47475d7..683d7908 100644 --- a/app/mobile/src/session/registry/Registry.styled.js +++ b/app/mobile/src/session/registry/Registry.styled.js @@ -8,6 +8,12 @@ export const styles = StyleSheet.create({ display: 'flex', flexDirection: 'column', }, + title: { + display: 'flex', + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'center', + }, topbar: { borderTopWidth: 1, borderBottomWidth: 1,