tweak notification modal and badge styling

fix phantom claims response key, add element colors to badge
This commit is contained in:
Justin Edmund 2025-12-17 20:07:29 -08:00
parent 62dd3f5cd7
commit d90d4e76bf
3 changed files with 42 additions and 11 deletions

View file

@ -313,11 +313,11 @@ export class CrewAdapter extends BaseAdapter {
* Get pending phantom claims for current user (phantoms assigned but not yet confirmed) * Get pending phantom claims for current user (phantoms assigned but not yet confirmed)
*/ */
async getPendingPhantomClaims(options?: RequestOptions): Promise<PhantomPlayer[]> { async getPendingPhantomClaims(options?: RequestOptions): Promise<PhantomPlayer[]> {
const response = await this.request<{ phantom_claims: PhantomPlayer[] }>( const response = await this.request<{ phantomClaims: PhantomPlayer[] }>(
'/pending_phantom_claims', '/pending_phantom_claims',
options options
) )
return response.phantom_claims return response.phantomClaims
} }
} }

View file

@ -114,7 +114,7 @@
</script> </script>
<Dialog bind:open> <Dialog bind:open>
<ModalHeader title="Notifications" description="Pending actions for your account" /> <ModalHeader title="Notifications" />
<ModalBody> <ModalBody>
{#if isLoading} {#if isLoading}
@ -133,9 +133,7 @@
{#if hasPhantomClaims} {#if hasPhantomClaims}
<div class="section"> <div class="section">
<h3 class="section-title">Phantom Assignments</h3> <h3 class="section-title">Phantom Assignments</h3>
<p class="section-description"> <p class="section-description">Accept to inherit the phantom's GW scores and join date</p>
Accept to inherit the phantom's GW scores and join date
</p>
<div class="notifications-list"> <div class="notifications-list">
{#each phantomClaims as phantom} {#each phantomClaims as phantom}
{@const crew = phantom.crew} {@const crew = phantom.crew}
@ -187,7 +185,7 @@
<!-- Crew Invitations Section --> <!-- Crew Invitations Section -->
{#if hasInvitations} {#if hasInvitations}
<div class="section"> <div class="section">
<h3 class="section-title">Crew Invitations</h3> <h3 class="section-title">Crew invites</h3>
<div class="notifications-list"> <div class="notifications-list">
{#each invitations as invitation} {#each invitations as invitation}
{@const expired = isExpired(invitation.expiresAt)} {@const expired = isExpired(invitation.expiresAt)}
@ -299,6 +297,10 @@
} }
.section { .section {
display: flex;
flex-direction: column;
gap: spacing.$unit-2x;
&:not(:first-child) { &:not(:first-child) {
margin-top: spacing.$unit-3x; margin-top: spacing.$unit-3x;
padding-top: spacing.$unit-3x; padding-top: spacing.$unit-3x;
@ -307,10 +309,10 @@
} }
.section-title { .section-title {
margin: 0 0 spacing.$unit-half 0;
font-size: typography.$font-regular; font-size: typography.$font-regular;
font-weight: typography.$medium; font-weight: typography.$medium;
color: var(--text-primary); color: var(--text-primary);
margin: 0;
} }
.section-description { .section-description {

View file

@ -1,6 +1,8 @@
<svelte:options runes={true} /> <svelte:options runes={true} />
<script lang="ts"> <script lang="ts">
import type { Element } from '$lib/types/api/shared'
interface Props { interface Props {
/** Number of notifications */ /** Number of notifications */
count?: number count?: number
@ -8,13 +10,19 @@
showCount?: boolean showCount?: boolean
/** Size variant */ /** Size variant */
size?: 'small' | 'medium' size?: 'small' | 'medium'
/** Element for color styling */
element?: Element
} }
let { count = 0, showCount = false, size = 'small' }: Props = $props() let { count = 0, showCount = false, size = 'small', element }: Props = $props()
</script> </script>
{#if count > 0} {#if count > 0}
<span class="notification-badge" class:medium={size === 'medium'} class:has-count={showCount}> <span
class="notification-badge {element ?? ''}"
class:medium={size === 'medium'}
class:has-count={showCount}
>
{#if showCount} {#if showCount}
{count > 99 ? '99+' : count} {count > 99 ? '99+' : count}
{/if} {/if}
@ -33,7 +41,7 @@
min-width: 8px; min-width: 8px;
height: 8px; height: 8px;
border-radius: 50%; border-radius: 50%;
background: colors.$fire-text-20; background: var(--button-primary-bg);
flex-shrink: 0; flex-shrink: 0;
&.medium { &.medium {
@ -56,5 +64,26 @@
font-size: 11px; font-size: 11px;
} }
} }
// Element-specific colors
&.wind {
background: var(--wind-button-bg);
}
&.fire {
background: var(--fire-button-bg);
}
&.water {
background: var(--water-button-bg);
}
&.earth {
background: var(--earth-button-bg);
}
&.light {
background: var(--light-button-bg);
color: black;
}
&.dark {
background: var(--dark-button-bg);
}
} }
</style> </style>