-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into indexer-hotfix
- Loading branch information
Showing
21 changed files
with
471 additions
and
292 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 14 additions & 12 deletions
26
apps/mobile/src/components/LaunchPad/TokenStats/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 81 additions & 21 deletions
102
apps/mobile/src/components/LaunchPad/UserShare/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,108 @@ | ||
import { FlatList, View } from 'react-native'; | ||
import { FlatList, Pressable, View } from 'react-native'; | ||
|
||
import { useStyles } from '../../../hooks'; | ||
import { UserShareInterface } from '../../../types/keys'; | ||
import { useStyles, useWaitConnection } from '../../../hooks'; | ||
import { TokenStatsInterface, UserShareInterface } from '../../../types/keys'; | ||
import { Text } from '../../Text'; | ||
import stylesheet from './styles'; | ||
import Loading from '../../Loading'; | ||
import { useGetShares } from '../../../hooks/api/indexer/useUserShare'; | ||
import { useAccount } from 'wagmi'; | ||
import { useEffect, useState } from 'react'; | ||
import { useWalletModal } from '../../../hooks/modals'; | ||
|
||
export type UserShareProps = { | ||
loading: boolean; | ||
coinAddress: string; | ||
shares?: UserShareInterface[]; | ||
}; | ||
|
||
export const UserShare: React.FC<UserShareProps> = ({ shares, loading }) => { | ||
export const UserShare: React.FC<UserShareProps> = ({ shares, loading, coinAddress }) => { | ||
const styles = useStyles(stylesheet); | ||
const [stats, setStats] = useState<TokenStatsInterface | undefined>(); | ||
const [sharesState, setShares] = useState<UserShareInterface | undefined>(); | ||
|
||
return loading ? ( | ||
<Loading /> | ||
) : ( | ||
<FlatList | ||
data={shares} | ||
keyExtractor={(item, index) => index.toString()} | ||
renderItem={({ item }) => ( | ||
const account = useAccount() | ||
const { data: sharesData, isLoading: sharesLoading, refetch } = useGetShares(coinAddress, account?.address ?? ""); | ||
|
||
const waitConnection = useWaitConnection(); | ||
const walletModal = useWalletModal(); | ||
const onConnect = async () => { | ||
if (!account.address) { | ||
walletModal.show(); | ||
|
||
const result = await waitConnection(); | ||
if (!result) return; | ||
} | ||
}; | ||
console.log("sharesData", sharesData) | ||
useEffect(() => { | ||
const data = sharesData || []; | ||
setStats(data); | ||
setShares(sharesData) | ||
}, [sharesData]); | ||
|
||
// return loading ? ( | ||
// <Loading /> | ||
// ) | ||
return ( | ||
|
||
|
||
|
||
<> | ||
|
||
{sharesLoading && <Loading></Loading>} | ||
|
||
{account && !account?.address && | ||
<View> | ||
|
||
<Pressable onPress={() => { | ||
onConnect() | ||
}}> | ||
<Text>Connect</Text> | ||
</Pressable> | ||
</View> | ||
} | ||
{sharesState && | ||
<View style={[styles.container, styles.borderBottom]}> | ||
|
||
|
||
<View style={styles.borderBottom}> | ||
<Text fontSize={14} weight="semiBold"> | ||
Memecoin Address | ||
Total | ||
</Text> | ||
<Text fontSize={14}>{item.token_address}</Text> | ||
<Text fontSize={14}>{Number(sharesState?.total_buy) - Number(sharesState?.total_sell)}</Text> | ||
</View> | ||
|
||
<View style={styles.borderBottom}> | ||
<Text fontSize={14} weight="semiBold"> | ||
Coin Recieved | ||
Total sell | ||
</Text> | ||
<Text fontSize={14}>{Number(item.total_supply)}</Text> | ||
<Text fontSize={14}>{sharesState?.total_sell}</Text> | ||
</View> | ||
<View style={styles.borderBottom}> | ||
<Text fontSize={14} weight="semiBold"> | ||
Quote amount paid | ||
</Text> | ||
<Text fontSize={14}>{sharesState?.quote_amount}</Text> | ||
</View> | ||
|
||
|
||
</View> | ||
)} | ||
ListEmptyComponent={<View style={{ paddingTop: 40 }}> | ||
<Text style={{ textAlign: 'center' }}>No user share available</Text> | ||
</View> | ||
|
||
} | ||
/> | ||
|
||
{/* <FlatList | ||
data={stats} | ||
keyExtractor={(item, index) => index.toString()} | ||
renderItem={({ item }) => ( | ||
)} | ||
ListEmptyComponent={<View style={{ paddingTop: 40 }}> | ||
<Text style={{ textAlign: 'center' }}>No user share available</Text> | ||
</View> | ||
} | ||
/> */} | ||
</> | ||
|
||
|
||
); | ||
}; |
Oops, something went wrong.