Skip to content

Commit 952179b

Browse files
authored
feat: update for blinking sync and tooltip addy (#2059)
1 parent 978019f commit 952179b

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

apps/namadillo/src/App/Ibc/ShieldAllPanel.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export const ShieldAllPanel = ({
9999
address={walletAddress}
100100
className="text-black px-2 py-1.5 border rounded-sm"
101101
displayFullAddress={true}
102+
displayTooltip={false}
102103
/>
103104
{isLoading ?
104105
<SkeletonLoading

apps/namadillo/src/App/Layout/SyncIndicator.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,23 @@ export const SyncIndicator = (): JSX.Element => {
4242
const [indexerBlockHeight, setIndexerBlockHeight] = useState<number | null>(
4343
null
4444
);
45+
const [showShieldedSync, setShowShieldedSync] = useState(false);
4546
const roundedProgress = useMemo(() => {
4647
// Only update when the progress changes by at least 1%
4748
return Math.min(Math.floor(shieldedProgress * 100), 100);
4849
}, [Math.floor(shieldedProgress * 100)]);
4950

51+
useEffect(() => {
52+
let timeout: ReturnType<typeof setTimeout> | undefined;
53+
if (isShieldedFetching && roundedProgress < 100) {
54+
// wait 2.5 s before we allow the ring to appear
55+
timeout = setTimeout(() => setShowShieldedSync(true), 2500);
56+
} else {
57+
setShowShieldedSync(false);
58+
}
59+
return () => clearTimeout(timeout);
60+
}, [isShieldedFetching, roundedProgress]);
61+
5062
const { errors } = syncStatus;
5163
const { services } = indexerServicesSyncStatus;
5264

@@ -74,7 +86,7 @@ export const SyncIndicator = (): JSX.Element => {
7486

7587
return (
7688
<div className="flex gap-10 px-2 py-3">
77-
{roundedProgress < 100 && isShieldedFetching && (
89+
{showShieldedSync && (
7890
<div className="relative group/tooltip">
7991
<div className="relative mt-1">
8092
<PulsingRing size="small" />

apps/namadillo/src/App/Transfer/SelectedWallet.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ type SelectedWalletProps = {
99
className?: string;
1010
onClick?: () => void;
1111
displayFullAddress?: boolean;
12+
displayTooltip?: boolean;
1213
};
1314

1415
export const SelectedWallet = ({
@@ -17,6 +18,7 @@ export const SelectedWallet = ({
1718
address,
1819
className = "",
1920
displayFullAddress = false,
21+
displayTooltip = true,
2022
}: SelectedWalletProps): JSX.Element => {
2123
if (!address) return <></>;
2224
return (
@@ -38,7 +40,7 @@ export const SelectedWallet = ({
3840
{address && (
3941
<WalletAddress
4042
address={address}
41-
displayTooltip={false}
43+
displayTooltip={displayTooltip}
4244
displayFullAddress={displayFullAddress}
4345
/>
4446
)}

apps/namadillo/src/App/Transfer/TransferDestination.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ export const TransferDestination = ({
164164
<SelectedWallet
165165
wallet={wallet}
166166
address={customAddressActive ? address : walletAddress}
167+
displayFullAddress={true}
167168
/>
168169
)}
169170
</div>

apps/namadillo/src/App/Transfer/__tests__/SelectChainModal.test.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ describe("Component: SelectChainModal", () => {
2424
expect(screen.getByText("Namada")).toBeInTheDocument();
2525
expect(screen.getByText("TestChain")).toBeInTheDocument();
2626

27-
// Beginning and end of wallet address
28-
expect(screen.getByText("cosmos1x", { exact: false })).toBeInTheDocument();
29-
expect(screen.getByText("jqgh", { exact: false })).toBeInTheDocument();
27+
// Truncated wallet address
28+
expect(
29+
screen.getByText("cosmos1x...yf0wjqgh", {
30+
exact: false,
31+
})
32+
).toBeInTheDocument();
3033

3134
// Check for modal title
3235
expect(screen.getByText("Select Source Chain")).toBeInTheDocument();

0 commit comments

Comments
 (0)