diff --git a/app/mobile/App.js b/app/mobile/App.js
index 9abf22b8..3f6e4b6d 100644
--- a/app/mobile/App.js
+++ b/app/mobile/App.js
@@ -12,6 +12,8 @@ import { AccountContextProvider } from 'context/AccountContext';
import { ProfileContextProvider } from 'context/ProfileContext';
import { CardContextProvider } from 'context/CardContext';
import { ChannelContextProvider } from 'context/ChannelContext';
+import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
+import { NavigationContainer } from '@react-navigation/native';
export default function App() {
@@ -22,16 +24,18 @@ export default function App() {
-
-
- } />
- } />
- } />
- } />
- } />
- } />
-
-
+
+
+
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+
+
+
diff --git a/app/mobile/src/session/Session.jsx b/app/mobile/src/session/Session.jsx
index 0578df82..4b7efb77 100644
--- a/app/mobile/src/session/Session.jsx
+++ b/app/mobile/src/session/Session.jsx
@@ -17,18 +17,24 @@ import { Details } from './details/Details';
import { Conversation } from './conversation/Conversation';
import { Welcome } from './welcome/Welcome';
+const ConversationStack = createStackNavigator();
+const ProfileStack = createStackNavigator();
+const ContactStack = createStackNavigator();
+const ProfileDrawer = createDrawerNavigator();
+const ContactDrawer = createDrawerNavigator();
+const DetailDrawer = createDrawerNavigator();
+const CardDrawer = createDrawerNavigator();
+const Tab = createBottomTabNavigator();
+
export function Session() {
const { state, actions } = useSession();
- const [ contactDrawer, setContactDrawer ] = useState(null);
- const Tab = createBottomTabNavigator();
const openCards = (nav) => {
nav.openDrawer();
}
const closeCards = (nav) => {}
const openProfile = (nav) => {
- setContactDrawer('profile');
nav.openDrawer();
}
const closeProfile = (nav) => {}
@@ -40,7 +46,6 @@ export function Session() {
const closeDetails = (nav) => {}
// tabbed containers
- const ConversationStack = createStackNavigator();
const ConversationStackScreen = () => {
return (
({ headerShown: false })}>
@@ -63,7 +68,6 @@ export function Session() {
const DetailsTabScreen = ({ navigation }) => {
return closeDetails(navigation)} />
}
- const ProfileStack = createStackNavigator();
const ProfileStackScreen = () => {
return (
({ headerShown: false })}>
@@ -71,58 +75,73 @@ export function Session() {
);
}
- const ContactStack = createStackNavigator();
const ContactStackScreen = () => {
+ const [cardId, setCardId] = useState(null);
+ const setCardStack = (navigation, id) => {
+ setCardId(id);
+ navigation.navigate('card')
+ }
+ const clearCardStack = (navigation) => {
+ navigation.goBack();
+ }
+
return (
({ headerShown: false })}>
-
-
+
+ {(props) => setCardStack(props.navigation, cardId)} />}
+
+
+ {(props) => clearCardStack(props.navigation)} />}
+
);
}
- const ContactsTabScreen = ({ navigation }) => {
- return openContact(navigation, cardId)} />
- }
- const ContactTabScreen = ({ navigation }) => {
- return closeContact(navigation)} />
- }
// drawered containers
- const CardDrawer = createDrawerNavigator();
- const CardDrawerContent = ({ contactNav, navigation }) => {
+ const CardDrawerContent = ({ navigation, setContact }) => {
return (
- openContact(contactNav, cardId)} />
+
+
+ )
+ }
+ const ProfileDrawerContent = ({ navigation }) => {
+ return (
+
+ closeProfile(navigation)} />
+
+ )
+ }
+ const DetailDrawerContent = ({ navigation }) => {
+ return (
+
+ closeDetails(navigation)} />
)
}
- const ContactDrawer = createDrawerNavigator();
const ContactDrawerContent = ({ navigation }) => {
+ const clearContact = () => {
+ navigation.closeDrawer();
+ }
+
return (
- { contactDrawer === 'profile' && (
- closeProfile(navigation)} />
- )}
- { contactDrawer === 'contacts' && (
- closeContact(navigation)} />
- )}
- { contactDrawer === 'details' && (
- closeDetails(navigation)} />
- )}
+
)
}
- const HomeScreen = ({ contactNav, navigation }) => {
+
+ const HomeScreen = ({ cardNav, detailNav, contactNav, profileNav }) => {
return (
- openProfile(contactNav)}>
+ openProfile(profileNav)}>
Profile
- openCards(navigation)}>
+ openCards(cardNav)}>
Contacts
@@ -133,7 +152,7 @@ export function Session() {
{ state.conversationId && (
- closeConversation(null)} openDetails={() => openDetails(contactNav)} />
+ closeConversation(null)} openDetails={() => openDetails(detailNav)} />
)}
{ !state.conversationId && (
@@ -143,70 +162,89 @@ export function Session() {
)
}
- const CardDrawerScreen = ({ navigation }) => {
+ const CardDrawerScreen = ({ detailNav, contactNav, profileNav, setContact }) => {
+
+ const setCardDrawer = (cardId) => {
+ setContact(cardId);
+ contactNav.openDrawer();
+ }
+
return (
- }>
-
- {(props) => }
+ }>
+
+ {(props) => }
);
};
+ const ContactDrawerScreen = ({ detailNav, profileNav }) => {
+
+ const [cardId, setCardId] = useState(null);
+ const setContact = (id) => {
+ setCardId(id);
+ }
+
+ return (
+ }>
+
+ {(props) => }
+
+
+ );
+ }
+
+ const ProfileDrawerScreen = ({ detailNav }) => {
+ return (
+ }>
+
+ {(props) => }
+
+
+ );
+ }
+
return (
-
-
- { state.tabbed === false && (
-
+ { state.tabbed === false && (
+ }>
+
+ {(props) => }
+
+
+ )}
+ { state.tabbed === true && (
+ ({
+ tabBarStyle: styles.tabBar,
+ headerShown: false,
+ tabBarIcon: ({ focused, color, size }) => {
+ if (route.name === 'Profile') {
+ return ;
}
- }}
- drawerContent={(props) => }>
-
-
- )}
- { state.tabbed === true && (
- ({
- tabBarStyle: styles.tabBar,
- headerShown: false,
- tabBarIcon: ({ focused, color, size }) => {
- if (route.name === 'Profile') {
- return ;
- }
- if (route.name === 'Conversation') {
- return ;
- }
- if (route.name === 'Contacts') {
- return ;
- }
- },
- tabBarShowLabel: false,
- tabBarActiveTintColor: Colors.white,
- tabBarInactiveTintColor: Colors.disabled,
- })}>
-
-
-
-
- )}
-
-
+ if (route.name === 'Conversation') {
+ return ;
+ }
+ if (route.name === 'Contacts') {
+ return ;
+ }
+ },
+ tabBarShowLabel: false,
+ tabBarActiveTintColor: Colors.white,
+ tabBarInactiveTintColor: Colors.disabled,
+ })}>
+
+
+
+ {(props) => ()}
+
+
+ )}
+ >
);
}
diff --git a/app/mobile/src/session/Session.styled.js b/app/mobile/src/session/Session.styled.js
index 4280b79f..6a1814d1 100644
--- a/app/mobile/src/session/Session.styled.js
+++ b/app/mobile/src/session/Session.styled.js
@@ -41,4 +41,8 @@ export const styles = StyleSheet.create({
channels: {
flexGrow: 1,
},
+ tabframe: {
+ width: '100%',
+ height: '100%',
+ }
});
diff --git a/app/mobile/src/session/cards/Cards.jsx b/app/mobile/src/session/cards/Cards.jsx
index 2b15a767..1952c0c4 100644
--- a/app/mobile/src/session/cards/Cards.jsx
+++ b/app/mobile/src/session/cards/Cards.jsx
@@ -1,12 +1,18 @@
-import { useContext } from 'react';
+import { useState, useContext } from 'react';
import { View, TouchableOpacity, Text } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { AppContext } from 'context/AppContext';
-export function Cards() {
+export function Cards({ navigation, openContact }) {
const app = useContext(AppContext);
+ const [cardId, setCardId] = useState(0);
- return (~ CARDS LOGOUT)
+ const onPressCard = () => {
+ openContact(cardId);
+ setCardId(cardId + 1);
+ }
+
+ return CARD
}
diff --git a/app/mobile/src/session/channels/Channels.jsx b/app/mobile/src/session/channels/Channels.jsx
index 7bffb458..69696176 100644
--- a/app/mobile/src/session/channels/Channels.jsx
+++ b/app/mobile/src/session/channels/Channels.jsx
@@ -11,7 +11,7 @@ export function Channels() {
return (
-
+
diff --git a/app/mobile/src/session/channels/Channels.styled.js b/app/mobile/src/session/channels/Channels.styled.js
index e5151c23..9a9d4cce 100644
--- a/app/mobile/src/session/channels/Channels.styled.js
+++ b/app/mobile/src/session/channels/Channels.styled.js
@@ -12,7 +12,7 @@ export const styles = StyleSheet.create({
display: 'flex',
flexDirection: 'row',
borderRadius: 4,
- backgroundColor: Colors.lightgrey,
+ backgroundColor: Colors.background,
alignItems: 'center',
marginRight: 8,
marginLeft: 8,
@@ -20,7 +20,7 @@ export const styles = StyleSheet.create({
inputfield: {
flex: 1,
textAlign: 'center',
- padding: 8,
+ padding: 4,
color: Colors.white,
fontSize: 16,
},
diff --git a/app/mobile/src/session/contact/Contact.jsx b/app/mobile/src/session/contact/Contact.jsx
index aa432a5e..0ebe441f 100644
--- a/app/mobile/src/session/contact/Contact.jsx
+++ b/app/mobile/src/session/contact/Contact.jsx
@@ -1,3 +1,12 @@
-export function Contact() {
- return <>>
+import { useState, useContext } from 'react';
+import { View, TouchableOpacity, Text } from 'react-native';
+
+export function Contact({ navigation, closeContact }) {
+
+ const onPressCard = () => {
+ closeContact();
+ }
+
+ return CLOSE
}
+
diff --git a/app/mobile/src/session/profile/Profile.jsx b/app/mobile/src/session/profile/Profile.jsx
index a44b957f..3c27ae0a 100644
--- a/app/mobile/src/session/profile/Profile.jsx
+++ b/app/mobile/src/session/profile/Profile.jsx
@@ -2,11 +2,18 @@ import { useContext } from 'react';
import { View, TouchableOpacity, Text } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { AppContext } from 'context/AppContext';
+import { useNavigate } from 'react-router-dom';
export function Profile() {
const app = useContext(AppContext);
+ const navigate = useNavigate();
- return (~ PROFILE LOGOUT)
+ const logout = () => {
+ app.actions.logout();
+ navigate('/');
+ }
+
+ return (~ PROFILE LOGOUT)
}
diff --git a/app/mobile/src/session/useSession.hook.js b/app/mobile/src/session/useSession.hook.js
index 09759de8..85f39fb3 100644
--- a/app/mobile/src/session/useSession.hook.js
+++ b/app/mobile/src/session/useSession.hook.js
@@ -8,11 +8,10 @@ export function useSession() {
const [state, setState] = useState({
tabbled: null,
- profileWidth: '33%',
- cardWidth: '33%',
+ subWidth: '33%',
+ baseWidth: '33%',
cardId: null,
converstaionId: null,
- contactDrawer: 'profile',
});
const dimensions = useWindowDimensions();
const app = useContext(AppContext);
@@ -26,10 +25,10 @@ export function useSession() {
if (dimensions.width > config.tabbedWidth) {
const width = Math.floor((dimensions.width * 33) / 100);
if (width > 500) {
- updateStatus({ tabbed: false, cardWidth: 550, profileWidth: 500 });
+ updateStatus({ tabbed: false, baseWidth: 550, subWidth: 500 });
}
else {
- updateState({ tabbed: false, cardWidth: width + 50, profileWidth: width });
+ updateState({ tabbed: false, baseWidth: width + 50, subWidth: width });
}
}
else {
@@ -38,9 +37,9 @@ export function useSession() {
}, [dimensions]);
const actions = {
- setContactDrawer: (contactDrawer) => {
- updateState({ contactDrawer });
- },
+ setCardId: (cardId) => {
+ updateState({ cardId });
+ }
};
return { state, actions };
diff --git a/app/mobile/src/session/welcome/Welcome.jsx b/app/mobile/src/session/welcome/Welcome.jsx
index 208d200a..ab0c4fc4 100644
--- a/app/mobile/src/session/welcome/Welcome.jsx
+++ b/app/mobile/src/session/welcome/Welcome.jsx
@@ -1,3 +1,4 @@
+import { useEffect } from 'react';
import { Image, View, TouchableOpacity, Text } from 'react-native';
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
import { styles } from './Welcome.styled';
@@ -5,6 +6,11 @@ import { styles } from './Welcome.styled';
import session from 'images/session.png';
export function Welcome() {
+
+ useEffect(() => {
+ console.log("WELCOME");
+ }, []);
+
return (
Welcome to Databag