-
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.
Merge pull request #594 from cocrafts/ltminhthu/first-time-popup
[wallet][MS-245] first time user popup for adding pixeverse
- Loading branch information
Showing
11 changed files
with
305 additions
and
4 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
apps/wallet/src/modals/FirstTimePopup/BlueCircleBackground.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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Defs, G, Svg } from 'react-native-svg'; | ||
|
||
export const BlueCircleBackground = () => { | ||
return ( | ||
<Svg width="308" height="174" viewBox="0 0 308 174" fill="none"> | ||
<G opacity="0.8" filter="url(#filter0_f_14670_15152)"> | ||
<circle cx="154" cy="87" r="120" fill="#17A3E1" /> | ||
</G> | ||
<Defs> | ||
<filter | ||
id="filter0_f_14670_15152" | ||
x="0" | ||
y="-67" | ||
width="308" | ||
height="308" | ||
filterUnits="userSpaceOnUse" | ||
colorInterpolationFilters="sRGB" | ||
> | ||
<feFlood floodOpacity="0" result="BackgroundImageFix" /> | ||
<feBlend | ||
mode="normal" | ||
in="SourceGraphic" | ||
in2="BackgroundImageFix" | ||
result="shape" | ||
/> | ||
<feGaussianBlur | ||
stdDeviation="17" | ||
result="effect1_foregroundBlur_14670_15152" | ||
/> | ||
</filter> | ||
</Defs> | ||
</Svg> | ||
); | ||
}; | ||
|
||
export default BlueCircleBackground; |
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,92 @@ | ||
import type { FC } from 'react'; | ||
import { Image, StyleSheet, View } from 'react-native'; | ||
import { Text } from '@walless/gui'; | ||
import type { WidgetDocument } from '@walless/store'; | ||
|
||
interface Props { | ||
widget: WidgetDocument; | ||
} | ||
|
||
const PixeverseCard: FC<Props> = ({ widget }) => { | ||
return ( | ||
<View style={styles.container}> | ||
<View> | ||
<Image | ||
style={styles.coverImage} | ||
source={{ uri: widget.storeMeta.coverUri }} | ||
/> | ||
<Image | ||
style={styles.iconImage} | ||
source={{ uri: widget.storeMeta.iconUri }} | ||
/> | ||
</View> | ||
|
||
<View style={styles.infoContainer}> | ||
<Text style={styles.title}>Pixeverse</Text> | ||
|
||
<Text | ||
style={[styles.description]} | ||
numberOfLines={2} | ||
ellipsizeMode="tail" | ||
> | ||
{widget.storeMeta.description} | ||
</Text> | ||
|
||
<View style={styles.addButton}> | ||
<Text style={styles.buttonText}>Add</Text> | ||
</View> | ||
</View> | ||
</View> | ||
); | ||
}; | ||
|
||
export default PixeverseCard; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flexDirection: 'row', | ||
backgroundColor: '#182027', | ||
paddingHorizontal: 12, | ||
paddingVertical: 12, | ||
borderRadius: 12, | ||
gap: 12, | ||
}, | ||
coverImage: { | ||
width: 112, | ||
height: 80, | ||
borderRadius: 8, | ||
}, | ||
iconImage: { | ||
position: 'absolute', | ||
bottom: 4, | ||
right: 4, | ||
width: 28, | ||
height: 28, | ||
borderRadius: 4, | ||
}, | ||
infoContainer: { | ||
flex: 1, | ||
justifyContent: 'space-between', | ||
}, | ||
title: { | ||
color: '#ffffff', | ||
fontWeight: '500', | ||
}, | ||
description: { | ||
fontSize: 10, | ||
color: '#566674', | ||
}, | ||
addButton: { | ||
backgroundColor: '#198CCA', | ||
paddingHorizontal: 16, | ||
paddingVertical: 4, | ||
borderColor: '#17A3E1', | ||
borderWidth: 1, | ||
borderRadius: 8, | ||
width: 'fit-content', | ||
}, | ||
buttonText: { | ||
color: '#ffffff', | ||
fontWeight: '500', | ||
}, | ||
}); |
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,120 @@ | ||
import { StyleSheet, TouchableOpacity, View } from 'react-native'; | ||
import { modalActions, Text } from '@walless/gui'; | ||
import { ModalId } from 'modals/types'; | ||
import { mockWidgets } from 'state/widget'; | ||
import { navigate } from 'utils/navigation'; | ||
import { addWidgetToStorage } from 'utils/storage'; | ||
|
||
import BlueCircleBackground from './BlueCircleBackground'; | ||
import PixeverseCard from './PixeverseCard'; | ||
|
||
const FirstTimePopup = () => { | ||
const pixeverseWidget = mockWidgets.find((item) => item._id === 'pixeverse'); | ||
|
||
const handleAddPixeverse = () => { | ||
if (!pixeverseWidget) return; | ||
|
||
addWidgetToStorage('pixeverse', pixeverseWidget); | ||
navigate('Dashboard', { | ||
screen: 'Explore', | ||
params: { | ||
screen: 'Widget', | ||
params: { | ||
id: 'pixeverse', | ||
}, | ||
}, | ||
}); | ||
modalActions.destroy(ModalId.FirstTimePopup); | ||
}; | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<View style={styles.upperPart}> | ||
<View style={styles.backgroundImage}> | ||
<BlueCircleBackground /> | ||
</View> | ||
|
||
{pixeverseWidget && <PixeverseCard widget={pixeverseWidget} />} | ||
</View> | ||
|
||
<View style={styles.lowerPart}> | ||
<Text style={styles.title}>Welcome to Walless</Text> | ||
|
||
<View style={styles.textContainer}> | ||
<Text style={styles.text}> | ||
Lets get you set up with a brand new way of Web3 wallet. From the | ||
Explorer tab, you can find the best of web3: gaming, multi-chain | ||
wallets, trading tools,… | ||
</Text> | ||
<Text style={styles.text}> | ||
To start earning daily tokens, add the in-wallet game PIXEVERSE and | ||
the wallet widget. | ||
</Text> | ||
</View> | ||
|
||
<TouchableOpacity onPress={handleAddPixeverse} style={styles.addButton}> | ||
<Text style={styles.buttonText}>Add Pixeverse</Text> | ||
</TouchableOpacity> | ||
</View> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
maxWidth: 374, | ||
borderRadius: 16, | ||
overflow: 'hidden', | ||
}, | ||
upperPart: { | ||
backgroundColor: '#031821', | ||
paddingHorizontal: 52, | ||
paddingVertical: 36, | ||
alignItems: 'center', | ||
}, | ||
backgroundImage: { | ||
position: 'absolute', | ||
top: 0, | ||
}, | ||
addButton: { | ||
backgroundColor: '#198CCA', | ||
paddingHorizontal: 16, | ||
paddingVertical: 4, | ||
borderColor: '#17A3E1', | ||
borderWidth: 1, | ||
borderRadius: 8, | ||
width: 'fit-content', | ||
}, | ||
buttonText: { | ||
color: '#ffffff', | ||
fontWeight: '500', | ||
}, | ||
lowerPart: { | ||
gap: 20, | ||
backgroundColor: '#222F37', | ||
paddingHorizontal: 24, | ||
paddingVertical: 24, | ||
alignItems: 'center', | ||
}, | ||
title: { | ||
color: '#ffffff', | ||
fontSize: 24, | ||
fontWeight: '500', | ||
}, | ||
textContainer: { | ||
gap: 12, | ||
}, | ||
text: { | ||
color: '#ffffff', | ||
}, | ||
}); | ||
|
||
export default FirstTimePopup; | ||
|
||
export const showFirstTimePopup = () => { | ||
modalActions.show({ | ||
id: ModalId.FirstTimePopup, | ||
component: FirstTimePopup, | ||
fullWidth: false, | ||
}); | ||
}; |
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
Oops, something went wrong.