diff --git a/js/components/pages/page-settings.js b/js/components/pages/page-settings.js index c1c8811..bbdea00 100644 --- a/js/components/pages/page-settings.js +++ b/js/components/pages/page-settings.js @@ -7,6 +7,7 @@ class PageSettings extends HTMLElement { super() this.isLoggedIn = false this.user = null + this.uidVisible = false } async connectedCallback() { @@ -82,6 +83,29 @@ class PageSettings extends HTMLElement { } }) + // Toggle UUID visibility + this.querySelector('#toggle-uid-btn')?.addEventListener('click', () => { + this.uidVisible = !this.uidVisible + const display = this.querySelector('#user-id-display') + const eyeIcon = this.querySelector('#toggle-uid-btn .icon-eye') + const eyeOffIcon = this.querySelector('#toggle-uid-btn .icon-eye-off') + if (display) { + display.textContent = this.uidVisible + ? this.user?.id + : '••••••••-••••-••••-••••-••••••••••••' + } + if (eyeIcon) eyeIcon.style.display = this.uidVisible ? 'none' : 'block' + if (eyeOffIcon) eyeOffIcon.style.display = this.uidVisible ? 'block' : 'none' + }) + + // Copy UUID + this.querySelector('#copy-uid-btn')?.addEventListener('click', async () => { + if (this.user?.id) { + await navigator.clipboard.writeText(this.user.id) + this.showToast(t('auth.copy') + ' ✓') + } + }) + // Logout this.querySelector('#logout-btn')?.addEventListener('click', () => { auth.logout() @@ -200,7 +224,27 @@ class PageSettings extends HTMLElement { ${this.isLoggedIn ? /* html */`
${user?.id?.slice(0, 8)}...
+ ${'•'.repeat(8)}-••••-••••-••••-${'•'.repeat(12)}
+