Skip to content

Commit

Permalink
Merge branch 'develop' into notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljscript committed Oct 11, 2024
2 parents f38bdd3 + 7c93737 commit cf8627c
Show file tree
Hide file tree
Showing 46 changed files with 2,046 additions and 1,705 deletions.
3 changes: 1 addition & 2 deletions apps/wallet-mobile/.storybook/storybook.requires.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions apps/wallet-mobile/src/YoroiApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {AuthProvider} from './features/Auth/AuthProvider'
import {BrowserProvider} from './features/Discover/common/BrowserProvider'
import {notificationManager} from './features/Notifications/useCases/common/notification-manager'
import {PortfolioTokenActivityProvider} from './features/Portfolio/common/PortfolioTokenActivityProvider'
import {ReviewTxProvider} from './features/ReviewTx/common/ReviewTxProvider'
import {CurrencyProvider} from './features/Settings/Currency/CurrencyContext'
import {AutomaticWalletOpenerProvider} from './features/WalletManager/context/AutomaticWalletOpeningProvider'
import {WalletManagerProvider} from './features/WalletManager/context/WalletManagerProvider'
Expand Down Expand Up @@ -67,9 +68,11 @@ const Yoroi = () => {
<PoolTransitionProvider>
<BrowserProvider>
<AutomaticWalletOpenerProvider>
<NotificationProvider manager={notificationManager}>
<InitApp />
</NotificationProvider>
<ReviewTxProvider>
<NotificationProvider manager={notificationManager}>
<InitApp />
</NotificationProvider>
</ReviewTxProvider>
</AutomaticWalletOpenerProvider>
</BrowserProvider>
</PoolTransitionProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import React from 'react'
import {ImageStyle, StyleSheet, View} from 'react-native'
import SkeletonPlaceholder from 'react-native-skeleton-placeholder'

import placeholderLight from '../../../../assets/img/nft-placeholder.png'
import placeholderDark from '../../../../assets/img/nft-placeholder-dark.png'
import {useSelectedWallet} from '../../../WalletManager/common/hooks/useSelectedWallet'
import placeholderLight from '../../assets/img/nft-placeholder.png'
import placeholderDark from '../../assets/img/nft-placeholder-dark.png'
import {useSelectedWallet} from '../../features/WalletManager/common/hooks/useSelectedWallet'

type MediaPreviewProps = {
info: Portfolio.Token.Info
Expand Down
26 changes: 26 additions & 0 deletions apps/wallet-mobile/src/components/SimpleTab/SimpleTab.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {action} from '@storybook/addon-actions'
import {storiesOf} from '@storybook/react-native'
import * as React from 'react'
import {View} from 'react-native'

import {SimpleTab} from './SimpleTab'

storiesOf('SimpleTab', module)
.add('Active', () => <Active />)
.add('Inactive', () => <Inactive />)

const Active = () => {
return (
<View style={{flexDirection: 'row'}}>
<SimpleTab name="Active" isActive={true} onPress={action('onPress')} />
</View>
)
}

const Inactive = () => {
return (
<View style={{flexDirection: 'row'}}>
<SimpleTab name="Inactive" isActive={false} onPress={action('onPress')} />
</View>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type Props = {
onPress: () => void
}

export const DAppExplorerTabItem = ({name, onPress, isActive}: Props) => {
export const SimpleTab = ({name, onPress, isActive}: Props) => {
const {styles} = useStyles()
return (
<TouchableOpacity onPress={onPress} style={[styles.container, isActive && styles.containerActive]}>
Expand All @@ -34,5 +34,5 @@ const useStyles = () => {
},
})

return {styles}
return {styles} as const
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {useTheme} from '@yoroi/theme'
import * as React from 'react'
import {FlatList, StyleSheet, View} from 'react-native'

import {SimpleTab} from '../../../../components/SimpleTab/SimpleTab'
import {Spacer} from '../../../../components/Spacer/Spacer'
import {useMetrics} from '../../../../kernel/metrics/metricsManager'
import {useSearch, useSearchOnNavBar} from '../../../Search/SearchContext'
Expand All @@ -13,7 +14,6 @@ import {useDAppsConnected} from '../../common/useDAppsConnected'
import {useStrings} from '../../common/useStrings'
import {CountDAppsAvailable} from './CountDAppsAvailable/CountDAppsAvailable'
import {CountDAppsConnected} from './CountDAppsConnected/CountDAppsConnected'
import {DAppExplorerTabItem} from './DAppExplorerTabItem/DAppExplorerTabItem'
import {DAppListItem} from './DAppListItem/DAppListItem'
import {DAppTypes} from './DAppTypes/DAppTypes'
import {WelcomeDAppModal} from './WelcomeDAppModal'
Expand Down Expand Up @@ -153,13 +153,13 @@ const HeaderControl = ({
<>
{hasConnectedDapps && (
<View style={styles.tabsContainer}>
<DAppExplorerTabItem
<SimpleTab
name={strings.connected}
isActive={currentTab === DAppTabs.connected}
onPress={() => onTabChange(DAppTabs.connected)}
/>

<DAppExplorerTabItem
<SimpleTab
name={strings.recommended}
isActive={currentTab === DAppTabs.recommended}
onPress={() => onTabChange(DAppTabs.recommended)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {Boundary} from '../../../../components/Boundary/Boundary'
import {CopyButton} from '../../../../components/CopyButton'
import {FadeIn} from '../../../../components/FadeIn'
import {Hr} from '../../../../components/Hr/Hr'
import {MediaPreview} from '../../../../components/MediaPreview/MediaPreview'
import {Spacer} from '../../../../components/Spacer/Spacer'
import {Tab, TabPanel, TabPanels, Tabs} from '../../../../components/Tabs/Tabs'
import {Text} from '../../../../components/Text'
Expand All @@ -28,7 +29,6 @@ import {useMetrics} from '../../../../kernel/metrics/metricsManager'
import {NftRoutes} from '../../../../kernel/navigation'
import {useSelectedWallet} from '../../../WalletManager/common/hooks/useSelectedWallet'
import {usePortfolioImageInvalidate} from '../hooks/usePortfolioImage'
import {MediaPreview} from '../MediaPreview/MediaPreview'
import {useNavigateTo} from '../navigation'

export const MediaDetailsScreen = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {Balance, Portfolio} from '@yoroi/types'
import * as React from 'react'
import {StyleSheet, Text, TouchableOpacity, useWindowDimensions, View} from 'react-native'

import {MediaPreview} from '../../../../components/MediaPreview/MediaPreview'
import {Spacer} from '../../../../components/Spacer/Spacer'
import {MediaPreview} from '../MediaPreview/MediaPreview'

type Props = {
amounts: ReadonlyArray<Portfolio.Token.Amount>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import {FlatList, Image, StyleSheet, Text, TouchableOpacity, useWindowDimensions
import placeholderLight from '../../../../../assets/img/nft-placeholder.png'
import placeholderDark from '../../../../../assets/img/nft-placeholder-dark.png'
import {Icon} from '../../../../../components/Icon'
import {MediaPreview} from '../../../../../components/MediaPreview/MediaPreview'
import {Spacer} from '../../../../../components/Spacer/Spacer'
import {useSelectedWallet} from '../../../../WalletManager/common/hooks/useSelectedWallet'
import {useNavigateTo} from '../../../common/hooks/useNavigateTo'
import {usePortfolioBalances} from '../../../common/hooks/usePortfolioBalances'
import {useStrings} from '../../../common/hooks/useStrings'
import {MediaPreview} from '../../../common/MediaPreview/MediaPreview'

export const DashboardNFTsList = () => {
const {styles, cardItemWidth} = useStyles()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import {StyleSheet, useWindowDimensions, View} from 'react-native'
import ViewTransformer from 'react-native-easy-view-transformer'

import {FadeIn} from '../../../../../../components/FadeIn'
import {MediaPreview} from '../../../../../../components/MediaPreview/MediaPreview'
import {useMetrics} from '../../../../../../kernel/metrics/metricsManager'
import {NftRoutes, useParams} from '../../../../../../kernel/navigation'
import {isEmptyString} from '../../../../../../kernel/utils'
import {useSelectedWallet} from '../../../../../WalletManager/common/hooks/useSelectedWallet'
import {MediaPreview} from '../../../../common/MediaPreview/MediaPreview'

type Params = NftRoutes['nft-details']

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {Animated, LayoutAnimation, StyleSheet, Text, TouchableOpacity, View} fro

import {Icon} from '../../../components/Icon'

export const CollapsibleSection = ({label, children}: {label: string; children: React.ReactNode}) => {
export const Accordion = ({label, children}: {label: string; children: React.ReactNode}) => {
const {styles, colors} = useStyles()
const [isOpen, setIsOpen] = React.useState(false)
const animatedHeight = React.useRef(new Animated.Value(0)).current
Expand All @@ -20,14 +20,12 @@ export const CollapsibleSection = ({label, children}: {label: string; children:
}

return (
<>
<View style={styles.sectionHeader}>
<View>
<TouchableOpacity activeOpacity={0.5} onPress={toggleSection} style={styles.sectionHeader}>
<Text style={styles.sectionHeaderText}>{label}</Text>

<TouchableOpacity activeOpacity={0.5} onPress={toggleSection}>
<Icon.Chevron direction={isOpen ? 'up' : 'down'} size={28} color={colors.chevron} />
</TouchableOpacity>
</View>
<Icon.Chevron direction={isOpen ? 'up' : 'down'} size={28} color={colors.chevron} />
</TouchableOpacity>

<Animated.View
style={[
Expand All @@ -43,7 +41,7 @@ export const CollapsibleSection = ({label, children}: {label: string; children:
>
{children}
</Animated.View>
</>
</View>
)
}

Expand Down
73 changes: 0 additions & 73 deletions apps/wallet-mobile/src/features/ReviewTx/common/Address.tsx

This file was deleted.

37 changes: 37 additions & 0 deletions apps/wallet-mobile/src/features/ReviewTx/common/CopiableText.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {useTheme} from '@yoroi/theme'
import * as React from 'react'
import {StyleSheet, TouchableOpacity, View} from 'react-native'

import {Icon} from '../../../components/Icon'
import {useCopy} from '../../../hooks/useCopy'

export const CopiableText = ({children, textToCopy}: {children: React.ReactNode; textToCopy: string}) => {
const {styles, colors} = useStyles()
const [, copy] = useCopy()

return (
<View style={styles.text}>
{children}

<TouchableOpacity onPress={() => copy(textToCopy)} activeOpacity={0.5}>
<Icon.Copy size={24} color={colors.copy} />
</TouchableOpacity>
</View>
)
}

const useStyles = () => {
const {atoms, color} = useTheme()
const styles = StyleSheet.create({
text: {
...atoms.flex_row,
...atoms.justify_between,
},
})

const colors = {
copy: color.gray_900,
}

return {styles, colors} as const
}
Loading

0 comments on commit cf8627c

Please sign in to comment.