Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
align-items: center;
height: var(--header-height);
box-sizing: border-box;
border-bottom: 1px solid;
border-bottom: 1px solid #ddd;
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This CSS color change is unrelated to the PR's purpose of disabling the button based on parameter changes. This change should be removed or submitted in a separate PR.

Suggested change
border-bottom: 1px solid #ddd;

Copilot uses AI. Check for mistakes.
}

.sider {
Expand Down
26 changes: 17 additions & 9 deletions src/components/RecipeForm/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Button } from "antd";
import { Button, Tooltip } from "antd";
import InputSwitch from "../InputSwitch";
import "./style.css";
import {
useSelectedRecipeId,
useFieldsToDisplay,
useIsPacking,
useIsOriginalRecipe,
} from "../../state/store";

interface RecipeFormProps {
Expand All @@ -15,6 +16,7 @@ const RecipeForm = ({ onStartPacking }: RecipeFormProps) => {
const recipeId = useSelectedRecipeId();
const fieldsToDisplay = useFieldsToDisplay();
const isPacking = useIsPacking();
const isOriginalRecipe = useIsOriginalRecipe();

return (
<div className="recipe-form">
Expand All @@ -39,15 +41,21 @@ const RecipeForm = ({ onStartPacking }: RecipeFormProps) => {
</div>
)}
{recipeId && (
<Button
onClick={onStartPacking}
color="primary"
variant="filled"
disabled={isPacking}
style={{ width: "100%" }}
<Tooltip
title={
isOriginalRecipe ? "Adjust any parameter to re-run" : ""
}
>
Re-run
</Button>
<Button
onClick={onStartPacking}
color="primary"
variant="filled"
disabled={isPacking || isOriginalRecipe}
style={{ width: "100%" }}
>
<strong>Re-run</strong>
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The button text change from 'Re-run' to 'Re-run' is unrelated to the PR's purpose of disabling the button when parameters haven't changed. This styling change should be removed or submitted in a separate PR focused on UI improvements.

Suggested change
<strong>Re-run</strong>
Re-run

Copilot uses AI. Check for mistakes.
</Button>
</Tooltip>
)}
</div>
);
Expand Down
15 changes: 11 additions & 4 deletions src/state/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ export const useRecipeStore = create<RecipeStore>()(
const remainingRecipesToLoad = recipeIds.filter(
(id) => id !== initialIdToLoad
);
Promise.all(remainingRecipesToLoad.map((id) => loadRecipe(id)))
.catch((err) => {
console.error("Error loading remaining recipes:", err);
});
Promise.all(
remainingRecipesToLoad.map((id) => loadRecipe(id))
).catch((err) => {
console.error("Error loading remaining recipes:", err);
});
},

selectRecipe: async (recipeId) => {
Expand Down Expand Up @@ -340,6 +341,12 @@ export const useResultUrl = () => {
return path;
};

export const useIsOriginalRecipe = () => {
const recipe = useCurrentRecipeData();
if (!recipe) return true;
return Object.keys(recipe.edits).length === 0;
};

Comment on lines +344 to +349
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW I reintroduced useIsModified in essentially the same way as this in #154

Assuming this merges first I'll bring these changes over and use this selector

// Action selectors
export const useLoadInputOptions = () =>
useRecipeStore((s) => s.loadInputOptions);
Expand Down