diff --git a/src/lib/components/profile/ProfileHeader.svelte b/src/lib/components/profile/ProfileHeader.svelte index 3e30edf3..89e18c99 100644 --- a/src/lib/components/profile/ProfileHeader.svelte +++ b/src/lib/components/profile/ProfileHeader.svelte @@ -1,19 +1,56 @@
@@ -57,8 +94,40 @@ + + {#if showMenu} +
+ + + + + + + + {#if canInvite} + + + + {/if} + + + +
+ {/if}
+{#if canInvite && userId && viewerCrewId} + +{/if} + diff --git a/src/routes/(app)/[username]/+page.svelte b/src/routes/(app)/[username]/+page.svelte index fac3c7a5..dfea628d 100644 --- a/src/routes/(app)/[username]/+page.svelte +++ b/src/routes/(app)/[username]/+page.svelte @@ -3,7 +3,8 @@ 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 { userQueries, type FavoritesPageResult } from '$lib/api/queries/user.queries' + import { crewStore } from '$lib/stores/crew.store.svelte' import { IsInViewport } from 'runed' import Icon from '$lib/components/Icon.svelte' import Button from '$lib/components/ui/Button.svelte' @@ -13,9 +14,13 @@ const isOwner = $derived(data.isOwner || false) const activeTab = $derived<'teams' | 'favorites'>(tab === 'favorites' ? 'favorites' : 'teams') + // Crew info for invite functionality + const viewerCrewRole = $derived(crewStore.membership?.role ?? null) + const viewerCrewId = $derived(crewStore.crew?.id ?? null) + // Note: Type assertion needed because favorites and parties queries have different // result structures (items vs results) but we handle both in the items $derived - const partiesQuery = createInfiniteQuery(() => { + const getQueryOptions = () => { const isFavorites = tab === 'favorites' && isOwner if (isFavorites) { @@ -57,8 +62,9 @@ } : undefined, initialDataUpdatedAt: 0 - } as unknown as ReturnType - }) + } + } + const partiesQuery = createInfiniteQuery(getQueryOptions as () => ReturnType) const items = $derived(() => { if (!partiesQuery.data?.pages) return data.items || [] @@ -93,9 +99,12 @@
{#if partiesQuery.isLoading}