Conversation
src/components/Main.tsx
Outdated
| component={WalletDetails} | ||
| options={{ | ||
| headerTitle: () => <ParamHeaderTitle<'walletDetails'> fromParams={params => params.walletName} /> | ||
| headerTitle: () => <ParamHeaderTitle<'walletDetails'> fromParams={params => params.sceneTitle} /> |
There was a problem hiding this comment.
Delete the sceneTitle param, and put the string formatting in fromParams:
const account = useSelector(state => state.core.account)
const wallet = account.currencyWallets[walletId]
return sprintf(lstrings.create_wallet_account_metadata_name, wallet?.currencyInfo.displayName)Or, better yet, export a WalletDetailsTitle component from WalletDetailsScene.tsx:
export const WalletDetailsTitle = () => {
const route = useRoute<RouteProp<'walletDetails'>>()
const account = useSelector(state => state.core.account)
const wallet = account.currencyWallets[walletId]
const title = sprintf(lstrings.create_wallet_account_metadata_name, wallet?.currencyInfo.displayName)
return <HeaderTitle title={title} />
}Then in Main.tsx, it can just be:
options={{ headerTitle: WalletDetailsTitle })Oh, one more thing: The lstrings.create_wallet_account_metadata_name should be called lstrings.network_title_1s or something like that.
There was a problem hiding this comment.
Regarding the string name, yes, it should be that, but this is an old string. Since it's old and has translations already, we can't change the key or we reset the translations.
There was a problem hiding this comment.
Ok, that makes sense. We really need to figure out how to rename strings in Crowdin.
031ac22 to
665da8e
Compare
| export interface WalletDetailsParams { | ||
| walletId: string | ||
| sceneTitle: string | ||
| walletName: string |
There was a problem hiding this comment.
So waletName isn't actually used anywhere. Please delete it, so the params are literally just walletId and tokenId...
It turns out that the countryCode route prop isn't really used either. Or, more specifically, there is only one place that actually provides it to WalletListScene, and that just does:
const { countryCode } = await getFirstOpenInfo()
navigation.navigate('walletDetails', { walletId, tokenId, countryCode })The WalletDetailsScene doesn't use countryCode either. The only thing it does is pass countryCode to InfoCardCarousel and BuyCrypto, both of which will be buggy (showing wrong cards or wrong strings) if countryCode is undefined.
This means we should just refactor InfoCardCarousel and BuyCrypto to get their own country code:
const [ firstOpenInfo ] = useAsyncValue(async () => await getFirstOpenInfo())
const { countryCode } = firstOpenInfo ?? {}And then we can delete it the WalletDetailsScene courntryCode param.
There was a problem hiding this comment.
I vaguely remember there was some reason we passed countryCode around instead of calling for it in the component but maybe it's no longer relevant...
| export const TransactionListTitle = () => { | ||
| const route = useRoute<RouteProp<'walletDetails'>>() | ||
| const account = useSelector(state => state.core.account) | ||
| const wallet = account.currencyWallets[route.params.walletId] | ||
| const title = wallet == null ? '' : getWalletName(wallet) | ||
| return <HeaderTitle title={title} /> | ||
| } | ||
|
|
There was a problem hiding this comment.
Thanks. But now that this is here, the walletName and countryCode route props are unused. For the the TransactionListScene, the route props should just be walletId, tokenId, and searchText.
665da8e to
5cf0c8c
Compare
For the TransactionList, keep the same title so the user knows which wallet the transactions are for.
7356a87 to
d4bfd7a
Compare
It was possible that multiple callers could trigger multiple disk reads if `getFirstOpenInfo` got called concurrently before the initial disk read completes.
d4bfd7a to
fb946f9
Compare
For the TransactionList, keep the same title so the user knows which wallet the transactions are for.
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
noneRequirements
If you have made any visual changes to the GUI. Make sure you have: