Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trim long desriptions on home view #1448

Merged
merged 3 commits into from
Jul 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading