-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Merge branch 'dev' into check_old_pnl-1
- Loading branch information
Showing
58 changed files
with
1,606 additions
and
160 deletions.
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -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', | ||
}, | ||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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, | ||
}, | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import type { FC } from 'react'; | ||
import type { ViewStyle } from 'react-native'; | ||
import { StyleSheet } from 'react-native'; | ||
import { View } from '@walless/gui'; | ||
|
||
import type { WidgetButtonProps } from './ButtonItem'; | ||
import { ButtonItem } from './ButtonItem'; | ||
|
||
interface Props { | ||
style?: ViewStyle; | ||
buttons: WidgetButtonProps[]; | ||
} | ||
|
||
const WidgetButtons: FC<Props> = ({ style, buttons }) => { | ||
return ( | ||
<View style={[styles.container, style]}> | ||
{buttons.map((item, idx) => ( | ||
<ButtonItem | ||
key={idx} | ||
Icon={item.Icon} | ||
iconColor={item.iconColor} | ||
iconSize={item.iconSize} | ||
onPress={item.onPress} | ||
style={item.style} | ||
title={item.title} | ||
titleStyle={item.titleStyle} | ||
/> | ||
))} | ||
</View> | ||
); | ||
}; | ||
|
||
export default WidgetButtons; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flexDirection: 'row', | ||
gap: 18, | ||
}, | ||
}); |
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
Oops, something went wrong.