From 9df41c411ce243d3d369cb9e39ff5d119f05cc74 Mon Sep 17 00:00:00 2001 From: Maphikza Date: Fri, 16 May 2025 12:08:23 +0200 Subject: [PATCH] fix: handle null receive addresses in TopUpBalanceModal and AddressList components --- .../components/AddressList/AddressList.tsx | 158 ++---------------- .../TopUpBalanceModal/TopUpBalanceModal.tsx | 67 ++------ 2 files changed, 27 insertions(+), 198 deletions(-) diff --git a/src/components/relay-dashboard/Balance/components/AddressList/AddressList.tsx b/src/components/relay-dashboard/Balance/components/AddressList/AddressList.tsx index 38cc860..ab492d5 100644 --- a/src/components/relay-dashboard/Balance/components/AddressList/AddressList.tsx +++ b/src/components/relay-dashboard/Balance/components/AddressList/AddressList.tsx @@ -36,9 +36,25 @@ const AddressText = styled.span` } `; +const EmptyMessage = styled.div` + text-align: center; + padding: 20px; + color: #aaa; + font-size: 16px; +`; + export const AddressList: React.FC = ({ addresses }) => { const [copiedIndex, setCopiedIndex] = React.useState(null); + // Handle empty addresses array + if (!addresses || addresses.length === 0) { + return ( + + No receiving addresses available at the moment. + + ); + } + return ( = ({ addresses }) => { /> ); }; - -// import React from 'react'; -// import { List, Button } from 'antd'; -// import { CopyToClipboard } from 'react-copy-to-clipboard'; -// import { CheckOutlined, CopyOutlined } from '@ant-design/icons'; -// import styled from 'styled-components'; - -// interface Address { -// index: string; -// address: string; -// } - -// interface AddressListProps { -// addresses: Address[]; -// } - -// const AddressContainer = styled.div` -// display: flex; -// justify-content: space-between; -// align-items: center; -// @media (max-width: 768px) { -// flex-direction: column; -// align-items: flex-start; -// } -// `; - -// const AddressText = styled.span` -// color: #aaa; -// margin-right: 8px; -// flex: 1; -// word-wrap: break-word; /* Ensure long addresses break properly */ -// @media (max-width: 768px) { -// margin-right: 0; -// margin-bottom: 8px; -// } -// `; - -// export const AddressList: React.FC = ({ addresses }) => { -// const [copiedIndex, setCopiedIndex] = React.useState(null); - -// return ( -// ( -// -// -// {address.address} -// setCopiedIndex(index)}> -//