diff --git a/index.html b/index.html index cb8a88b..79dd1a7 100644 --- a/index.html +++ b/index.html @@ -12,10 +12,10 @@

Meshtastic QR Code Generator

- Generate Configuration + Share this with others
- +
@@ -25,7 +25,7 @@

Meshtastic QR Code Generator

- +
@@ -136,6 +136,8 @@

Meshtastic QR Code Generator

+ + diff --git a/src/main.ts b/src/main.ts index bde2f67..030be82 100644 --- a/src/main.ts +++ b/src/main.ts @@ -99,13 +99,29 @@ async function generateConfig(): Promise { function copyUrlToClipboard(): void { const urlField = document.getElementById('generatedUrl') as HTMLInputElement; - // Use the Clipboard API to copy the URL navigator.clipboard.writeText(urlField.value) - .then(() => { - alert('URL copied to clipboard!'); - }) - .catch(err => { - console.error('Failed to copy text: ', err); - alert('Failed to copy URL'); - }); + .then(() => { + showCopyNotification(); + }) + .catch(err => { + console.error('Failed to copy text: ', err); + alert('Failed to copy URL'); + }); } + +/** + * Show the "URL copied" notification with animation + */ +function showCopyNotification(): void { + const notification = document.getElementById('copyNotification'); + + if (notification) { + notification.classList.add('show'); + + // Hide the notification after 2 seconds + setTimeout(() => { + notification.classList.remove('show'); + }, 2000); + } +} + diff --git a/src/styles.scss b/src/styles.scss index c4a1fd2..8b47923 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -1,3 +1,7 @@ +body { + font-family: Arial, sans-serif; +} + fieldset { margin-bottom: 20px; padding: 10px; @@ -32,3 +36,24 @@ button#generateConfig { border: #4CAF50 1px solid; font-size: large; } + +#copyNotification { + position: fixed; + top: 20px; + left: 50%; + transform: translateX(-50%); + background-color: #4CAF50; + color: white; + padding: 10px 20px; + border-radius: 5px; + font-size: 14px; + opacity: 0; + visibility: hidden; + transition: opacity 0.5s ease, visibility 0.5s ease; + z-index: 1000; +} + +#copyNotification.show { + visibility: visible; + opacity: 1; +}