|
166 | 166 | margin-top: 1rem;
|
167 | 167 | width: -moz-fit-content;
|
168 | 168 | width: fit-content;
|
| 169 | + z-index: 2; |
169 | 170 |
|
170 | 171 | /* Fade in animation */
|
171 | 172 | opacity: 0;
|
@@ -253,7 +254,7 @@ <h3 id="camera-view-title">VIN Scanner</h3>
|
253 | 254 | </div>
|
254 | 255 | <h3 id="scan-title"></h3>
|
255 | 256 | <div style="display: flex; justify-content: center">
|
256 |
| - <h3 id="notification">Test</h3> |
| 257 | + <h3 id="notification"></h3> |
257 | 258 | </div>
|
258 | 259 | </div>
|
259 | 260 | </div>
|
@@ -517,6 +518,7 @@ <h3 style="margin: 0">Result</h3>
|
517 | 518 | settingsModal.style.display = "none";
|
518 | 519 |
|
519 | 520 | // Show success notification on scan mode switch
|
| 521 | + notification.className = ""; |
520 | 522 | notification.classList.add("banner-success");
|
521 | 523 | notification.innerText = `Now ${SCAN_MODE_TITLES[mode]}`;
|
522 | 524 | // Fade in animation for notificaiton
|
@@ -590,14 +592,29 @@ <h3 style="margin: 0">Result</h3>
|
590 | 592 | copyResultButton.addEventListener("click", () => {
|
591 | 593 | const results = document.querySelector("#results").innerText;
|
592 | 594 |
|
| 595 | + // Reset notification |
| 596 | + notification.className = ""; |
| 597 | + |
593 | 598 | navigator.clipboard
|
594 | 599 | .writeText(results)
|
595 | 600 | .then(function () {
|
596 |
| - console.log("Result copied successfully!"); |
| 601 | + // Show notification that the result is copied |
| 602 | + notification.classList.add("banner-success"); |
| 603 | + notification.innerText = `Result copied successfully!`; |
597 | 604 | })
|
598 | 605 | .catch((ex) => {
|
599 | 606 | let errMsg = ex.message || ex;
|
600 | 607 | console.error("Failed to copy result", errMsg);
|
| 608 | + // Show notification that copy failed |
| 609 | + notification.classList.add("banner-error"); |
| 610 | + notification.innerText = `Failed to copy result.`; |
| 611 | + }) |
| 612 | + .finally(() => { |
| 613 | + // Fade in animation for notificaiton |
| 614 | + notification.style.opacity = 1; |
| 615 | + setTimeout(function () { |
| 616 | + notification.style.opacity = 0; |
| 617 | + }, 5000); |
601 | 618 | });
|
602 | 619 | });
|
603 | 620 |
|
|
0 commit comments