Skip to content

Commit 9c9072c

Browse files
feat: Create Tx history page (#14)
* feat: create tx-history list components * feat: use the new cards components in the TxHistory list * fix: remove todo * feat: add missing variants to tx history page * feat: add missing multiSendCall information in the txList * feat: create static transactions messages layout * fix: android crash * feat: add detox test for transactions * fix: add the right name in the bulk transactions section * fix: scroll margin in the txHistory component * fix: story book of the TxCards components * fix: unit tests * fix: detox tests * fix: remove unnecessary comment * fix: remove swap order comment * fix: tx history in light mode * fix: use snapshot tests instead of inline object comparison * fix: remove TODO comments * chore: rename tx cards --------- Co-authored-by: Daniel Dimitrov <[email protected]>
1 parent 4a9ab2d commit 9c9072c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1380
-147
lines changed

app/(tabs)/_layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ export default function TabLayout() {
1818
tabBarIcon: ({ color }) => <TabBarIcon name={'wallet'} color={color} />,
1919
}}
2020
/>
21+
2122
<Tabs.Screen
2223
name="transactions"
2324
options={{
2425
title: 'Transactions',
26+
tabBarTestID: 'transactions',
2527
tabBarIcon: ({ color }) => <TabBarIcon name={'transactions'} color={color} />,
2628
}}
2729
/>

app/(tabs)/index.tsx

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
1-
import { StyleSheet } from 'react-native'
2-
3-
import TxHistory from '@/src/features/TxHistory'
1+
import Ionicons from '@expo/vector-icons/Ionicons'
2+
import { StyleSheet, View } from 'react-native'
43

4+
import ParallaxScrollView from '@/src/components/ParallaxScrollView'
55
import { Text } from 'tamagui'
6-
import { SafeAreaView } from 'react-native-safe-area-context'
76

87
export default function HomeScreen() {
98
return (
10-
<SafeAreaView style={styles.content}>
11-
<Text testID="welcome-title" paddingHorizontal={20}>
12-
Transactions History
13-
</Text>
14-
15-
<TxHistory />
16-
</SafeAreaView>
9+
<ParallaxScrollView
10+
headerBackgroundColor={{ light: '#D0D0D0', dark: '#353636' }}
11+
headerImage={<Ionicons size={310} name="code-slash" style={styles.headerImage} />}
12+
>
13+
<View style={styles.titleContainer}>
14+
<Text testID="explore-title">HomeScreen</Text>
15+
</View>
16+
</ParallaxScrollView>
1717
)
1818
}
1919

