From 00f6a99f92e958796f6ecbd1b892494fdd001d7a Mon Sep 17 00:00:00 2001 From: Padreug Date: Wed, 10 Jun 2026 17:26:25 +0200 Subject: [PATCH] refactor(sidebar): show identity inline, move edit form into gear popup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Read-only identity (avatar, display name, @username, copyable Lightning address, copyable npub) stays visible in the sheet so the user can grab their address without opening any form. The full edit form moves behind a gear-icon dialog. Log out stays in the sheet footer so signing out doesn't require opening the popup. Lightning Address and NIP-05 share the same `username@domain` in this stack — the @username row above the card already signals NIP-05, so the copyable address row is labeled just "Lightning". The picture-upload row now stacks the preview above the upload widget on narrow viewports so the Gallery/Camera buttons stay inside the sheet/dialog. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/components/layout/ProfileSheetContent.vue | 202 ++++++++++++++++-- .../base/components/ProfileSettings.vue | 128 +++-------- 2 files changed, 208 insertions(+), 122 deletions(-) diff --git a/src/components/layout/ProfileSheetContent.vue b/src/components/layout/ProfileSheetContent.vue index 26667b1..76635c9 100644 --- a/src/components/layout/ProfileSheetContent.vue +++ b/src/components/layout/ProfileSheetContent.vue @@ -1,38 +1,122 @@ diff --git a/src/modules/base/components/ProfileSettings.vue b/src/modules/base/components/ProfileSettings.vue index 1ad99ef..7a3386a 100644 --- a/src/modules/base/components/ProfileSettings.vue +++ b/src/modules/base/components/ProfileSettings.vue @@ -1,14 +1,5 @@ @@ -173,8 +121,7 @@ import { toTypedSchema } from '@vee-validate/zod' import * as z from 'zod' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' -import { Separator } from '@/components/ui/separator' -import { User, Zap, Hash } from 'lucide-vue-next' +import { User } from 'lucide-vue-next' import { FormControl, FormDescription, @@ -184,27 +131,13 @@ import { FormMessage, } from '@/components/ui/form' import ImageUpload from './ImageUpload.vue' -import { - AlertDialog, - AlertDialogAction, - AlertDialogCancel, - AlertDialogContent, - AlertDialogDescription, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogTitle, - AlertDialogTrigger, -} from '@/components/ui/alert-dialog' -import { LogOut } from 'lucide-vue-next' import { useAuth } from '@/composables/useAuthService' -import { useRouter } from 'vue-router' import { injectService, SERVICE_TOKENS } from '@/core/di-container' import type { ImageUploadService } from '../services/ImageUploadService' import { useToast } from '@/core/composables/useToast' // Services -const { user, updateProfile, logout } = useAuth() -const router = useRouter() +const { user, updateProfile } = useAuth() const imageService = injectService(SERVICE_TOKENS.IMAGE_UPLOAD_SERVICE) const toast = useToast() @@ -224,14 +157,14 @@ const lightningDomain = computed(() => import.meta.env.VITE_LIGHTNING_DOMAIN || window.location.hostname ) -// Computed previews +// Live preview of the user's NIP-05 / Lightning address — shown in the +// username field's helper text so the consequence of a future rename is +// visible inline. const nip05Preview = computed(() => { const username = form.values.username || currentUsername.value || 'username' return `${username}@${lightningDomain.value}` }) -const lightningAddress = computed(() => nip05Preview.value) - // Form schema const profileFormSchema = toTypedSchema(z.object({ username: z.string() @@ -327,17 +260,4 @@ const updateUserProfile = async (formData: any) => { isUpdating.value = false } } - -// Log out + redirect to /login on this app's origin. -const onLogout = async () => { - try { - await logout() - toast.success('Logged out') - router.push('/login') - } catch (error) { - const errorMessage = error instanceof Error ? error.message : 'Failed to log out' - console.error('Error logging out:', error) - toast.error(`Logout failed: ${errorMessage}`) - } -}