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

Fix and LFG #102

Merged
merged 9 commits into from
Aug 31, 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
2 changes: 1 addition & 1 deletion apps/data-backend/src/services/telegram-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function launchBot(token:string) {
// Handle stop events
enableGracefulStop(bot)

return bot
// return bot
} catch (e) {
console.log("launchBot error", e)
}
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/app/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {Icon} from '../components';
import {Navbar} from '../components/Navbar';
import {useStyles, useTheme} from '../hooks';
import GroupChatDetail from '../modules/Group/groupDetail/GroupChatDetail';
import GroupChatGroupRequest from '../modules/Group/memberAction/ViewRequest';
import GroupChat from '../modules/Group/message/GroupMessage';
import AuthSidebar from '../modules/Layout/auth-sidebar';
import DegensSidebar from '../modules/Layout/degens-sidebar';
Expand Down Expand Up @@ -45,7 +46,6 @@ import {
RootStackParams,
} from '../types';
import {retrievePublicKey} from '../utils/storage';
import GroupChatGroupRequest from '../modules/Group/memberAction/ViewRequest';
const DrawerStack = createDrawerNavigator<MainStackParams>();
const RootStack = createNativeStackNavigator<RootStackParams>();
const AuthStack = createDrawerNavigator<AuthStackParams>();
Expand Down
7 changes: 1 addition & 6 deletions apps/mobile/src/assets/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ export const RepostIcon: React.FC<SvgProps> = (props) => {
);
};


