Skip to content

Commit

Permalink
fix: Handle clipboard copy with browser compatibility checks
Browse files Browse the repository at this point in the history
  • Loading branch information
aidamiscom committed Jan 4, 2025
1 parent db99c53 commit d330099
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,17 @@ function WhatIsMainstreamToken() {
CA : <span
style={{cursor: 'pointer', textDecoration: 'underline'}}
onClick={() => {
navigator.clipboard.writeText('HT9C48yRmS2kiUYJfLcDX7JidtcKBupe3DE2GDyQr3i3');
alert('Contract address copied to clipboard!');
if (navigator?.clipboard) {
navigator.clipboard.writeText('HT9C48yRmS2kiUYJfLcDX7JidtcKBupe3DE2GDyQr3i3')
.then(() => {
alert('Contract address copied to clipboard!');
})
.catch(() => {
alert('Failed to copy to clipboard. Please copy manually.');
});
} else {
alert('Clipboard access not available. Please copy manually.');
}
}}
>
HT9C48yRmS2kiUYJfLcDX7JidtcKBupe3DE2GDyQr3i3
Expand Down

0 comments on commit d330099

Please sign in to comment.