From 7ee25e2437ba0d67750cdbcc9a00034994aadea5 Mon Sep 17 00:00:00 2001 From: xiaomai Date: Sat, 2 May 2026 09:32:08 +0800 Subject: [PATCH] refactor(pokemon): reorganize edit form fields into tabs Split form into Basic and Advance tabs to improve usability Add validation logic to switch tabs if required fields are missing --- DESIGN.md | 14 ++ frontend/src/i18n.ts | 6 + frontend/src/styles/main.css | 68 ++++++ frontend/src/views/PokemonEdit.vue | 355 ++++++++++++++++------------- 4 files changed, 286 insertions(+), 157 deletions(-) diff --git a/DESIGN.md b/DESIGN.md index 032e97b..44874d3 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -199,6 +199,20 @@ Pokemon 可配置: - 翻译 - 排序 +Pokemon 编辑表单使用标签页组织字段: + +- 基础标签页: + - 第一行:ID、名称 + - 第二行:喜欢的环境、特长 + - 第三行:喜欢的东西 + - 特长掉落物品随已选择且支持掉落物的特长显示 +- Advance 标签页: + - 第一行:Genus + - 第二行:Details + - 第三行:Height / Weight,身高与体重控件在桌面端同一行展示 + - 第四行:Types + - 第五行:六维 Stats + Pokemon 列表功能: - 搜索 diff --git a/frontend/src/i18n.ts b/frontend/src/i18n.ts index fe15ac4..0893304 100644 --- a/frontend/src/i18n.ts +++ b/frontend/src/i18n.ts @@ -98,6 +98,9 @@ const messages = { detailKicker: 'Pokédex Detail', editKicker: 'Pokédex Edit', editSubtitle: 'Maintain Pokemon profile, details, types, stats, specialities, and favourites.', + editSections: 'Pokemon edit sections', + editTabBasic: 'Basic', + editTabAdvance: 'Advance', newTitle: 'New Pokemon', editTitle: 'Edit #{id} {name}', loadingList: 'Loading Pokemon list', @@ -529,6 +532,9 @@ const messages = { detailKicker: 'Pokédex Detail', editKicker: 'Pokédex Edit', editSubtitle: '维护 Pokemon 介绍、属性、六维、特长和喜欢的东西。', + editSections: 'Pokemon 编辑分区', + editTabBasic: '基础', + editTabAdvance: '进阶', newTitle: '新增 Pokemon', editTitle: '编辑 #{id} {name}', loadingList: '正在加载 Pokemon 列表', diff --git a/frontend/src/styles/main.css b/frontend/src/styles/main.css index b06ef23..229d7ce 100644 --- a/frontend/src/styles/main.css +++ b/frontend/src/styles/main.css @@ -725,6 +725,69 @@ button:disabled, gap: 12px; } +.modal-edit-form--tabbed { + gap: 14px; +} + +.pokemon-edit-form { + height: clamp(420px, calc(100dvh - 188px), 640px); + min-height: 0; + grid-template-rows: auto minmax(0, 1fr); +} + +.pokemon-edit-panel { + min-height: 0; + display: grid; + gap: 12px; + align-content: start; + overflow-y: auto; + padding-right: 2px; +} + +.pokemon-edit-grid { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 12px; + align-items: start; +} + +.pokemon-measurement-row { + display: grid; + grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); + gap: 12px; + align-items: stretch; +} + +.pokemon-measurement-control { + min-width: 0; + display: flex; + flex-wrap: wrap; + align-items: flex-end; + gap: 8px; + padding: 12px; + border: 1px solid var(--line); + border-radius: var(--radius-card); + background: var(--surface-soft); +} + +.pokemon-measurement-control > .field-label { + min-height: 44px; + display: inline-flex; + align-items: center; +} + +.pokemon-measurement-control > .field { + min-width: 96px; + flex: 1 1 110px; +} + +.pokemon-measurement-control > .pokemon-measurement-fields { + min-width: 0; + flex: 1 1 220px; + grid-template-columns: repeat(2, minmax(72px, 1fr)); + gap: 8px; +} + .pokemon-measurement-fields, .pokemon-stats-fields { display: grid; @@ -3409,6 +3472,10 @@ button:disabled, .appearance-row__main { grid-template-columns: repeat(2, minmax(0, 1fr)); } + + .pokemon-measurement-row { + grid-template-columns: 1fr; + } } @media (max-width: 640px) { @@ -3436,6 +3503,7 @@ button:disabled, .toolbar, .entity-grid, .grid, + .pokemon-edit-grid, .coming-soon-preview { grid-template-columns: 1fr; } diff --git a/frontend/src/views/PokemonEdit.vue b/frontend/src/views/PokemonEdit.vue index 426a39f..79a73ae 100644 --- a/frontend/src/views/PokemonEdit.vue +++ b/frontend/src/views/PokemonEdit.vue @@ -1,12 +1,13 @@