fix: component props and type assertions

- make UncapIndicator StarRender props optional for transcendence stars
- add type assertion for star props spreading (as any)
- fix element name type (string -> literal union with type assertion)
- fix PartySegmentedControl props (value/onValueChange -> selectedTab/onTabChange)
- remove userGender prop (component gets it from context)
- add type assertions for ResourceType and ImageVariant comparisons
- add required id/shortcode to Party object in teams/new
- fix auth hooks expiresAt (undefined -> empty string default)
- add type assertion for Select value binding (excludes null/boolean)
This commit is contained in:
Justin Edmund 2025-11-28 21:04:39 -08:00
parent c821873ac6
commit 073bed01d3
6 changed files with 18 additions and 13 deletions

View file

@ -28,7 +28,7 @@ export const handleSession: Handle = async ({ event, resolve }) => {
? {
accessToken: account.token,
user: user,
expiresAt: account.expires_at
expiresAt: account.expires_at ?? ''
}
: null

View file

@ -44,7 +44,7 @@
{#if editable}
<div class="edit-value">
{#if type === 'select' && options}
<Select bind:value {options} {placeholder} size="medium" contained />
<Select bind:value={value as string | number | undefined} {options} {placeholder} size="medium" contained />
{:else if type === 'checkbox'}
<label class="checkbox-wrapper">
<input type="checkbox" bind:checked={checkboxValue} class="checkbox" />

View file

@ -40,7 +40,7 @@
// Get element name for button styling
const elementName = $derived((() => {
const elementMap: Record<number, string> = {
const elementMap: Record<number, string | undefined> = {
0: undefined, // Null element
1: 'wind',
2: 'fire',
@ -109,7 +109,7 @@
<Button
variant="primary"
size="medium"
element={elementName}
element={elementName as "fire" | "water" | "earth" | "wind" | "light" | "dark" | undefined}
onclick={onSave}
disabled={isSaving}
>

View file

@ -21,7 +21,11 @@
interface StarRender {
type: 'uncap' | 'transcendence'
props: Record<string, any>
props: {
index?: number
onStarClick?: (index: number, empty: boolean) => void
[key: string]: any
}
}
let {
@ -97,7 +101,7 @@
ulb: options.ulb,
special: options.special,
tabIndex: editable ? 0 : undefined,
onStarClick: editable ? toggleStar : undefined
onStarClick: editable ? toggleStar : () => {}
}
}
}
@ -160,9 +164,9 @@
{@const star = renderStar(i)}
{#if star}
{#if star.type === 'transcendence'}
<TranscendenceStar {...star.props} />
<TranscendenceStar {...(star.props as any)} />
{:else}
<UncapStar {...star.props} />
<UncapStar {...(star.props as any)} />
{/if}
{/if}
{/each}

View file

@ -550,16 +550,17 @@
</header>
<PartySegmentedControl
value={activeTab}
onValueChange={selectTab}
selectedTab={activeTab}
onTabChange={selectTab}
party={{
id: '',
shortcode: '',
element: 0,
job: undefined,
characters,
weapons,
summons
}}
userGender={currentUser?.gender}
/>
<div class="party-content">

View file

@ -69,9 +69,9 @@
// Generated image URL
const imageUrl = $derived(
getImageUrl(resourceType, itemId || null, variant, {
getImageUrl(resourceType as ResourceType, itemId || null, variant as ImageVariant, {
pose: finalPose,
element: resourceType === 'weapon' && variant === 'grid' ? weaponElement : undefined
element: (resourceType as ResourceType) === 'weapon' && (variant as ImageVariant) === 'grid' ? weaponElement : undefined
})
)