export const LikeIcon: React.FC<SvgProps> = (props) => {
return (
<Svg width="26" height="26" viewBox="0 0 20 20" fill="none" {...props}>
Expand All @@ -426,14 +425,10 @@ export const BookmarkIcon: React.FC<SvgProps> = (props) => (

export const BookmarkFillIcon: React.FC<SvgProps> = (props) => (
<Svg width="32" height="32" viewBox="0 0 21 21" {...props}>
<Path
fill="currentColor"
d="M4 2C2.343 2 1 3.343 1 5v15l7-4 7 4V5c0-1.657-1.343-3-3-3H4z"
/>
<Path fill="currentColor" d="M4 2C2.343 2 1 3.343 1 5v15l7-4 7 4V5c0-1.657-1.343-3-3-3H4z" />
</Svg>
);


export const LikeFillIcon: React.FC<SvgProps> = (props) => {
return (
<Svg width="26" height="26" viewBox="0 0 20 20" fill="none" {...props}>
Expand Down
8 changes: 5 additions & 3 deletions apps/mobile/src/components/Filter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
} from 'react-native';

import {useStyles} from '../../hooks';
import {SORT_OPTION_EVENT_NOSTR} from '../../types/nostr';
import stylesheet from './styles';
import { SORT_OPTION_EVENT_NOSTR } from '../../types/nostr';

interface IFilterMenuProps {
visible: boolean;
Expand All @@ -31,7 +31,6 @@ const NDK_KIND_OPTIONS = [
{label: 'Metadata', value: NDKKind.Metadata},
];


// const SORT_OPTIONS = [
// {label: 'Time', value: 'time'},
// {label: 'For You', value: 'forYou'},
Expand Down Expand Up @@ -78,7 +77,10 @@ const FilterMenu: React.FC<IFilterMenuProps> = ({
{SORT_OPTIONS.map((option) => (
<Pressable
key={option.value}
style={[styles.button, activeSortBy === option.value.toString() && styles.activeButton]}
style={[
styles.button,
activeSortBy === option.value.toString() && styles.activeButton,
]}
onPress={() => onSortChange(option.value.toString())}
>
<Text style={styles.buttonText}>{option.label}</Text>
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/src/components/HeaderScreen/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {Image, View} from 'react-native';
import {SafeAreaView} from 'react-native-safe-area-context';

import {useStyles, useTheme} from '../../hooks';
import {Spacing} from '../../styles';
import {Divider} from '../Divider';
import {Text} from '../Text';
import stylesheet from './styles';
import {Divider} from '../Divider';
import {Spacing} from '../../styles';

export type HeaderProps = {
showLogo?: boolean;
Expand Down
2 changes: 0 additions & 2 deletions apps/mobile/src/components/HeaderScreen/styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import {StyleSheet} from 'react-native';

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

export default ThemedStyleSheet((theme) => ({
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/components/Input/styles.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Spacing, ThemedStyleSheet, Typography} from '../../styles';

export default ThemedStyleSheet(
(theme, error: boolean, left: boolean, right: boolean, paddingRight: boolean = true) => ({
(theme, error: boolean, left: boolean, right: boolean, paddingRight = true) => ({
container: {
width: '100%',
},
Expand Down
13 changes: 6 additions & 7 deletions apps/mobile/src/components/Navbar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import * as React from 'react';
import { Image, Text, TouchableOpacity, View } from 'react-native';
import {Image, Text, TouchableOpacity, View} from 'react-native';

import { useStyles, useWindowDimensions } from '../../hooks';
import { Icon } from '../Icon';
import {useStyles, useWindowDimensions} from '../../hooks';
import {Icon} from '../Icon';
import stylesheet from './styles';
interface CustomHeaderInterface {
title?: string;
navigation?: any;
showLogo?: boolean;
}
export const Navbar = ({ title, navigation, showLogo }: CustomHeaderInterface) => {
export const Navbar = ({title, navigation, showLogo}: CustomHeaderInterface) => {
const styles = useStyles(stylesheet);
const dimensions = useWindowDimensions();
const isDesktop = React.useMemo(() => {
Expand All @@ -27,18 +27,17 @@ export const Navbar = ({ title, navigation, showLogo }: CustomHeaderInterface) =
)}
<Text style={styles.headerTitle}>{title}</Text>

{!isDesktop &&
{!isDesktop && (
<TouchableOpacity onPress={() => navigation?.openDrawer()} style={styles.burgerIcon}>
<Icon name="MenuIcon" size={25} />
</TouchableOpacity>
}
)}

{/* {isDesktop &&
<TouchableOpacity onPress={() => navigation?.openDrawer()} style={styles.burgerIcon}>
<Icon name="MenuIcon" size={25} />
</TouchableOpacity>
} */}

</View>
);
};
8 changes: 2 additions & 6 deletions apps/mobile/src/components/PrivateKeyImport/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@ import {useState} from 'react';
import {TouchableOpacity, View} from 'react-native';

import {CopyIconStack, LockIcon} from '../../assets/icons';
import {useWindowDimensions} from '../../hooks';
import {useToast} from '../../hooks/modals';
import {getPublicKeyFromSecret} from '../../utils/keypair';
import {
retrieveAndDecryptPrivateKey,
retrievePassword,
retrievePublicKey,
} from '../../utils/storage';
import {retrieveAndDecryptPrivateKey, retrievePublicKey} from '../../utils/storage';
import {Button} from '../Button';
import {Input} from '../Input';
import {Text} from '../Text';
import styles from './styles';
import {useWindowDimensions} from '../../hooks';

export const PrivateKeyImport: React.FC = () => {
const {publicKey, isExtension, privateKey, setAuth} = useAuth();
Expand Down
71 changes: 38 additions & 33 deletions apps/mobile/src/components/PrivateMessages/Chat/index.tsx
Original file line number Diff line number Diff line change
@@ -1,42 +1,47 @@
import React from 'react';
import { ConversationType } from '../../../types/messages';
import { useStyles } from '../../../hooks';
import { View, Image, Text } from 'react-native';
import { MessageInput } from '../PrivateMessageInput';
import { MessagesList } from '../MessagesList.tsx';
import {Image, Text, View} from 'react-native';

import {useStyles} from '../../../hooks';
import {ConversationType} from '../../../types/messages';
import {IconButton} from '../../IconButton';
import {MessagesList} from '../MessagesList.tsx';
import {MessageInput} from '../PrivateMessageInput';
import stylesheet from './styles';
import { IconButton } from '../../IconButton';

export type ChatProps = {
conversation: ConversationType;
handleGoBack: () => void;
conversation: ConversationType;
handleGoBack: () => void;
};

export const Chat: React.FC<ChatProps> = ({ conversation, handleGoBack }) => {

const styles = useStyles(stylesheet);
const user = conversation.user;
const avatar = user.avatar ? {uri: user.avatar } : require('../../../assets/pepe-logo.png');
export const Chat: React.FC<ChatProps> = ({conversation, handleGoBack}) => {
const styles = useStyles(stylesheet);
const user = conversation.user;
const avatar = user.avatar ? {uri: user.avatar} : require('../../../assets/pepe-logo.png');

const handleSendMessage = (message: string) => {
//todo: integrate hook here
//todo: encrypt message
//todo: send message
};
const handleSendMessage = (message: string) => {
//todo: integrate hook here
//todo: encrypt message
//todo: send message
};

return (
<>
<View style={styles.header}>
<IconButton icon="ChevronLeftIcon" size={20} onPress={handleGoBack} style={styles.backButton} />
<View style={styles.headerContent}>
<Image source={avatar} style={styles.avatar} />
<Text style={styles.name}>{user.name}</Text>
</View>
</View>
<View style={styles.container}>
<MessagesList messages={conversation.messages} />
<MessageInput onSend={handleSendMessage} />
</View>
</>
);
return (
<>
<View style={styles.header}>
<IconButton
icon="ChevronLeftIcon"
size={20}
onPress={handleGoBack}
style={styles.backButton}
/>
<View style={styles.headerContent}>
<Image source={avatar} style={styles.avatar} />
<Text style={styles.name}>{user.name}</Text>
</View>
</View>
<View style={styles.container}>
<MessagesList messages={conversation.messages} />
<MessageInput onSend={handleSendMessage} />
</View>
</>
);
};
66 changes: 33 additions & 33 deletions apps/mobile/src/components/PrivateMessages/Chat/styles.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import { ThemedStyleSheet } from "../../../styles";
import {ThemedStyleSheet} from '../../../styles';

export default ThemedStyleSheet((theme) => ({
container: {
flex: 1,
backgroundColor: theme.colors.background,
},
header: {
padding: 10,
borderBottomWidth: 1,
borderBottomColor: theme.colors.divider,
alignItems: 'center',
justifyContent: 'center',
position: 'relative',
},
headerContent: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
backButton: {
position: 'absolute',
left: 10,
},
avatar: {
width: 50,
height: 50,
borderRadius: 25,
marginBottom: 5,
},
name: {
fontSize: 16,
fontWeight: 'bold',
color: theme.colors.text,
},
container: {
flex: 1,
backgroundColor: theme.colors.background,
},
header: {
padding: 10,
borderBottomWidth: 1,
borderBottomColor: theme.colors.divider,
alignItems: 'center',
justifyContent: 'center',
position: 'relative',
},
headerContent: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
backButton: {
position: 'absolute',
left: 10,
},
avatar: {
width: 50,
height: 50,
borderRadius: 25,
marginBottom: 5,
},
name: {
fontSize: 16,
fontWeight: 'bold',
color: theme.colors.text,
},
}));
36 changes: 18 additions & 18 deletions apps/mobile/src/components/PrivateMessages/Conversation/index.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import React from 'react';
import { Pressable, View, Text, Image } from 'react-native';
import {Image, Pressable, Text, View} from 'react-native';

import {useStyles} from '../../../hooks';
import {ConversationType} from '../../../types/messages';
import stylesheet from './styles';
import { useStyles } from '../../../hooks';
import { ConversationType } from '../../../types/messages';

export type ConversationPreviewProps = {
conversation: ConversationType;
onPressed: () => void;
conversation: ConversationType;
onPressed: () => void;
};

export const Conversation: React.FC<ConversationPreviewProps> = ({conversation, onPressed}) => {
const styles = useStyles(stylesheet);

const styles = useStyles(stylesheet);

const user = conversation.user;
const avatar = user.avatar ? {uri: user.avatar } : require('../../../assets/pepe-logo.png');
const user = conversation.user;
const avatar = user.avatar ? {uri: user.avatar} : require('../../../assets/pepe-logo.png');

return (
<Pressable style={styles.container} onPress={onPressed}>
<Image source={avatar} style={styles.avatar} />
<View style={styles.textContainer}>
<Text style={styles.name}>{user.name}</Text>
<Text style={styles.handle}>{user.handle}</Text>
</View>
</Pressable>
);
return (
<Pressable style={styles.container} onPress={onPressed}>
<Image source={avatar} style={styles.avatar} />
<View style={styles.textContainer}>
<Text style={styles.name}>{user.name}</Text>
<Text style={styles.handle}>{user.handle}</Text>
</View>
</Pressable>
);
};
Loading
Loading