Skip to content

Commit

Permalink
Feat/week hack (#364)
Browse files Browse the repository at this point in the history
* add binary target

* add openssl before copy

* add new screen console and icon for new UI/UX

* clean

* try fix login + try logs notes and do a view text

* try fix kind

* undo nav
  • Loading branch information
MSghais authored Dec 14, 2024
1 parent 7620097 commit b066a41
Show file tree
Hide file tree
Showing 22 changed files with 327 additions and 1,364 deletions.
4 changes: 3 additions & 1 deletion Dockerfile.indexer.railway
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ COPY package.json pnpm-workspace.yaml ./

# Install pnpm globally
RUN npm install -g pnpm
RUN apk add --no-cache openssl

# Copy the entire repository into the Docker container
COPY . .

RUN apk add --no-cache openssl
# RUN apk add --no-cache openssl


# Install all dependencies for the workspace
RUN pnpm install --force
Expand Down
14 changes: 14 additions & 0 deletions apps/mobile/src/app/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import {ThemedStyleSheet} from '../styles';
// Utilities
import {AuthStackParams, HomeBottomStackParams, MainStackParams, RootStackParams} from '../types';
import {initGoogleAnalytics, logPageView} from '../utils/analytics';
import { ConsoleScreen } from '../screens/Console';

type TabBarIconProps = {
focused: boolean;
Expand Down Expand Up @@ -130,6 +131,17 @@ const HomeBottomTabNavigator: React.FC = () => {
}}
/>


<HomeBottomTabsStack.Screen
name="Console"
component={ConsoleScreen as any}
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'grey',
tabBarIcon: ({ focused }) => <TabBarIcon focused={focused} name="ConsoleIcon" />,
}}
/>

