From 6409de0c29d0bd2986bf2bbca0c9e7f8fe42186b Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Mon, 1 Dec 2025 03:29:47 -0800 Subject: [PATCH] feat(weapons): add edit mode to weapon detail page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add edit mode state management (editMode, editData, isSaving) - Use DetailScaffold wrapper for consistent edit UI - Import and integrate section components: - WeaponMetadataSection, WeaponUncapSection - WeaponTaxonomySection, WeaponStatsSection - Add Nicknames, Dates, Links, Character (recruits) sections in edit mode - Connect saveChanges to entityAdapter.updateWeapon() - Invalidate TanStack Query cache after successful save πŸ€– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../(app)/database/weapons/[id]/+page.svelte | 471 +++++++++++++----- 1 file changed, 354 insertions(+), 117 deletions(-) diff --git a/src/routes/(app)/database/weapons/[id]/+page.svelte b/src/routes/(app)/database/weapons/[id]/+page.svelte index 2ec64b04..d23856cb 100644 --- a/src/routes/(app)/database/weapons/[id]/+page.svelte +++ b/src/routes/(app)/database/weapons/[id]/+page.svelte @@ -1,28 +1,33 @@ -
+
{#if weapon} -
- + +
+ + + + - - - - {#if weapon.uncap} - - + + + + + + + + + + - - {/if} - + {#if editData.flb} + + {/if} + {#if editData.ulb} + + {/if} + {#if editData.transcendence} + + {/if} + - - - - {#if flb} - - {/if} - {#if ulb} - - {/if} - + + + + + + - - - - {#if flb} - + + + {/if} - {#if ulb} - - {/if} - -
-

Skills

-
- {#if weapon.weapon_skills && weapon.weapon_skills.length > 0} - {#each weapon.weapon_skills as skill} -
-

{skill.name || 'Unknown Skill'}

-

{skill.description || 'No description available'}

-
- {/each} - {:else} -

No skills available

- {/if} -
-
-
+ {#if !editMode} +
+

Skills

+
+ {#if weapon.weapon_skills && weapon.weapon_skills.length > 0} + {#each weapon.weapon_skills as skill} +
+

{skill.name || 'Unknown Skill'}

+

{skill.description || 'No description available'}

+
+ {/each} + {:else} +

No skills available

+ {/if} +
+
+ {/if} + + {:else}

Weapon Not Found

@@ -130,35 +398,6 @@ @use '$src/themes/spacing' as spacing; @use '$src/themes/typography' as typography; - .weapon-detail { - padding: spacing.$unit-2x 0; - } - - .page-header { - margin-bottom: spacing.$unit-2x; - - .back-button { - background: #f8f9fa; - border: 1px solid #dee2e6; - padding: spacing.$unit * 0.5 spacing.$unit; - border-radius: 4px; - cursor: pointer; - font-size: typography.$font-small; - margin-bottom: spacing.$unit; - transition: all 0.2s; - - &:hover { - background: #e9ecef; - } - } - - h1 { - font-size: typography.$font-xxlarge; - font-weight: typography.$bold; - margin: 0; - } - } - .not-found { text-align: center; padding: spacing.$unit * 4; @@ -167,7 +406,7 @@ background: #007bff; color: white; border: none; - padding: spacing.$unit * 0.5 spacing.$unit; + padding: spacing.$unit-half spacing.$unit; border-radius: 4px; cursor: pointer; margin-top: spacing.$unit; @@ -178,15 +417,13 @@ } } - .weapon-content { - background: white; - border-radius: 8px; - box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); - overflow: hidden; + .details { + display: flex; + flex-direction: column; } .weapon-skills { - padding: spacing.$unit * 2; + padding: spacing.$unit-2x; border-bottom: 1px solid #e5e5e5; &:last-child { @@ -234,7 +471,7 @@ } @media (max-width: 768px) { - .skills-grid { + .weapon-skills .skills-grid { grid-template-columns: 1fr; } }