-
Notifications
You must be signed in to change notification settings - Fork 4
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
Merged
Fix/author details #229
Changes from 6 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
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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> | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,28 +2,60 @@ | |
import { goto } from '$app/navigation'; | ||
import { page } from '$app/state'; | ||
import SettingsNavigationButton from '$lib/fragments/SettingsNavigationButton/SettingsNavigationButton.svelte'; | ||
import type { userProfile } from '$lib/types'; | ||
import { apiClient, getAuthId } from '$lib/utils'; | ||
import { | ||
DatabaseIcon, | ||
Logout01Icon, | ||
Notification02FreeIcons | ||
} from '@hugeicons/core-free-icons'; | ||
import { HugeiconsIcon } from '@hugeicons/svelte'; | ||
import { onMount } from 'svelte'; | ||
let route = $derived(page.url.pathname); | ||
let username: string = $state('_.ananyayaya._'); | ||
let userEmail: string = $state('[email protected]'); | ||
let userImage: string = $state('https://picsum.photos/200/300'); | ||
let ownerId: string | null = $state(null); | ||
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.
Show resolved
Hide resolved
|
||
</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"> | ||
|
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
Oops, something went wrong.
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.