From 3527bc820f636df0e54b9cd915fe7c847213c4e0 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Wed, 3 Dec 2025 18:08:08 -0800 Subject: [PATCH] make Edit button elemental based on artifact element --- .../CollectionArtifactDetailPane.svelte | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/lib/components/collection/CollectionArtifactDetailPane.svelte b/src/lib/components/collection/CollectionArtifactDetailPane.svelte index eddd9406..1fb45d2e 100644 --- a/src/lib/components/collection/CollectionArtifactDetailPane.svelte +++ b/src/lib/components/collection/CollectionArtifactDetailPane.svelte @@ -10,7 +10,7 @@ import { onMount } from 'svelte' import type { CollectionArtifact } from '$lib/types/api/artifact' import { isQuirkArtifact } from '$lib/types/api/artifact' - import { usePaneStack, type PaneConfig } from '$lib/stores/paneStack.svelte' + import { usePaneStack, type PaneConfig, type ElementType } from '$lib/stores/paneStack.svelte' import { sidebar } from '$lib/stores/sidebar.svelte' import { getArtifactImage } from '$lib/utils/images' import DetailsSection from '$lib/components/sidebar/details/DetailsSection.svelte' @@ -50,6 +50,17 @@ const skills = $derived(artifact.skills ?? []) const hasSkills = $derived(!isQuirk && skills.some((s) => s !== null)) + // Convert numeric element to ElementType string + const elementNames: Record = { + 1: 'wind', + 2: 'fire', + 3: 'water', + 4: 'earth', + 5: 'dark', + 6: 'light' + } + const elementType = $derived(elementNames[artifact.element] ?? undefined) + // Push edit pane function handleEdit() { const config: PaneConfig = { @@ -67,7 +78,7 @@ // Set up the Edit action button in the pane header for owners onMount(() => { if (isOwner) { - sidebar.setAction(handleEdit, 'Edit') + sidebar.setAction(handleEdit, 'Edit', elementType) } return () => {