Coffee journaling on ATProto (alpha) alpha.arabica.social
coffee

fix: fix profile and brew viewing bugs #9

closed opened by pdewey.com targeting main from refactor-svelte
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:hm5f3dnm6jdhrc55qp2npdja/sh.tangled.repo.pull/3mdercwj6w222
+29 -7
Diff #0
-4
BACKLOG.md
··· 58 - Profile page should show more details, and allow brew entries to take up more vertical space 59 60 - Show "view" button on brews in profile page (same as on brews list page) 61 - 62 - - Navigating to "my profile" while on another user's profile, the url changes but the page does not change 63 - 64 - - Clicking "back to brews" on brew view page returns user to their brews list, even if the brew belonged to another user
··· 58 - Profile page should show more details, and allow brew entries to take up more vertical space 59 60 - Show "view" button on brews in profile page (same as on brews list page)
+23 -2
frontend/src/routes/BrewView.svelte
··· 13 let loading = true; 14 let error = null; 15 let isOwnProfile = false; 16 17 $: isAuthenticated = $authStore.isAuthenticated; 18 $: currentUserDID = $authStore.user?.did; ··· 52 brew = brews.find((b) => b.rkey === brewRKey); 53 if (!brew) { 54 error = "Brew not found"; 55 } 56 } 57 ··· 60 // Fetch brew from API using AT-URI 61 const atURI = `at://${userDID}/social.arabica.alpha.brew/${brewRKey}`; 62 brew = await api.get(`/api/brew?uri=${encodeURIComponent(atURI)}`); 63 } catch (err) { 64 console.error("Failed to load brew:", err); 65 error = err.message || "Failed to load brew"; ··· 341 <!-- Back button --> 342 <div class="mt-6"> 343 <button 344 - on:click={() => navigate("/brews")} 345 class="text-brown-700 hover:text-brown-900 font-medium hover:underline" 346 > 347 - ← Back to Brews 348 </button> 349 </div> 350 </div>
··· 13 let loading = true; 14 let error = null; 15 let isOwnProfile = false; 16 + let brewOwnerHandle = null; 17 + let brewOwnerDID = null; 18 19 $: isAuthenticated = $authStore.isAuthenticated; 20 $: currentUserDID = $authStore.user?.did; ··· 54 brew = brews.find((b) => b.rkey === brewRKey); 55 if (!brew) { 56 error = "Brew not found"; 57 + } else { 58 + // Set owner to current user for own brews 59 + brewOwnerDID = currentUserDID; 60 + brewOwnerHandle = $authStore.user?.handle; 61 } 62 } 63 ··· 66 // Fetch brew from API using AT-URI 67 const atURI = `at://${userDID}/social.arabica.alpha.brew/${brewRKey}`; 68 brew = await api.get(`/api/brew?uri=${encodeURIComponent(atURI)}`); 69 + brewOwnerDID = userDID; 70 + 71 + // Fetch the profile to get the handle 72 + const profileData = await api.get(`/api/profile-json/${userDID}`); 73 + brewOwnerHandle = profileData.profile?.handle; 74 } catch (err) { 75 console.error("Failed to load brew:", err); 76 error = err.message || "Failed to load brew"; ··· 352 <!-- Back button --> 353 <div class="mt-6"> 354 <button 355 + on:click={() => { 356 + if (isOwnProfile) { 357 + navigate("/brews"); 358 + } else if (brewOwnerHandle) { 359 + navigate(`/profile/${brewOwnerHandle}`); 360 + } else if (brewOwnerDID) { 361 + navigate(`/profile/${brewOwnerDID}`); 362 + } else { 363 + navigate("/"); 364 + } 365 + }} 366 class="text-brown-700 hover:text-brown-900 font-medium hover:underline" 367 > 368 + ← {isOwnProfile ? "Back to My Brews" : "Back to Profile"} 369 </button> 370 </div> 371 </div>
+5
frontend/src/routes/Profile.svelte
··· 41 await loadProfile(); 42 }); 43 44 async function loadProfile() { 45 try { 46 const data = await api.get(`/api/profile-json/${actor}`);
··· 41 await loadProfile(); 42 }); 43 44 + // Reload profile when actor prop changes (e.g., navigating from one profile to another) 45 + $: if (actor) { 46 + loadProfile(); 47 + } 48 + 49 async function loadProfile() { 50 try { 51 const data = await api.get(`/api/profile-json/${actor}`);
+1 -1
static/app/index.html
··· 35 <!-- Web Manifest --> 36 <link rel="manifest" href="/static/manifest.json" /> 37 <meta name="theme-color" content="#78350f" /> 38 - <script type="module" crossorigin src="/static/app/assets/index-Byldwb2g.js"></script> 39 <link rel="stylesheet" crossorigin href="/static/app/assets/index-DUcERGgO.css"> 40 </head> 41 <body class="bg-brown-50 text-brown-900 min-h-screen">
··· 35 <!-- Web Manifest --> 36 <link rel="manifest" href="/static/manifest.json" /> 37 <meta name="theme-color" content="#78350f" /> 38 + <script type="module" crossorigin src="/static/app/assets/index-COWWPLMS.js"></script> 39 <link rel="stylesheet" crossorigin href="/static/app/assets/index-DUcERGgO.css"> 40 </head> 41 <body class="bg-brown-50 text-brown-900 min-h-screen">

History

1 round 0 comments
sign up or login to add to the discussion
pdewey.com submitted #0
1 commit
expand
fix: fix profile and brew viewing bugs
expand 0 comments
closed without merging