Skip to content

Commit

Permalink
init screen
Browse files Browse the repository at this point in the history
  • Loading branch information
MSghais committed Aug 21, 2024
1 parent 8c440a3 commit 6e914a8
Show file tree
Hide file tree
Showing 27 changed files with 424 additions and 372 deletions.
107 changes: 52 additions & 55 deletions apps/mobile/src/app/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
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 {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 Sidebar from '../modules/Layout/sidebar';
import {Icon} from '../components';
import {Navbar} from '../components/Navbar';
import {useStyles, useTheme} from '../hooks';
import AuthSidebar from '../modules/Layout/auth-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 { 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 { AuthStackParams, HomeBottomStackParams, MainStackParams, RootStackParams } from '../types';
import { retrievePublicKey } from '../utils/storage';
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 {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 {AuthStackParams, HomeBottomStackParams, MainStackParams, RootStackParams} from '../types';
import {retrievePublicKey} from '../utils/storage';

const DrawerStack = createDrawerNavigator<MainStackParams>();
const RootStack = createNativeStackNavigator<RootStackParams>();
Expand All @@ -44,8 +44,8 @@ const HomeBottomTabsStack = createBottomTabNavigator<HomeBottomStackParams>();
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 @@ -62,7 +62,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 @@ -81,7 +81,7 @@ const HomeBottomTabNavigator: React.FC = () => {
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'grey',
tabBarIcon: ({ focused }) => (
tabBarIcon: ({focused}) => (
<View style={styles.tabBarIcon}>
<Icon
name="CoinIcon"
Expand All @@ -101,7 +101,7 @@ const HomeBottomTabNavigator: React.FC = () => {
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'grey',
tabBarIcon: ({ focused }) => (
tabBarIcon: ({focused}) => (
<View style={styles.tabBarIcon}>
<Icon
name="GameIcon"
Expand All @@ -118,11 +118,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 @@ -143,7 +143,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 @@ -180,7 +180,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 @@ -193,7 +193,7 @@ const AuthNavigator: React.FC = () => {
overlayColor: isDesktop ? 'transparent' : theme.theme.colors.background, // Make sure overlay settings are correct
// swipeEdgeWidth: 0
drawerStyle: {
width: "25%", // Adjust width or other styling as necessary
width: '25%', // Adjust width or other styling as necessary
},
})}
>
Expand All @@ -218,7 +218,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 Down Expand Up @@ -283,9 +283,10 @@ const MainNavigator: React.FC = () => {

const linking = {
prefixes: [
"home", "search",
"profile/:publicKey",
"details/:id"
'home',
'search',
'profile/:publicKey',
'details/:id',
/* your linking prefixes */
],
config: {
Expand Down Expand Up @@ -335,15 +336,13 @@ 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} /> */}
{publicKey ? (
<RootStack.Screen
name="MainStack"
component={MainNavigator} />
<RootStack.Screen name="MainStack" component={MainNavigator} />
) : (
<RootStack.Screen name="AuthStack" component={AuthNavigator} />
)}
Expand All @@ -356,9 +355,7 @@ export const Router: React.FC = () => {
const windowWidth = Dimensions.get('window').width;
const shouldShowSidebar = isWeb && windowWidth >= 1024;
return (
<NavigationContainer
linking={linking}
>
<NavigationContainer linking={linking}>
{/* {shouldShowSidebar && <Sidebar></Sidebar>} */}

<RootNavigator />
Expand Down
14 changes: 5 additions & 9 deletions apps/mobile/src/assets/icons.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Svg, { G, Path, Rect, SvgProps } from 'react-native-svg';
import Svg, {G, Path, Rect, SvgProps} from 'react-native-svg';

export const AddPostIcon: React.FC<SvgProps> = (props) => (
<Svg viewBox="0 0 72 72" fill="none" {...props}>
Expand Down Expand Up @@ -106,8 +106,8 @@ export const AFKIcon: React.FC<SvgProps> = (props) => (
<Path
fill="currentColor"
d="m0 0h205l6 3 2 4v120l-4 5-2 1-132 1v38l136 1 2 3v127l-4 3-133 1-1 68-2 5-6 5h-139l-6-4-2-4v-285l3-6 4-3 64-1 1-76 5-5z"
// d="m0 0h143l5 4 1 4v156h62v-100l3-3h149l3 3v127l-3 3-96 1-1 57h96l4 3v127l-2 3h-151l-2-3v-84h-62v77l-3 6-4 2h-142l-4-2-3-8v-364l3-7z"
// d="M7.202 9.44V1h3.38v9.32c0 3.72-3.02 5.12-5.78 5.12-1.66 0-3.24-.52-4.04-1.32l.94-3.04c.76.66 1.86 1.06 2.86 1.06 1.4 0 2.64-.78 2.64-2.7ZM28.578 8c0 5-4.32 7.46-7.98 7.46-3.68 0-7.98-2.46-7.98-7.46s4.3-7.46 7.98-7.46c3.66 0 7.98 2.46 7.98 7.46Zm-3.46 0c0-2.86-2.44-4.26-4.52-4.26-2.1 0-4.54 1.4-4.54 4.26s2.44 4.24 4.54 4.24c2.08 0 4.52-1.38 4.52-4.24Zm-6.08.02c0-.94.6-1.56 1.56-1.56.94 0 1.54.62 1.54 1.56 0 .94-.6 1.54-1.54 1.54-.96 0-1.56-.6-1.56-1.54ZM30.001 1h3.94l5.52 8.26V15h-3.38V9.38L30.001 1Zm9.2 3.5 2.4-3.5h3.94l-4.38 5.82-1.96-2.32ZM56.335 15h-9v-2.74h8.3c1.14 0 1.72-.78 1.72-1.58 0-.78-.58-1.56-1.72-1.56h-8.3v-2.5h7.04c1.14 0 1.72-.76 1.72-1.54 0-.76-.58-1.54-1.72-1.54h-7.04V1h7.74c2.92 0 4.38 2.02 4.38 4.06 0 .84-.26 1.68-.76 2.38 1.3.84 1.92 2.2 1.92 3.54 0 2.04-1.46 4.02-4.28 4.02ZM78.414 8c0 5-4.32 7.46-7.98 7.46-3.68 0-7.98-2.46-7.98-7.46s4.3-7.46 7.98-7.46c3.66 0 7.98 2.46 7.98 7.46Zm-3.46 0c0-2.86-2.44-4.26-4.52-4.26-2.1 0-4.54 1.4-4.54 4.26s2.44 4.24 4.54 4.24c2.08 0 4.52-1.38 4.52-4.24Zm-6.08.02c0-.94.6-1.56 1.56-1.56.94 0 1.54.62 1.54 1.56 0 .94-.6 1.54-1.54 1.54-.96 0-1.56-.6-1.56-1.54ZM79.836 1h3.94l5.52 8.26V15h-3.38V9.38L79.836 1Zm9.2 3.5 2.4-3.5h3.94l-4.38 5.82-1.96-2.32Z"
// d="m0 0h143l5 4 1 4v156h62v-100l3-3h149l3 3v127l-3 3-96 1-1 57h96l4 3v127l-2 3h-151l-2-3v-84h-62v77l-3 6-4 2h-142l-4-2-3-8v-364l3-7z"
// d="M7.202 9.44V1h3.38v9.32c0 3.72-3.02 5.12-5.78 5.12-1.66 0-3.24-.52-4.04-1.32l.94-3.04c.76.66 1.86 1.06 2.86 1.06 1.4 0 2.64-.78 2.64-2.7ZM28.578 8c0 5-4.32 7.46-7.98 7.46-3.68 0-7.98-2.46-7.98-7.46s4.3-7.46 7.98-7.46c3.66 0 7.98 2.46 7.98 7.46Zm-3.46 0c0-2.86-2.44-4.26-4.52-4.26-2.1 0-4.54 1.4-4.54 4.26s2.44 4.24 4.54 4.24c2.08 0 4.52-1.38 4.52-4.24Zm-6.08.02c0-.94.6-1.56 1.56-1.56.94 0 1.54.62 1.54 1.56 0 .94-.6 1.54-1.54 1.54-.96 0-1.56-.6-1.56-1.54ZM30.001 1h3.94l5.52 8.26V15h-3.38V9.38L30.001 1Zm9.2 3.5 2.4-3.5h3.94l-4.38 5.82-1.96-2.32ZM56.335 15h-9v-2.74h8.3c1.14 0 1.72-.78 1.72-1.58 0-.78-.58-1.56-1.72-1.56h-8.3v-2.5h7.04c1.14 0 1.72-.76 1.72-1.54 0-.76-.58-1.54-1.72-1.54h-7.04V1h7.74c2.92 0 4.38 2.02 4.38 4.06 0 .84-.26 1.68-.76 2.38 1.3.84 1.92 2.2 1.92 3.54 0 2.04-1.46 4.02-4.28 4.02ZM78.414 8c0 5-4.32 7.46-7.98 7.46-3.68 0-7.98-2.46-7.98-7.46s4.3-7.46 7.98-7.46c3.66 0 7.98 2.46 7.98 7.46Zm-3.46 0c0-2.86-2.44-4.26-4.52-4.26-2.1 0-4.54 1.4-4.54 4.26s2.44 4.24 4.54 4.24c2.08 0 4.52-1.38 4.52-4.24Zm-6.08.02c0-.94.6-1.56 1.56-1.56.94 0 1.54.62 1.54 1.56 0 .94-.6 1.54-1.54 1.54-.96 0-1.56-.6-1.56-1.54ZM79.836 1h3.94l5.52 8.26V15h-3.38V9.38L79.836 1Zm9.2 3.5 2.4-3.5h3.94l-4.38 5.82-1.96-2.32Z"
/>
</Svg>
);
Expand Down Expand Up @@ -242,9 +242,8 @@ export const LikeIcon: React.FC<SvgProps> = (props) => {
);
};


export const BookmarkIcon: React.FC<SvgProps> = (props) => (
<Svg width="32" height="32" viewBox="0 0 21 21" {...props}>
<Svg width="32" height="32" viewBox="0 0 21 21" {...props}>
<Path
fill="currentColor"
fillRule="evenodd"
Expand All @@ -253,9 +252,7 @@ export const BookmarkIcon: React.FC<SvgProps> = (props) => (
// d="M 12.8125 2 C 12.335938 2.089844 11.992188 2.511719 12 3 L 12 47 C 11.996094 47.359375 12.1875 47.691406 12.496094 47.871094 C 12.804688 48.054688 13.1875 48.054688 13.5 47.875 L 25 41.15625 L 36.5 47.875 C 36.8125 48.054688 37.195313 48.054688 37.503906 47.871094 C 37.8125 47.691406 38.003906 47.359375 38 47 L 38 3 C 38 2.449219 37.550781 2 37 2 L 13 2 C 12.96875 2 12.9375 2 12.90625 2 C 12.875 2 12.84375 2 12.8125 2 Z M 14 4 L 36 4 L 36 45.25 L 25.5 39.125 C 25.191406 38.945313 24.808594 38.945313 24.5 39.125 L 14 45.25 Z"
/>
</Svg>

)

);

export const LikeFillIcon: React.FC<SvgProps> = (props) => {
return (
Expand Down Expand Up @@ -589,7 +586,6 @@ export const MoonIcon: React.FC<SvgProps> = (props) => (
</Svg>
);


export const MenuIcon: React.FC<SvgProps> = (props) => (
<Svg viewBox="0 0 32 32" fill="none" {...props}>
<Path
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/src/components/PrivateKeyImport/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {useTheme} from '@react-navigation/native';
import {useAuth} from 'afk_nostr_sdk';
import * as Clipboard from 'expo-clipboard';
import {useState} from 'react';
import {Pressable, TouchableOpacity, View} from 'react-native';
import {TouchableOpacity, View} from 'react-native';

import {CopyIconStack, LockIcon} from '../../assets/icons';
import {useToast} from '../../hooks/modals';
Expand All @@ -12,10 +12,10 @@ import {
retrievePassword,
retrievePublicKey,
} from '../../utils/storage';
import {Button} from '../Button';
import {Input} from '../Input';
import {Text} from '../Text';
import styles from './styles';
import { Button } from '../Button';

export const PrivateKeyImport: React.FC = () => {
const {publicKey, isExtension, privateKey, setAuth} = useAuth();
Expand Down
Loading

0 comments on commit 6e914a8

Please sign in to comment.