Skip to content

Commit

Permalink
fixup! Split TransactionListScene
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon-edge committed Jan 28, 2025
1 parent ecb3d20 commit 442c7ff
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/actions/WalletListMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export type WalletListMenuKey =
| string // for split keys like splitbitcoincash, splitethereum, etc.

export function walletListMenuAction(
navigation: WalletsTabSceneProps<'walletList' | 'transactionList'>['navigation'],
navigation: WalletsTabSceneProps<'walletList' | 'walletDetails'>['navigation'],
walletId: string,
option: WalletListMenuKey,
tokenId: EdgeTokenId,
Expand Down Expand Up @@ -292,7 +292,7 @@ export function walletListMenuAction(
const { currencyWallets } = account
const wallet = currencyWallets[walletId]

navigation.navigate('transactionList', {
navigation.navigate('walletDetails', {
walletId,
tokenId: null,
walletName: getWalletName(wallet)
Expand Down
18 changes: 9 additions & 9 deletions src/components/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ import { SweepPrivateKeyCompletionScene as SweepPrivateKeyCompletionSceneCompone
import { SweepPrivateKeyProcessingScene as SweepPrivateKeyProcessingSceneComponent } from './scenes/SweepPrivateKeyProcessingScene'
import { SweepPrivateKeySelectCryptoScene as SweepPrivateKeySelectCryptoSceneComponent } from './scenes/SweepPrivateKeySelectCryptoScene'
import { TransactionDetailsScene as TransactionDetailsSceneComponent } from './scenes/TransactionDetailsScene'
import { TransactionList as TransactionListComponent } from './scenes/TransactionListScene'
import { TransactionList2 as TransactionList2Component } from './scenes/TransactionListScene2'
import { TransactionList as TransactionListComponent } from './scenes/TransactionListScene2'
import { TransactionsExportScene as TransactionsExportSceneComponent } from './scenes/TransactionsExportScene'
import { UpgradeUsernameScene as UpgradeUsernameSceneComponent } from './scenes/UpgradeUsernameScreen'
import { WalletDetails as WalletDetailsComponent } from './scenes/WalletDetailsScene'
import { WalletListScene as WalletListSceneComponent } from './scenes/WalletListScene'
import { WalletRestoreScene as WalletRestoreSceneComponent } from './scenes/WalletRestoreScene'
import { WcConnectionsScene as WcConnectionsSceneComponent } from './scenes/WcConnectionsScene'
Expand Down Expand Up @@ -219,7 +219,7 @@ const SwapSettingsScene = ifLoggedIn(SwapSettingsSceneComponent)
const SwapSuccessScene = ifLoggedIn(SwapSuccessSceneComponent)
const TransactionDetailsScene = ifLoggedIn(TransactionDetailsSceneComponent)
const TransactionList = ifLoggedIn(TransactionListComponent)
const TransactionList2 = ifLoggedIn(TransactionList2Component)
const WalletDetails = ifLoggedIn(WalletDetailsComponent)
const TransactionsExportScene = ifLoggedIn(TransactionsExportSceneComponent)
const WalletListScene = ifLoggedIn(WalletListSceneComponent)
const WalletRestoreScene = ifLoggedIn(WalletRestoreSceneComponent)
Expand Down Expand Up @@ -279,10 +279,10 @@ const EdgeWalletsTabScreen = () => {
}}
/>
<WalletsStack.Screen
name="transactionList2"
component={TransactionList2}
name="walletDetails"
component={WalletDetails}
options={{
headerTitle: () => <ParamHeaderTitle<'transactionList2'> fromParams={params => params.walletName} />
headerTitle: () => <ParamHeaderTitle<'walletDetails'> fromParams={params => params.walletName} />
}}
/>
</WalletsStack.Navigator>
Expand Down Expand Up @@ -791,10 +791,10 @@ const EdgeAppStack = () => {
}}
/>
<WalletsStack.Screen
name="transactionList2"
component={TransactionList2}
name="transactionList"
component={TransactionList}
options={{
headerTitle: () => <ParamHeaderTitle<'transactionList2'> fromParams={params => params.walletName} />
headerTitle: () => <ParamHeaderTitle<'transactionList'> fromParams={params => params.walletName} />
}}
/>
<AppStack.Screen
Expand Down
2 changes: 1 addition & 1 deletion src/components/cards/VisaCardCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const ioniaPluginIds = Object.keys(SPECIAL_CURRENCY_INFO).filter(pluginId
interface Props {
wallet: EdgeCurrencyWallet
tokenId: EdgeTokenId
navigation: WalletsTabSceneProps<'transactionList'>['navigation']
navigation: WalletsTabSceneProps<'walletDetails'>['navigation']
}

export const VisaCardCard = (props: Props) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/WalletListMenuModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface Option {

interface Props {
bridge: AirshipBridge<void>
navigation: WalletsTabSceneProps<'walletList' | 'transactionList'>['navigation']
navigation: WalletsTabSceneProps<'walletList' | 'walletDetails'>['navigation']

// Wallet identity:
tokenId: EdgeTokenId
Expand Down
8 changes: 4 additions & 4 deletions src/components/scenes/TransactionListScene2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ import { SearchFooter } from '../themed/SearchFooter'
import { EmptyLoader, SectionHeader, SectionHeaderCentered } from '../themed/TransactionListComponents'
import { TransactionListRow } from '../themed/TransactionListRow'

export interface TransactionList2Params {
export interface TransactionListParams {
walletId: string
walletName: string
tokenId: EdgeTokenId
countryCode?: string
}

type ListItem = EdgeTransaction | string | null
interface Props extends WalletsTabSceneProps<'transactionList2'> {
interface Props extends WalletsTabSceneProps<'transactionList'> {
wallet: EdgeCurrencyWallet
}

function TransactionList2Component(props: Props) {
function TransactionListComponent(props: Props) {
const { navigation, route, wallet } = props
const theme = useTheme()
const styles = getStyles(theme)
Expand Down Expand Up @@ -257,7 +257,7 @@ function checkToken(tokenId: EdgeTokenId, allTokens: EdgeTokenMap): EdgeTokenId
return tokenId
}

export const TransactionList2 = withWallet(TransactionList2Component)
export const TransactionList = withWallet(TransactionListComponent)

const getStyles = cacheStyles(() => ({
flatList: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ import { EmptyLoader, SectionHeaderCentered } from '../themed/TransactionListCom
import { TransactionListRow } from '../themed/TransactionListRow'
import { TransactionListTop } from '../themed/TransactionListTop'

export interface TransactionListParams {
export interface WalletDetailsParams {
walletId: string
walletName: string
tokenId: EdgeTokenId
countryCode?: string
}

type ListItem = EdgeTransaction | string | null
interface Props extends WalletsTabSceneProps<'transactionList'> {
interface Props extends WalletsTabSceneProps<'walletDetails'> {
wallet: EdgeCurrencyWallet
}

function TransactionListComponent(props: Props) {
function WalletDetailsComponent(props: Props) {
const { navigation, route, wallet } = props
const theme = useTheme()
const styles = getStyles(theme)
Expand All @@ -61,8 +61,7 @@ function TransactionListComponent(props: Props) {

const tokenId = checkToken(route.params.tokenId, wallet.currencyConfig.allTokens)
const { pluginId } = wallet.currencyInfo
const { currencyCode } = tokenId == null ? wallet.currencyInfo : wallet.currencyConfig.allTokens[tokenId]
const { displayName } = tokenId == null ? wallet.currencyInfo : wallet.currencyConfig.allTokens[tokenId]
const { currencyCode, displayName } = tokenId == null ? wallet.currencyInfo : wallet.currencyConfig.allTokens[tokenId]

// State:
const flashListRef = React.useRef<Animated.FlatList<ListItem> | null>(null)
Expand Down Expand Up @@ -173,7 +172,7 @@ function TransactionListComponent(props: Props) {
})

const handlePressSeeAll = useHandler(() => {
navigation.navigate('transactionList2', route.params)
navigation.navigate('transactionList', route.params)
})

//
Expand Down Expand Up @@ -223,7 +222,7 @@ function TransactionListComponent(props: Props) {
<Paragraph>
<EdgeText>{fiatRateFormat}</EdgeText>
</Paragraph>
<SwipeChart cardAdjust assetId={assetId} currencyCode={currencyCode} fiatCurrencyCode={fiatCurrencyCode} />
<SwipeChart marginRem={[0, -1]} assetId={assetId} currencyCode={currencyCode} fiatCurrencyCode={fiatCurrencyCode} />
</EdgeCard>
)}
<SectionHeaderUi4
Expand Down Expand Up @@ -370,7 +369,7 @@ function checkToken(tokenId: EdgeTokenId, allTokens: EdgeTokenMap): EdgeTokenId
return tokenId
}

export const TransactionList = withWallet(TransactionListComponent)
export const WalletDetails = withWallet(WalletDetailsComponent)

const getStyles = cacheStyles(() => ({
flatList: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/themed/TransactionListTop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const SWAP_ASSET_PRIORITY: Array<{ pluginId: string; tokenId: EdgeTokenId }> = [
]

interface OwnProps {
navigation: WalletsTabSceneProps<'transactionList'>['navigation']
navigation: WalletsTabSceneProps<'walletDetails'>['navigation']

isLightAccount: boolean

Expand Down
2 changes: 1 addition & 1 deletion src/components/themed/WalletListSwipeable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function WalletListSwipeableComponent(props: Props) {
.then(
activationNotRequired =>
activationNotRequired &&
navigation.navigate('transactionList', {
navigation.navigate('walletDetails', {
walletId,
tokenId,
walletName: wallet.name ?? wallet.currencyInfo.displayName,
Expand Down
2 changes: 1 addition & 1 deletion src/components/themed/WalletListSwipeableCurrencyRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function WalletListSwipeableCurrencyRowComponent(props: Props) {
.then(async activated => {
const { countryCode } = await getFirstOpenInfo()
if (activated) {
navigation.navigate('transactionList', {
navigation.navigate('walletDetails', {
tokenId,
walletId: wallet.id,
walletName: wallet.name ?? wallet.currencyInfo.displayName,
Expand Down
8 changes: 4 additions & 4 deletions src/types/routerTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ import type { SweepPrivateKeyCompletionParams } from '../components/scenes/Sweep
import type { SweepPrivateKeyProcessingParams } from '../components/scenes/SweepPrivateKeyProcessingScene'
import type { SweepPrivateKeySelectCryptoParams } from '../components/scenes/SweepPrivateKeySelectCryptoScene'
import type { TransactionDetailsParams } from '../components/scenes/TransactionDetailsScene'
import type { TransactionListParams } from '../components/scenes/TransactionListScene'
import type { TransactionList2Params } from '../components/scenes/TransactionListScene2'
import type { TransactionListParams } from '../components/scenes/TransactionListScene2'
import type { TransactionsExportParams } from '../components/scenes/TransactionsExportScene'
import type { WalletDetailsParams } from '../components/scenes/WalletDetailsScene'
import type { WcConnectionsParams } from '../components/scenes/WcConnectionsScene'
import type { WcConnectParams } from '../components/scenes/WcConnectScene'
import type { WcDisconnectParams } from '../components/scenes/WcDisconnectScene'
Expand All @@ -88,8 +88,8 @@ import type { FiatPluginSepaFormParams } from '../plugins/gui/scenes/SepaFormSce

export type WalletsTabParamList = {} & {
walletList: undefined
walletDetails: WalletDetailsParams
transactionList: TransactionListParams
transactionList2: TransactionList2Params
transactionDetails: TransactionDetailsParams
}

Expand Down Expand Up @@ -206,7 +206,7 @@ export type EdgeAppStackParamList = {} & {
sweepPrivateKeySelectCrypto: SweepPrivateKeySelectCryptoParams
testScene: undefined
transactionDetails: TransactionDetailsParams
transactionList2: TransactionList2Params
transactionList2: TransactionListParams
transactionsExport: TransactionsExportParams
upgradeUsername: undefined
walletRestore: undefined
Expand Down

0 comments on commit 442c7ff

Please sign in to comment.