@@ -36,9 +36,25 @@ const AddressText = styled.span`
3636 }
3737` ;
3838
39+ const EmptyMessage = styled . div `
40+ text-align: center;
41+ padding: 20px;
42+ color: #aaa;
43+ font-size: 16px;
44+ ` ;
45+
3946export const AddressList : React . FC < AddressListProps > = ( { addresses } ) => {
4047 const [ copiedIndex , setCopiedIndex ] = React . useState < number | null > ( null ) ;
4148
49+ // Handle empty addresses array
50+ if ( ! addresses || addresses . length === 0 ) {
51+ return (
52+ < EmptyMessage >
53+ No receiving addresses available at the moment.
54+ </ EmptyMessage >
55+ ) ;
56+ }
57+
4258 return (
4359 < List
4460 itemLayout = "horizontal"
@@ -61,145 +77,3 @@ export const AddressList: React.FC<AddressListProps> = ({ addresses }) => {
6177 />
6278 ) ;
6379} ;
64-
65- // import React from 'react';
66- // import { List, Button } from 'antd';
67- // import { CopyToClipboard } from 'react-copy-to-clipboard';
68- // import { CheckOutlined, CopyOutlined } from '@ant-design/icons';
69- // import styled from 'styled-components';
70-
71- // interface Address {
72- // index: string;
73- // address: string;
74- // }
75-
76- // interface AddressListProps {
77- // addresses: Address[];
78- // }
79-
80- // const AddressContainer = styled.div`
81- // display: flex;
82- // justify-content: space-between;
83- // align-items: center;
84- // @media (max-width: 768px) {
85- // flex-direction: column;
86- // align-items: flex-start;
87- // }
88- // `;
89-
90- // const AddressText = styled.span`
91- // color: #aaa;
92- // margin-right: 8px;
93- // flex: 1;
94- // word-wrap: break-word; /* Ensure long addresses break properly */
95- // @media (max-width: 768px) {
96- // margin-right: 0;
97- // margin-bottom: 8px;
98- // }
99- // `;
100-
101- // export const AddressList: React.FC<AddressListProps> = ({ addresses }) => {
102- // const [copiedIndex, setCopiedIndex] = React.useState<number | null>(null);
103-
104- // return (
105- // <List
106- // itemLayout="horizontal"
107- // dataSource={addresses}
108- // renderItem={(address, index) => (
109- // <List.Item>
110- // <List.Item.Meta
111- // title={`Address: ${parseInt(address.index) + 1}`}
112- // description={
113- // <AddressContainer>
114- // <AddressText>{address.address}</AddressText>
115- // <CopyToClipboard text={address.address} onCopy={() => setCopiedIndex(index)}>
116- // <Button icon={copiedIndex === index ? <CheckOutlined /> : <CopyOutlined />} size="small" />
117- // </CopyToClipboard>
118- // </AddressContainer>
119- // }
120- // />
121- // </List.Item>
122- // )}
123- // />
124- // );
125- // };
126-
127- // import React from 'react';
128- // import { List, Button } from 'antd';
129- // import { CopyToClipboard } from 'react-copy-to-clipboard';
130- // import { CheckOutlined, CopyOutlined } from '@ant-design/icons';
131-
132- // interface Address {
133- // index: string;
134- // address: string;
135- // }
136-
137- // interface AddressListProps {
138- // addresses: Address[];
139- // }
140-
141- // export const AddressList: React.FC<AddressListProps> = ({ addresses }) => {
142- // const [copiedIndex, setCopiedIndex] = React.useState<number | null>(null);
143-
144- // return (
145- // <List
146- // itemLayout="horizontal"
147- // dataSource={addresses}
148- // renderItem={(address, index) => (
149- // <List.Item>
150- // <List.Item.Meta
151- // title={`Address: ${parseInt(address.index) + 1}`}
152- // description={
153- // <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
154- // <span style={{ color: '#aaa', marginRight: '8px', flex: 1 }}>{address.address}</span>
155- // <CopyToClipboard text={address.address} onCopy={() => setCopiedIndex(index)}>
156- // <Button icon={copiedIndex === index ? <CheckOutlined /> : <CopyOutlined />} size="small" />
157- // </CopyToClipboard>
158- // </div>
159- // }
160- // />
161- // </List.Item>
162- // )}
163- // />
164- // );
165- // };
166-
167- // import React from 'react';
168- // import { List, Button } from 'antd';
169- // import { CopyToClipboard } from 'react-copy-to-clipboard';
170- // import { CheckOutlined, CopyOutlined } from '@ant-design/icons';
171-
172- // interface Address {
173- // index: string;
174- // address: string;
175- // }
176-
177- // interface AddressListProps {
178- // addresses: Address[];
179- // }
180-
181- // export const AddressList: React.FC<AddressListProps> = ({ addresses }) => {
182- // const [copiedIndex, setCopiedIndex] = React.useState<number | null>(null);
183-
184- // return (
185- // <List
186- // itemLayout="horizontal"
187- // dataSource={addresses}
188- // renderItem={(address, index) => (
189- // <List.Item>
190- // <List.Item.Meta
191- // title={`Address: ${parseInt(address.index) + 1}`}
192- // description={
193- // <div style={{ display: 'flex', alignItems: 'center' }}>
194- // <span style={{ color: '#aaa', marginRight: '8px' }}>{address.address}</span>
195- // <CopyToClipboard text={address.address} onCopy={() => setCopiedIndex(index)}>
196- // <Button icon={copiedIndex === index ? <CheckOutlined /> : <CopyOutlined />} size="small" />
197- // </CopyToClipboard>
198- // </div>
199- // }
200- // />
201- // </List.Item>
202- // )}
203- // />
204- // );
205- // };
0 commit comments