From fbc4d21f362a8d160ce67e34040f043353b70201 Mon Sep 17 00:00:00 2001 From: Lucas Werey Date: Fri, 15 Nov 2024 18:47:51 +0100 Subject: [PATCH] :bug:(lld) hedera split address --- .changeset/rotten-lamps-care.md | 5 +++++ .../components/OperationsList/AddressCell.tsx | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 .changeset/rotten-lamps-care.md diff --git a/.changeset/rotten-lamps-care.md b/.changeset/rotten-lamps-care.md new file mode 100644 index 000000000000..0cb7589d04ce --- /dev/null +++ b/.changeset/rotten-lamps-care.md @@ -0,0 +1,5 @@ +--- +"ledger-live-desktop": patch +--- + +Fix split address that didn't take in consideration special characters (cf Hedera) diff --git a/apps/ledger-live-desktop/src/renderer/components/OperationsList/AddressCell.tsx b/apps/ledger-live-desktop/src/renderer/components/OperationsList/AddressCell.tsx index 836d809ef563..fab2ead710aa 100644 --- a/apps/ledger-live-desktop/src/renderer/components/OperationsList/AddressCell.tsx +++ b/apps/ledger-live-desktop/src/renderer/components/OperationsList/AddressCell.tsx @@ -22,11 +22,19 @@ export const SplitAddress = ({ ff, fontSize, }; - const third = Math.round(value.length / 3); // FIXME why not using CSS for this? meaning we might be able to have a left & right which both take 50% & play with overflow & text-align - const left = value.slice(0, third); - const right = value.slice(third, value.length); + let left, right; + if (value.includes(".")) { + const parts = value.split("."); + left = parts[0] + "."; + right = parts.slice(1).join("."); + } else { + const third = Math.round(value.length / 3); + left = value.slice(0, third); + right = value.slice(third, value.length); + } + return ( {left}