From e9a4960d78d33aec1ec9c0deccb664f7ce04b8c8 Mon Sep 17 00:00:00 2001 From: Nitesh Balusu Date: Wed, 10 Jul 2024 14:27:14 -0400 Subject: [PATCH 1/3] trim long desriptions on home view --- src/components/TransactionCard.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/TransactionCard.tsx b/src/components/TransactionCard.tsx index 5f39de312..dd0159012 100644 --- a/src/components/TransactionCard.tsx +++ b/src/components/TransactionCard.tsx @@ -86,6 +86,18 @@ export default function TransactionCard({ onPress, transaction, unit }: IProps) } } + const getDescription = () => { + if (!description || !description.length) { + return "No description"; + } + + if (description.length > 50) { + return `${description.substring(0, 100)}...`; + } + + return description; + }; + return ( onPress(transaction.rHash)}> @@ -158,7 +170,7 @@ export default function TransactionCard({ onPress, transaction, unit }: IProps) {recipientOrSender}:{" "} )} - {description && description.length !== 0 ? description : "No description"} + {getDescription()} {statusLabel} From 08443a1d4a6861e7e8439839186a392d3c3b2dc3 Mon Sep 17 00:00:00 2001 From: Nitesh Balusu Date: Wed, 10 Jul 2024 14:28:38 -0400 Subject: [PATCH 2/3] minor fix --- src/components/TransactionCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TransactionCard.tsx b/src/components/TransactionCard.tsx index dd0159012..967c3d6b3 100644 --- a/src/components/TransactionCard.tsx +++ b/src/components/TransactionCard.tsx @@ -91,7 +91,7 @@ export default function TransactionCard({ onPress, transaction, unit }: IProps) return "No description"; } - if (description.length > 50) { + if (description.length > 100) { return `${description.substring(0, 100)}...`; } From 60a703358c881c1cbff78a64e61611fe70e507f5 Mon Sep 17 00:00:00 2001 From: Nitesh Balusu Date: Wed, 10 Jul 2024 14:29:41 -0400 Subject: [PATCH 3/3] minor fix --- src/components/TransactionCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TransactionCard.tsx b/src/components/TransactionCard.tsx index 967c3d6b3..ef14228f1 100644 --- a/src/components/TransactionCard.tsx +++ b/src/components/TransactionCard.tsx @@ -91,7 +91,7 @@ export default function TransactionCard({ onPress, transaction, unit }: IProps) return "No description"; } - if (description.length > 100) { + if (description.length > 120) { return `${description.substring(0, 100)}...`; }