feat(recipe): edit opens the prefilled create form; fields select their value on tap

This commit is contained in:
2026-09-10 21:34:32 +07:00
parent b154e50191
commit 868ebfe6e2
4 changed files with 103 additions and 96 deletions
+18 -3
View File
@@ -57,6 +57,13 @@ interface AdjustmentPanelProps {
// CREATE quick-input saves a brand-new recipe (name + adjustments from the
// modal) and applies it, unlike onSaveRecipe which snapshots the live state.
onCreateRecipe: (recipe: Omit<Recipe, 'id' | 'isCustom'>) => void;
// Recipe being edited (custom ones only) — non-null puts the CREATE form
// into editor mode, prefilled with that recipe's name and parameters.
editingRecipe?: Recipe | null;
onCloseEdit: () => void;
// SAVE from the editor: the caller decides overwrite (same name) vs
// save-as (new name).
onUpdateRecipe: (recipe: Omit<Recipe, 'id' | 'isCustom'>) => void;
onSelectRecipe: (recipe: Recipe) => void;
onUpdateAdjustments: (adjustments: Partial<ColorAdjustments>) => void;
onUpdateFrame: (frameId: FrameId) => void;
@@ -165,6 +172,9 @@ export default function AdjustmentPanel({
onOpenParamChange,
currentBaseFilter,
onCreateRecipe,
editingRecipe,
onCloseEdit,
onUpdateRecipe,
onSelectRecipe,
onUpdateAdjustments,
onUpdateFrame,
@@ -752,11 +762,16 @@ export default function AdjustmentPanel({
)}
{chipsRow}
<RecipeCreateModal
visible={createVisible}
visible={createVisible || !!editingRecipe}
currentBase={currentBaseFilter}
onClose={() => setCreateVisible(false)}
initial={editingRecipe ?? null}
onClose={() => {
setCreateVisible(false);
onCloseEdit();
}}
onSave={(recipe) => {
onCreateRecipe(recipe);
if (editingRecipe) onUpdateRecipe(recipe);
else onCreateRecipe(recipe);
setShowRecipes(true);
}}
/>