diff --git a/src/lib/components/ui/DetailItem.svelte b/src/lib/components/ui/DetailItem.svelte new file mode 100644 index 00000000..3aabd9f1 --- /dev/null +++ b/src/lib/components/ui/DetailItem.svelte @@ -0,0 +1,58 @@ + + + + +
+ {label} + {#if children} +
+ {@render children()} +
+ {:else} + {value || '—'} + {/if} +
+ + diff --git a/src/lib/components/ui/DetailsContainer.svelte b/src/lib/components/ui/DetailsContainer.svelte new file mode 100644 index 00000000..c186e27c --- /dev/null +++ b/src/lib/components/ui/DetailsContainer.svelte @@ -0,0 +1,46 @@ + + + + +
+

{title}

+
+ {@render children()} +
+
+ + diff --git a/src/lib/components/ui/DetailsHeader.svelte b/src/lib/components/ui/DetailsHeader.svelte new file mode 100644 index 00000000..4b25a529 --- /dev/null +++ b/src/lib/components/ui/DetailsHeader.svelte @@ -0,0 +1,127 @@ + + + + +
+
+

{getDisplayName(name)}

+
+ {#if element !== undefined} + + {/if} + {#if (type === 'character' || type === 'weapon') && proficiency} + {#if Array.isArray(proficiency)} + {#if proficiency[0] !== undefined} + + {/if} + {#if proficiency[1] !== undefined} + + {/if} + {:else if proficiency !== undefined} + + {/if} + {/if} +
+
+ +
+ {getDisplayName(name)} { + const placeholder = + type === 'character' + ? '/images/placeholders/placeholder-character-main.png' + : type === 'summon' + ? '/images/placeholders/placeholder-summon-main.png' + : '/images/placeholders/placeholder-weapon-main.png' + ;(e.currentTarget as HTMLImageElement).src = placeholder + }} + /> +
+
+ + diff --git a/src/lib/utils/uncap.ts b/src/lib/utils/uncap.ts new file mode 100644 index 00000000..6252294a --- /dev/null +++ b/src/lib/utils/uncap.ts @@ -0,0 +1,41 @@ +/** + * Utility functions for character uncap calculations + */ + +export interface UncapData { + flb: boolean + ulb: boolean + transcendence?: boolean +} + +export interface CharacterUncapData { + special: boolean + uncap: UncapData +} + +/** + * Calculate the maximum uncap level for a character based on their uncap data + * @param special - Whether the character is special (limited/seasonal) + * @param flb - Whether the character has FLB (4th uncap) + * @param ulb - Whether the character has ULB (5th uncap) + * @returns The maximum uncap level + */ +export function getMaxUncapLevel(special: boolean, flb: boolean, ulb: boolean): number { + if (special) { + // Special characters: 3 base + FLB + ULB + return ulb ? 5 : flb ? 4 : 3 + } else { + // Regular characters: 4 base + FLB + ULB/transcendence + return ulb ? 6 : flb ? 5 : 4 + } +} + +/** + * Calculate the maximum uncap level from character uncap data + * @param character - Character data with uncap information + * @returns The maximum uncap level + */ +export function getCharacterMaxUncapLevel(character: CharacterUncapData): number { + const { special, uncap } = character + return getMaxUncapLevel(special, uncap.flb, uncap.ulb) +}