Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 8
Fix/author details#229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Fix/author details #229
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1937e4c
fix: author-details
grv-saini-20 73f8332
fix: owner-details
grv-saini-20 4d853ec
fix: author avatar
grv-saini-20 0f73122
fix: auth user avatar
grv-saini-20 488cc36
fix: error handling
grv-saini-20 9010f78
fix: author image in bottom nav
grv-saini-20 a13f9c6
Merge branch 'feat/w3ds-adapters' into fix/author-details
coodos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
8 changes: 6 additions & 2 deletions
8 platforms/pictique/src/lib/fragments/BottomNav/BottomNav.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 30 additions & 29 deletions
59 platforms/pictique/src/lib/fragments/SideBar/SideBar.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3 platforms/pictique/src/routes/(protected)/profile/+page.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| <script lang="ts"> | ||
| <script> | ||
| </script> | ||
14 changes: 9 additions & 5 deletions
14 platforms/pictique/src/routes/(protected)/profile/[id]/+page.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -2,23 +2,24 @@ | ||
| import { goto } from '$app/navigation'; | ||
| import { page } from '$app/state'; | ||
| import { Profile } from '$lib/fragments'; | ||
| import { ownerId, selectedPost } from '$lib/store/store.svelte'; | ||
| import { selectedPost } from '$lib/store/store.svelte'; | ||
| import type { userProfile, PostData } from '$lib/types'; | ||
| import { apiClient } from '$lib/utils/axios'; | ||
| import { apiClient, getAuthId } from '$lib/utils/axios'; | ||
| import { onMount } from 'svelte'; | ||
| import Post from '../../../../lib/fragments/Post/Post.svelte'; | ||
| let profileId = $derived(page.params.id); | ||
| let profile = $state<userProfile | null>(null); | ||
| let error = $state<string | null>(null); | ||
| let loading = $state(true); | ||
| let ownerId: string | null = $state(null); | ||
| async function fetchProfile() { | ||
| try { | ||
| loading = true; | ||
| error = null; | ||
| const response = await apiClient.get(`/api/users/${profileId}`); | ||
| profile = response.data; | ||
| console.log(JSON.stringify(profile)); | ||
| } catch (err) { | ||
| error = err instanceof Error ? err.message : 'Failed to load profile'; | ||
| } finally { | ||
| @@ -38,7 +39,7 @@ | ||
| async function handleMessage() { | ||
| try { | ||
| await apiClient.post(`/api/chats/`, { | ||
| name: profile.username, | ||
| name: profile?.username, | ||
| participantIds: [profileId] | ||
| }); | ||
| goto('/messages'); | ||
| @@ -52,6 +53,9 @@ | ||
| selectedPost.value = post; | ||
| goto('/profile/post'); | ||
| } | ||
| $effect(()=> { | ||
| ownerId = getAuthId(); | ||
| }) | ||
This conversation was marked as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| onMount(fetchProfile); | ||
| </script> | ||
| @@ -67,7 +71,7 @@ | ||
| </div> | ||
| {:else if profile} | ||
| <Profile | ||
| variant={ownerId.value === profileId ? 'user' : 'other'} | ||
| variant={ownerId === profileId ? 'user' : 'other'} | ||
| profileData={profile} | ||
| handleSinglePost={(post) => handlePostClick(post)} | ||
| {handleFollow} | ||
49 changes: 36 additions & 13 deletions
49 platforms/pictique/src/routes/(protected)/settings/+page.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -2,7 +2,8 @@ | ||
| import { goto } from '$app/navigation'; | ||
| import { page } from '$app/state'; | ||
| import SettingsNavigationButton from '$lib/fragments/SettingsNavigationButton/SettingsNavigationButton.svelte'; | ||
| import { apiClient } from '$lib/utils'; | ||
| import type { userProfile } from '$lib/types'; | ||
| import { apiClient, getAuthId } from '$lib/utils'; | ||
| import { | ||
| DatabaseIcon, | ||
| Logout01Icon, | ||
| @@ -12,27 +13,49 @@ | ||
| import { onMount } from 'svelte'; | ||
| let route = $derived(page.url.pathname); | ||
| let username: string = $state(''); | ||
| let userEmail: string = $state(''); | ||
| let userImage: string = $state(''); | ||
| let ownerId: string | null = $state(null); | ||
| onMount(async () => { | ||
| const { data } = await apiClient.get('/api/users'); | ||
| username = data.displayName; | ||
| userEmail = data.handle; | ||
| userImage = data.avatarUrl; | ||
| }); | ||
| let profile = $state<userProfile | null>(null); | ||
| let error = $state<string | null>(null); | ||
| let loading = $state(true); | ||
| async function fetchProfile() { | ||
| try { | ||
| loading = true; | ||
| error = null; | ||
| const response = await apiClient.get(`/api/users/${ownerId}`); | ||
| profile = response.data; | ||
| } catch (err) { | ||
| error = err instanceof Error ? err.message : 'Failed to load profile'; | ||
| } finally { | ||
| loading = false; | ||
| } | ||
| } | ||
| $effect(()=> { | ||
| ownerId = getAuthId(); | ||
| }) | ||
| onMount(fetchProfile) | ||
This conversation was marked as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| </script> | ||
| <div class="bg-grey rounded-xl p-3 md:p-5"> | ||
| <SettingsNavigationButton onclick={() => goto(`/settings/account`)} profileSrc={userImage}> | ||
| {#if loading} | ||
| <div class="flex h-64 items-center justify-center"> | ||
| <p class="text-gray-500">Loading profile...</p> | ||
| </div> | ||
| {:else if error} | ||
| <div class="flex h-64 items-center justify-center"> | ||
| <p class="text-red-500">{error}</p> | ||
| </div> | ||
| {:else if profile} | ||
| <SettingsNavigationButton onclick={() => goto(`/settings/account`)} profileSrc={profile?.avatarUrl}> | ||
| {#snippet children()} | ||
| <div class="flex flex-col items-start"> | ||
| <h2 class="text-lg">{username}</h2> | ||
| <p class="text-sm">{userEmail}</p> | ||
| <h2 class="text-lg">{profile?.handle}</h2> | ||
| <p class="text-sm">{profile?.description}</p> | ||
| </div> | ||
| {/snippet} | ||
| </SettingsNavigationButton> | ||
| {/if} | ||
| </div> | ||
| <hr class="text-grey" /> | ||
| <div class="flex flex-col gap-3"> | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.