- Fix Party.svelte: add null checks for existingChar/existingWeapon/existingSummon - Fix DropdownItem.svelte: replace asChild with child snippet pattern for bits-ui v2 - Fix UncapStar.svelte, TranscendenceStar.svelte: tabIndex -> tabindex - Fix Party.svelte, Navigation.svelte: remove asChild prop usage - Fix images.ts: add | undefined to pose/element params for exactOptionalPropertyTypes - Fix ItemHeader.svelte, UncapIndicator.svelte: accept number | null | undefined - Fix GridRepCollection.svelte, GuidebookUnit.svelte: PartyView -> Party type - Fix search.adapter.ts: add optional type property to SearchResult - Update various Props interfaces for exactOptionalPropertyTypes compliance Co-Authored-By: Justin Edmund <justin@jedmund.com>
62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
import { sidebar } from '$lib/stores/sidebar.svelte'
|
|
import JobSelectionSidebar from '$lib/components/sidebar/JobSelectionSidebar.svelte'
|
|
import JobSkillSelectionSidebar from '$lib/components/sidebar/JobSkillSelectionSidebar.svelte'
|
|
import type { Job, JobSkill } from '$lib/types/api/entities'
|
|
import type { JobSkillList } from '$lib/types/api/party'
|
|
|
|
interface JobSelectionOptions {
|
|
currentJobId?: string | undefined
|
|
onSelectJob?: ((job: Job) => void) | undefined
|
|
}
|
|
|
|
interface JobSkillSelectionOptions {
|
|
job?: Job | undefined
|
|
currentSkills?: JobSkillList | undefined
|
|
targetSlot: number
|
|
onSelectSkill?: ((skill: JobSkill) => void) | undefined
|
|
onRemoveSkill?: (() => void) | undefined
|
|
}
|
|
|
|
export function openJobSelectionSidebar(options: JobSelectionOptions) {
|
|
const { currentJobId, onSelectJob } = options
|
|
|
|
sidebar.openWithComponent(
|
|
'Select Job',
|
|
JobSelectionSidebar,
|
|
{
|
|
currentJobId,
|
|
onSelectJob: (job: Job) => {
|
|
onSelectJob?.(job)
|
|
sidebar.close()
|
|
}
|
|
},
|
|
false // scrollable = false
|
|
)
|
|
}
|
|
|
|
export function openJobSkillSelectionSidebar(options: JobSkillSelectionOptions) {
|
|
const { job, currentSkills, targetSlot, onSelectSkill, onRemoveSkill } = options
|
|
|
|
sidebar.openWithComponent(
|
|
`Select Skill - Slot ${targetSlot + 1}`,
|
|
JobSkillSelectionSidebar,
|
|
{
|
|
job,
|
|
currentSkills,
|
|
targetSlot,
|
|
onSelectSkill: (skill: JobSkill) => {
|
|
onSelectSkill?.(skill)
|
|
sidebar.close()
|
|
},
|
|
onRemoveSkill: () => {
|
|
onRemoveSkill?.()
|
|
sidebar.close()
|
|
}
|
|
},
|
|
false // scrollable = false
|
|
)
|
|
}
|
|
|
|
export function closeJobSidebar() {
|
|
sidebar.close()
|
|
}
|