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

[wallet] release: wallet 1.2.2 with custom wallet, pnl, bugs fixing, pixeverse popup #608

Draft
wants to merge 83 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
1c1e004
PnL with mock data
ltminhthu May 19, 2024
857cbb4
adjust some details of value pnl
ltminhthu May 20, 2024
04fcf34
fix some details in token item pnl
ltminhthu May 25, 2024
a190a22
Adding query P&L token
kayx86 May 26, 2024
7fa2d18
Add field to TokenMetadata
kayx86 May 26, 2024
577057f
Remove pnl24h in TokenMetadata
kayx86 May 26, 2024
2cde3c9
Update schema
kayx86 May 26, 2024
ff45dd1
add type pnl24h to TokenInfo
kayx86 May 31, 2024
94aaa52
Add pnl24h
kayx86 Jun 3, 2024
861bb69
Add pnl to Token struct
kayx86 Jun 3, 2024
7d5cba4
first time user popup for adding pixeverse
ltminhthu Jul 9, 2024
df33b44
add yarn.lock
ltminhthu Jul 9, 2024
bf1fd81
choer: reverse cocoapod version
ltminhthu Jul 10, 2024
929dc68
chore: remove icon and move it to the modal folder as a component
ltminhthu Jul 10, 2024
fa2a663
chore: change var name and fix small details
ltminhthu Jul 10, 2024
7689bce
Merge branch 'dev' of https://github.com/cocrafts/walless into ltminh…
ltminhthu Jul 18, 2024
8203d89
fix: add show popup flag to the pouchdb instead of local storage
ltminhthu Jul 19, 2024
fd74f7d
remove react native async local storage
ltminhthu Jul 19, 2024
ea7b446
init custom wallet
ltminhthu Jul 22, 2024
807d583
fix: landing page launch button responsive
ltminhthu Jul 23, 2024
59ead0b
construct a custom wallet
ltminhthu Jul 27, 2024
8f7c4d6
add assets for samo widget
ltminhthu Jul 29, 2024
5c6388b
revert explorer
ltminhthu Jul 29, 2024
a0e8f11
adjust custom wallet layout
ltminhthu Jul 29, 2024
08790d1
add advertisement for custom wallet
ltminhthu Jul 29, 2024
584e1ab
adjust some related functions
ltminhthu Jul 29, 2024
01e3045
add more ads and ads indicator
ltminhthu Jul 29, 2024
3191fa7
add ads indicator to the ads
ltminhthu Jul 29, 2024
db08ef9
filter out the custom wallet when users have no required tokens
ltminhthu Jul 29, 2024
e967e3f
fix some small details such as types, size, etc.
ltminhthu Jul 29, 2024
c9d2f38
hndle case wrapped sol is inserted
ltminhthu Jul 30, 2024
325fd43
refactor: filter out the custom wallet meet the requirement
ltminhthu Jul 30, 2024
8710579
fix: type check error
ltminhthu Jul 30, 2024
23c0c9d
fix: get wrong collection id
ltminhthu Jul 30, 2024
62f2e27
Merge branch 'main' into ltminhthu/profit-and-lost
hnimtadd Jul 31, 2024
3806c6e
feat: sync pnl schema from server
hnimtadd Jul 31, 2024
d53d984
feat: sync changes from types
hnimtadd Jul 31, 2024
5519006
feat-wip: working with PnL UI
hnimtadd Jul 31, 2024
6eb4275
change auto swipe card
ltminhthu Aug 1, 2024
8289459
replace nft tab by collectible list
ltminhthu Aug 5, 2024
b43a2b2
remove widget type, group it to widget category
ltminhthu Aug 5, 2024
0ac6cb1
replace token tab by token list
ltminhthu Aug 5, 2024
ccb8b2a
abstract filter for widget
ltminhthu Aug 5, 2024
ebca821
change data to widget
ltminhthu Aug 5, 2024
150020b
fix: type check
ltminhthu Aug 5, 2024
6fc0f21
keep the old style of slider tabs and add linear gradient
ltminhthu Aug 5, 2024
6baa969
refactor: name the constant
ltminhthu Aug 5, 2024
0dee521
fix: change icon size to optional
ltminhthu Aug 5, 2024
5e90793
remove redundant log
ltminhthu Aug 5, 2024
696c0aa
update scroll animation for advertisement
ltminhthu Aug 6, 2024
6f03cf5
adjust the filter return from object to boolean
ltminhthu Aug 6, 2024
0bdcc98
move token list and collectible list to components
ltminhthu Aug 6, 2024
d04a81f
combine category and subcategory of widget
ltminhthu Aug 6, 2024
b8d3351
update type after changing the way to classify widgets
ltminhthu Aug 6, 2024
ea75b52
fix: eslint
ltminhthu Aug 6, 2024
216ce3c
Merge pull request #603 from cocrafts/ltminhthu/landing-page
ltminhthu Aug 6, 2024
997dd7c
revert to old version of podfile
ltminhthu Aug 6, 2024
2203b38
add setting button to the side bar
ltminhthu Aug 6, 2024
f8af32e
fix: revert setting in profile
ltminhthu Aug 6, 2024
942f658
chore: make tokenPnL render with 4 precision
hnimtadd Aug 1, 2024
f7aa19d
fix: fix render wrong pnl percentage container
hnimtadd Aug 8, 2024
f295234
feat: calc tokenPnL
hnimtadd Aug 1, 2024
66398b1
chore: remove hardcoded address
hnimtadd Aug 8, 2024
2cec776
Merge pull request #606 from cocrafts/ltminhthu/fix-small-details
tanlethanh Aug 9, 2024
27e0cca
Merge pull request #604 from cocrafts/ltminhthu/custom-wallet
tanlethanh Aug 9, 2024
70197ab
Merge pull request #594 from cocrafts/ltminhthu/first-time-popup
tanlethanh Aug 9, 2024
7a34a91
chore: Merge branch 'dev' into check_old_pnl-1
hnimtadd Aug 10, 2024
f8ed0f0
Merge pull request #605 from cocrafts/ltminhthu/profit-and-lost
tanlethanh Aug 12, 2024
aa2c548
Merge pull request #607 from cocrafts/dev
tanlethanh Aug 12, 2024
fd5674c
fix: add custom wallet info to the remote config
ltminhthu Aug 12, 2024
9d754e2
fix: add all the custom stuff to remote config
ltminhthu Aug 12, 2024
e165d2a
chore: only render pnl if percentages is different than 0
hnimtadd Aug 12, 2024
f02ae39
feat: revise pnl colors based on figma styles
hnimtadd Aug 12, 2024
2f50ebc
change default value of option filter added to true
ltminhthu Aug 15, 2024
12c0f06
get remote config of custom wallets on firebase
ltminhthu Aug 15, 2024
3056a09
Merge pull request #610 from cocrafts/ltminhthu/profit-and-lost
tanlethanh Aug 15, 2024
ce7fdba
Merge pull request #611 from cocrafts/dev
tanlethanh Aug 15, 2024
a34aeef
add whitelist for custom wallet
ltminhthu Aug 15, 2024
bc884cd
fix: remove redundant log
ltminhthu Aug 15, 2024
732ec79
fix: change the way to get widget (from mock data to hook)
ltminhthu Aug 15, 2024
35f8093
fix: remove log debug
ltminhthu Aug 15, 2024
fdc772d
Merge pull request #609 from cocrafts/ltminhthu/fix-custom-wallet
tanlethanh Aug 15, 2024
18d52d2
Merge pull request #612 from cocrafts/dev
tanlethanh Aug 15, 2024
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ cli/tokens/**/cache.json
cli/tokens/**/config.json
cli/tokens/**/sugar.log

