From 5152bb6e5e1c67f26ab85942183654d017afa6c8 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 1 Dec 2025 14:28:49 -0400 Subject: [PATCH] Update the profile information in the fields if a profile already exists. --- Trash/trash.json | 49 ++++++++++++++++++++++++++++++++++++++++++++++ web/superball.html | 28 ++++++++++++++++++++++++-- 2 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 Trash/trash.json diff --git a/Trash/trash.json b/Trash/trash.json new file mode 100644 index 0000000..de9223a --- /dev/null +++ b/Trash/trash.json @@ -0,0 +1,49 @@ +Reply to a post from Primal + +{ + "kind": 1, + "created_at": 1763420960, + "content": "From Primal.", + "pubkey": "8ff74724ed641b3c28e5a86d7c5cbc49c37638ace8c6c38935860e7a5eedde0e", + "id": "555c77e419c6f34d1d36b6baf36489c5eb17d829645c940fc996d90c26df59a1", + "tags": [ + [ + "e", + "ac50dd87901863590d577fb9080ab294b8dd1b6b10563e9733d5bad817c735db", + "wss://nos.lol", + "root" + ], + [ + "p", + "8ff74724ed641b3c28e5a86d7c5cbc49c37638ace8c6c38935860e7a5eedde0e" + ], + [ + "r", + "wss://nostr.mom/" + ], + [ + "r", + "wss://relay.laantungir.net/" + ] + ], + "sig": "5ab8f7b43e972e2089ebc95f68c49cace183832a3f867801a85c689ce6797eaa52a60ba07847212019fc2361ffca276c74f9cd69402095c6c783faac2c827bde" +} + + +Reply to post from proposed superball builder change. + +{ + "id": "56e6dadc32afe11f13e83fcf8107ea8a819e4a96232d64eacafd10370224e685", + "sig": "3766102783acfc7654f134b1dc5fd716e89e154fc81a96c7f60d20a867e5b52919cdfa7a01151550880e4e8a2945ef05feb43c022bbd7761724ded8308254b1d", + "kind": 1, + "tags": [ + [ + "e", + "ac50dd87901863590d577fb9080ab294b8dd1b6b10563e9733d5bad817c735db", + "root" + ] + ], + "pubkey": "8ff74724ed641b3c28e5a86d7c5cbc49c37638ace8c6c38935860e7a5eedde0e", + "content": "Yeah, it is a great night.", + "created_at": 1763420892 +} \ No newline at end of file diff --git a/web/superball.html b/web/superball.html index 621113a..4b0ed1b 100644 --- a/web/superball.html +++ b/web/superball.html @@ -32,7 +32,7 @@
Post
Reply
-
Create Profile
+
Create/Edit Profile

Post

@@ -49,7 +49,7 @@
-

Create Profile

+

Create/Edit Profile

@@ -132,6 +132,11 @@ // Show corresponding content const tabId = tab.getAttribute('data-tab'); document.getElementById(tabId).classList.add('active'); + + // If tab3 (Create/Edit Profile) is activated, populate form with existing profile data + if (tabId === 'tab3' && userProfileData) { + populateProfileForm(userProfileData); + } }); }); }); @@ -144,6 +149,7 @@ let bounceCounter = 0; let discoveredThrowers = []; let userRelays = []; + let userProfileData = null; // Store loaded profile data // Initialize NOSTR_LOGIN_LITE async function initializeApp() { @@ -229,6 +235,7 @@ if (events.length > 0) { console.log('SUCCESS', 'Profile event received'); const profile = JSON.parse(events[0].content); + userProfileData = profile; // Store profile data globally displayProfile(profile); } else { console.log('INFO', 'No profile found'); @@ -256,6 +263,23 @@ console.log('SUCCESS', `Profile displayed: ${name}`); } + // Populate profile form with existing profile data + function populateProfileForm(profile) { + if (!profile) return; + + // Populate each field with existing data if available + document.getElementById('name').value = profile.name || ''; + document.getElementById('about').value = profile.about || ''; + document.getElementById('profile-pic').value = profile.picture || ''; + document.getElementById('display-name').value = profile.display_name || profile.displayName || ''; + document.getElementById('website').value = profile.website || ''; + document.getElementById('banner').value = profile.banner || ''; + document.getElementById('nip05').value = profile.nip05 || ''; + document.getElementById('lud16').value = profile.lud16 || ''; + + console.log('INFO', 'Profile form populated with existing data'); + } + // Load user's NIP-65 relay list async function loadUserRelayList() { if (!userPubkey) return [];