Skip to content

Commit

Permalink
feat: enhance EditButton functionality to toggle editing state
Browse files Browse the repository at this point in the history
  • Loading branch information
truemiller committed Dec 24, 2024
1 parent 6527ee0 commit 9565dcc
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions frontend/components/UpdateAgentPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,18 @@ const UpdateAgentProvider = ({ children }: PropsWithChildren) => {
};

const EditButton = () => {
const { setIsEditing } = useContext(UpdateAgentContext);
const { setIsEditing, isEditing } = useContext(UpdateAgentContext);

const handleEdit = () => {
setIsEditing?.((prev) => !prev);
};

if (isEditing) {
return null;
}

return (
<Button
icon={<EditFilled />}
onClick={() => setIsEditing?.((prev) => !prev)}
>
<Button icon={<EditFilled />} onClick={handleEdit}>
Edit
</Button>
);
Expand Down

0 comments on commit 9565dcc

Please sign in to comment.