Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Group Flows #60

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 66 additions & 61 deletions apps/mobile/src/app/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { createDrawerNavigator } from '@react-navigation/drawer';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { useAuth } from 'afk_nostr_sdk';
import { useEffect, useMemo, useState } from 'react';
import { Dimensions, Platform, StyleSheet, useWindowDimensions, View } from 'react-native';

import { Icon } from '../components';
import { Navbar } from '../components/Navbar';
import { useStyles, useTheme } from '../hooks';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import {createDrawerNavigator} from '@react-navigation/drawer';
import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {useAuth} from 'afk_nostr_sdk';
import {useEffect, useMemo, useState} from 'react';
import {Dimensions, Platform, StyleSheet, useWindowDimensions, View} from 'react-native';

import {Icon} from '../components';
import {Navbar} from '../components/Navbar';
import {useStyles, useTheme} from '../hooks';
import GroupChatDetail from '../modules/Group/groupDetail/GroupChatDetail';
import GroupChat from '../modules/Group/message/GroupMessage';
import AuthSidebar from '../modules/Layout/auth-sidebar';
import DegensSidebar from '../modules/Layout/degens-sidebar';
import Sidebar from '../modules/Layout/sidebar';
import { CreateAccount } from '../screens/Auth/CreateAccount';
import { ImportKeys } from '../screens/Auth/ImportKeys';
import { Login } from '../screens/Auth/Login';
import { SaveKeys } from '../screens/Auth/SaveKeys';
import { ChannelDetail } from '../screens/ChannelDetail';
import { ChannelsFeed } from '../screens/ChannelsFeed';
import { CreateChannel } from '../screens/CreateChannel';
import { CreateForm } from '../screens/CreateForm';
import { CreatePost } from '../screens/CreatePost';
import { Defi } from '../screens/Defi';
import { EditProfile } from '../screens/EditProfile';
import { Feed } from '../screens/Feed';
import { Games } from '../screens/Games';
import { LaunchDetail } from '../screens/LaunchDetail';
import { LightningNetworkScreen } from '../screens/Lightning';
import { PostDetail } from '../screens/PostDetail';
import { Profile } from '../screens/Profile';
import { Search } from '../screens/Search';
import { Settings } from '../screens/Settings';
import { Tips } from '../screens/Tips';
import { ThemedStyleSheet } from '../styles';
import {CreateAccount} from '../screens/Auth/CreateAccount';
import {ImportKeys} from '../screens/Auth/ImportKeys';
import {Login} from '../screens/Auth/Login';
import {SaveKeys} from '../screens/Auth/SaveKeys';
import {ChannelDetail} from '../screens/ChannelDetail';
import {ChannelsFeed} from '../screens/ChannelsFeed';
import {CreateChannel} from '../screens/CreateChannel';
import {CreateForm} from '../screens/CreateForm';
import {CreatePost} from '../screens/CreatePost';
import {Defi} from '../screens/Defi';
import {EditProfile} from '../screens/EditProfile';
import {Feed} from '../screens/Feed';
import {Games} from '../screens/Games';
import {LaunchDetail} from '../screens/LaunchDetail';
import {LightningNetworkScreen} from '../screens/Lightning';
import {PostDetail} from '../screens/PostDetail';
import {Profile} from '../screens/Profile';
import {Search} from '../screens/Search';
import {Settings} from '../screens/Settings';
import {Tips} from '../screens/Tips';
import {Whatever} from '../screens/Whatever';
import {ThemedStyleSheet} from '../styles';
import {
AuthStackParams,
DegensAppStackParams,
Expand All @@ -41,8 +44,7 @@ import {
MainStackParams,
RootStackParams,
} from '../types';
import { retrievePublicKey } from '../utils/storage';
import { Whatever } from '../screens/Whatever';
import {retrievePublicKey} from '../utils/storage';
const DrawerStack = createDrawerNavigator<MainStackParams>();
const RootStack = createNativeStackNavigator<RootStackParams>();
const AuthStack = createDrawerNavigator<AuthStackParams>();
Expand All @@ -56,8 +58,8 @@ const DegensAppStack = createDrawerNavigator<DegensAppStackParams>();
const HomeBottomTabNavigator: React.FC = () => {
const styles = useStyles(stylesheet);

const { publicKey } = useAuth();
const { theme } = useTheme();
const {publicKey} = useAuth();
const {theme} = useTheme();

return (
<HomeBottomTabsStack.Navigator
Expand All @@ -74,7 +76,7 @@ const HomeBottomTabNavigator: React.FC = () => {
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: theme.colors.background,
tabBarIcon: ({ focused }) => (
tabBarIcon: ({focused}) => (
<View style={styles.tabBarIcon}>
<Icon
name="HomeIcon"
Expand All @@ -93,7 +95,7 @@ const HomeBottomTabNavigator: React.FC = () => {
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'grey',
tabBarIcon: ({ focused }) => (
tabBarIcon: ({focused}) => (
<View style={styles.tabBarIcon}>
<Icon
name="CoinIcon"
Expand All @@ -113,7 +115,7 @@ const HomeBottomTabNavigator: React.FC = () => {
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'grey',
tabBarIcon: ({ focused }) => (
tabBarIcon: ({focused}) => (
<View style={styles.tabBarIcon}>
<Icon
name="GameIcon"
Expand All @@ -130,11 +132,11 @@ const HomeBottomTabNavigator: React.FC = () => {
<HomeBottomTabsStack.Screen
name="UserProfile"
component={Profile as any}
initialParams={{ publicKey }}
initialParams={{publicKey}}
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'grey',
tabBarIcon: ({ focused }) => (
tabBarIcon: ({focused}) => (
<View style={styles.tabBarIcon}>
<Icon
name="UserIcon"
Expand All @@ -155,7 +157,7 @@ const HomeBottomTabNavigator: React.FC = () => {
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'grey',
tabBarIcon: ({ focused }) => (
tabBarIcon: ({focused}) => (
<View style={styles.tabBarIcon}>
<Icon
name="UserIcon"
Expand Down Expand Up @@ -192,7 +194,7 @@ const AuthNavigator: React.FC = () => {
return (
<AuthStack.Navigator
drawerContent={(props) => <AuthSidebar navigation={props?.navigation}></AuthSidebar>}
screenOptions={({ navigation }) => ({
screenOptions={({navigation}) => ({
// headerShown:false,
header: () => <Navbar navigation={navigation} title="AFK" showLogo={true} />,
headerShown: false,
Expand All @@ -219,7 +221,7 @@ const AuthNavigator: React.FC = () => {

const DrawerRightDesktop = createDrawerNavigator();

const RightDrawerNavigator = () => {
const RightDrawerNavigator = () => {
const dimensions = useWindowDimensions();
const isDesktop = useMemo(() => {
return dimensions.width >= 1024;
Expand All @@ -231,7 +233,7 @@ const RightDrawerNavigator = () => {
<DrawerRightDesktop.Navigator
// initialRouteName="RightDrawer"
drawerContent={(props) => <AuthSidebar navigation={props?.navigation}></AuthSidebar>}
screenOptions={({ navigation }) => ({
screenOptions={({navigation}) => ({
// drawerPosition: "right",
drawerType: isDesktop ? 'permanent' : 'front',
// drawerType:"permanent",
Expand All @@ -248,8 +250,7 @@ const RightDrawerNavigator = () => {
<DrawerRightDesktop.Screen name="Whatever" component={Whatever} />
</DrawerRightDesktop.Navigator>
);
}

};

const MainNavigator: React.FC = () => {
const dimensions = useWindowDimensions();
Expand All @@ -264,7 +265,7 @@ const MainNavigator: React.FC = () => {
// screenOptions={{ headerShown: false }}
// initialRouteName="Home"
drawerContent={(props) => <Sidebar navigation={props?.navigation}></Sidebar>}
screenOptions={({ navigation }) => ({
screenOptions={({navigation}) => ({
// headerShown:false,
header: () => <Navbar navigation={navigation} title="AFK" showLogo={true} />,
headerStyle: {
Expand All @@ -287,10 +288,12 @@ const MainNavigator: React.FC = () => {
) : (
<DrawerStack.Screen name="Feed" component={Feed} />
)}
{isDesktop &&
<DrawerStack.Screen name="RightDrawer" component={RightDrawerNavigator} >
</ DrawerStack.Screen>
}
{isDesktop && (
<DrawerStack.Screen
name="RightDrawer"
component={RightDrawerNavigator}
></DrawerStack.Screen>
)}

<DrawerStack.Screen name="Profile" component={Profile} />
<DrawerStack.Screen name="EditProfile" component={EditProfile} />
Expand All @@ -303,6 +306,8 @@ const MainNavigator: React.FC = () => {
<DrawerStack.Screen name="CreateForm" component={CreateForm} />
<DrawerStack.Screen name="Defi" component={Defi} />
<DrawerStack.Screen name="Games" component={Games} />
<DrawerStack.Screen name="GroupChat" component={GroupChat} />
<DrawerStack.Screen name="GroupChatDetail" component={GroupChatDetail} />
<DrawerStack.Screen name="Tips" component={Tips} />
<DrawerStack.Screen name="Settings" component={Settings} />
<DrawerStack.Screen name="LaunchDetail" component={LaunchDetail} />
Expand All @@ -316,8 +321,8 @@ const MainNavigator: React.FC = () => {
const DegensBottomTabNavigator: React.FC = () => {
const styles = useStyles(stylesheet);

const { publicKey } = useAuth();
const { theme } = useTheme();
const {publicKey} = useAuth();
const {theme} = useTheme();

return (
<DegensBottomTabsStack.Navigator
Expand All @@ -334,7 +339,7 @@ const DegensBottomTabNavigator: React.FC = () => {
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: theme.colors.background,
tabBarIcon: ({ focused }) => (
tabBarIcon: ({focused}) => (
<View style={styles.tabBarIcon}>
<Icon
name="MoonIcon"
Expand All @@ -353,7 +358,7 @@ const DegensBottomTabNavigator: React.FC = () => {
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'grey',
tabBarIcon: ({ focused }) => (
tabBarIcon: ({focused}) => (
<View style={styles.tabBarIcon}>
<Icon
name="CoinIcon"
Expand All @@ -373,7 +378,7 @@ const DegensBottomTabNavigator: React.FC = () => {
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'grey',
tabBarIcon: ({ focused }) => (
tabBarIcon: ({focused}) => (
<View style={styles.tabBarIcon}>
<Icon
name="GameIcon"
Expand All @@ -393,7 +398,7 @@ const DegensBottomTabNavigator: React.FC = () => {
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'grey',
tabBarIcon: ({ focused }) => (
tabBarIcon: ({focused}) => (
<View style={styles.tabBarIcon}>
<Icon
name="UserIcon"
Expand Down Expand Up @@ -423,7 +428,7 @@ const DegensAppNavigator: React.FC = () => {
// screenOptions={{ headerShown: false }}
// initialRouteName="Home"
drawerContent={(props) => <DegensSidebar navigation={props?.navigation}></DegensSidebar>}
screenOptions={({ navigation }) => ({
screenOptions={({navigation}) => ({
// headerShown:false,
header: () => <Navbar navigation={navigation} title="AFK" showLogo={true} />,
headerStyle: {
Expand Down Expand Up @@ -534,10 +539,10 @@ const linking = {
};

const RootNavigator: React.FC = () => {
const { publicKey } = useAuth();
const {publicKey} = useAuth();

return (
<RootStack.Navigator screenOptions={{ headerShown: false }}>
<RootStack.Navigator screenOptions={{headerShown: false}}>
{/* <RootStack.Screen name="MainStack" component={MainNavigator} />
<RootStack.Screen name="AuthStack" component={AuthNavigator} />
<RootStack.Screen name="DegensStack" component={DegensAppNavigator} /> */}
Expand Down
Loading
Loading