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

fix: long recipient name breaking line on Account #1760

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
16 changes: 8 additions & 8 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
64 changes: 32 additions & 32 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"privatePackages": {
"version": true,
"tag": true
},
"changelog": [
"@changesets/changelog-github",
{
"repo": "FuelLabs/fuels-wallet"
}
],
"commit": false,
"fixed": [
[
"@fuel-wallet/*",
"fuels-wallet",
"@fuels/playwright-utils"
]
],
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": [
"docs",
"@fuel-wallet/e2e-contract-tests"
],
"snapshot": {
"useCalculatedVersion": true,
"prereleaseTemplate": "{tag}-{commit}"
}
{
Dhanraj30 marked this conversation as resolved.
Show resolved Hide resolved
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"privatePackages": {
"version": true,
"tag": true
},
"changelog": [
"@changesets/changelog-github",
{
"repo": "FuelLabs/fuels-wallet"
}
],
"commit": false,
"fixed": [
[
"@fuel-wallet/*",
"fuels-wallet",
"@fuels/playwright-utils"
]
],
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": [
"docs",
"@fuel-wallet/e2e-contract-tests"
],
"snapshot": {
"useCalculatedVersion": true,
"prereleaseTemplate": "{tag}-{commit}"
}
}
5 changes: 5 additions & 0 deletions .changeset/old-jars-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fuels-wallet": patch
---

Fixing display of long recipient names
10 changes: 5 additions & 5 deletions .changeset/plenty-grapes-itch.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"fuels-wallet": minor
---

Improve handling of custom assets.
---
"fuels-wallet": minor
---
Improve handling of custom assets.
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { cssObj } from '@fuel-ui/css';
import { Avatar, Box, Card, Heading, Icon, Image, Text } from '@fuel-ui/react';
import {
Avatar,
Box,
Card,
Heading,
Icon,
Image,
Text,
Tooltip,
} from '@fuel-ui/react';
import type { OperationTransactionAddress } from 'fuels';
import { Address, AddressType, ChainName, isB256, isBech32 } from 'fuels';
import { type FC, useMemo } from 'react';
import { type FC, useEffect, useMemo, useRef, useState } from 'react';
import { EthAddress, FuelAddress, useAccounts } from '~/systems/Account';

import { useContractMetadata } from '~/systems/Contract/hooks/useContractMetadata';
Expand Down Expand Up @@ -33,6 +42,8 @@ export const TxRecipientCard: TxRecipientCardComponent = ({
const isNetwork = address === 'Network';

const contract = useContractMetadata(address);
const nameRef = useRef<HTMLHeadingElement>(null);
const [isTruncated, setIsTruncated] = useState(false);

const name = useMemo<string>(() => {
if (isContract) {
Expand All @@ -42,6 +53,23 @@ export const TxRecipientCard: TxRecipientCardComponent = ({
return accounts?.find((a) => a.address === fuelAddress)?.name || 'unknown';
}, [isContract, contract, accounts, fuelAddress]);

useEffect(() => {
const checkIfTruncated = () => {
if (nameRef.current) {
const isNameTruncated =
nameRef.current.offsetWidth < nameRef.current.scrollWidth;
setIsTruncated(isNameTruncated);
}
};

checkIfTruncated();
window.addEventListener('resize', checkIfTruncated);

return () => {
window.removeEventListener('resize', checkIfTruncated);
};
}, [name]);

return (
<Card
css={styles.root}
Expand Down Expand Up @@ -97,7 +125,19 @@ export const TxRecipientCard: TxRecipientCardComponent = ({
isNetwork ? 'Address' : 'Name'
}`}
>
{isNetwork ? address : name}
<Tooltip content={name} isOpen={isTruncated}>
Dhanraj30 marked this conversation as resolved.
Show resolved Hide resolved
<div
ref={nameRef}
style={{
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
overflow: 'hidden',
maxWidth: '100px',
}}
>
{name}
</div>
</Tooltip>
</Heading>
{!isNetwork && (
<FuelAddress
Expand Down