diff --git a/src/lib/components/profile/ProfileHeader.svelte b/src/lib/components/profile/ProfileHeader.svelte new file mode 100644 index 00000000..53680f99 --- /dev/null +++ b/src/lib/components/profile/ProfileHeader.svelte @@ -0,0 +1,112 @@ + + +
+ {#if avatarPicture} + {`Avatar + {:else} + + {/if} +
+

{displayTitle}

+ +
+
+ + diff --git a/src/routes/(app)/[username]/+page.svelte b/src/routes/(app)/[username]/+page.svelte index 4174c130..fac3c7a5 100644 --- a/src/routes/(app)/[username]/+page.svelte +++ b/src/routes/(app)/[username]/+page.svelte @@ -2,8 +2,8 @@ import type { PageData } from './$types' import { createInfiniteQuery } from '@tanstack/svelte-query' import ExploreGrid from '$lib/components/explore/ExploreGrid.svelte' + import ProfileHeader from '$lib/components/profile/ProfileHeader.svelte' import { userQueries } from '$lib/api/queries/user.queries' - import { getAvatarSrc, getAvatarSrcSet } from '$lib/utils/avatar' import { IsInViewport } from 'runed' import Icon from '$lib/components/Icon.svelte' import Button from '$lib/components/ui/Button.svelte' @@ -11,10 +11,7 @@ const { data } = $props() as { data: PageData } const tab = $derived(data.tab || 'teams') const isOwner = $derived(data.isOwner || false) - - const avatarFile = $derived(data.user?.avatar?.picture || '') - const avatarSrc = $derived(getAvatarSrc(avatarFile)) - const avatarSrcSet = $derived(getAvatarSrcSet(avatarFile)) + const activeTab = $derived<'teams' | 'favorites'>(tab === 'favorites' ? 'favorites' : 'teams') // Note: Type assertion needed because favorites and parties queries have different // result structures (items vs results) but we handle both in the items $derived @@ -94,35 +91,12 @@
-
- {#if data.user?.avatar?.picture} - {`Avatar - {:else} - - {/if} -
-

{data.user.username}

- -
-
+ {#if partiesQuery.isLoading}
@@ -170,39 +144,6 @@ .profile { padding: $unit-2x 0; } - .header { - display: flex; - align-items: center; - gap: $unit-2x; - margin-bottom: $unit-2x; - } - .avatar { - width: 64px; - height: 64px; - border-radius: 50%; - background: $grey-80; - border: 1px solid $grey-75; - object-fit: cover; - } - .sub { - color: $grey-55; - margin: 0; - } - .tabs { - display: flex; - gap: $unit-2x; - margin-top: $unit-half; - } - .tabs a { - text-decoration: none; - color: inherit; - padding-bottom: 2px; - border-bottom: 2px solid transparent; - } - .tabs a.active { - border-color: #3366ff; - color: #3366ff; - } .empty, .end, diff --git a/src/routes/(app)/[username]/collection/+layout.svelte b/src/routes/(app)/[username]/collection/+layout.svelte index 7f8fda54..4bd997f9 100644 --- a/src/routes/(app)/[username]/collection/+layout.svelte +++ b/src/routes/(app)/[username]/collection/+layout.svelte @@ -2,18 +2,14 @@ import type { LayoutData } from './$types' import { page } from '$app/stores' import { goto } from '$app/navigation' - import { getAvatarSrc, getAvatarSrcSet } from '$lib/utils/avatar' + import ProfileHeader from '$lib/components/profile/ProfileHeader.svelte' import SegmentedControl from '$lib/components/ui/segmented-control/SegmentedControl.svelte' import Segment from '$lib/components/ui/segmented-control/Segment.svelte' let { data, children }: { data: LayoutData; children: any } = $props() - const avatarFile = $derived(data.user?.avatar?.picture || '') - const avatarSrc = $derived(getAvatarSrc(avatarFile)) - const avatarSrcSet = $derived(getAvatarSrcSet(avatarFile)) - - // Determine active tab from URL path - const activeTab = $derived.by(() => { + // Determine active entity type from URL path + const activeEntityType = $derived.by(() => { const path = $page.url.pathname if (path.includes('/weapons')) return 'weapons' if (path.includes('/summons')) return 'summons' @@ -32,31 +28,17 @@
-
- {#if data.user?.avatar?.picture} - {`Avatar - {:else} - - {/if} -
-

{username}'s Collection

- -
-
+