Skip to content

Commit

Permalink
chore: udpates
Browse files Browse the repository at this point in the history
  • Loading branch information
stackchain committed May 6, 2024
1 parent b540556 commit 9a95c6a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
25 changes: 16 additions & 9 deletions apps/wallet-mobile/src/NftDetails/NftDetailsImage.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import React from 'react'
import {Dimensions, StyleSheet, View} from 'react-native'
import {Dimensions, StyleSheet, useWindowDimensions, View} from 'react-native'

Check failure on line 2 in apps/wallet-mobile/src/NftDetails/NftDetailsImage.tsx

View workflow job for this annotation

GitHub Actions / check

'Dimensions' is defined but never used. Allowed unused vars must match /^_/u
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import ViewTransformer from 'react-native-easy-view-transformer'

import {FadeIn} from '../components'
import {NftPreview} from '../components/NftPreview'
import {MediaPreview} from '../features/Portfolio/common/MediaGallery/MediaPreview'
import {useSelectedWallet} from '../features/WalletManager/Context'
import {useMetrics} from '../metrics/metricsManager'
import {NftRoutes, useParams} from '../navigation'
import {isEmptyString} from '../utils/utils'
import {useNft} from '../yoroi-wallets/hooks'

type Params = NftRoutes['nft-details']

Expand All @@ -21,20 +20,28 @@ const isParams = (params?: Params | object | undefined): params is Params => {
export const NftDetailsImage = () => {
const {id} = useParams<Params>(isParams)
const wallet = useSelectedWallet()
const nft = useNft(wallet, {id})
const {track} = useMetrics()

// TODO: revisit (missing refresh mechanism)
// reading from the getter, there is no need to subscribe to changes
// until implementation of the new refresh mechanism in here
const amount = wallet.balances.records.get(id)

const dimensions = useWindowDimensions()

const {track} = useMetrics()
React.useEffect(() => {
if (!isEmptyString(nft?.id)) track.nftGalleryDetailsImageViewed()
}, [nft?.id, track])
track.nftGalleryDetailsImageViewed()
}, [track, id])

const dimensions = Dimensions.get('window')
// record can be gone when arriving here, need a state
// TODO: revisit + product definition (missing is gone state)
if (!amount) return null

return (
<FadeIn style={styles.container}>
<ViewTransformer maxScale={3} minScale={1}>
<View style={styles.contentContainer}>
<NftPreview nft={nft} width={dimensions.width} height={dimensions.height} zoom={1} contentFit="contain" />
<MediaPreview info={amount.info} width={dimensions.width} height={dimensions.height} contentFit="contain" />
</View>
</ViewTransformer>
</FadeIn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ export const TxHistoryList = (props: Props) => {
testID="txHistoryList"
onEndReached={handleOnEndReached}
onEndReachedThreshold={0.5}
estimatedItemSize={88}
estimatedItemSize={72}
/>
</View>
)
}

const batchSize = 20
const batchSize = 20

const getTransactionsByDate = (transactions: Record<string, TransactionInfo>) =>
_(transactions)
Expand Down

0 comments on commit 9a95c6a

Please sign in to comment.