From 61cf217107c4935c5a95ca103e25ad792dae4d5d Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Wed, 17 Dec 2025 23:00:22 -0800 Subject: [PATCH] move pending claims to pending tab with badge --- src/routes/(app)/crew/members/+page.svelte | 136 +++++++++++++-------- 1 file changed, 84 insertions(+), 52 deletions(-) diff --git a/src/routes/(app)/crew/members/+page.svelte b/src/routes/(app)/crew/members/+page.svelte index 32c187ff..384b0734 100644 --- a/src/routes/(app)/crew/members/+page.svelte +++ b/src/routes/(app)/crew/members/+page.svelte @@ -65,6 +65,12 @@ enabled: crewStore.isOfficer && !!crewStore.crew?.id })) + // Query for phantoms (needed for pending claims badge when not viewing phantom/all filter) + const phantomsQuery = createQuery(() => ({ + ...crewQueries.members('phantom'), + enabled: filter !== 'phantom' && filter !== 'all' && crewStore.isOfficer + })) + // Calculate total active roster size (members + phantoms) const activeRosterSize = $derived.by(() => { // Use active filter data if viewing active, otherwise use dedicated query @@ -308,9 +314,14 @@ ) // Get phantoms with pending claims (assigned but not confirmed) - const pendingClaimPhantoms = $derived( - membersQuery.data?.phantoms?.filter((p) => p.claimedBy && !p.claimConfirmed) ?? [] - ) + // Use phantom query when not viewing phantom/all filter to ensure badge always has data + const pendingClaimPhantoms = $derived.by(() => { + let phantoms = membersQuery.data?.phantoms + if (filter !== 'phantom' && filter !== 'all') { + phantoms = phantomsQuery.data?.phantoms + } + return phantoms?.filter((p) => p.claimedBy && !p.claimConfirmed) ?? [] + }) @@ -329,6 +340,9 @@ onclick={() => handleFilterChange(option.value)} > {option.label} + {#if option.value === 'pending' && (pendingInvitationsCount > 0 || pendingClaimPhantoms.length > 0)} + {pendingInvitationsCount + pendingClaimPhantoms.length} + {/if} {/each} @@ -345,7 +359,7 @@ {#snippet trigger({ props })} -