From 25f5df78e277fd4cbfc612eaf2335ad77067d368 Mon Sep 17 00:00:00 2001 From: MSGhais Date: Fri, 30 Aug 2024 19:38:15 +0200 Subject: [PATCH 1/7] hooks webln --- apps/mobile/src/hooks/useWebln.ts | 51 ++++++++ apps/mobile/src/modules/Lightning/index.tsx | 129 ++++++++++++++------ apps/mobile/src/screens/Lightning/index.tsx | 14 ++- 3 files changed, 154 insertions(+), 40 deletions(-) create mode 100644 apps/mobile/src/hooks/useWebln.ts diff --git a/apps/mobile/src/hooks/useWebln.ts b/apps/mobile/src/hooks/useWebln.ts new file mode 100644 index 00000000..7a5494f3 --- /dev/null +++ b/apps/mobile/src/hooks/useWebln.ts @@ -0,0 +1,51 @@ +import { WebLNProvider } from '@webbtc/webln-types'; + + + +export const useWebln = () => { + + + + const handleWebln = async () => { + if (window.webln) { + try { + await window.webln.enable(); + const invoice = await window.webln.makeInvoice({ amount: 1000, defaultMemo: "React Native Zap" }); + } catch (error) { + } + } else { + } + } + + const handleGetBalance = async () => { + if (window.webln) { + try { + await window.webln.enable(); + // let connected = await window.webln.isEnabled() + // if(!connected) { + + // } + // const invoice = await window?.webln?.getBalance(); + } catch (error) { + } + } else { + } + } + + const handleMakeInvoice = async (amount:number, memo?:string) => { + if (window.webln) { + try { + await window.webln.enable(); + const invoice = await window.webln.makeInvoice({ amount: amount ?? 1000, defaultMemo: memo?? "React Native Zap" }); + } catch (error) { + } + } else { + } + } + + return{ + handleGetBalance, + handleMakeInvoice, + handleWebln + } +} \ No newline at end of file diff --git a/apps/mobile/src/modules/Lightning/index.tsx b/apps/mobile/src/modules/Lightning/index.tsx index b862df22..7c7dcdfa 100644 --- a/apps/mobile/src/modules/Lightning/index.tsx +++ b/apps/mobile/src/modules/Lightning/index.tsx @@ -1,27 +1,38 @@ import '../../../applyGlobalPolyfills'; -import { init, launchModal } from '@getalby/bitcoin-connect-react'; +import { init, launchModal, requestProvider } from '@getalby/bitcoin-connect-react'; import { LightningAddress } from '@getalby/lightning-tools'; import { webln } from '@getalby/sdk'; -import React from 'react'; -import { Platform, SafeAreaView, Text, TextInput, View } from 'react-native'; -import WebView from 'react-native-webview'; +import React, { useRef } from 'react'; +import { Platform, SafeAreaView, ScrollView, Text, TextInput, View } from 'react-native'; +import WebView, { WebViewMessageEvent } from 'react-native-webview'; import PolyfillCrypto from 'react-native-webview-crypto'; +import { WebLNProvider } from '@webbtc/webln-types'; + import { Button, Input } from '../../components'; import { useStyles } from '../../hooks'; import stylesheet from './styles'; export const LightningNetworkWalletView: React.FC = () => { const styles = useStyles(stylesheet); return ( - + // + + + - + + + + // + ); }; function LightningNetworkWallet() { + + const styles = useStyles(stylesheet); const [amountSats, setAmountSats] = React.useState("1") @@ -33,6 +44,30 @@ function LightningNetworkWallet() { const [nostrWebLN, setNostrWebLN] = React.useState( undefined, ); + const webviewRef = useRef(null); + + const onMessage = (event: WebViewMessageEvent) => { + const { data } = event.nativeEvent; + console.log('Received message from WebView:', data); + + // Handle messages sent from the WebView, e.g., invoice payment status + }; + + const injectJavaScript = ` + (async function() { + if (window.webln) { + try { + await window.webln.enable(); + const invoice = await window.webln.makeInvoice({ amount: 1000, memo: "React Native Zap" }); + window.ReactNativeWebView.postMessage(JSON.stringify({ type: "invoice", data: invoice })); + } catch (error) { + window.ReactNativeWebView.postMessage(JSON.stringify({ type: "error", message: error.message })); + } + } else { + window.ReactNativeWebView.postMessage(JSON.stringify({ type: "error", message: "WebLN not available" })); + } + })(); +`; const [balance, setBalance] = React.useState(); React.useEffect(() => { @@ -96,6 +131,7 @@ function LightningNetworkWallet() { async function connectWithAlby() { const nwc = webln.NostrWebLNProvider.withNewSecret({ //authorizationUrl: "http://192.168.1.102:8080", + // authorizationUrl:nwcAuthUrl }); console.log('nwc', nwc); @@ -138,24 +174,47 @@ function LightningNetworkWallet() { const handleRequest = async () => { let modal = launchModal(); - // const provider = await requestProvider(); + const provider = await requestProvider(); // let send_payment = await provider.sendPayment('lnbc...'); return; }; + return ( - + + {/* + { + Platform.OS == "web" ? + - - } + )} - {Platform.OS != "web" && process.env.EXPO_PUBLIC_PIXEL_URL && - - - } + {Platform.OS != 'web' && process.env.EXPO_PUBLIC_PIXEL_URL && ( + + )} - ); -}; \ No newline at end of file +}; diff --git a/apps/mobile/src/modules/PixelPeace/styles.ts b/apps/mobile/src/modules/PixelPeace/styles.ts index 5535fb41..992c9a4d 100644 --- a/apps/mobile/src/modules/PixelPeace/styles.ts +++ b/apps/mobile/src/modules/PixelPeace/styles.ts @@ -1,12 +1,12 @@ import {ThemedStyleSheet} from '../../styles'; export default ThemedStyleSheet((theme) => ({ - container: { - flex: 1, - backgroundColor: theme.colors.background, - }, - separator: { - height: 1, - backgroundColor: theme.colors.divider, - }, + container: { + flex: 1, + backgroundColor: theme.colors.background, + }, + separator: { + height: 1, + backgroundColor: theme.colors.divider, + }, })); diff --git a/apps/mobile/src/modules/Post/index.tsx b/apps/mobile/src/modules/Post/index.tsx index 6bffbc81..9b203836 100644 --- a/apps/mobile/src/modules/Post/index.tsx +++ b/apps/mobile/src/modules/Post/index.tsx @@ -1,10 +1,17 @@ import {NDKEvent, NDKKind} from '@nostr-dev-kit/ndk'; import {useNavigation} from '@react-navigation/native'; import {useQueryClient} from '@tanstack/react-query'; -import {useProfile, useReact, useReactions, useReplyNotes, useRepost, useBookmark} from 'afk_nostr_sdk'; +import { + useBookmark, + useProfile, + useReact, + useReactions, + useReplyNotes, + useRepost, +} from 'afk_nostr_sdk'; // import { useAuth } from '../../store/auth'; import {useAuth} from 'afk_nostr_sdk'; -import {useEffect, useMemo, useState} from 'react'; +import {useMemo, useState} from 'react'; import {ActivityIndicator, Image, Pressable, View} from 'react-native'; import Animated, { Easing, @@ -27,13 +34,19 @@ import stylesheet from './styles'; export type PostProps = { asComment?: boolean; event?: NDKEvent; - repostedEventProps?:string; - isRepost?:boolean; - isBookmarked?:boolean; + repostedEventProps?: string; + isRepost?: boolean; + isBookmarked?: boolean; }; -export const Post: React.FC = ({asComment, event, repostedEventProps, isRepost, isBookmarked = false}) => { - const repostedEvent = repostedEventProps ?? undefined; +export const Post: React.FC = ({ + asComment, + event, + repostedEventProps, + isRepost, + isBookmarked = false, +}) => { + const repostedEvent = repostedEventProps ?? undefined; const {theme} = useTheme(); const styles = useStyles(stylesheet); @@ -50,8 +63,8 @@ export const Post: React.FC = ({asComment, event, repostedEventProps, const comments = useReplyNotes({noteId: event?.id}); const react = useReact(); const queryClient = useQueryClient(); - const repostMutation = useRepost({ event }); - const { bookmarkNote, removeBookmark } = useBookmark(publicKey); + const repostMutation = useRepost({event}); + const {bookmarkNote, removeBookmark} = useBookmark(publicKey); const [menuOpen, setMenuOpen] = useState(false); @@ -139,15 +152,15 @@ export const Post: React.FC = ({asComment, event, repostedEventProps, if (!event) return; try { if (isBookmarked) { - await removeBookmark({ eventId: event.id }); - showToast({ title: 'Post removed from bookmarks', type: 'success' }); + await removeBookmark({eventId: event.id}); + showToast({title: 'Post removed from bookmarks', type: 'success'}); } else { - await bookmarkNote({ event }); - showToast({ title: 'Post bookmarked successfully', type: 'success' }); + await bookmarkNote({event}); + showToast({title: 'Post bookmarked successfully', type: 'success'}); } } catch (error) { console.error('Bookmark error:', error); - showToast({ title: 'Failed to bookmark', type: 'error' }); + showToast({title: 'Failed to bookmark', type: 'error'}); } }; @@ -156,12 +169,14 @@ export const Post: React.FC = ({asComment, event, repostedEventProps, return ( - {repostedEvent || event?.kind == NDKKind.Repost || isRepost && ( - - - Reposted - - )} + {repostedEvent || + event?.kind == NDKKind.Repost || + (isRepost && ( + + + Reposted + + ))} @@ -298,14 +313,12 @@ export const Post: React.FC = ({asComment, event, repostedEventProps, {repostMutation.isPending && } - + + title={isBookmarked ? 'Bookmarked' : 'Bookmark'} + /> diff --git a/apps/mobile/src/modules/PostCard/index.tsx b/apps/mobile/src/modules/PostCard/index.tsx index 225f8f06..9a6950cc 100644 --- a/apps/mobile/src/modules/PostCard/index.tsx +++ b/apps/mobile/src/modules/PostCard/index.tsx @@ -1,28 +1,36 @@ -import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; -import { View } from 'react-native'; -import { useStyles } from '../../hooks'; -import { Post } from '../Post'; +import {NDKEvent, NDKKind} from '@nostr-dev-kit/ndk'; +import {useState} from 'react'; +import {View} from 'react-native'; + +import {useStyles} from '../../hooks'; +import {Post} from '../Post'; import stylesheet from './styles'; -import { useState } from 'react'; export type PostCardProps = { event?: NDKEvent; - isRepostProps?:boolean; - isBookmarked?:boolean; + isRepostProps?: boolean; + isBookmarked?: boolean; }; -export const PostCard: React.FC = ({ event, isRepostProps, isBookmarked }) => { +export const PostCard: React.FC = ({event, isRepostProps, isBookmarked}) => { const styles = useStyles(stylesheet); let repostedEvent = undefined; - const [isRepost, setIsRepost] = useState(isRepostProps ?? event?.kind == NDKKind.Repost ? true : false) + const [isRepost, setIsRepost] = useState( + isRepostProps ?? event?.kind == NDKKind.Repost ? true : false, + ); if (event?.kind == NDKKind.Repost) { - repostedEvent = JSON.stringify(event?.content) + repostedEvent = JSON.stringify(event?.content); } return ( - + ); }; diff --git a/apps/mobile/src/screens/Auth/Login.tsx b/apps/mobile/src/screens/Auth/Login.tsx index ddf60e1f..c36d4a63 100644 --- a/apps/mobile/src/screens/Auth/Login.tsx +++ b/apps/mobile/src/screens/Auth/Login.tsx @@ -169,12 +169,14 @@ export const Login: React.FC = ({navigation}) => { Create Account Import Account Nostr extension diff --git a/apps/mobile/src/screens/ChannelDetail/index.tsx b/apps/mobile/src/screens/ChannelDetail/index.tsx index 684bff19..c25f99da 100644 --- a/apps/mobile/src/screens/ChannelDetail/index.tsx +++ b/apps/mobile/src/screens/ChannelDetail/index.tsx @@ -1,10 +1,10 @@ import {View} from 'react-native'; +import {Header, IconButton} from '../../components'; import {useStyles} from '../../hooks'; import {ChannelDetailComponent} from '../../modules/ChannelDetailPage'; import {ChannelDetailScreenProps} from '../../types'; import stylesheet from './styles'; -import { Header, IconButton } from '../../components'; export const ChannelDetail: React.FC = ({navigation, route}) => { const {postId, post} = route.params; @@ -15,10 +15,9 @@ export const ChannelDetail: React.FC = ({navigation, r
} + left={} // right={} - + title="ChannelDetail" /> diff --git a/apps/mobile/src/screens/Feed/index.tsx b/apps/mobile/src/screens/Feed/index.tsx index 0af21f83..4ce98011 100644 --- a/apps/mobile/src/screens/Feed/index.tsx +++ b/apps/mobile/src/screens/Feed/index.tsx @@ -1,22 +1,22 @@ -import { NDKKind } from '@nostr-dev-kit/ndk'; -import { useAllProfiles, useContacts, useSearch, useSearchNotes } from 'afk_nostr_sdk'; -import { useState } from 'react'; -import { ActivityIndicator, FlatList, Image, Pressable, RefreshControl, View } from 'react-native'; +import {NDKKind} from '@nostr-dev-kit/ndk'; +import {useAllProfiles, useSearch} from 'afk_nostr_sdk'; +import {useState} from 'react'; +import {ActivityIndicator, FlatList, Image, Pressable, RefreshControl, View} from 'react-native'; -import { AddPostIcon } from '../../assets/icons'; -import { BubbleUser } from '../../components/BubbleUser'; +import {AddPostIcon} from '../../assets/icons'; +import {BubbleUser} from '../../components/BubbleUser'; import SearchComponent from '../../components/search'; -import { useStyles, useTheme } from '../../hooks'; -import { ChannelComponent } from '../../modules/ChannelCard'; -import { PostCard } from '../../modules/PostCard'; -import { FeedScreenProps } from '../../types'; +import {useStyles, useTheme} from '../../hooks'; +import {ChannelComponent} from '../../modules/ChannelCard'; +import {PostCard} from '../../modules/PostCard'; +import {FeedScreenProps} from '../../types'; import stylesheet from './styles'; -export const Feed: React.FC = ({ navigation }) => { - const { theme } = useTheme(); +export const Feed: React.FC = ({navigation}) => { + const {theme} = useTheme(); const styles = useStyles(stylesheet); - const profiles = useAllProfiles({limit:10}); - const [activeSortBy, setSortBy] = useState() + const profiles = useAllProfiles({limit: 10}); + const [activeSortBy, setSortBy] = useState(); const [search, setSearch] = useState(undefined); const [kinds, setKinds] = useState([ NDKKind.Text, @@ -31,23 +31,23 @@ export const Feed: React.FC = ({ navigation }) => { const notes = useSearch({ // search: search, kinds, - limit:10, + limit: 10, // authors: activeSortBy && contacts?.data?.?? [], // sortBy: activeSortBy, }); - // Filter profiles based on the search query const profilesSearch = - profiles?.data?.pages - ?.flat() + profiles?.data?.pages?.flat() ?? // .filter((item) => (search && search?.length > 0 ? item?.content?.includes(search) : true)) ?? - ?? []; + []; // Filter notes based on the search query - const filteredNotes = notes.data?.pages - .flat() - .filter((item) => (search && search?.length > 0 ? item?.content?.includes(search) : true)) ?? []; + const filteredNotes = + notes.data?.pages + .flat() + .filter((item) => (search && search?.length > 0 ? item?.content?.includes(search) : true)) ?? + []; return ( @@ -71,30 +71,34 @@ export const Feed: React.FC = ({ navigation }) => { {notes?.data?.pages?.length == 0 && } - profiles.fetchNextPage()} - refreshControl={ - profiles.refetch()} /> - } - ItemSeparatorComponent={() => } - renderItem={({ item }) => } - />} + ListHeaderComponent={ + <> + profiles.fetchNextPage()} + refreshControl={ + profiles.refetch()} + /> + } + ItemSeparatorComponent={() => } + renderItem={({item}) => } + /> + + } contentContainerStyle={styles.flatListContent} data={filteredNotes} keyExtractor={(item) => item?.id} - renderItem={({ item }) => { + renderItem={({item}) => { if (item.kind === NDKKind.ChannelCreation || item.kind === NDKKind.ChannelMetadata) { return ; - } - else if (item.kind === NDKKind.ChannelMessage) { + } else if (item.kind === NDKKind.ChannelMessage) { return ; - } - else if (item.kind === NDKKind.Text) { + } else if (item.kind === NDKKind.Text) { return ; } return <>; @@ -107,7 +111,7 @@ export const Feed: React.FC = ({ navigation }) => { navigation.navigate('MainStack', { screen: 'CreateForm' })} + onPress={() => navigation.navigate('MainStack', {screen: 'CreateForm'})} > diff --git a/apps/mobile/src/screens/Games/index.tsx b/apps/mobile/src/screens/Games/index.tsx index 79deae53..9c721b5e 100644 --- a/apps/mobile/src/screens/Games/index.tsx +++ b/apps/mobile/src/screens/Games/index.tsx @@ -5,13 +5,13 @@ 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 {GameSreenProps} from '../../types'; import {SelectedTab, TABS_MENU} from '../../types/tab'; import {AllKeysComponent} from '../KeysMarketplace/AllKeysComponent'; import {LaunchpadComponent} from '../Launchpad/LaunchpadComponent'; import {SlinksMap} from '../Slink/SlinksMap'; import stylesheet from './styles'; -import { PixelPeace } from '../../modules/PixelPeace'; export const Games: React.FC = ({navigation}) => { const theme = useTheme(); @@ -41,8 +41,7 @@ export const Games: React.FC = ({navigation}) => { > - - {selectedTab == SelectedTab.PIXEL_PEACE && ( + {selectedTab == SelectedTab.PIXEL_PEACE && ( <> diff --git a/apps/mobile/src/screens/Lightning/index.tsx b/apps/mobile/src/screens/Lightning/index.tsx index cce54511..1d10db09 100644 --- a/apps/mobile/src/screens/Lightning/index.tsx +++ b/apps/mobile/src/screens/Lightning/index.tsx @@ -1,14 +1,11 @@ import React from 'react'; -import { ScrollView, View } from 'react-native'; +import {ScrollView} from 'react-native'; -import { LightningNetworkWalletView } from '../../modules/Lightning'; -import { LightningNetworkScreenProps } from '../../types'; +import {LightningNetworkWalletView} from '../../modules/Lightning'; +import {LightningNetworkScreenProps} from '../../types'; export const LightningNetworkScreen: React.FC = () => { return ( - + ); diff --git a/apps/mobile/src/screens/Profile/index.tsx b/apps/mobile/src/screens/Profile/index.tsx index 0527d4ef..beeb61d1 100644 --- a/apps/mobile/src/screens/Profile/index.tsx +++ b/apps/mobile/src/screens/Profile/index.tsx @@ -1,36 +1,43 @@ -import { useBookmark, useReposts, useRootNotes, useSearch } from 'afk_nostr_sdk'; -import { ActivityIndicator, FlatList, Pressable, RefreshControl, ScrollView, View } from 'react-native'; - -import { useStyles } from '../../hooks'; -import { PostCard } from '../../modules/PostCard'; -import { ProfileScreenProps } from '../../types'; -import { ProfileInfo } from './Info'; +import {NDKKind} from '@nostr-dev-kit/ndk'; +import {useBookmark, useSearch} from 'afk_nostr_sdk'; +import {useMemo, useState} from 'react'; +import { + ActivityIndicator, + FlatList, + Pressable, + RefreshControl, + ScrollView, + View, +} from 'react-native'; + +import {Text} from '../../components'; +import {useStyles} from '../../hooks'; +import {PostCard} from '../../modules/PostCard'; +import {ProfileScreenProps} from '../../types'; +import {ProfileInfo} from './Info'; import stylesheet from './styles'; -import { useMemo, useState } from 'react'; -import { NDKKind } from '@nostr-dev-kit/ndk'; -import { Text } from '../../components'; -export const Profile: React.FC = ({ route }) => { - const { publicKey } = route.params ?? {}; +export const Profile: React.FC = ({route}) => { + const {publicKey} = route.params ?? {}; const styles = useStyles(stylesheet); const [ndkKinds, setNdkKind] = useState([NDKKind.Text]); const kindFilter = useMemo(() => { - return ndkKinds - }, [ndkKinds]) + return ndkKinds; + }, [ndkKinds]); // const notesSearch = useRootNotes({ authors: [publicKey] }); - const search = useSearch({ authors: [publicKey], kinds: kindFilter }); + const search = useSearch({authors: [publicKey], kinds: kindFilter}); // const reposts = useReposts({ authors: [publicKey] }); - const { bookmarksWithNotes } = useBookmark(publicKey); + const {bookmarksWithNotes} = useBookmark(publicKey); // Extract all bookmarked note IDs const bookmarkedNoteIds = useMemo(() => { if (!bookmarksWithNotes) return new Set(); const ids = new Set(); - bookmarksWithNotes.forEach(bookmark => { - bookmark.notes.forEach(note => { + bookmarksWithNotes.forEach((bookmark) => { + bookmark.notes.forEach((note) => { ids.add(note?.id || ''); }); }); @@ -46,17 +53,12 @@ export const Profile: React.FC = ({ route }) => { // console.log("getData", getData) + const getData = search.data?.pages.flat(); - const getData = search.data?.pages.flat(); - - console.log("getData", getData) - + console.log('getData', getData); return ( - - - @@ -90,13 +92,13 @@ export const Profile: React.FC = ({ route }) => { } data={getData} keyExtractor={(item) => item.id} - renderItem={({ item }) => { - if (!item) return <> + renderItem={({item}) => { + if (!item) return <>; if (ndkKinds.includes(NDKKind.Repost)) { const itemReposted = JSON.parse(item?.content); - return + return ; } - return + return ; }} refreshControl={ search.refetch()} /> diff --git a/apps/mobile/src/screens/Profile/styles.ts b/apps/mobile/src/screens/Profile/styles.ts index 085f902c..fa78209c 100644 --- a/apps/mobile/src/screens/Profile/styles.ts +++ b/apps/mobile/src/screens/Profile/styles.ts @@ -7,19 +7,19 @@ export default ThemedStyleSheet((theme) => ({ }, optionsContentContainer: { paddingVertical: 5, - paddingHorizontal:5, + paddingHorizontal: 5, flexDirection: 'row', rowGap: 3, gap: 3, columnGap: 15, }, optionsContainer: { - paddingHorizontal:5, + paddingHorizontal: 5, paddingVertical: 5, flexDirection: 'row', rowGap: 3, gap: 3, - columnGap: 3 + columnGap: 3, }, option: { paddingVertical: 10, @@ -32,6 +32,6 @@ export default ThemedStyleSheet((theme) => ({ }, selected: { backgroundColor: theme.colors.primary, - color: theme.colors.text - } + color: theme.colors.text, + }, })); diff --git a/apps/mobile/src/screens/Whatever/index.tsx b/apps/mobile/src/screens/Whatever/index.tsx index a87f2ef9..5d66c3e2 100644 --- a/apps/mobile/src/screens/Whatever/index.tsx +++ b/apps/mobile/src/screens/Whatever/index.tsx @@ -1,6 +1,7 @@ import {NDKEvent, NDKKind} from '@nostr-dev-kit/ndk'; import {useNavigation} from '@react-navigation/native'; import {useAccount, useProvider} from '@starknet-react/core'; +import {useNostrContext} from 'afk_nostr_sdk'; import {useState} from 'react'; import {View} from 'react-native'; import {byteArray, cairo, CallData, getChecksumAddress, uint256} from 'starknet'; @@ -17,7 +18,6 @@ import {ChannelComponent} from '../../modules/ChannelCard'; import {MainStackNavigationProps} from '../../types'; import {TipsComponent} from '../Tips/TipsComponent'; import stylesheet from './styles'; -import { useNostrContext } from 'afk_nostr_sdk'; enum SelectedTab { TIPS, diff --git a/apps/mobile/src/types/messages.ts b/apps/mobile/src/types/messages.ts index 48fa0540..250d76d2 100644 --- a/apps/mobile/src/types/messages.ts +++ b/apps/mobile/src/types/messages.ts @@ -9,7 +9,7 @@ export type Message = { message: string; isUser: boolean; // Indicates if the message is from the current user or the other party timestamp: string; -} +}; export type ConversationType = { id: string; diff --git a/apps/mobile/src/types/nostr.ts b/apps/mobile/src/types/nostr.ts index 00fb5eb2..b23ef7ff 100644 --- a/apps/mobile/src/types/nostr.ts +++ b/apps/mobile/src/types/nostr.ts @@ -1,6 +1,5 @@ export enum SORT_OPTION_EVENT_NOSTR { - TIME, - TRENDING, - FOR_YOU - -} \ No newline at end of file + TIME, + TRENDING, + FOR_YOU, +} diff --git a/apps/mobile/src/types/tab.ts b/apps/mobile/src/types/tab.ts index 7b70af1a..2adcbe45 100644 --- a/apps/mobile/src/types/tab.ts +++ b/apps/mobile/src/types/tab.ts @@ -23,7 +23,6 @@ export enum SelectedTab { ALL_GROUP, GROUP_MESSAGE, PIXEL_PEACE, - } export const TABS_TIP_LIST: {screen?: string; title: string; tab: SelectedTab}[] = [ @@ -150,7 +149,7 @@ export const TABS_MENU: {screen?: string; title: string; tab: SelectedTab}[] = [ screen: 'Slink', tab: SelectedTab.SLINK, }, - + { title: '?', screen: '?', diff --git a/apps/mobile/src/utils/dummyData.ts b/apps/mobile/src/utils/dummyData.ts index d730a28e..ae067493 100644 --- a/apps/mobile/src/utils/dummyData.ts +++ b/apps/mobile/src/utils/dummyData.ts @@ -1,225 +1,225 @@ -import { Conversation } from "../types/messages"; +import {Conversation} from '../types/messages'; export const conversationsData: Conversation[] = [ - { - id: '1', - user: { - id: '1', - name: 'John Doe', - handle: '@johndoe', - avatar: '', - }, - messages: [ - { - message: 'Doing well, thanks!', - isUser: true, - timestamp: new Date().toString(), - }, - { - message: 'How are you?', - isUser: false, - timestamp: new Date().toString(), - }, - { - message: 'Hello', - isUser: false, - timestamp: new Date().toString(), - }, - { - message: 'Hi!', - isUser: true, - timestamp: new Date().toString(), - }, - ] - }, - { - id: '2', - user: { - id: '2', - name: 'Jane Doe', - handle: '@janedoe', - avatar: '', - }, - messages: [] - }, - { - id: '3', - user: { - id: '3', - name: 'Alice', - handle: '@alice', - avatar: '', - }, - messages: [] - }, - { - id: '4', - user: { - id: '4', - name: 'Bob', - handle: '@bob', - avatar: '', - }, - messages: [] - }, - { - id: '5', - user: { - id: '5', - name: 'Charlie', - handle: '@charlie', - avatar: '', - }, - messages: [] - }, - { - id: '6', - user: { - id: '6', - name: 'David', - handle: '@david', - avatar: '', - }, - messages: [] - }, - { - id: '7', - user: { - id: '7', - name: 'Eve', - handle: '@eve', - avatar: '', - }, - messages: [] - }, - { - id: '8', - user: { - id: '8', - name: 'Frank', - handle: '@frank', - avatar: '', - }, - messages: [] - }, - { - id: '9', - user: { - id: '9', - name: 'Grace', - handle: '@grace', - avatar: '', - }, - messages: [] - }, - { - id: '10', - user: { - id: '10', - name: 'Harry', - handle: '@harry', - avatar: '', - }, - messages: [] - }, - { - id: '11', - user: { - id: '11', - name: 'Ivy', - handle: '@ivy', - avatar: '', - }, - messages: [] - }, - { - id: '12', - user: { - id: '12', - name: 'Jack', - handle: '@jack', - avatar: '', - }, - messages: [] - }, - { - id: '13', - user: { - id: '13', - name: 'Kate', - handle: '@kate', - avatar: '', - }, - messages: [] - }, - { - id: '14', - user: { - id: '14', - name: 'Liam', - handle: '@liam', - avatar: '', - }, - messages: [] - }, - { - id: '15', - user: { - id: '15', - name: 'Mia', - handle: '@mia', - avatar: '', - }, - messages: [] - }, - { - id: '16', - user: { - id: '16', - name: 'Noah', - handle: '@noah', - avatar: '', - }, - messages: [] - }, - { - id: '17', - user: { - id: '17', - name: 'Olivia', - handle: '@olivia', - avatar: '', - }, - messages: [] - }, - { - id: '18', - user: { - id: '18', - name: 'Peter', - handle: '@peter', - avatar: '', - }, - messages: [] - }, - { - id: '19', - user: { - id: '19', - name: 'Quinn', - handle: '@quinn', - avatar: '', - }, - messages: [] - }, - { - id: '20', - user: { - id: '20', - name: 'Rose', - handle: '@rose', - avatar: '', - }, - messages: [] - } + { + id: '1', + user: { + id: '1', + name: 'John Doe', + handle: '@johndoe', + avatar: '', + }, + messages: [ + { + message: 'Doing well, thanks!', + isUser: true, + timestamp: new Date().toString(), + }, + { + message: 'How are you?', + isUser: false, + timestamp: new Date().toString(), + }, + { + message: 'Hello', + isUser: false, + timestamp: new Date().toString(), + }, + { + message: 'Hi!', + isUser: true, + timestamp: new Date().toString(), + }, + ], + }, + { + id: '2', + user: { + id: '2', + name: 'Jane Doe', + handle: '@janedoe', + avatar: '', + }, + messages: [], + }, + { + id: '3', + user: { + id: '3', + name: 'Alice', + handle: '@alice', + avatar: '', + }, + messages: [], + }, + { + id: '4', + user: { + id: '4', + name: 'Bob', + handle: '@bob', + avatar: '', + }, + messages: [], + }, + { + id: '5', + user: { + id: '5', + name: 'Charlie', + handle: '@charlie', + avatar: '', + }, + messages: [], + }, + { + id: '6', + user: { + id: '6', + name: 'David', + handle: '@david', + avatar: '', + }, + messages: [], + }, + { + id: '7', + user: { + id: '7', + name: 'Eve', + handle: '@eve', + avatar: '', + }, + messages: [], + }, + { + id: '8', + user: { + id: '8', + name: 'Frank', + handle: '@frank', + avatar: '', + }, + messages: [], + }, + { + id: '9', + user: { + id: '9', + name: 'Grace', + handle: '@grace', + avatar: '', + }, + messages: [], + }, + { + id: '10', + user: { + id: '10', + name: 'Harry', + handle: '@harry', + avatar: '', + }, + messages: [], + }, + { + id: '11', + user: { + id: '11', + name: 'Ivy', + handle: '@ivy', + avatar: '', + }, + messages: [], + }, + { + id: '12', + user: { + id: '12', + name: 'Jack', + handle: '@jack', + avatar: '', + }, + messages: [], + }, + { + id: '13', + user: { + id: '13', + name: 'Kate', + handle: '@kate', + avatar: '', + }, + messages: [], + }, + { + id: '14', + user: { + id: '14', + name: 'Liam', + handle: '@liam', + avatar: '', + }, + messages: [], + }, + { + id: '15', + user: { + id: '15', + name: 'Mia', + handle: '@mia', + avatar: '', + }, + messages: [], + }, + { + id: '16', + user: { + id: '16', + name: 'Noah', + handle: '@noah', + avatar: '', + }, + messages: [], + }, + { + id: '17', + user: { + id: '17', + name: 'Olivia', + handle: '@olivia', + avatar: '', + }, + messages: [], + }, + { + id: '18', + user: { + id: '18', + name: 'Peter', + handle: '@peter', + avatar: '', + }, + messages: [], + }, + { + id: '19', + user: { + id: '19', + name: 'Quinn', + handle: '@quinn', + avatar: '', + }, + messages: [], + }, + { + id: '20', + user: { + id: '20', + name: 'Rose', + handle: '@rose', + avatar: '', + }, + messages: [], + }, ];