Skip to content

Commit 1cfe4c8

Browse files
authored
Style transaction rows (#135)
1 parent 38f790e commit 1cfe4c8

File tree

7 files changed

+334
-76
lines changed

7 files changed

+334
-76
lines changed

packages/mobile-app/app/(drawer)/account/index.tsx

Lines changed: 5 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
Modal,
1414
} from "@ui-kitten/components";
1515
import { StyleSheet, View } from "react-native";
16-
import { Image } from "expo-image";
1716
import { setStringAsync } from "expo-clipboard";
1817
import Animated, {
1918
useAnimatedScrollHandler,
@@ -27,6 +26,8 @@ import { router, Stack } from "expo-router";
2726
import { SafeAreaView } from "react-native-safe-area-context";
2827
import { CurrencyUtils } from "@ironfish/sdk";
2928
import { CONFIRMATIONS } from "@/data/constants";
29+
import { AssetRow } from "@/components/account/AssetRow";
30+
import { TransactionRow } from "@/components/account/TransactionRow";
3031

3132
const ReceiveIcon = (props: IconProps) => (
3233
<Icon {...props} name="download-outline" />
@@ -309,26 +310,10 @@ export default function Balances() {
309310
{selectedIndex === 1 && (
310311
<>
311312
{getTransactionsResult.data?.map((transaction) => (
312-
<Card
313+
<TransactionRow
313314
key={transaction.hash}
314-
style={styles.transactionCard}
315-
onPress={() =>
316-
router.push(
317-
`/(drawer)/account/transaction/${transaction.hash}`,
318-
)
319-
}
320-
>
321-
<Text category="s1">{transaction.type.toString()}</Text>
322-
<Text category="p2" appearance="hint">
323-
Block: {transaction.block?.sequence ?? "Pending"}
324-
</Text>
325-
<Text category="p2" appearance="hint">
326-
{new Date(transaction.timestamp).toLocaleString()}
327-
</Text>
328-
<Text category="p2" appearance="hint">
329-
Status: {transaction.status.toString()}
330-
</Text>
331-
</Card>
315+
transaction={transaction}
316+
/>
332317
))}
333318
</>
334319
)}
@@ -342,36 +327,6 @@ export default function Balances() {
342327
);
343328
}
344329

345-
function AssetRow({
346-
name,
347-
amount,
348-
verified,
349-
image,
350-
}: {
351-
name: string;
352-
amount: string;
353-
verified: boolean;
354-
image?: string;
355-
}) {
356-
return (
357-
<Card style={styles.assetCard}>
358-
<Layout style={styles.assetCardContent}>
359-
<Layout style={styles.assetBadge}>
360-
<Image source={image} style={styles.assetBadge} />
361-
</Layout>
362-
<Layout style={styles.assetInfo}>
363-
<Text category="s1">
364-
{name} {verified ? "(Verified)" : ""}
365-
</Text>
366-
<Text category="p2" appearance="hint">
367-
{amount}
368-
</Text>
369-
</Layout>
370-
</Layout>
371-
</Card>
372-
);
373-
}
374-
375330
const styles = StyleSheet.create({
376331
container: {
377332
flex: 1,
@@ -412,29 +367,6 @@ const styles = StyleSheet.create({
412367
actionButton: {
413368
flexDirection: "column",
414369
},
415-
assetBadge: {
416-
width: 40,
417-
height: 40,
418-
borderRadius: 20,
419-
backgroundColor: "#E1E1E1",
420-
elevation: 4,
421-
shadowColor: "#000",
422-
shadowOffset: { width: 0, height: 2 },
423-
shadowOpacity: 0.25,
424-
shadowRadius: 4,
425-
},
426-
assetCard: {
427-
marginVertical: 4,
428-
},
429-
assetCardContent: {
430-
flexDirection: "row",
431-
alignItems: "center",
432-
gap: 12,
433-
},
434-
assetInfo: {
435-
gap: 4,
436-
flex: 1,
437-
},
438370
syncCard: {
439371
margin: 16,
440372
marginTop: 0,
@@ -450,9 +382,6 @@ const styles = StyleSheet.create({
450382
flexDirection: "row",
451383
justifyContent: "space-between",
452384
},
453-
transactionCard: {
454-
marginVertical: 4,
455-
},
456385
backdrop: {
457386
backgroundColor: "rgba(0, 0, 0, 0.5)",
458387
},
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import { Layout, Text, Card } from "@ui-kitten/components";
2+
import { Image } from "expo-image";
3+
import { StyleSheet } from "react-native";
4+
5+
export function AssetRow({
6+
name,
7+
amount,
8+
verified,
9+
image,
10+
}: {
11+
name: string;
12+
amount: string;
13+
verified: boolean;
14+
image?: string;
15+
}) {
16+
return (
17+
<Card style={styles.assetCard}>
18+
<Layout style={styles.assetCardContent}>
19+
<Layout style={styles.assetBadge}>
20+
<Image source={image} style={styles.assetBadge} />
21+
</Layout>
22+
<Layout style={styles.assetInfo}>
23+
<Text category="s1">
24+
{name} {verified ? "(Verified)" : ""}
25+
</Text>
26+
<Text category="p2" appearance="hint">
27+
{amount}
28+
</Text>
29+
</Layout>
30+
</Layout>
31+
</Card>
32+
);
33+
}
34+
35+
const styles = StyleSheet.create({
36+
assetBadge: {
37+
width: 40,
38+
height: 40,
39+
borderRadius: 20,
40+
backgroundColor: "#E1E1E1",
41+
elevation: 4,
42+
shadowColor: "#000",
43+
shadowOffset: { width: 0, height: 2 },
44+
shadowOpacity: 0.25,
45+
shadowRadius: 4,
46+
},
47+
assetCard: {
48+
marginVertical: 4,
49+
},
50+
assetCardContent: {
51+
flexDirection: "row",
52+
alignItems: "center",
53+
gap: 12,
54+
},
55+
assetInfo: {
56+
gap: 4,
57+
flex: 1,
58+
},
59+
});

0 commit comments

Comments
 (0)