2020
const styles = StyleSheet.create({
21-
content: {
22-
flex: 1,
23-
flexDirection: 'column',
24-
width: '100%',
25-
rowGap: 20,
21+
headerImage: {
22+
color: '#808080',
23+
bottom: -90,
24+
left: -35,
25+
position: 'absolute',
26+
},
27+
titleContainer: {
28+
flexDirection: 'row',
29+
gap: 8,
2630
},
2731
})

app/(tabs)/transactions.tsx

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { Tabs } from 'expo-router'
2+
import React from 'react'
3+
import { StyleSheet } from 'react-native'
4+
import { SafeAreaView } from 'react-native-safe-area-context'
5+
import Title from '@/src/components/Title'
6+
import InlineTab from '@/src/components/InlineTab'
7+
import { View } from 'tamagui'
8+
9+
const TransactiosHeader = () => (
10+
<View paddingHorizontal="$3">
11+
<Title paddingTop={'$10'} marginBottom="$8" testID="welcome-title">
12+
Transactions
13+
</Title>
14+
15+
<InlineTab
16+
items={[
17+
{
18+
path: '/transactions',
19+
label: 'History',
20+
},
21+
{
22+
path: '/transactions/messages',
23+
label: 'Messages',
24+
},
25+
]}
26+
/>
27+
</View>
28+
)
29+
30+
export default function TransactionsLayout() {
31+
return (
32+
<SafeAreaView style={styles.content}>
33+
<TransactiosHeader />
34+
35+
<Tabs
36+
screenOptions={{
37+
headerShown: false,
38+
tabBarShowLabel: false,
39+
tabBarStyle: { display: 'none' },
40+
}}
41+
>
42+
<Tabs.Screen name="index" />
43+
<Tabs.Screen name="messages" />
44+
</Tabs>
45+
</SafeAreaView>
46+
)
47+
}
48+
49+
export const styles = StyleSheet.create({
50+
content: {
51+
flex: 1,
52+
flexDirection: 'column',
53+
width: '100%',
54+
rowGap: 10,
55+
},
56+
})

app/(tabs)/transactions/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import TxHistory from '@/src/features/TxHistory'
2+
3+
export default function TransactionsScreen() {
4+
return <TxHistory />
5+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { SafeFontIcon } from '@/src/components/SafeFontIcon/SafeFontIcon'
2+
import SafeListItem from '@/src/components/SafeListItem'
3+
import { formatWithSchema } from '@/src/utils/date'
4+
import React from 'react'
5+
import { Text, View } from 'tamagui'
6+
7+
function Messages() {
8+
return (
9+
<View paddingHorizontal="$3">
10+
<SafeListItem.Header title={formatWithSchema(Date.now(), 'MMM d, yyyy')} />
11+
<SafeListItem
12+
label={'Hello Web3Modal Eth'}
13+
leftNode={
14+
<View backgroundColor="$borderLightDark" padding="$2" borderRadius={100}>
15+
<SafeFontIcon name="sign" color="$primaryLight" />
16+
</View>
17+
}
18+
rightNode={
19+
<View backgroundColor="#1D3D28" paddingHorizontal={'$3'} paddingVertical={'$1'} borderRadius={25}>
20+
<Text color={'$primary'}>Success</Text>
21+
</View>
22+
}
23+
/>
24+
</View>
25+
)
26+
}
27+
28+
export default Messages

app/+not-found.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const styles = StyleSheet.create({
2222
flex: 1,
2323
alignItems: 'center',
2424
justifyContent: 'center',
25-
padding: 20,
2625
},
2726
link: {
2827
marginTop: 15,

e2e/starter.test.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
describe('Example', () => {
1+
describe('Welcome', () => {
22
beforeAll(async () => {
3-
await device.launchApp();
4-
});
3+
await device.launchApp()
4+
})
55

66
beforeEach(async () => {
7-
await device.reloadReactNative();
8-
});
7+
await device.reloadReactNative()
8+
})
99

1010
it('should have welcome screen', async () => {
11-
await expect(element(by.id('welcome-title'))).toBeVisible();
12-
});
11+
await expect(element(by.id('welcome-title'))).toBeVisible()
12+
})
1313

1414
it('should show hello screen after tap', async () => {
15-
await element(by.text('Explore')).tap();
16-
await expect(element(by.id('explore-title'))).toBeVisible();
17-
});
18-
});
15+
await element(by.text('Explore')).tap()
16+
await expect(element(by.id('explore-title'))).toBeVisible()
17+
})
18+
})

e2e/transactions.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
describe('Transactions', () => {
2+
beforeAll(async () => {
3+
await device.launchApp()
4+
})
5+
6+
beforeEach(async () => {
7+
await device.reloadReactNative()
8+
})
9+
10+
it('should navigate to transactions and be able to scroll', async () => {
11+
await element(by.id('transactions')).tap()
12+
await expect(element(by.text('History'))).toBeVisible()
13+
await element(by.id('tx-history-list')).scroll(500, 'down')
14+
await element(by.id('tx-history-list')).scroll(500, 'up')
15+
})
16+
})
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Container applies the correct styles 1`] = `
4+
{
5+
"borderBottomLeftRadius": 7,
6+
"borderBottomRightRadius": 7,
7+
"borderTopLeftRadius": 7,
8+
"borderTopRightRadius": 7,
9+
"flexDirection": "column",
10+
"paddingBottom": 16,
11+
"paddingLeft": 16,
12+
"paddingRight": 16,
13+
"paddingTop": 16,
14+
}
15+
`;

0 commit comments

Comments
 (0)