playground
playground
.nvmrc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const styles = StyleSheet.create({
},
button: {
marginHorizontal: 8,
alignSelf: 'flex-start',
alignSelf: 'flex-end',
},
line: {
backgroundColor: '#ffffff',
Expand Down
3 changes: 2 additions & 1 deletion apps/landing/components/layouts/Home/Navigation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ export const HomeNavigation: FC = () => {
const modalRef = useRef(null);

const temporarilyDisabled = false;

const handleShowLaunchingModal = () => {
modalActions.show({
id: 'launching',
fullWidth: false,
bindingRef: modalRef,
bindingDirection: BindDirections.InnerTopLeft,
bindingDirection: BindDirections.InnerTopRight,
animateDirection: AnimateDirections.Inner,
component: LaunchingModal,
});
Expand Down
Binary file added apps/wallet/assets/img/widget/samo-ad-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/wallet/assets/img/widget/samo-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/wallet/assets/img/widget/samo-cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/wallet/assets/img/widget/samo-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
116 changes: 116 additions & 0 deletions apps/wallet/src/components/CollectibleList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import type { FC } from 'react';
import { ScrollView, StyleSheet } from 'react-native';
import { Text, View } from '@walless/gui';
import type { NftDocument } from '@walless/store';
import CollectionCard from 'components/CollectionCard';
import type { WrappedCollection } from 'utils/hooks';
import { useLazyGridLayout } from 'utils/hooks';
import { navigate } from 'utils/navigation';

interface Props {
collections?: WrappedCollection[];
nfts?: NftDocument[];
}

export const CollectibleList: FC<Props> = ({ collections = [], nfts = [] }) => {
const { onGridContainerLayout, width } = useLazyGridLayout({
referenceWidth: 150,
gap: gridGap,
});

const handlePressCollection = (ele: WrappedCollection) => {
const collectionId = ele._id.split('/')[2];

navigate('Dashboard', {
screen: 'Explore',
params: {
screen: 'Collection',
params: {
screen: 'Default',
params: { id: collectionId },
},
},
});
};

const handlePressCollectible = (ele: NftDocument) => {
const collectibleId = ele._id.split('/')[2];

navigate('Dashboard', {
screen: 'Explore',
params: {
screen: 'Collection',
params: { screen: 'NFT', params: { id: collectibleId } },
},
});
};

return (
<ScrollView
style={styles.container}
showsVerticalScrollIndicator={false}
onLayout={(e) => onGridContainerLayout(e.nativeEvent.layout)}
>
{collections.length === 0 && nfts.length === 0 && (
<View horizontal style={styles.emptyContainer}>
<Text style={styles.emptyText}>You do not have any NFT yet</Text>
</View>
)}
<View style={styles.contentContainer}>
{width > 0 &&
collections.map((ele, index) => {
return (
<CollectionCard
key={index}
item={ele}
collectibleCount={ele.count}
onPress={() => handlePressCollection(ele)}
size={width}
/>
);
})}
</View>

<View style={styles.contentContainer}>
{width > 0 &&
nfts.map((ele, index) => {
return (
<CollectionCard
key={index}
item={ele}
onPress={() => handlePressCollectible(ele)}
size={width}
/>
);
})}
</View>
</ScrollView>
);
};

export default CollectibleList;

const gridGap = 18;
const styles = StyleSheet.create({
container: {
marginTop: 16,
marginBottom: 32,
borderRadius: 12,
overflow: 'hidden',
},
contentContainer: {
flexDirection: 'row',
flexWrap: 'wrap',
gap: gridGap,
overflow: 'hidden',
},
emptyContainer: {
flex: 1,
justifyContent: 'center',
},
emptyText: {
marginTop: 120,
fontSize: 13,
color: '#566674',
},
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { FC } from 'react';
import type { StyleProp, ViewStyle } from 'react-native';
import { Image, StyleSheet } from 'react-native';
import type { TokenPnL } from '@walless/core';
import { Hoverable, Text, View } from '@walless/gui';
import type { TokenDocument } from '@walless/store';
import assets from 'utils/assets';
Expand All @@ -10,22 +11,33 @@ interface Props {
style?: StyleProp<ViewStyle>;
token: TokenDocument;
onPress?: () => void;
tokenPnL?: TokenPnL;
}

export const TokenItem: FC<Props> = ({ style, token, onPress }) => {
export const TokenItem: FC<Props> = ({ style, token, onPress, tokenPnL }) => {
const pnl = tokenPnL?.priceChangePercentage24H ?? 0;
const { symbol, image, quotes, balance } = token;
const unitQuote = quotes?.usd;
const totalQuote = unitQuote && unitQuote * balance;

const iconSource = image ? { uri: image } : assets.misc.unknownToken;
const fixedPnL = Math.round(pnl * 10000) / 10000;

const itemName = symbol || 'Unknown';
const isLost = fixedPnL < 0;
const isProfit = fixedPnL > 0;

return (
<Hoverable style={[styles.container, style]} onPress={onPress}>
<Image style={styles.iconImg} source={iconSource} resizeMode="cover" />
<View style={styles.infoContainer}>
<Text style={styles.primaryText}>{itemName}</Text>
<Text style={styles.secondaryText}>{formatQuote(unitQuote)}</Text>
<View style={styles.unitQuoteContainer}>
<Text style={styles.secondaryText}>{formatQuote(unitQuote)}</Text>
<Text style={isLost ? styles.lostText : styles.profitText}>
{isLost ? `-${-fixedPnL}` : isProfit ? `+${fixedPnL}` : null}
</Text>
</View>
</View>
<View style={styles.balanceContainer}>
<Text style={styles.primaryText}>{balance}</Text>
Expand Down Expand Up @@ -75,4 +87,18 @@ const styles = StyleSheet.create({
color: '#566674',
fontSize: 13,
},
unitQuoteContainer: {
flexDirection: 'row',
alignItems: 'center',
gap: 8,
},
profitText: {
color: '#60C591',
fontSize: 10,
alignSelf: 'flex-end',
},
lostText: {
color: '#AE3939',
fontSize: 10,
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface Props<T extends Token> {
itemStyle?: StyleProp<ViewStyle>;
separateStyle?: StyleProp<ViewStyle>;
contentContainerStyle?: StyleProp<ViewStyle>;
items: TokenDocument<T>[];
tokens: TokenDocument<T>[];
ListHeaderComponent?: ComponentType<TokenDocument<T>> | ReactElement;
onPressItem?: (item: TokenDocument<T>) => void;
}
Expand All @@ -23,7 +23,7 @@ export const TokenList = <T extends Token>({
itemStyle,
separateStyle,
contentContainerStyle,
items,
tokens,
ListHeaderComponent,
onPressItem,
}: Props<T>) => {
Expand All @@ -39,9 +39,10 @@ export const TokenList = <T extends Token>({
style={[
itemStyle,
index === 0 && styles.firstItem,
index === items.length - 1 && styles.lastItem,
index === tokens.length - 1 && styles.lastItem,
]}
onPress={handlePressItem}
tokenPnL={item.pnl}
/>
);
};
Expand All @@ -52,7 +53,7 @@ export const TokenList = <T extends Token>({
showsVerticalScrollIndicator={false}
style={style}
contentContainerStyle={contentContainerStyle}
data={items}
data={tokens}
renderItem={renderItem}
keyExtractor={(item) => item._id}
ItemSeparatorComponent={() => <Separator style={separateStyle} />}
Expand Down
73 changes: 73 additions & 0 deletions apps/wallet/src/components/TotalPnL.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import type { FC } from 'react';
import { StyleSheet } from 'react-native';
import { Text, View } from '@walless/gui';

interface Props {
value: number;
percentage: number;
isDarkTheme: boolean;
}

const TotalPnL: FC<Props> = ({ value, percentage, isDarkTheme = false }) => {
const isLost = value < 0;
const isProfit = value > 0;

return (
<View style={styles.container}>
<Text
style={[
styles.pnlTextBase,
styles.pnlValueBase,
isDarkTheme ? styles.darkThemePnLText : styles.lightThemePnLText,
]}
>
{isLost ? `≈ -$${-value}` : isProfit ? `≈ +$${value}` : null}
</Text>
<View
style={[
styles.percentageContainerBase,
isLost
? styles.LostPercentageContainer
: styles.ProfitPercentageContainer,
]}
>
<Text style={[styles.pnlTextBase]}>
{isLost ? `${percentage}%` : isProfit ? `+${percentage}%` : null}
</Text>
</View>
</View>
);
};

export default TotalPnL;

const styles = StyleSheet.create({
container: {
flexDirection: 'row',
alignItems: 'center',
gap: 8,
},
pnlTextBase: {
color: '#ffffff',
},
pnlValueBase: {
fontSize: 20,
},
darkThemePnLText: {
color: '#babdc0',
},
lightThemePnLText: {
color: '#ffffff',
},
percentageContainerBase: {
borderRadius: 4,
paddingVertical: 4,
paddingHorizontal: 8,
},
ProfitPercentageContainer: {
backgroundColor: '#29985F',
},
LostPercentageContainer: {
backgroundColor: '#DB1901',
},
});
62 changes: 62 additions & 0 deletions apps/wallet/src/components/WidgetButtons/ButtonItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import type { FC } from 'react';
import type { TextStyle, ViewStyle } from 'react-native';
import { StyleSheet } from 'react-native';
import { Hoverable, Text, View } from '@walless/gui';
import type { IconProps } from '@walless/icons';

export interface WidgetButtonProps {
style?: ViewStyle;
title?: string;
titleStyle?: TextStyle;
Icon: FC<IconProps>;
iconColor?: string;
iconSize?: number;
onPress?: () => void;
}

export const ButtonItem: FC<WidgetButtonProps> = ({
Icon,
iconColor,
iconSize,
onPress,
style,
title,
titleStyle,
}) => {
const innerStyle: ViewStyle = {
width: 38,
height: 38,
borderRadius: 12,
gap: 8,
backgroundColor: onPress ? '#0694D3' : '#43525F',
alignItems: 'center',
justifyContent: 'center',
};

return (
<View noSelect style={styles.container}>
<Hoverable
style={[innerStyle, style]}
onPress={onPress}
disabled={!onPress}
>
{<Icon color={iconColor} size={iconSize || 24} />}
</Hoverable>
{title && <Text style={[styles.title, titleStyle]}>{title}</Text>}
</View>
);
};

const styles = StyleSheet.create({
container: {
alignItems: 'center',
},
innerContainer: {
borderRadius: 12,
},
title: {
color: '#4e5e6b',
fontSize: 13,
marginTop: 8,
},
});
Loading
Loading