-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: handle unverified assets activation
- Loading branch information
1 parent
9263375
commit a53e313
Showing
7 changed files
with
239 additions
and
15 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
108 changes: 108 additions & 0 deletions
108
packages/mobile/components/modals/unverified-asset-modal.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,108 @@ | ||
import { | ||
BottomSheetBackdrop, | ||
BottomSheetBackdropProps, | ||
BottomSheetModal, | ||
BottomSheetView, | ||
} from "@gorhom/bottom-sheet"; | ||
import { forwardRef, useCallback } from "react"; | ||
import { StyleSheet } from "react-native"; | ||
|
||
import { AssetImage } from "~/components/ui/asset-image"; | ||
import { Button } from "~/components/ui/button"; | ||
import { Text } from "~/components/ui/text"; | ||
import { Colors } from "~/constants/theme-colors"; | ||
|
||
interface UnverifiedAssetModalProps { | ||
onActivate: () => void; | ||
assetSymbol: string; | ||
assetImageUrl?: string; | ||
} | ||
|
||
export const UnverifiedAssetModal = forwardRef< | ||
BottomSheetModal, | ||
UnverifiedAssetModalProps | ||
>(({ onActivate, assetSymbol, assetImageUrl }, ref) => { | ||
return ( | ||
<BottomSheetModal | ||
ref={ref} | ||
enablePanDownToClose | ||
// enableDynamicSizing={false} | ||
// snapPoints={["50%"]} | ||
backdropComponent={useCallback( | ||
(props: BottomSheetBackdropProps) => ( | ||
<BottomSheetBackdrop | ||
{...props} | ||
appearsOnIndex={0} | ||
disappearsOnIndex={-1} | ||
/> | ||
), | ||
[] | ||
)} | ||
backgroundStyle={styles.bottomSheetBackground} | ||
handleIndicatorStyle={styles.indicator} | ||
> | ||
<BottomSheetView style={styles.container}> | ||
{assetImageUrl && ( | ||
<AssetImage uri={assetImageUrl} style={styles.assetIcon} /> | ||
)} | ||
<Text type="title" style={styles.title}> | ||
Activate unverified assets | ||
</Text> | ||
<Text type="subtitle" style={styles.description}> | ||
{assetSymbol} is an unverified token. Do you wish to activate it? Be | ||
sure to research thoroughly before trading. | ||
</Text> | ||
<Text type="caption" style={styles.note}> | ||
You can always deactivate this setting in the settings modal. | ||
</Text> | ||
<Button | ||
title="Activate" | ||
variant="primary" | ||
onPress={onActivate} | ||
buttonStyle={styles.button} | ||
/> | ||
</BottomSheetView> | ||
</BottomSheetModal> | ||
); | ||
}); | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
alignItems: "center", | ||
paddingHorizontal: 24, | ||
paddingTop: 5, | ||
paddingBottom: 42, | ||
flex: 1, | ||
}, | ||
bottomSheetBackground: { | ||
backgroundColor: Colors.osmoverse[900], | ||
}, | ||
indicator: { | ||
backgroundColor: Colors.osmoverse[400], | ||
}, | ||
assetIcon: { | ||
width: 48, | ||
height: 48, | ||
borderRadius: 24, | ||
marginBottom: 16, | ||
}, | ||
title: { | ||
fontSize: 24, | ||
marginBottom: 16, | ||
textAlign: "center", | ||
}, | ||
description: { | ||
color: Colors.osmoverse[200], | ||
textAlign: "center", | ||
marginBottom: 12, | ||
}, | ||
note: { | ||
color: Colors.osmoverse[300], | ||
textAlign: "center", | ||
marginBottom: 24, | ||
}, | ||
button: { | ||
width: "100%", | ||
paddingVertical: 16, | ||
}, | ||
}); |
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 |
---|---|---|
|
@@ -25,6 +25,5 @@ const styles = StyleSheet.create({ | |
width: 40, | ||
height: 40, | ||
borderRadius: 20, | ||
marginRight: 12, | ||
}, | ||
}); |
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,22 @@ | ||
import { create } from "zustand"; | ||
import { createJSONStorage, persist } from "zustand/middleware"; | ||
|
||
import { mmkvStorage } from "~/utils/mmkv"; | ||
|
||
interface SettingsState { | ||
showUnverifiedAssets: boolean; | ||
setShowUnverifiedAssets: (show: boolean) => void; | ||
} | ||
|
||
export const useSettingsStore = create<SettingsState>()( | ||
persist( | ||
(set) => ({ | ||
showUnverifiedAssets: false, | ||
setShowUnverifiedAssets: (show) => set({ showUnverifiedAssets: show }), | ||
}), | ||
{ | ||
name: "settings-store", | ||
storage: createJSONStorage(() => mmkvStorage), | ||
} | ||
) | ||
); |
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