-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create profile screen #17
Open
jessepinho
wants to merge
29
commits into
main
Choose a base branch
from
jessepinho/profile-screen
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
66841fb
Make Avatar size prop; use it in TabScreenHeader, and make it a link
jessepinho bb59a20
Ensure button label is always one line
jessepinho 26d840d
Create ListItemChevronRightSuffix; use it in DepositMethod (and fix a…
jessepinho 2e57efc
Build out profile and default payment token screens
jessepinho 9606c65
Install/configure expo-sqlite
jessepinho c5d05be
Revert "Install/configure expo-sqlite"
jessepinho 178cf60
Install/configure expo-secure-store
jessepinho a5a2f1e
Add secureStore key to Redux
jessepinho d637ce2
Create ListItemIconSuffix
jessepinho 0f9b83b
Hook up the screen to Redux
jessepinho 8ff9c12
Add persistor to the app
jessepinho 917064d
Create separate root reducer for Storybook etc.
jessepinho 1d1995e
Add token search functionality
jessepinho 4c1c025
Add startAdornment prop; add stories
jessepinho 681c42a
Create helper component
jessepinho c99198e
Add placeholder and clearButtonMode props to TextInput
jessepinho e8c0eed
Make text input on default payment token nicer
jessepinho a8579ac
Add keyboardType prop
jessepinho 21dca8c
Add more docs re: secureStore
jessepinho 28f7a46
Create Box component
jessepinho f95e4ca
Show correct secondary text
jessepinho 43a1171
Build out GRPC screen; fix some issues
jessepinho 5872fbc
Document the store
jessepinho 790ddea
More docs
jessepinho 81af19f
Comments
jessepinho 74e5b3f
Load gRPC endpoints properly via a Thunk
jessepinho fd3a152
Make string translatable
jessepinho f2e2e74
yarn extract/compile
jessepinho b53d703
Comments
jessepinho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,5 @@ | ||
import ProfileScreen from '@/components/ProfileScreen'; | ||
|
||
export default function ProfileRoute() { | ||
return <ProfileScreen />; | ||
} |
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,5 @@ | ||
import DefaultPaymentTokenScreen from '@/components/ProfileScreen/DefaultPaymentTokenScreen'; | ||
|
||
export default function DefaultPaymentTokenRoute() { | ||
return <DefaultPaymentTokenScreen />; | ||
} |
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,5 @@ | ||
import GrpcScreen from '@/components/ProfileScreen/GrpcScreen'; | ||
|
||
export default function GrpcRoute() { | ||
return <GrpcScreen />; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import Box from '.'; | ||
import { Text } from 'dripsy'; | ||
|
||
const meta: Meta<typeof Box> = { | ||
component: Box, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
children: { control: false }, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Basic: StoryObj<typeof Box> = { | ||
args: { | ||
padding: true, | ||
children: <Text>Box content goes here</Text>, | ||
}, | ||
}; |
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,31 @@ | ||
import { Sx, View } from 'dripsy'; | ||
import { ReactNode } from 'react'; | ||
|
||
export interface BoxProps { | ||
children?: ReactNode; | ||
/** | ||
* When `true`, provides default padding. Leave undefined (or `false`) when | ||
* your children have their own padding -- e.g., in the case of `<ListItem | ||
* />`s. | ||
*/ | ||
padding?: boolean; | ||
} | ||
|
||
/** | ||
* A simple, generic wrapper that provides a background and optional padding for | ||
* its children. | ||
*/ | ||
export default function Box({ children, padding }: BoxProps) { | ||
return <View sx={{ ...sx.root, ...(padding ? sx.rootPadding : {}) }}>{children}</View>; | ||
} | ||
|
||
const sx = { | ||
root: { | ||
backgroundColor: 'neutralContrast', | ||
borderRadius: 'lg', | ||
}, | ||
|
||
rootPadding: { | ||
p: '$4', | ||
}, | ||
} satisfies Record<string, Sx>; |
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
12 changes: 12 additions & 0 deletions
12
react-native-expo/components/ListItemChevronRightSuffix/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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ChevronRight } from 'lucide-react-native'; | ||
import ListItemIconSuffix from '../ListItemIconSuffix'; | ||
|
||
/** | ||
* Many `<ListItem />`s have a right-pointing chevron to indicate they can be | ||
* tapped to open a new screen. Since this is such a common use case, | ||
* `<ListItemChevronRightSuffix />` exists to be passed to the `<ListItem />` | ||
* `suffix` prop. | ||
*/ | ||
export default function ListItemChevronRightSuffix() { | ||
return <ListItemIconSuffix IconComponent={ChevronRight} />; | ||
} |
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,15 @@ | ||
import { LucideIcon } from 'lucide-react-native'; | ||
import Icon from '../Icon'; | ||
|
||
export interface ListItemIconSuffixProps { | ||
IconComponent: LucideIcon; | ||
} | ||
|
||
/** | ||
* Many `<ListItem />`s have an icon suffix. Since this is such a common use | ||
* case, `<ListItemIconSuffix />` exists to be passed to the `<ListItem />` | ||
* `suffix` prop. | ||
*/ | ||
export default function ListItemIconSuffix({ IconComponent }: ListItemIconSuffixProps) { | ||
return <Icon IconComponent={IconComponent} size='md' color='neutralLight' />; | ||
} |
11 changes: 11 additions & 0 deletions
11
react-native-expo/components/ProfileScreen/DefaultPaymentTokenScreen/assets.ts
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,11 @@ | ||
import Asset from '@/types/Asset'; | ||
|
||
const ASSETS: Asset[] = [ | ||
{ name: 'USD Coin', symbol: 'USDC' }, | ||
{ name: 'Penumbra', symbol: 'UM' }, | ||
{ name: 'Cosmo', symbol: 'ATOM' }, | ||
{ name: 'Ethereum', symbol: 'ETH' }, | ||
{ name: 'Osmosis', symbol: 'OSMO' }, | ||
]; | ||
|
||
export default ASSETS; |
62 changes: 62 additions & 0 deletions
62
react-native-expo/components/ProfileScreen/DefaultPaymentTokenScreen/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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import AssetIcon from '@/components/AssetIcon'; | ||
import List from '@/components/List'; | ||
import ListItem from '@/components/ListItem'; | ||
import ListItemIconSuffix from '@/components/ListItemIconSuffix'; | ||
import TextInput from '@/components/TextInput'; | ||
import { setSearchText } from '@/store/defaultPaymentTokenScreen'; | ||
import { useAppDispatch, useAppSelector } from '@/store/hooks'; | ||
import { setDefaultPaymentToken } from '@/store/secureStore'; | ||
import { Trans, useLingui } from '@lingui/react/macro'; | ||
import { Sx, Text, View } from 'dripsy'; | ||
import { Check, Search } from 'lucide-react-native'; | ||
import useFilteredAssets from './useFilteredAssets'; | ||
import TextInputIconStartAdornment from '@/components/TextInputIconStartAdornment'; | ||
|
||
export default function DefaultPaymentTokenScreen() { | ||
const defaultPaymentToken = useAppSelector(state => state.secureStore.defaultPaymentToken); | ||
const dispatch = useAppDispatch(); | ||
const searchText = useAppSelector(state => state.defaultPaymentTokenScreen.searchText); | ||
const filteredAssets = useFilteredAssets(); | ||
const { t } = useLingui(); | ||
|
||
return ( | ||
<View sx={sx.root}> | ||
<Text variant='h4'> | ||
<Trans>Default payment token</Trans> | ||
</Text> | ||
|
||
<TextInput | ||
value={searchText} | ||
onChangeText={text => dispatch(setSearchText(text))} | ||
startAdornment={<TextInputIconStartAdornment IconComponent={Search} />} | ||
placeholder={t`Search tokens...`} | ||
clearButtonMode='always' | ||
/> | ||
|
||
<List> | ||
{filteredAssets.map(asset => ( | ||
<ListItem | ||
key={asset.symbol} | ||
avatar={<AssetIcon />} | ||
primaryText={asset.symbol} | ||
secondaryText={asset.name} | ||
onPress={() => dispatch(setDefaultPaymentToken(asset.symbol))} | ||
suffix={ | ||
asset.symbol === defaultPaymentToken ? ( | ||
<ListItemIconSuffix IconComponent={Check} /> | ||
) : undefined | ||
} | ||
/> | ||
))} | ||
</List> | ||
</View> | ||
); | ||
} | ||
|
||
const sx = { | ||
root: { | ||
px: 'screenHorizontalMargin', | ||
flexDirection: 'column', | ||
gap: '$4', | ||
}, | ||
} satisfies Record<string, Sx>; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://docs.expo.dev/versions/latest/sdk/securestore/#exempting-encryption-prompt
(I can't leave this comment in the file, since JSON doesn't support comments 😭 )