Skip to content

Commit

Permalink
Release/od hack lfg (#41)
Browse files Browse the repository at this point in the history
* ui tip + todo defi screen

* backend + readme + start search base

* add linking for web

* init screen

* init hooks private group
  • Loading branch information
MSghais authored Aug 21, 2024
1 parent a450e46 commit de78fee
Show file tree
Hide file tree
Showing 45 changed files with 1,128 additions and 341 deletions.
18 changes: 18 additions & 0 deletions apps/data-backend/README.Md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Backend of AFK

## Description
Express typescript backend.
Routes for Indexer.
Telegram bot answers for AFK Mini app.

## TODO

- [] Telegram Alert for Event on AFK
- [] Gamification

## Kill process issues
```
sudo lsof -t -i:5050
sudo kill -9 [ID_RECEIVED_BEFORE]
```
40 changes: 0 additions & 40 deletions apps/data-backend/src/index.js

This file was deleted.

1 change: 0 additions & 1 deletion apps/data-backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ app.listen(port, () => {
console.log(`🚀 Backend server running at http://localhost:${port}`);
try {
launchBot(process.env.TELEGRAM_BOT_TOKEN)

}catch(e) {

}
Expand Down
1 change: 1 addition & 0 deletions apps/data-backend/src/services/telegram-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function listenToCommands(bot) {
reply_markup: {
inline_keyboard: [
[{ text: "Start Mini App", web_app: { url: process.env.TELEGRAM_WEB_APP } }],
[{ text: "Start AFK", web_app: { url: process.env.TELEGRAM_MOBILE_APP } }],
]
}
})
Expand Down
132 changes: 79 additions & 53 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 @@ -178,12 +178,12 @@ const AuthNavigator: React.FC = () => {
if (publicKey === undefined) return null;

return (
<AuthStack.Navigator
<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,
headerShown: false,
headerStyle: {
backgroundColor: theme.theme.colors.background,
},
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,35 +283,63 @@ const MainNavigator: React.FC = () => {

const linking = {
prefixes: [
// "home","search", "profile/:publicKey", "details/:id"
'home',
'search',
'profile/:publicKey',
'details/:id',
/* your linking prefixes */
],
config: {
screens: {
Home: 'home',
MainStack: 'app',
Menu: 'menu',
Search: 'search',
AuthStack: 'auth',
Feed: 'feed',
ImportKeys: 'import-keys',
KeysMarketplace: 'keys-marketplace',
CreateChannel: 'create-channel',
CreateForm: 'create-form',
EditProfile: 'edit-profile',
Launchpad: 'launchpad',
LaunchToken: 'launch-token',
Games: 'games',
Defi: 'defi',
Settings: 'settings',
Tips: 'Tips',
ChannelDetail: {
path: 'channel/:publicKey', // Example of a path with a parameter
parse: {
id: (id: any) => `${id}`, // Convert the id from the URL to a string, if needed
},
},
Details: {
path: 'profile/:publicKey', // Example of a path with a parameter
parse: {
id: (id: any) => `${id}`, // Convert the id from the URL to a string, if needed
},
},
Profile: {
path: 'details/:id', // Example of a path with a parameter
path: 'profile/nostr/', // Example of a path with a parameter
parse: {
id: (id: any) => `${id}`, // Convert the id from the URL to a string, if needed
},

// path: 'details/:id', // Example of a path with a parameter
// parse: {
// id: (id: any) => `${id}`, // Convert the id from the URL to a string, if needed
// },
},
},
},
};

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} />
Expand All @@ -327,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
Loading

0 comments on commit de78fee

Please sign in to comment.