fix(extra) : persist picker selections
CI / Verify (push) Successful in 1m6s
CI / Build immutable images and deploy (push) Successful in 1m53s

This commit is contained in:
2026-09-05 13:20:33 +07:00 Unverified
parent 86882dc338
commit 6a8a19f186
+58 -5
View File
@@ -3379,12 +3379,25 @@ function ExtraCatalogItemsEditor({
</SelectGroup></SelectContent>
</Select>
<div className="min-w-64 flex-1">
<CatalogPicker items={items} value={key} onChange={setKey} placeholder={`เลือก${labels[kind]}`} showSelectedImage rarityBackground />
<CatalogPicker
items={items}
value={key}
onChange={(nextKey) => {
if (
nextKey &&
!value.some(
(item) => item.kind === kind && item.key === nextKey,
)
) {
onChange([...value, { kind, key: nextKey }]);
}
setKey("");
}}
placeholder={`เลือก${labels[kind]}`}
showSelectedImage
rarityBackground
/>
</div>
<Button type="button" variant="outline" disabled={!key || value.some((item) => item.kind === kind && item.key === key)} onClick={() => { onChange([...value, { kind, key }]); setKey(""); }}>
<PlusIcon data-icon="inline-start" />
เพิ่มรายการ
</Button>
</div>
</div>
</Field>
@@ -3878,6 +3891,26 @@ function ExtraEditor({ guide, initial, characters, weapons, artifacts }: EditorB
rowIndex,
"backgroundColor",
)}
onClick={() => {
if (row.backgroundColor !== null) return;
setSections(
sections.map((item, index) =>
index === sectionIndex
? {
...item,
rows: item.rows.map((candidate, inner) =>
inner === rowIndex
? {
...candidate,
backgroundColor: DEFAULT_EXTRA_BACKGROUND_COLOR,
}
: candidate,
),
}
: item,
),
);
}}
onChange={(event) =>
setSections(
sections.map((item, index) =>
@@ -3941,6 +3974,26 @@ function ExtraEditor({ guide, initial, characters, weapons, artifacts }: EditorB
rowIndex,
"textColor",
)}
onClick={() => {
if (row.textColor !== null) return;
setSections(
sections.map((item, index) =>
index === sectionIndex
? {
...item,
rows: item.rows.map((candidate, inner) =>
inner === rowIndex
? {
...candidate,
textColor: DEFAULT_EXTRA_TEXT_COLOR,
}
: candidate,
),
}
: item,
),
);
}}
onChange={(event) =>
setSections(
sections.map((item, index) =>