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, accessToken: account.token,
user: user, user: user,
expiresAt: account.expires_at expiresAt: account.expires_at ?? ''
} }
: null : null

View file

@ -44,7 +44,7 @@
{#if editable} {#if editable}
<div class="edit-value"> <div class="edit-value">
{#if type === 'select' && options} {#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'} {:else if type === 'checkbox'}
<label class="checkbox-wrapper"> <label class="checkbox-wrapper">
<input type="checkbox" bind:checked={checkboxValue} class="checkbox" /> <input type="checkbox" bind:checked={checkboxValue} class="checkbox" />

View file

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

View file

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

View file

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

View file

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