diff --git a/frontend/src/assets/copy-icon.png b/frontend/src/assets/copy-icon.png new file mode 100644 index 0000000..1379b8b Binary files /dev/null and b/frontend/src/assets/copy-icon.png differ diff --git a/frontend/src/components/SecretCard.vue b/frontend/src/components/SecretCard.vue index da86cc9..9f2a43b 100644 --- a/frontend/src/components/SecretCard.vue +++ b/frontend/src/components/SecretCard.vue @@ -3,13 +3,23 @@
{{ issuer }}
{{ username }}
- {{ generateTotp(secret) }} -
+ + ****** + {{ generateTotp(secret) }} + + @@ -26,9 +36,7 @@ export default { return { otp: 123456, notes: "", - remainingTime: 0, - timerWidth: 0, - totalTime: 30, + otpHidden: true, }; }, @@ -39,17 +47,19 @@ export default { this.remainingTime = remaining / 1000; this.timerWidth = remaining * 100; // console.log("hello"); + this.otp = otp; return otp; }, - startTimer() { - this.interval = setInterval(() => { - if (this.remainingTime > 0) { - this.timerWidth = (this.remainingTime / this.totalTime) * 10; - } else { - clearInterval(this.interval); - } - }, 100); + async copyOtp() { + await navigator.clipboard + .writeText(this.otp) + .then(() => { + console.log("copying successful"); + }) + .catch((err) => { + console.log("copy failed", err); + }); }, editSecret() { @@ -57,9 +67,7 @@ export default { }, }, - mounted() { - // this.startTimer(); - }, + mounted() {}, }; @@ -87,12 +95,6 @@ export default { font-size: 2rem; } -.timer { - /* width: 100%; */ - height: 3px; - background-color: green; -} - .card-top { display: flex; justify-content: space-between; @@ -104,7 +106,7 @@ export default { border: none; } -.edit-icon { +.button-icon { width: 16px; height: 16px; }