<HomeBottomTabsStack.Screen
name="Games"
component={Games as any}
Expand Down Expand Up @@ -325,6 +337,8 @@ const MainNavigator: React.FC = () => {
<MainStack.Screen name="Launchpad" component={LaunchpadScreen} />
<MainStack.Screen name="Nameservice" component={NameserviceScreen} />
<MainStack.Screen name="ReceiveEcash" component={ReceiveEcash} />
<MainStack.Screen name="Console" component={ConsoleScreen} />

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


export const ConsoleIcon: React.FC<SvgProps> = (props) => (
<Svg viewBox="0 0 24 24" fill="none" {...props}>
<Path
fill="currentColor"
d="M20 3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H4V5h16v14z"
/>
<Path
fill="currentColor"
d="M6 7h5v5H6zm7 0h5v5h-5zm-7 7h5v3H6zm7 0h5v3h-5z"
/>
</Svg>
);


export const AddPostIcon: React.FC<SvgProps> = (props) => (
<Svg viewBox="0 0 72 72" fill="none" {...props}>
<Path
Expand Down
10 changes: 9 additions & 1 deletion apps/mobile/src/context/LoginModalProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import {createContext, useCallback, useMemo, useRef, useState} from 'react';
import {useNavigation} from '@react-navigation/native';

import {Modalize} from '../components';
import {LoginNostrModule} from '../modules/Login';
import {TipSuccessModal, TipSuccessModalProps} from '../modules/TipSuccessModal';
import { MainStackNavigationProps } from '../types';

export type LoginModalContextType = {
show: () => void;
Expand All @@ -18,6 +20,9 @@ export type LoginModal = Modalize;
export const LoginModalProvider: React.FC<React.PropsWithChildren> = ({children}) => {
const loginModalRef = useRef<LoginModal>(null);


// const navigation = useNavigation<MainStackNavigationProps>()

const [successModal, setSuccessModal] = useState<TipSuccessModalProps | null>(null);

const show = useCallback(() => {
Expand Down Expand Up @@ -57,7 +62,10 @@ export const LoginModalProvider: React.FC<React.PropsWithChildren> = ({children}
ref={loginModalRef}
adjustToContentHeight
>
<LoginNostrModule />
{/* TODO: Add navigationProps in the Login Modal others issues */}
<LoginNostrModule
// navigationProps={navigation}
/>
</Modalize>

{successModal && <TipSuccessModal {...successModal} />}
Expand Down
97 changes: 97 additions & 0 deletions apps/mobile/src/screens/Console/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import {useState} from 'react';
import {KeyboardAvoidingView, ScrollView, Text, View} from 'react-native';
import {SafeAreaView} from 'react-native-safe-area-context';

import {TextButton} from '../../components';
import TabSelector from '../../components/TabSelector';
import {useStyles, useTheme} from '../../hooks';
import {PixelPeace} from '../../modules/PixelPeace';
import {ConsoleScreenProps} from '../../types';
import {SelectedTab, TABS_CONSOLE} from '../../types/tab';
import {AllKeysComponent} from '../KeysMarketplace/AllKeysComponent';
import {LaunchpadComponent} from '../Launchpad/LaunchpadComponent';
import {SlinksMap} from '../Slink/SlinksMap';
import stylesheet from './styles';
import {NameserviceComponent} from '../../modules/nameservice';

export const ConsoleScreen: React.FC<ConsoleScreenProps> = ({navigation}) => {
const theme = useTheme();
const styles = useStyles(stylesheet);
const [selectedTab, setSelectedTab] = useState<SelectedTab | undefined>(
SelectedTab.LAUNCHPAD_VIEW,
);
const handleTabSelected = (tab: string | SelectedTab, screen?: string) => {
setSelectedTab(tab as any);
if (screen) {
navigation.navigate(screen as any);
}
};
return (
<View style={styles.container}>
<SafeAreaView edges={['top', 'left', 'right']} style={styles.header}>
<TextButton style={styles.cancelButton} onPress={navigation.goBack}>
Cancel
</TextButton>
</SafeAreaView>
<KeyboardAvoidingView behavior="padding" style={styles.content}>
<TabSelector
activeTab={selectedTab}
handleActiveTab={handleTabSelected}
buttons={TABS_CONSOLE}
addScreenNavigation={false}
></TabSelector>
<SafeAreaView edges={['bottom', 'left', 'right']} style={styles.viewContent}>
<ScrollView>
{selectedTab == SelectedTab.PIXEL_PEACE && (
<>
<PixelPeace></PixelPeace>
</>
)}

{selectedTab == SelectedTab.SLINK && (
<>
<SlinksMap></SlinksMap>
</>
)}

{selectedTab == SelectedTab.LAUNCHPAD_VIEW && (
<View>
<LaunchpadComponent isButtonInstantiateEnable={true}></LaunchpadComponent>
</View>
)}

{selectedTab == SelectedTab.NAMESERVICE && (
<View>
<NameserviceComponent></NameserviceComponent>
</View>
)}

{selectedTab == SelectedTab?.VIEW_KEYS_MARKETPLACE && (
<>
<View
style={{
paddingVertical: 5,
borderRadius: 5,
borderColor: theme.theme?.colors?.shadow,
}}
>
<Text style={styles.text}>Key pass for Starknet user</Text>
<Text style={styles.text}>
{' '}
Send the force and tip your friends and favorite content creator.
</Text>
<Text style={styles.text}>
{' '}
Buy or sell the keys to get perks and rewards from them, linked to Nostr &
Starknet.
</Text>
</View>
<AllKeysComponent isButtonInstantiateEnable={true}></AllKeysComponent>
</>
)}
</ScrollView>
</SafeAreaView>
</KeyboardAvoidingView>
</View>
);
};
76 changes: 76 additions & 0 deletions apps/mobile/src/screens/Console/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// import {StyleSheet} from 'react-native';

import {Spacing, ThemedStyleSheet, Typography} from '../../styles';

export default ThemedStyleSheet((theme) => ({
container: {
flex: 1,
color: theme.colors.text,
backgroundColor: theme.colors.background,
},
header: {
flexDirection: 'row',
justifyContent: 'space-between',
backgroundColor: theme.colors.surface,
paddingHorizontal: Spacing.pagePadding,
// borderBottomWidth: StyleSheet.hairlineWidth,
// borderBottomColor: theme.colors.divider,
},
cancelButton: {
paddingVertical: Spacing.small,
paddingHorizontal: Spacing.xsmall,
},
content: {
flex: 1,
backgroundColor: theme.colors.background,
margin: Spacing.pagePadding,
// color: theme.colors.text,
},
viewContent: {
flex: 1,
backgroundColor: theme.colors.background,
marginTop: Spacing.pagePadding,
marginBottom: Spacing.pagePadding,
// color: theme.colors.text,
},
form: {
flex: 1,
},
input: {
flex: 1,
padding: Spacing.large,
color: theme.colors.inputText,
textAlignVertical: 'top',
fontSize: 16,
lineHeight: 24,
...Typography.medium,
},
imageContainer: {
padding: Spacing.pagePadding,
},
image: {
width: '100%',
resizeMode: 'cover',
borderRadius: 8,
overflow: 'hidden',
},

buttons: {
position: 'relative',
},
mediaButtons: {
flexDirection: 'row',
paddingHorizontal: Spacing.pagePadding,
paddingVertical: Spacing.small,
gap: Spacing.large,
alignItems: 'center',
},
sendButton: {
position: 'absolute',
right: Spacing.pagePadding,
bottom: '110%',
},
text: {
color: theme.colors.text,
},
}));
21 changes: 16 additions & 5 deletions apps/mobile/src/screens/Feed/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {NDKKind} from '@nostr-dev-kit/ndk';
import {useAllProfiles, useSearch} from 'afk_nostr_sdk';
import {useAuth, useContacts} from 'afk_nostr_sdk';
import {useCallback, useEffect, useState} from 'react';
import {ActivityIndicator, FlatList, Image, Pressable, RefreshControl, View} from 'react-native';
import {ActivityIndicator, FlatList, Image, Pressable, RefreshControl, View, Text} from 'react-native';

import {AddPostIcon} from '../../assets/icons';
import {BubbleUser} from '../../components/BubbleUser';
Expand All @@ -29,9 +29,9 @@ export const Feed: React.FC<FeedScreenProps> = ({navigation}) => {
NDKKind.GroupChat,
NDKKind.ChannelMessage,
NDKKind.Metadata,
NDKKind.VerticalVideo,
NDKKind.HorizontalVideo,
30311 as NDKKind,
// NDKKind.VerticalVideo,
// NDKKind.HorizontalVideo,
// 30311 as NDKKind,
]);

const contacts = useContacts({authors: [publicKey]});
Expand All @@ -42,6 +42,9 @@ export const Feed: React.FC<FeedScreenProps> = ({navigation}) => {
// authors: activeSortBy && contacts?.data?.?? [],
// sortBy: activeSortBy,
});

// console.log(notes, 'notes');
console.log("notes", notes);

// Filter profiles based on the search query
const profilesSearch =
Expand Down Expand Up @@ -110,7 +113,15 @@ export const Feed: React.FC<FeedScreenProps> = ({navigation}) => {
/>

{notes?.isLoading && <ActivityIndicator></ActivityIndicator>}
{notes?.data?.pages?.length == 0 && <ActivityIndicator></ActivityIndicator>}
{notes?.data?.pages?.length == 0 &&

<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text>No notes found</Text>
<Text>Try to refresh the page or contact the support please!</Text>
{/* <Button title="Go to console" onPress={() => navigation.navigate('Console')} /> */}
</View>

}

<FlatList
ListHeaderComponent={
Expand Down
2 changes: 0 additions & 2 deletions apps/mobile/src/screens/Launchpad/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export const LaunchpadScreen: React.FC<LaunchpadScreenProps> = () => {
const {theme} = useTheme();
const styles = useStyles(stylesheet);
const [loading, setLoading] = useState<false | number>(false);
const {ndk} = useNostrContext();

const {provider} = useProvider();
const account = useAccount();
const {sendTransaction} = useTransaction({});
Expand Down
7 changes: 7 additions & 0 deletions apps/mobile/src/types/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export type MainStackParams = {
SocialPayment: undefined;
TwitterCallback: {code: string};
Nameservice: undefined;
Console: undefined;
};

export type HomeBottomStackParams = {
Expand Down Expand Up @@ -118,6 +119,7 @@ export type HomeBottomStackParams = {
ShortVideos: undefined;
TokenDetail: {coinAddress: string};
Nameservice: undefined;
Console: undefined;

// CreateForm: undefined;
// ChannelsFeed:undefined;
Expand Down Expand Up @@ -397,6 +399,11 @@ export type TwitterCallback = CompositeScreenProps<
NativeStackScreenProps<RootStackParams>
>;

export type ConsoleScreenProps = CompositeScreenProps<
NativeStackScreenProps<MainStackParams | HomeBottomStackParams, 'Console'>,
NativeStackScreenProps<RootStackParams>
>;

export type DrawerStackNavigationProps = DrawerNavigationProp<MainStackParams>;

/** TODO delete */
Expand Down
Loading

0 comments on commit b066a41

Please sign in to comment.