Skip to content

Commit

Permalink
trim long desriptions on home view (#1448)
Browse files Browse the repository at this point in the history
* trim long desriptions on home view

* minor fix

* minor fix
  • Loading branch information
niteshbalusu11 authored Jul 10, 2024
1 parent b5feea1 commit 56b70e2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/components/TransactionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Card>
<CardItem activeOpacity={1} button={true} onPress={() => onPress(transaction.rHash)}>
Expand Down Expand Up @@ -158,7 +170,7 @@ export default function TransactionCard({ onPress, transaction, unit }: IProps)
{recipientOrSender}:{" "}
</Text>
)}
{description && description.length !== 0 ? description : "No description"}
{getDescription()}
</Text>
<Text note={true} style={transactionStyle.status}>
{statusLabel}
Expand Down

0 comments on commit 56b70e2

Please sign in to comment.