From 56b70e2737512060c84d489bb4b7458e96fe8151 Mon Sep 17 00:00:00 2001 From: Nitesh <84944042+niteshbalusu11@users.noreply.github.com> Date: Wed, 10 Jul 2024 14:32:34 -0400 Subject: [PATCH] trim long desriptions on home view (#1448) * trim long desriptions on home view * minor fix * minor fix --- 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..ef14228f1 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 > 120) { + 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}